small medium large xlarge

Back to: All Forums  Arduino
13 Aug 2010, 21:31
Tom de Grunt (5 posts)


Just tried the sensortest example (with the TMP36 sensor), using the code from the book (download). My serial output is as follows: 4.80 47.06 C 4.17 42.17 C

I’m pretty sure that temperature is off by 20 degrees C. My board is a Arduino Duemilanove.

Any suggestions?

Cheers, Tom.

14 Aug 2010, 05:33
Maik Schmidt (122 posts)

Hi Tom!

Thank you very much for pointing this out!

I could reproduce this behavior and it seems that something subtle has changed in the most recent versions of the Arduino IDE. So the bandgap trick to determine the Arduino’s supply voltage no longer works. I’ll try to fix it but in the meantime replace the get_supply_voltage() function with the following one:

const float get_supply_voltage() { return 5.0; }

This is not as accurate as determining the correct supply voltage, but it’s way more accurate than the buggy one.

Hope this helps!


14 Aug 2010, 20:46
Tom de Grunt (5 posts)

Hello Maik,

Thanks for the quick answer. I was assuming it had something to do with the voltage used for the calculation, but I’m too new with Arduino to pinpoint it.

Cheers, Tom.

You must be logged in to comment