The number of IoT devices seems to be at an all-time high, from industrial sensors, to IoT clothespins (really!), to smart water dispensers for cats. For mainstream IoT applications, battery life is often a huge differentiator in buying decisions, so designing a device with an energy-frugal microcontroller unit (MCU) is a critical success factor. Once you have selected the MCU, however, your job has just begun. Your MCU firmware programming decisions can have effects ranging from fractions of a percent to an order of magnitude or more.
Carefully select the MCU hardware architecture to match your application. For example, some MCUs include efficient DC-DC buck converters that allow you to specify voltage levels for the MCU and peripherals that can operate across a range of voltages. A transceiver IC that can operate at voltages ranging from 2.2 to 3.6 V will have substantially different power consumption, output power, attenuation, and blocking characteristics at different input voltages, so flexible DC-DC conversion is a plus. Also, an MCU may integrate RF radio capabilities, sensors, and other peripherals. Greater integration may decrease current draw by offering greater control over options that can reduce current.
Accelerators and peripherals
Some MCUs have hardware accelerators for rapid CRC, computation, cryptography, random number generation, or other powerful math operations. The high speed of these peripherals lets you put the MCU to sleep faster, but there may be a tradeoff between speed and current consumption. Other MCUs use a wake-up peripheral that saves time by using a low-power RC circuit to clock the MCU while the main crystal oscillator powers up and stabilizes, again saving MCU runtime. Some MCUs have sensors with buffers that accumulate multiple samples for efficient batch reading later – customers probably do not need their IoT aquarium thermometer to send data to the cloud every millisecond. Some of these peripherals may also improve the security of your device because they include hardware security features.
Every IoT device needs some memory to run its programs, but unused RAM simply wastes current. Some, but not all, MCUs allow you to turn off power to unused RAM. Also, the various memory technologies (EEPROM, SRAM, FRAM, flash, and so on) consume different amounts of power. Some MCUs have one type of memory technology for program storage, and small caches of SRAM that perform most program operations with low-power memory.
Low power states
The key to long battery life is to increase the time spent in low-power sleep states, but the sleep states in different MCU architectures vary dramatically. Furthermore, the names used for these states – sleep, hibernate, idle, deep sleep, standby, light sleep, snooze – lack consistency. Review the MCU’s low power modes carefully, along with the consequences of entering and exiting them, such as data loss, time to enter and exit the state, and requirements to reboot various levels of functionality.
The variety of timers and clocks available on the MCU may also affect battery runtime. At a minimum, most MCUs have two clocks – a relatively fast master clock for fast reactions and signal processing and another, slower clock for keeping the real-time clock alive in sleep states. Other MCUs may combine a small current sink, a comparator, and an RC circuit to form a low-power wake-up source whose period depends on the circuit’s resistance and capacitance. This is less precise than a crystal, but it saves power, and it may be sufficient for some applications.
In conclusion, there are many things to consider when you select your MCU. What to do after you have selected your MCU will be described in future articles.