LM35 Temperature Sensor Arduino Project

In this project, we measure the temperature and display it on a 16x2 LCD. In some embedded applications like a microwave oven, AC, Induction cooker we need to maintain the temperature to running it properly.

In this tutorial, we are interfacing LM35 temperature sensor with the arduino uno. The temperature may changes with time so we need an analog sensor that converts the temperature into the analog voltage. The analog voltage then converted to digital data so Arduino can process it.
Learn what is ADC in arduino before going to this project.

What is LM35 Temperature Sensor

The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius(Centigrade) temperature. The LM35 does not require any external calibration or trimming to provide typical accuracies of ±1⁄4°C at room temperature and ±3⁄4°C over a full −55 to +150°C temperature range.

  • Calibrated directly in ° Celsius (Centigrade)
  • Linear + 10.0 mV/°C scale factor
  • 0.5°C accuracy guaranteeable (at +25°C)
  • Rated for full −55° to +150°C range
  • Suitable for remote applications
  • Low cost due to wafer-level trimming
  • Operates from 4 to 30 volts
  • Less than 60 μA current drain
  • Low self-heating, 0.08°C in still air
  • Nonlinearity only ±1⁄4°C typical
  • Low impedance output, 0.1 W for 1 mA load

More about LM35 Datasheet.

LM35 Pinout

lm35 temperature sensor pinout

How to calculate analog to digital value - Formula

Use the following ratio:
e/V max  =  d/2 n- 1

  • V max maximum voltage that the analog signal can assume
  • number of bits available for the digital encoding, Here n = 10
  • present digital encoding
  • present analog voltage from sensor


How to Calculate the Digital Value if we have 30 °C temperature.
scale factor = 10.0 mV/°C or 0.01V/°C
If we have 30 °C temperature than Voltage = 30 * 0.01 = 0.3V
So e = 0.30V
Vmax = 5V
d = e * 2 n- 1 / V max
d = 0.30 * 1023/5
d = 61.38 or almost double
Note: Every time we calculate the digital value, it is double to the temperature.
So in programming, we divide it by 2 for getting the approximate value of the temperature.

Hardware Required

  • Arduino Uno
  • LM35
  • 16x2 LCD
  • 20K Preset
  • Breadboard

LM35 Arduino Connection

Temperature Sensor data will be displayed on the LCD so we need to know the connection of it to the Arduino. How to interface 16x2 LCD with Arduino Tutorial.
So here in this tutorial, only LM35 is remaining to the interface.

arduino lm35 temperature sensor with lcd display schematic

We can connect the led to any pin of arduino uno by simply changing led connection at desired pin and change in programming also.

LM35 Arduino Circuit


arduino lm35 temperature sensor with lcd display circuit

LM35 Arduino Code

Here is arduino library function analogRead(A0) to read LM35 sensor value. The temperature value is stored in variable ADCvalue and almost double the temperature value. So divide it by 2 to get the actual temperature and display to LCD.

/*In this program we are reading the analog value from analog pin A0 and display it to the LCD.  
LM35 Connection:  
Pin 1 : Vcc/+5V  
Pin 2 : Arduino Analog Pin A0  
Pin 3 : GND
####### LCD Connection with Arduino #######
LCD Pin    
1(Vss) => GND 
2(Vdd) => +5V 
3(Vee) => Center Pin of 20K Preset or GND 
4(RS)  => digital pin 8 
5(RW)  => GND 
6(E)   => digital pin 9 
7(D0)  => NC(not connected) 
8(D1)  => NC 
9(D2)  => NC 
10(D3) => NC 
11(D4) => digital pin 10 
12(D5) => digital pin 11 
13(D6) => digital pin 12 
14(D7) => digital pin 13 
15(A)  => +5V 
16(K)  => GND */
// include the LCD library
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  int ADCvalue = 0;
void loop() {
  // Read the analog value from pin A0
  int ADCvalue = analogRead(A0);
  ADCvalue = ADCvalue/2;
  lcd.setCursor(0, 0); // top left
  // print the value at LCD
  lcd.setCursor(0, 1); 
  delay(50);       // delay in between reads for stability