LM35: A Not So Simple Temperature Sensor for The Arduino

Image by C.D. Reimer

An Internet search for a temperature sensor to connect to the Arduino microcontroller board brings up the LM35DZ (or LM35 for short). An inexpensive one-wire temperature sensor from National Semiconductor. Every how-to article has a diagram or picture of three wires—power, out, and ground — connecting the sensor on the breadboard to the Arduino. A little bit of copy-and-paste code uploaded to the Arduino makes it possible to measure room temperature.

Except for one small problem — that simple circuit doesn’t work.

After I connected the three jumper wires from the LM35 on the breadboard to the 5V, A5 and GND pins on the Arduino, and uploaded the code to display a temperature every second to the serial console, the numbers alternated between zeroes and random numbers. The number I expected to see was 28°C degrees, the ambient temperature for my home office.

After reading numerous comments that the circuit doesn’t work and plenty of bad advice on how to fix it, I came across a comment that pinpointed the real problem: all those how-to articles were nothing more than copy-and-paste click bait for the websites.

The LM35 with only three wires probably worked on early Arduino boards years ago. (The LM35 came out in 1999, and the first Arduino came out in 2006.) No one tested the circuit against the newer Arduino boards to see if it still works. Updating the how-to articles would take away from the click-bait simplicity of measuring room temperature with a sensor and three wires.

After reading numerous comments that the circuit doesn’t work and plenty of bad advice on how to fix it, I came across a comment that pinpointed the real problem: all those how-to articles were nothing more than copy-and-paste click bait for the websites.

The LM35 with only three wires probably worked on early Arduino boards years ago. (The LM35 came out in 1999, and the first Arduino came out in 2006.) No one tested the circuit against the newer Arduino boards to see if it still works. Updating the how-to articles would take away from the click-bait simplicity of measuring room temperature with a sensor and three wires.

What does it take to make the LM35 work with the Arduino today?

Read the rest of the essay on Medium. If you’re interested in supporting my writing on Medium, become a paid member and I’ll get a referral bonus.