Tag Archives: arduino thermometer

LM35 Precision Cheap Temperature Sensor

The LM35 from Texas Instruments is a cheap but very good temperature sensor. It is available in various packages. Please refer to the LM35 Temperature Sensor for package and other details.

It can be powered directly from the 5v supply of Arduino.

The chip outputs  10.0 mV per °C. Below is a small snippet of code that can be used to convert the output voltage into temperature.

val = analogRead(tempPin);
mv = ( val/1024.0)*5000;  // mv = (val/1024) * (voltage * 1000) The 1024 is derived from  the fact that the Atmega ADC has 10 bit resolution, returning integers from 0 to 1023.
cel = mv/10; // cel = mv / 10.0 milli volt per °C
farh = (cel*9)/5 + 32;

Please refer the Datasheet for Pin Configuration.