View on GitHub

Kerala-IoT-Challenge

Experiment 9 : LM35 Temperature Sensor

Description :

LM35 is a type of commonly used temperature sensor, that can be used to measure temperature with an electrical output comparative to the temperature in (°C). It can measure temperature in a better way than thermistor. It has an accuracy of ±1/4°C. The output temperature is 0℃~100℃, the conversion formula is as follows:

Equation

LM35 fig :

LM35

Pin Number Pin Name Description
1 Vcc Input voltage is +5V for typical applications
2 Analog Out There will be increase in 10mV for raise of every 1°C. Can range from -1V(-55°C) to 6V(150°C)
3 Ground Connected to ground of circuit

In Arduino 1023 corresponds to 5V.
Also 1V gives us 100 celcius. Hence, 5V gives 500 celcius.
Suppose we take 60 as the value from the sensor temperature will be Temperature = (60 * 500)/1023 = 29.32°C.
So equation will be Temperature = (value * 500)/1023

Refer this video to learn more about LM35 sensor.

Components Used :

Circuit :

Connections are made according to the Circuit given
LM35

Code :

#define TEMP A0
int val;
float temp;
void setup()
{
  pinMode(TEMP,INPUT);
  Serial.begin(9600);
}
void loop()
{
  val=analogRead(TEMP);
  temp=(val*500)/1023;//equation for finding temperature
  Serial.print("Temperature = ");//prints Temperature =
  Serial.print(temp);//prints value of temperature
  Serial.println("°C");//prints °C
  delay(1000);//pause for 1 second
}

Pictures :

Connected Circuit :
EXP9

Serial Monitor Output :
Serial