Electronic – Why LM35DZ temperature sensor accuracy deteriorates towards the lower end of the range

sensortemperature

I get some curious data from my LM35DZ temperature sensor. Every minute or so I take 8 measurements 1/2-second apart and average them. The graph below shows that the accuracy of the measurements deteriorates noticeably towards the low end of the range (0°C). I connect the sensor's OUT pin to ATmega328's ADC pin directly – no resistors or capacitors – with 6 inches of unshielded hookup wire. The sensor is in the same plastic enclosure with XBee, humidity sensor, relay switching 110V-powered fan and a 12V to 5V voltage regulator.

Here's the graph illustrating the problem:

enter image description here

As you can see, at 20°C the accuracy is worse than ±2°C. I have a similar sensor connected to another ATmega328. With no other sensors or fans attached to it. And the accuracy is as expected (half a degree or so). So I'm positive it's my circuit (and not the sensor or the micro code).

Any ideas what could be affecting the accuracy and how I can improve it?

Best Answer

Have you actually measured the voltage the LM35 is outputting with a multimeter? I would trust the LM35 far more than the ATmega's ADC to go completely down to 0 V.

From the graph you included, it looks like something is hitting a rail somewhere.

If it is indeed the LM35 outputting the errant voltages, try a pulldown (~50 kilohm?) on the output to ground (or better yet, -5 V).

You're measuring a very small voltage with the built-in ADC - 20 °C is only 200 mV. Furthermore, without a negative power rail, the sensor is only really good to 2 °C, and any bias current on the output (from the ADC) will probably affect the readings you get.