Tips and Tricks for Reducing Power Consumption

The best way to reduce power consumption is to put the microcontroller to sleep whenever code does not need to be run. Identify the downtime of the code and put the microcontroller to sleep whenever possible.

Code execution implies that the microcontroller is awake, so the more that can be minimized, the more power will be saved. Several peripherals can become helpful for this as well as some hardware features for other peripherals.

  1. 1.The Event System

    One of the most helpful peripherals for power saving is the Event System. This peripheral offers a way to connect signals between peripherals without using code.

    Peripherals can generate events that are similar to interrupt conditions but do not wake up the device. These events can be connected through the Event System to activate the functions of other peripherals.

    For example, a timer overflow will produce an event that can be routed to the ADC, so a conversion starts whenever the condition is reached.

    More information on the Event System can be found in the data sheet for the AVR DA.

  2. 2.Hardware Features

    Many peripherals have hardware implementation for functions that would normally be done in software.

    Here are some examples of the most useful functions that can be done from the hardware.

    • The ADC has a hardware accumulation function that can go up to 128 samples. The ADC can also be put into Free-Running mode, where it starts another conversion whenever one ends.
    • Two timer B instances can be cascaded to obtain a 32-bit timer
    • USART offers error detection and error correction capabilities
    • TWI offers address match capabilities in any sleep mode

    Additionally, the Analog Comparator has power-saving modes that can reduce the power consumption at the expense of switching speed. This feature is found in the Control A (CTRLA) register of the AC.

    Figure 1. Power Profiles for Analog Comparator
  3. 3.The Configurable Custom Logic (CCL) Module

    This module can be used to produce custom logic functions directly in hardware. Tasks that are usually done in software can be assigned to this peripheral, and the microcontroller core can be put to sleep.

    For example, an application that sends an SOS signal can be implemented in software with delays and pin changes, or a custom circuit that produces the SOS signal can be created with the CCL. More information can be found in the Core Independent Solution Using AVR DA Peripherals Lab Training Manual.