Internal temperature

Hi,

Anyone knows why this: https://playground.arduino.cc/Main/InternalTemperatureSensor cannot be used in Arduboy?

It runs but it doesn’t work.

At least I’m pretty sure the Arduboy isn’t fluctuating between 572 and -265 degrees, I could be wrong.

My guess is that the pins are configured differently

Also the line // The offset of 324.31 could be wrong. It is just an indication. makes me think the code might be incorrect on some boards.

Try the code from here instead, it seems to work better:

http://www.narkidae.com/research/atmega-core-temperature-sensor/

Giving me a temp of between 31 C and 34 C, and the room is 19.6 C so that seems legit.

The person goes on to say that the sensor has an error of +/-10C, so that definitely seems a better estimate.

Oh you are right. I tried several codes and that one you found works :open_mouth:

Thanks!

EDIT: Oh! is because if you use Arduboy2 you get a wrong temperature!

1 Like

That’s because I’m really good at Google-Fu :sunglasses:

I was just using the plain code without Arduboy2.
That’s good to know though, I suspect Arduboy2 clobbers the ADMUX or something, I’ve got a feeling I’ve seen ADMUX used in Arduboy2 code somewhere.

The Arduboy2 library powers down the ADC in order to save power and extend battery life because it doesn’t expect many sketches to need it.

Try putting

power_adc_enable();

in setup() after calling arduboy.begin() or arduboy.boot()

(I haven’t tested this myself.)

3 Likes