ATmega Power Management And Sleep Modes

Article by:
Date Published:
Last Modified:


The ATmega architecture provides power saving modes of operation to reduce to total power consumption of the microcontroller. The number and type of power saving modes depends on the exact chip in the ATmega family. Power saving modes are very useful when designing an embedded solution that will be powered of a limited power source, such as a coin-cell, solar power, or energy harvesting method.

AVR-LibC Library

AVR-LibC provides a good library for utilising the sleep modes on an ATmega microcontroller. To use them, make sure to include sleep.h from AVR-LibC into your project. If using AVR Studio 5, this can be done with the following inclusion at the top of your code.

#include <avr/sleep.h>

The following code examples make use of the functions provided by this library.

Sleep Modes

ModeclkCPUclkFLASHclkI/OCan Wake Up FromNotes
  • External interrupts
  • Internal interrupts
Stops the cpu and flash access, but allows all other components to run.
ADC Noise Reduction Mode000
  • External interrupts
  • Internal interrupts
  • Watchdog reset
Improves the noise performance of the ADC. Use this if you want to do hard-core ADC measurements and get the maximum possible resolution.
Power-down Mode
Power-save Mode
Standby Mode

Putting The Micro To Sleep

There are three functions from the AVR-LibC sleep library that need to be called to make the microcontroller enter a sleep mode. The first is set_sleep_mode(mode).

Things To Watch Out For

  • USART/other comm transmissions have finished before you enter a sleep mode which stops the USART clock. If not, you will be sending corrupted data.


Geoffrey Hunter

Dude making stuff.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License .

Related Content

No related content found.


    comments powered by Disqus