loading

A simple temperature sensor using one LM35 Precision Temperature Sensor and Arduino. The circuit will send serial information about the temperature that you can use on your computer.

Step 1: Materials

You will need :

  • Arduino Uno ( I used the Uno R3 , You can use any other micro controller but for that you'll have to change the source code).
  • LM35 Temperature Sensor.
  • Breadboard.
  • Some connecting wires.
  • A computer

Step 2: Setting Up the Arduino With Temperature Sensor

Connect the temperature sensor to board

  1. Connect the +Vs to +5v on your Arduino board.
  2. Connect Vout to Analog0 or A0 on Arduino board.
  3. Connect GND with GND on Arduino.

The Analog to Digital Converter (ADC) converts analog values into a digital approximation based on the formula ADC Value = sample * 1024 / reference voltage (+5v). So with a +5 volt reference, the digital approximation will = input voltage * 205.

Step 3: Setting Up Arduino With Code (sketch)

Open up the Arduino IDE and write the following code :

float temp;
int tempPin = 0;

void setup()

{

Serial.begin(9600);

}

void loop()

{

temp = analogRead(tempPin);

temp = temp * 0.48828125;

Serial.print("TEMPRATURE = ");

Serial.print(temp);

Serial.print("*C");

Serial.println();

delay(1000);

}

I have also attached the final file for your reference.

After everything is done compile the code and upload it to the board. Wait for few seconds and open the Serial Monitor to view the output.

<p>I tried both way, normal and like mwolinski ... I got readings (both ways), however, in both ways the sensor gets really hot and makes the Arduino stop responding (not able to send sketches and no terminal output). Am I doing something wrong? </p>
<p>I faced that too...plese check that the sensor was connected correctly ...This occors when you change the annode and cathode ...</p>
<p>Yes I think I might did it wrong (it was exactly opposite as expected). I bought a new one which works, the old one is broken probably.</p>
<p>This did not work for me initially....the ground and 5v were switched. I checked another instructable and found those details showed them switched. I switched them and it works fine.</p>
<p>It is not working for me:</p><p>TEMPRATURE = 0.00*C</p><p>TEMPRATURE = 0.00*C</p><p>TEMPRATURE = 6.84*C</p><p>TEMPRATURE = 99.61*C</p><p>TEMPRATURE = 309.08*C</p><p>TEMPRATURE = 499.51*C</p><p>TEMPRATURE = 462.40*C</p><p>TEMPRATURE = 198.73*C</p><p>TEMPRATURE = 0.00*C</p><p>TEMPRATURE = 0.00*C</p><p>TEMPRATURE = 0.49*C</p><p>TEMPRATURE = 54.69*C</p><p>TEMPRATURE = 246.58*C</p><p>TEMPRATURE = 474.12*C</p><p>TEMPRATURE = 499.51*C</p><p>TEMPRATURE = 250.00*C</p><p>TEMPRATURE = 28.32*C</p><p>TEMPRATURE = 0.00*C</p><p>TEMPRATURE = 2.93*C</p>
<p>Tried several sketches and this is the only one that worked correctly for me. Thanks!</p>
<p>my worked with temp * 250 / 1024</p>
<p>can we add a lcd to display temp*</p>
<p>yes you can just avoid the serial (unless its a serial lcd display)</p>
<p>why we multiply with 0.48828125</p>
It is 500/1024..this is done to convert reading from pin into millivolts which further is converted to degree celcius by dividing by 10
<p>i am getting output of abov 350 degree celsius when i touch my hand to themistor i dont know why and also the arduino board automaticaclly gets off after certain time why this problem are coming ?</p>
Make sure curved part of sensor is towards left edge of the beadboard
<p>can we add a lcd for display</p>
nice idea<br>Excuse me can you give full informattion<br><br>
<p>Lol...Yeah...</p><p>Check how you have connected wires to LM35. Or check the programme once.</p>
<p>Not sure why I'm getting this output. I'm not working in a fridge.</p><p>TEMPRATURE = 2.93*C</p><p>TEMPRATURE = 2.93*C</p><p>TEMPRATURE = 2.44*C</p><p>TEMPRATURE = 2.93*C</p><p>TEMPRATURE = 2.93*C</p><p>TEMPRATURE = 2.44*C</p><p>TEMPRATURE = 2.44*C</p><p>TEMPRATURE = 2.44*C</p><p>TEMPRATURE = 2.44*C</p><p>TEMPRATURE = 2.44*C</p><p>TEMPRATURE = 1.95*C</p><p>TEMPRATURE = 2.44*C</p><p>TEMPRATURE = 1.95*C</p><p>TEMPRATURE = 1.95*C</p><p>TEMPRATURE = 1.95*C</p><p>TEMPRATURE = 1.95*C</p><p>TEMPRATURE = 1.46*C</p><p>TEMPRATURE = 1.46*C</p>
<p>I m getting result as 134.24*C n all instead of 24*C...how can I rectify ds ???</p>
<p>if you are using wires between LM32 and arduino then try changing wires </p>
<p>hello I m getting d output as 130.23*C N ALLL but not in 24*C ...... I have checked d code it is crct....how can I get d perfect output .....</p>
<p>Thanks for the tutorial</p>
<p>Is any algorithm implemented on this...!</p>

About This Instructable

100,579views

37favorites

License:

More by Kartik Bholla:Arduino Temperature Sensor Interfacing (LM35) .THE EASIEST WAY 
Add instructable to: