Component guide · Beginner · 3 min read
LM35 temperature sensor
Pinout, Wiring and Code
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
The LM35 is an analog temperature sensor whose output rises 10 mV for every degree Celsius, so 250 mV means 25 °C. It needs 4 to 30 V supply and gives about ±0.5 °C accuracy at room temperature. Read it with an analog pin and multiply the voltage by 100. The LM35DZ version covers 0 to 100 °C.
Key specs at a glance
- Output
- 10 mV per °C, 0 V at 0 °C
- Range
- LM35: −55 to 150 °C (needs negative supply below 2 °C); LM35DZ: 0 to 100 °C
- Accuracy
- ±0.5 °C at 25 °C (LM35A), about ±1 °C for LM35DZ
- Supply
- 4 to 30 V, about 60 µA
- Package
- TO-92 (three pins) or probe and module versions
- Self-heating
- About 0.08 °C in still air
Models in this guide
These are alternatives. Pick the one that fits your project; you only need one.
- Option 1Texas Instruments LM35DZ/NOPB TO-92 Temperature Sensor – 卤1.5掳C Accuracy₹78
Option 2Keyestudio LM35 Linear Temperature Sensor Module for Arduino₹337
Option 3LM35D Analog Temperature Sensor Module (Without Cable) – Analog Voltage Output₹138
Option 4LM35DZ Precision Temperature Sensor Probe with 1 Meter Cable₹169
What the LM35 temperature sensor is
The LM35 is a precision integrated-circuit temperature sensor with a linear voltage output calibrated in Celsius. No library and no calibration are needed: read the voltage and divide by 10 mV.
It is a classic first sensor in lessons because the maths is simple. For long cables or several sensors on one pin, the digital DS18B20 is usually better.
LM35 temperature sensor pinout
The pins on the LM35 temperature sensor and what each one does.
| Pin | Function |
|---|---|
| +Vs (left, flat side facing you) | 4 to 30 V supply |
| Vout (middle) | Analog output, 10 mV/°C |
| GND (right) | Ground |
- +Vs (left, flat side facing you)
- 4 to 30 V supply
- Vout (middle)
- Analog output, 10 mV/°C
- GND (right)
- Ground
Wiring the LM35 temperature sensor
With the flat face towards you and pins down, the order is +Vs, Vout, GND. Getting this wrong makes the chip hot within seconds. On an ESP32, power the LM35 from 5 V; its output stays under 1.5 V, which is safe for the ADC.
| LM35 temperature sensor pin | Arduino Uno | ESP32 |
|---|---|---|
| +Vs | 5V | 5V (VIN) |
| Vout | A0 | GPIO 34 |
| GND | GND | GND |
- +Vs
- Arduino Uno:
- 5V
- ESP32:
- 5V (VIN)
- Vout
- Arduino Uno:
- A0
- ESP32:
- GPIO 34
- GND
- Arduino Uno:
- GND
- ESP32:
- GND
Example code
The internal 1.1 V reference gives about 0.1 °C resolution up to 110 °C. With the default 5 V reference each step is about 0.5 °C.
const int PIN = A0;
void setup() {
Serial.begin(9600);
analogReference(INTERNAL); // 1.1 V reference: ~0.1 C per step
}
void loop() {
long sum = 0;
for (int i = 0; i < 16; i++) sum += analogRead(PIN); // average out noise
float mv = (sum / 16.0) * 1100.0 / 1023.0;
Serial.print(mv / 10.0, 1);
Serial.println(" C");
delay(1000);
}Setup and tuning
average several readings and add a 0.1 µF capacitor from Vout to GND at the Arduino end.
add a 2 kΩ resistor in series with the output to keep the LM35 stable with cable capacitance.
use analogReadMilliVolts(), which applies the factory calibration.
the probe version can sit in liquids; seal any joints.
What you need
Shop this list4 of 6 found in our store · ₹5,946
- TI LM35DZ temperature sensor (TO-92): the bare chipFind this part
Keyestudio LM35 temperature sensor module: plug-in modulekeyestudio₹5,571
LM35D analog temperature sensor module: breadboard moduleLM35D Analog Temperature Sensor Module (Without Cable) – Analog Voltage Output₹138
LM35DZ temperature probe with 1 m cable: for liquidsLM35DZ Precision Temperature Sensor Probe with 1 Meter Cable₹169- Uno R3 development board: the controller used in the wiring tableFind this part
Solderless breadboard: to build without solderingSolderless Breadboard₹68
Alternatives and when to choose them
- DS18B20: digital, waterproof probes, many on one pin.
- AHT20: adds humidity, I2C.
- NTC thermistors: cheapest, non-linear, wide range.
Try it: Adc resolution calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Reversing the pins, which heats the chip.
- Expecting negative temperatures from the LM35DZ on a single supply.
- Reading with the 5 V reference and seeing 0.5 °C jumps.
- Using it on 3.3 V supply; it needs at least 4 V.
Frequently asked questions
How do I convert LM35 output to temperature?
Temperature in °C = output voltage in mV ÷ 10.
Can the LM35 run on 3.3 V?
No, it needs at least 4 V. Power it from 5 V; its output is still safe for 3.3 V ADCs.
Can it measure negative temperatures?
The LM35 can with a negative bias supply; the LM35DZ is 0 to 100 °C only.
Why are my readings jumping?
ADC noise. Average readings, use the 1.1 V reference and add a capacitor.
LM35 or DS18B20?
LM35 for the simplest analog lesson; DS18B20 for accuracy, long cables and waterproof probes.
Is it accurate?
About ±0.5 °C to ±1 °C, depending on version and your ADC.
Parts for this guide
Calculators
Projects that use it
Put this into practice: 13 step-by-step builds in our project library use parts from this guide.
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

