Tags: , , ,

The temperature sensor LM35 is a small easy to use, easy to find device. Its output voltage is directly proportional to the temperature and gives a precise measurement.


  • Computer
  • Arduino UNO
  • USB cable to connect Arduino to the computer
  • Temperature sensor LM35



The datasheet of the sensor LM35 gives the temperature range measurement, -55 to 150°C , and the conversion rule between voltage and temperature value, 10 mV/°C. The value is read with an analog port of the Arduino, so the output voltage (0 to 5V) is converted on a digital value (0 to 1023).

// Constants
#define DELAY 1000 // Delay between two measurements in ms

// Parameters
const int sensorPin = A0; // Pin connected to sensor

// Variables
float voltage, temperature;

void setup(void) {

void loop(void) {
  voltage= analogRead(sensorPin) * (5.0 / 1023.0); // Convert digital value to voltage
  Serial.print("Sensor voltage = ");
  Serial.println(voltage); // the voltage reading
  temperature=100*voltage; // conversion from V to °C
  Serial.print("Sensor reading = ");
  Serial.println(temperature); // the temperature reading



Find more tutorials and examples in our code generator
Code Architect