LM35 temperature sensor (TO-92)
LM35 pinout (+VS, VOUT, GND), the 10 mV per °C formula, why it needs at least 4 V, reading it on ESP32 and Pico ADCs, and spotting fakes.
Community draft — report a mistake
3.3 V or 5 V? The LM35 needs at least 4 V, so power it from 5 V even on ESP32 and Pico. That’s safe: VOUT is only 10 mV/°C (1.5 V at 150 °C), well inside a 3.3 V ADC. Never feed it from 3.3 V.
The LM35 gives a voltage directly proportional to temperature in Celsius: 10 mV per °C, so °C = millivolts / 10. No library, no calibration constants — one analog pin. It reads 2–150 °C with the basic circuit, accurate to about ±0.5 °C at 25 °C on a genuine part.
It’s simple and robust, but it needs at least 4 V of supply, and reading a small voltage on a noisy ADC is where the accuracy goes. On Uno, analogReference(INTERNAL) (1.1 V) gives about 0.1 °C resolution up to 110 °C. On ESP32 use analogReadMilliVolts(); on Pico, analogRead() with the 3.3 V reference is fine.
Fakes are common. Real LM35s are printed “LM35DZ” by TI or National. Fakes often read several degrees off or drift — if two from the same batch disagree by more than 1 °C, suspect them. For a digital, waterproof alternative use the DS18B20.
Prices are indicative (Nov 2026) and vary by seller.
Pinout
| Pin | What it does |
|---|---|
+VS | Supply, 4–30 V — left leg with the flat face towards you and legs down |
VOUT | Analog output, 10 mV per °C (250 mV = 25 °C) — middle leg |
GND | Ground — right leg |
Use it with
Common errors
Reads 50–100 °C or random values
Probably +VS and GND are swapped (the sensor gets hot to touch — unplug it). Check the leg order with the flat face towards you.
Reads a few degrees off on ESP32
The ESP32 ADC is non-linear at the bottom of its range. Use analogReadMilliVolts() and divide by 10, average 16 samples, and use an ADC1 pin.
Reading is fine on 5 V, wrong on 3.3 V
Below 4 V the LM35 is out of spec. Feed it 5 V; the output stays low enough for any ADC.
Unstable on a long cable
The LM35 can oscillate when driving cable capacitance. Add a 2 kΩ resistor in series with VOUT, or a 1 µF capacitor from VOUT to GND at the board end.