Close
0%
0%

AVR temperature measurement without a sensor

Only a few AVR Microcontrollers comes with an on-chip temperature sensor. But they have a temperature sensetiv RC and Watchdog Oscillator.

Similar projects worth following
Only a few AVR Microcontrollers comes with an on-chip temperature sensor. But they have a temperature sensetiv RC and Watchdog Oscillator. In this case we can use the several time drifts for an simple temperature messurement.

Use case:

  • overheating protection
  • two point thermostat
  • simple thermometer

The proof of concept implements a thermostat with two points on an ATtiny13a.


How it works


The ATtiny13 runs at 1.2 MHz (using the internal RC oszillator). The internal oscillator has a frequency drift over temperature - with a rising temperature the µC gets faster.

(Figure 19-59 - ATMEL Datasheet ATtiny13a)


For temperature measurement we starts the watchdog timer (prescale 16 ms). In the meantime we start to count. The watchdog interrupt stops the measurement. The result is a 16Bit value.

  • 1 × ATtiny13a Microprocessors, Microcontrollers, DSPs / ARM, RISC-Based Microcontrollers

View all 2 project logs

Enjoy this project?

Share

Discussions

Игорь Голов wrote 06/11/2015 at 08:22 point

Wow! Really cool Hack!

  Are you sure? yes | no

Eric Hertz wrote 05/03/2015 at 12:40 point

Cool.

My Assembly-understanding is limited. 

Can you give a brief description of *how* this works? 

Does the WDT actually cause a reset? Are you using an external (crystal) oscillator?

  Are you sure? yes | no

Thomas Baum wrote 05/04/2015 at 06:21 point

Thanks. 

The µC runs at 1.2 MHz (default, internal RC / Div 8). The WDT causes an interrupt. I have added a short description. 

  Are you sure? yes | no

Eric Hertz wrote 05/04/2015 at 13:37 point

Ahhh! The Tiny13a has an interrupt for the WDT, I didn't pick up on that.

Also quite interesting, the WDT oscillator frequency decreases with temperature while the internal oscillator increases, I'd've never expected that.

Clever work, surely useful in a number of ways. And thank you for the explanation!

  Are you sure? yes | no

Does this project spark your interest?

Become a member to follow this project and never miss any updates