Skip to main content

Minimizing energy consumption by controlling peripheral activity

Minimizing energy consumption by controlling peripheral activity

November 22, 2017

Synopsis

This application note describes how to schedule periodic activities in order to achieve low energy consumption.

Setup

Measurements are made with Otii Arc on Atmel ATmega328PB Xplained Mini evaluation board.

Sample application uses built-in ADC to measure voltage level at NTC thermistor. Each measurement is an average of 232 ADC samples. Measurements are taken periodically at different intervals: 100, 75, 50 and <50 ms.

CPU runs at 250 kHz and enters power-save mode between measurements.

Periodic Activities

Navigators, environment monitors and similar battery-powered devices usually do not keep their sensors powered all the time. Instead, they tend to have CPU sleeping and peripherals powered off and wake up at pre-programmed intervals to query the sensors, process and display or transmit sensor data.

A typical simplified algorithm looks like following from booting the device:

    1. Turn peripherals off.
    2. Schedule a timer.
    3. Send CPU to sleep.
    4. Wake up from timer.
    5. Turn peripherals on.
    6. Read and process data from peripherals.
    7. Turn peripherals off.
    8. Jump to 3.

Considering latency, accuracy and energy consumption, main aspects of such periodic activities are:

  • Wakeup interval: the more often device wakes up, the faster it reacts on changes.
  • Amount of data read from a peripheral: it takes longer time to read more but the result will be more accurate.

These aspects are tightly related and can be formulated as a ratio of duration of wakeup to duration of sleep.

Optimization of step 6, is out of scope of this application note. Common method is to turn off the sensors and CPU as soon as the job is done and to sleep until the next wakeup.

This method has limitations that will be demonstrated and discussed further on in this application note.

Limitations of Periodic Sleep/Wakeup Method

Measurements have been made using sample application for different wakeup intervals: 100, 75, 50 and <50 ms (timer’s counter was set to 12 for 50 ms and to 11 for <50 ms).

Fig 1. Screenshot of taken measurements

Tab. 1. Energy consumed by wakeup intervals

No sleep100 ms75 ms50 ms<50 ms
Energy, uWh172168169171172

As can be seen from Tab. 1. with reduction of time between wakeups amount of consumed energy grows and at certain point it reaches the value when periodic sleep/wakeups become impractical.

Fig. 2. Single period of 100 ms
Fig. 3. Single period of <50 ms

It must be noticed (Fig. 2 and 3) that although wakeup interval <50 ms is short, it is still longer than activity time, ie periods of sleep and activity do not overlap, there is still some time between going to sleep and waking up: 57 ms for 100 ms interval and 5 ms for <50 ms.

Energy Saving Effect of Wakeup/Sleep Sequence

To estimate the effect of periodic wakeup/sleep sequence, energy consumed during one wakeup/sleep cycle needs to be compared to system’s consumption during the same time if the system would stay on.

Letterpainro
Stateperiodicactiveidle (sleep)turning onrunningalways on

For one period energy can be calculated as:

(1)      Ep = Ea + Ei

a sum of energy consumptions during activity and idle, where

(2)      Ea = En + Er

with En as energy spent on turning on and Er as energy spent on running.

(3)      Ep = V(Intn + Irtr + Iiti )

And for a system that would be kept running during the same time:

(4)      Eo = VIr(tn + tr + ti)

For periodic activities to give positive effect on energy consumption, expressions (3) and (4) must meet the following relation:

(5)      Eo > Ep

Voltage can be assumed a constant thus (5) can be expressed as following:

(6)      Always on        Periodic
         Ir(tn + tr + ti)  >  Intn + Irtr + Iiti
         Irtn + Irtr + Irti  >  Intn + Irtr + Iiti
         Irtn + Irti       >  Intn + Iiti
         Irtn + Irti       >  tn(Ir + IΔn) + ti(Ir - IΔi)
         Irtn + Irti       >  Irtn + IΔntn + Irti - IΔiti
         IΔiti            >  IΔntn

         where IΔi = Ir - Ii and IΔn = In - Ir

Relation (6) can be formulated as a generic rule:
In order for periodic wakeup/sleep sequence to give positive energy saving effect, energy cost of wakeup must be lower than energy save in sleep mode.

In practice for every periodic process minimal duration of activity period that ensures required accuracy needs to be determined first. Then interval between wakeups is decided based on required latency. If relation (6) is not true for these timings, either the system should be kept awake all the time or requirements for accuracy and latency need to be changed.

When dealing with multiple periodic processes it is recommended to align them in time for their intervals of activity to overlap. This will help to avoid situations when the system wakes up for one process immediately after going to sleep for another.

If alignment in time is not possible, e.g. when there are non-periodic wakeup/sleep processes, it can be recommended before going to sleep to check time remaining until the nearest predictable wakeup and refrain from sleeping if the time is too short.

Summary

In this application note measurements of energy consumption for periodic processes with different periods of inactivity were presented, followed by theoretical background and practical advice on scheduling wakeup/sleep activities.

Become a member of our community

Gain access to exclusive resources, educational materials, and expert advice to enhance your knowledge and understanding of powering IoT devices and battery testing.