tutorial
LM35 Interfacing with Arduino UNO
LM35 is an analog, linear temperature sensor whose output voltage varies linearly with the change in temperature. LM35 is three terminal linear temperature sensor from National Semiconductors. It can measure temperature from -55 degree Celsius to +150 degree Celsius. The voltage output of the LM35 increases 10mV per degree Celsius rise in temperature. LM35 can be operated from a 5V supply and the stand by current is less than 60uA. The pinout of LM35 is shown in the figure below.
Description:
The +5v for LM35 can be taken from the +5v out pin of Arduino UNO. Also, the ground pin of LM35 can be connected to GND pin of Arduino UNO. Connect Vout (the analog out of LM35) to any of the analog input pins of Arduino UNO. In this circuit diagram, we have connected Vout of LM35 to A0 of Arduino.
Connection Diagram:
Code:
int val;
int tempPin = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000;
float cel = mv/10;
float farh = (cel*9)/5 + 32;
Serial.print("TEMPRATURE = ");
Serial.print(cel);
Serial.print("*C");
Serial.println();
delay(1000);
Serial.print("TEMPRATURE = ");
Serial.print(farh);
Serial.print("*F");
Serial.println();
}
int tempPin = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000;
float cel = mv/10;
float farh = (cel*9)/5 + 32;
Serial.print("TEMPRATURE = ");
Serial.print(cel);
Serial.print("*C");
Serial.println();
delay(1000);
Serial.print("TEMPRATURE = ");
Serial.print(farh);
Serial.print("*F");
Serial.println();
}
Note:- LM35 is available in the market in 3 series variations – LM35A, LM35C, and LM35D series. The main difference between these 3 versions of LM35 IC is in their range of temperature measurements. The LM35D series is designed to measure from 0 degree Celsius to 100 degree Celsius, whereas the LM35A series is designed to measure a wider range of -55 degree Celsius to 155 degree Celsius. The LM35C series is designed to measure from -40 degree Celsius to 110 degree Celsius.
OUTPUT:
It will print the temperature values.
Reference:
· Serial.begin(): Sets the data rate in bits per second (baud) for serial data transmission. For communicating with the computer, use one of these rates: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200.
· Serial.println (): Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or '\r') and a newline character (ASCII 10, or '\n'). This command takes the same forms as Serial.print().
· Serial.println (): Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or '\r').
No comments:
Post a Comment