TEMPERATURE SENSOR WITH ARDUINO

  LM35 ARDUINO


Components Required:-
1. LM-35:-


2. Arduino UNO:-


LM35:-It is a temperature sensor whose voltage varies as temperature increases or decreases. With 1° change in temperature, there is a change of 10 millivolts therefore if temperature rises by 1 degree then 10 millivolts will be added similarly if temperature is reduced by 1 degree then 10 millivolts will be reduced.

Summary in mathematical equation:-

1°C = 10mV

LM35 PINOUT

  1. GND PIN- connected to GND pin of Arduino.

  2. OUTPUT– it is an output pin.

  3. VCC PIN-  connected to VCC pin of Arduino.




  LM35 INTERFACING WITH ARDUINO

  • First we have to connect VCC pin of Arduino to 1st terminal of LM35. 

  • Then we have to connect 2nd pin of LM35 to A0 pin of Arduino. 

  • Then connect GND pin of Arduino to 3rd pin of LM35.



ARDUINO CODE
________________________________


char input;

float temperature;

void setup() 

{

  pinMode(A0,INPUT);

  Serial.begin(9600);

}


void loop()

{

 temperature=0.48828125 * analogRead(A0);

 input=Serial.read();

 if (input=='t')

 {

  if (temperature>48)

  {

    Serial.println(" It's too hot");

  }

   else if(temperature<20)

   {

     Serial.println(" It's too cold");

   }

   else

   {

     Serial.println("It's normal temperature");

   }

 }

   delay(100);

}

___________________________________

To learn this project in more detail, click here or on this picture to watch on YouTube.





Comments