You Are Here: Home » Blog » Electronics News Updates » ATMEGA Core Temperature Sensor

ATMEGA Core Temperature Sensor




Abstract:

I recently stumbled across an interesting fact in the datasheet for the ATMEGA32u4, the microcontroller I am using for my Einstepper Project. I was surprised to find that Atmel had included a temperature sensor in the core of the device that you can read using the internal ADC. As it turns out, there are many megaAVR devices contain an internal temperature sensor. According to Atmel’s product finder, these devices are:

ATMEGA Core Temperature Sensor

  • AT90PWM161
  • AT90PWM81
  • ATmega168A
  • ATmega168P
  • ATmega168PA
  • ATmega16M1
  • ATmega16U4
  • ATmega328
  • ATmega328P
  • ATmega32M1
  • ATmega32U4
  • ATmega48A
  • ATmega48P
  • ATmega48PA
  • ATmega64M1
  • ATmega88A
  • ATmega88P
  • ATmega88PA

I was interested to see what temperature the microcontroller idled at and if this sensor could be used to detect the temperature of the room. By using a known temperature differential between the ambient air and core, it should be possible to calculate the ambient temperature. The Arduino Leonardo and Arduino Pro Micro use the ATMEGA32u4 so all the code below should work without modification. For other AVR boards that use a different chipset, minor modifications to the registers will be necessary.

Hardware:

I am using one of the boards from my Einstepper Project, but any board with one of the supported chips should work. There may be varying thermal characteristics between different packages (TQFP vs QFN) as well as different chips. These results are specifically for the ATMEGA32u4 in the TQFP package.

Software:

The first step was to setup the ADC to be able to read the internal temperature sensor. In order to use the temperature sensor correctly, you must set the ADC reference to the 2.56V internal reference, set the multiplexer to the temperature sensor, and enable the ADC. The code I used to configure the ATMEGA32u4′s temperature sensor is as follows. This is specifically for the ATMEGA32u4 so if you are using a different chip, you should check the datasheet for the correct register values.

 

 

For more detail: ATMEGA Core Temperature Sensor

 

Leave a Comment

You must be logged in to post a comment.

Read previous post:
DIY Digital Wristwatch
DIY Digital Wristwatch

Introduction The main incentive behind this project was to see how much I could cram, in terms of both hardware...

Close
Scroll to top