Using smart hardware to improve IoT energy efficiency

IoT

The Internet of Things (IoT) will use distributed sensors to build more intelligence into the world around us. By sensing chemicals, moisture, temperature and other environmental variables, IoT systems will be able to tune conditions inside buildings to be more comfortable, make factories more productive, and distribution more effective by keeping the goods under optimum conditions at all times.

An important requirement for an IoT sensor node is low energy consumption. In many cases, the sensor node will be wireless for ease of installation. All of the node’s power will need to be supplied by a built-in battery or harvested from the environment. To minimise maintenance costs, many users will want the battery to be able to power the device for its full service life – which could be five, 10 or more years.

The lifetime energy usage of an IoT sensor is a combination of the energy consumed while actively processing and interacting with the wireless network and the energy used for the periods in between those periods of activity. The power consumption of any CMOS logic-based device such as a microcontroller is largely due to the influx of charge required to switch between different states. On top of this, the constant trickle of current lost through leakage needs to be added.

The power consumed during switching is determined by the formula CV²f where C is the total capacitance of the circuit paths within the device, V is the supply voltage and f is the operating frequency. The leakage power depends on the process technology and is at a much lower level than switching power. But, because leakage is continual, it leads to significant wastage of energy over the long term.

The only way to prevent leakage is to power down the circuitry completely. Many microcontrollers are designed to support this. When the system is quiescent, the microcontroller’s sleep state allows large parts of the integrated circuit (IC) to have the power rails disconnected, leaving only small portions of the device, such as the real-time clock, running. A low-power sleep state will consume far less energy during a given period of time than its active state.

Many IoT applications can take advantage of the microcontroller’s support for sleep modes. The gaps between periods of high activity can be relatively long. Each sensor reading is likely to take no more than a few hundred microseconds to complete and can be far less. Even if a sensor reading is required ten times a second, the sensor node can be fully asleep for much of its overall lifetime.

Lifetime is highly sensitive to the duty cycle between active and sleep modes. At a duty cycle of five per cent, the device can wake five times every second for a period of 10ms. An MCU that consumes 1mA when fully active, and which supports a deep-sleep mode that consumes a constant 2µA, may operate for approximately four years from an 1800mAh battery. If this active cycle increases to 10 per cent then the lifetime will be almost halved.

Designers of microcontrollers aimed at the IoT have taken great care to not just reduce the power consumed during active and sleep modes but to make it possible to increase the proportion of time spent in sleep than in high-activity states. Peak activity for a microcontroller will typically occur during periods when the central processor is running software.

Some power will also be wasted during the wakeup and activity-suspension periods. During these periods, the software will not be performing useful work. Although MCU designers have worked to reduce the wakeup delay using fast-starting on-chip clock oscillators but the system will consume power while it transfers the values of important registers to and from non-volatile memory and performs other housekeeping tasks. The key, therefore, to longer battery life is to minimise the number of wakeup cycles needed. Intelligent peripherals provide the means to achieving this.

A number of have incorporated intelligent, power-saving peripherals – they range from 8bit MCUs such as the Microchip PIC range through to 32bit ARM-based SoCs. Some of them incorporate state machines and I/O processors that coordinate peripherals without the need to involve software processing until absolutely necessary.

Examples include Atmel’s picoPower and SleepWalking technologies and the LESENSE peripheral block used by the Gecko series of MCUs made by Silicon Labs. Microchip has employed the concept of Core-Independent Peripherals in a number of its PIC12 and PIC16 MCUs.

The inclusion of state machines and other logic into the hardware peripherals make it possible to keep the processor core asleep for longer by transferring some of the calculations often performed in software into the hardware domain. The simpler, low-level hardware engines can activate more quickly from a sleep state and consume far less power than the fully operational central processing unit.

In a typical application, the MCU will run for much of its time almost fully asleep with only the most vital functions, such as the core hardware interrupt circuitry and the real-time clock running. This not only allows the system to process reset interrupts and maintain the system clock, but having the clock operational makes it possible to generate a timer interrupt at regular intervals.

This timer interrupt can lead to a partial wakeup that activates important hardware blocks such as the analogue-to-digital converters (ADCs) attached to the IoT device’s external sensors. Once activated, the ADCs can take measurements and pass them into on-chip memory. The state machine in a LESENSE controller, for example, can compare the new value with a threshold set by the software before the processor core last went to sleep. If the value is below the threshold, the processor can remain sleeping. Otherwise, the LESENSE unit will wake the processor to perform more detailed analysis and possibly act on the change.

Low-level hardware coordination between peripherals makes it possible to store data from repeated measurements so that the values are available to the processor when it finally needs to be woken. The picoPower subsystems in Atmel ARM-based MCUs have access to direct memory access (DMA) controllers that allow captured data to be stored safely in local memory. The DMA controller can reduce system power even further by using a hardware CRC engine to automatically calculate a checksum to provide integrity checking, saving additional power.

The range of Core-Independent Peripherals available for the Microchip PIC range include a Configurable Logic Cell that performs combinational and state-based logic on up to 32 internal or external input sources, continuing operation while the processor core is asleep. This lets the MCU perform signal conditioning and data manipulation without invoking the processor unless the logic’s truth determines that the wakeup interrupt needs to be asserted.

Atmel’s Dynamic SleepWalking optimises power consumption further by enabling power domain transitions without waking the processor. This allows the MCU to use the lowest-energy mode possible at any given time, autonomously increase to a higher power domain if required to use additional system or peripheral resources, and return to a lower power mode once the event has been handled.

Within the ARM ecosystem, software support for low-energy IoT applications has arrived in the form of the event-based mBed OS. Traditional real-time operating system (RTOS) design can increase power consumption by attempting to provide the lowest possible latency.

The event-based model of mBed OS follows the design principle used by hardware-enhanced MCUs to minimise energy consumption. The mBed OS  does not use regular timer interrupts to initiate tasks – the processor is expected to only wake up if events need to be handled. The single-threaded model processes tasks within the same power domain before transferring control to tasks from a different domain. This avoids the problem of different power domains being activated and put to sleep again frequently, which minimises overall energy consumption.

The optimisation of processing for energy efficiency in the MCU ecosystem continues, which will yield further gains in battery lifetime for sensor nodes. But the combination of smarter hardware peripherals running in conjunction with microprocessor cores already provides the framework for low-energy IoT sensor nodes.