LM35 temperature sensor


The LM35DZ is an integrated circuit analog sensor that can be used to measure temperature with an electrical output proportional to the temperature (this is why it is an analog sensor). It can measure temperature more accurately than a thermistor. The sensor circuitry is sealed and not subject to oxidation. The LM35DZ generates a higher output voltage than thermocouples and may not require that the output voltage be amplified. The LM35 has an output voltage that is proportional to the temperature.The scale factor is .01V/°C (Celcius).

LM35DZ sensor is typical of many other analog temperature sensors. If you have another analog sensor then read the data sheet to know how to calculate the real temperature from the analog value read from the input analog pin.

Technical information of this sensor is available here.

Connecting to Arduino

Code example

 *  Program:  LM35 sensor tester
 *  Description: Reads the voltage from a LM35 temperature
 *  sensor on pin A0 of the Arduino. Converts the voltage to 
 *  a temperature and sends it out of the serial port for 
 *  display on the serial monitor.

// Use analog pin 0 (A0) to read the output of the sensor
#define TEMP_PIN_READ A0
void setup(){
  Serial.begin(38400); // initialize the serial port

// Define a new function that reads and converts the raw reading to temperature
float temperature_celcius() { 
  return analogRead(TEMP_PIN_READ) * (5.0 / 1023.0 * 100.0); 

void loop(){

The raw source of the sketch example is visible here.