Language: EN


Measuring temperature with Arduino and LM35 sensor

What is an LM35 sensor?

The LM35 is an integrated precision temperature sensor. Unlike other devices such as thermistors where temperature measurement is obtained from the measurement of their electrical resistance, the LM35 is an integrated circuit with its own control circuit, which provides a voltage output proportional to the temperature.

The output of the LM35 is linear with temperature, increasing the value at a rate of 10mV per degree centigrade. The measurement range is -55ºC (-550mV) to 150ºC (1500 mV). Its accuracy at room temperature is 0.5ºC.

LM35 sensors are relatively common in the world of electronics enthusiasts due to their low price and ease of use.


LM35 sensors are cheap. We can find an LM35 sensor for €0.60 from international sellers on Ebay or AliExpress.


Electrical schematic

The pinout of the LM35 is shown in the following image. The end pins are for power, while the center pin provides the measurement in a voltage reference, at a rate of 10mV/ºC.


Therefore, the electrical schematic we need is as follows.


Assembly diagram

While the assembly on a breadboard would be as follows.


Code example

The code needed to perform the reading is simple. We simply read the voltage value through the analog input, and translate the value to degrees Celsius using the 10 mV/C relationship.

const int sensorPin= A0;

void setup()

void loop()
  int value = analogRead(sensorPin);
  float millivolts = (value / 1023.0) * 5000;
  float celsius = millivolts / 10; 
  Serial.println(" C");

Download the code

All the code from this post is available for download on Github. github-full