Arduino UNO R3 Compatible using CH340T
 

  10.00 JD                  Add to cart

 LM35DZ
 

   1.90 JD                   Add to cart

  830-Point Breadboard
 

   6.00 JD                   Add to cart

LM35 Temperature Sensor

 LM35 sensor has three legs like a Transistor, first leg is Vin second one is Vout and the third one is Ground. we have to supply 5 volts to Vin and Ground and take the output voltage at Vout which tells us the temperature in terms of voltage.

Circuit

 

 Code 

// this is where we will store the temperature in centigrade
float
temperature;
// this is where we will store the raw reading from the analogue pin
int reading;          
// this is where we will store the pin number that we are reading from
int lm35Pin =5;           


voidsetup()
{
analogReference(INTERNAL);
Serial.begin(9600);
}

voidloop()
{
reading =analogRead(lm35Pin);
temperature = reading /9.31;
Serial.println(temperature);
delay(1000);
}

 

Test and Run

Reading will be wrtten to computer via serial monitor.