LM35 temperature sensor
The LM35 precision centigrade sensor in a TO-92 case: 10 mV a degree from 0 V at 0 °C. Aliases: LM35DZ, analog temperature sensor.
It looks exactly like a TMP36 and has the same three legs in the same order, which is why the two get mixed up. The difference is the offset: a TMP36 sits at 500 mV at 0 °C, and an LM35 sits at 0 V. So on an LM35 the millivolts divided by ten are the degrees, with nothing to subtract.
Pins
Flat face towards you, left to right:
| Pin | What it does |
|---|---|
VS |
Supply, 4 V to 30 V. |
VOUT |
10 mV per °C above ground, a low-impedance output. |
GND |
Ground. |
Properties
temperature is where the slider starts, 22.5 °C by default, and it can be anything
in the rated range of -55 °C to 150 °C.
While it runs
Drag the slider under the part to change the temperature it is sitting in. The middle leg follows at once.
Reading it on an Arduino
With the ADC's 5 V reference, one count is 5000 / 1024 mV, which is exactly 625 / 128. One millivolt is a tenth of a degree, so the whole conversion is whole numbers:
int reading = analogRead(A0);
long tenths = (long)reading * 625 / 128; // 250 is 25.0 C
Mokxi's boards have no floating-point library, so reading * 5.0 / 1024 * 100 from a
tutorial does not link; the line above is the same sum, exact.
What the model gets right
The transfer function. Texas Instruments' datasheet (SNIS159) gives 10.0 mV/°C with no offset, and so does the part: 250 mV at 25 °C, 1.000 V at 100 °C.
The supply. The sheet's minimum is 4 V. Below that VOUT is not driven at all
here. On a 3.3 V board (an ESP32, a Pico) a bare LM35 is out of its datasheet, which
is the first question in every forum thread about one; use a TMP36, which runs from
2.7 V.
Below zero. On one supply the output cannot go under ground. The sheet's basic
circuit reads +2 °C to +150 °C; the full -55 °C range needs a resistor to a negative
rail. Here VOUT stays at 0 V for anything under zero, as it does on a breadboard.
The rails. The output is clamped to the supply, behind the sheet's low output impedance.
What it does not model
The accuracy spread (0.5 °C at 25 °C for the LM35D, 0.2 °C for the LM35A), 60 µA of self-heating, settling time, and the sheet's warning that more than 50 pF on the output (a long cable) wants a 75 ohm resistor in series. The number on the slider is the number that comes out.
Common mistakes
Subtracting 500 mV as if it were a TMP36, and reading every temperature 50 degrees low.
Powering it from 3.3 V. It needs 4 V.
See it in action
Heat, magnet and wheel reads an LM35 on A0 beside two other kit sensors. Open it at /templates.