Low-power considerations

A project log for Low-power environmental data logger

Small battery-powered data logger that runs on 3.2 µA when measuring at a 1 minute interval

martin2250martin2250 06/11/2015 at 21:130 Comments

Since one of the key features of this project is the low power consumption, I'll go into some more detail on how to archive similar results on AVR microcontrollers.

Power Management

Use the macros provided by <power.h> to turn off modules that you don't need. My usual approach is disabling all modules when going to sleep and only activating modules as you need them.

Be careful though, registers of disabled modules can't be accessed! I spent a lot of time tracking down a bug where I set up a timer, and enabled it only before starting it.

Sleep Modes

Whenever you have to wait for an external event or just want to pause the program for a certain time, use sleep modes. As there are many different modes it's important to choose the correct one depending on the task. If you need to keep a peripheral running in the background, you can't use 'power down' mode, instead use 'idle' mode.

I used two flags in my status variable which indicate if either the timer used for debouncing or the USART are running. The main loop will enter 'power down' mode only if both flags are cleared.


If you need to wake up from a sleep mode after a predetermined time, you should use the watchdog timer instead of a normal timer where possible.

The advantage of the watchdog is that it has it's own 128kHz clock and will still continue to operate in 'power down' mode whereas the other timers rely on the I/O clock (aka the main oscillator) which uses a lot of power.

It does have it's disadvantages though, you can only choose from a small selection of timeouts ranging from 16ms to 8 seconds. Also, the 128kHz clock is not calibrated. If you need accurate timing, you'll have to use normal timers.

I used the watchdog to wake the processor from deep sleep after sending a measurement request to the sensor and waiting for the conversion to finish. Since the conversion takes around 53ms and happens every minute, there is a lot of power to be saved.

Before, I used a normal timer and put the processor to 'idle' mode. In this configuration, the average current over one minute was around 10µA. That means that the processor in 'idle' mode for 50ms alone used twice the power of the processor in 'power down' mode for one full minute and doing some processing and communication alongside the sensor doing a conversion and both other chips idling.