---

Monday, February 16, 2015

Accurate and Reliable Readings from a TMP36

I have been using the TMP36 for years, with Arduino, BeagleBone and now the Spark Core/Photon. It has often been reported in the Arduino forums that this chip is inaccurate and unreliable. Indeed a quick glance at the datasheet tells you accurate to 2 degrees C (which seems pretty poor).

I'm working on a Spark Core project for a book and tried out a TMP36. The results seemed totally mad, -25C when it should have been 17C. I checked the maths which was all fine. Then, thinking I had a duff TMP36, I connected my multimeter to measure the output of the TMP36. Suddenly the readings started to be accurate and stable! My magic multimeter was making things work right!

So, going back to the datasheet for the TMP36, the equivalent schematic looks like this:

To add a load resistor (I used 1k, but looking at the spec, the load should not really exceed 50uA so a 20k or 47k resistor would be better) to any microcontroller analog input, connect your resistor between Vout and GND on the TMP36.

So, if we have all been using the TMP36 incorrectly for years, then how has it ever worked?

Well, the Arduino has a relatively low input impedance to the analog inputs, so enough current flowed to ground to make it usable, if not terribly good. However the Spark Core has analog inputs that are biased to roughly 1.65V, which totally screws the TMP36 output, without any kind of load resistor. Even my high impedance multimeter voltage range was enough of a pull-down for it all to work.

So, the lesson is:

*** If your TMP36 is misbehaving, put a 47kΩ resistor between Vout and GND on your TMP36. ***

No comments: