The rise of portable, battery-powered applications has resulted in more features packed into smaller form factors. Particularly wireless communication, this means a bigger demand on the system power source. With the help of the most recent advances in microcontroller functionality, including various integrated features and peripherals, power management in embedded designs has become easier and smarter to implement. These MCUs have also enabled better design techniques
by Jin Xu, Microchip Technology
In case you haven’t noticed, it seems that everything around us is getting smarter and connected to one thing or another. Your shoes now have sensors that can tell you how to improve your running time by displaying your pace on your smart phone. Your scale can automatically save your weight to your cloud–based tracking application, and it can let you know why that last doughnut you ate was a bad idea—via an alert on your smart phone. Your home security system can inform you about a leak in your garage via text message, thanks to a small wireless sensor placed next to the water heater.
The rise in popularity of portable battery-powered applications has increased exponentially, thanks to the technological advances over time. Engineers are constantly being pushed to increase product functionality while reducing its overall dimensions, for each successive design. These additional features put a bigger demand on the system power source. The challenge becomes how to implement these new functions while extending the battery life, all in a smaller footprint.
The conventional approach for battery-powered application design is to keep as many modules in a low-power state for as long as possible, occasionally waking up to perform the required tasks before returning to sleep mode. In a complex design with multiple MCU/MPUs and components, a low pin count 8-bit microcontroller is often used as the system supervisor, to perform housekeeping tasks such as turning on and off modules as needed to maximize the power efficiency. Still, the majority of designs have only one main microcontroller with a host of integrated peripherals to implement the required system functions. Therefore, the power consumption of that microcontroller becomes a critical parameter. However, not all microcontrollers are made the same when it comes to low-power performance. This is where an 8-bit microcontroller can outshine a 32-bit device in many cases. Some 8-bit MCUs consume as little as 20 nA in the lowest power setting, while a 32-bit bottoms out around 10 to 20 times higher, at best.
There are a number of ways to wake up the microcontroller from sleep mode. Using the microcontroller’s internal timers to wake up the system periodically is a common practice. The timer can be configured to trigger an interrupt after it overflows. A 16-bit timer with 1:8 pre-scaler, running off the internal, low-power 31 kHz oscillator (or with an external crystal) can keep the device in sleep for about 17 seconds. Another option is to use the MCU’s watchdog timer (WDT), ideally with a maximum idle time of 256 seconds while consuming around 440 nA. (Once again, a typical 32-bit MCU with WDT enabled consumes at least 3 times the current of an 8-bit MCU.)
Take an application that doesn’t need to wake up frequently, such as an environmental monitor that wakes up roughly every four hours to read the humidity sensor before going back to sleep again. Does this mean that we must wake up more frequently, due to the internal timer limitations? Not necessarily. One option is to use a real time clock (RTC) and crystal that can provide accurate time keeping in terms of hours, days, months and even years, if needed. Since not all microcontrollers offer an integrated RTC and crystal, often for cost reasons, a stand-alone RTC can also be considered.
Another option to extend the idle period without any additional components or power penalty is to use the unique peripherals found in some next-generation 8-bit microcontrollers (such as Microchip Technology’s PIC MCUs). For example, designers can connect one of these MCU’s configurable logic cells (CLCs) and its numerically controlled oscillator (NCO) to the 16-bit timer, in order to extend the period from 17 seconds to 205 days, before triggering an interrupt to wake up the MCU (Figure 1). Of course, it is rare for an application to have a need to remain idle for such long period, but the capability is present if necessary. The power consumption of this implementation can be reduced by 50% to around 2.3 µA, by using an external crystal instead of the MCU’s internal 31 kHz oscillator.
An 8-bit microcontroller’s core-independent peripherals are being used to extend the idle period to 205 days, without any additional components or power penalty
External interrupt sources can also be used to wake up the microcontroller, such as a switch or sensor. Some of the larger MCU/MPUs have multiple interrupts with priority levels, but these features are often not present in most of the low pin count MCUs on the market. Remember the configurable logic cell module that we used to extend the timer period in the previous example? Not only can it be used to create extra interrupt sources when the MCU has only one system INT, the CLC also allows designers to add conditional or sequential logic to the wake-up routine; making it smarter with no additional current draw. If the system requires a number of signals to represent a specific state, in order to wake up the CPU to check the condition, very often it was awakened due to one signal change, only to find the other signals had not yet occurred. It is now possible to configure and combine the available logic functions and state machines in the CLC, or even multiple CLC modules, to create specific wake-up conditions that avoid frequent false triggers and unnecessary power drain.
While we would like to do everything in sleep mode, certain tasks must be performed in active mode where the MCU core consumes the highest amount of power relative to all other modules. This is where things can get a bit tricky. Figure 2 is a simplified graphic representation of the system current consumption over time. The area under the current-consumption line represents the total discharge over time, measured in Coulombs. If the sum of all the areas under the sleep-mode period is much greater than the active mode, then the sleep-current value is more critical since most of the energy consumption takes place in a low-power mode. Vice versa, if the sum of the area under the active-mode period is significantly higher, then the sleep current value and the time spent in sleep mode become irrelevant.
A graphic representation of a microcontroller’s current consumption over time.
Applications with wireless communication, such as Wi-Fi or Bluetooth LE, are particularly challenging systems in which to reduce power consumption. Designers of these systems must consider how much data is transmitted or received, since this will directly impact the overall current consumption. Wireless modules can be used in “Beacon Mode,” to wake up periodically and search for signals; or they can go into standby mode when not in use.
Analog sensors require the use of the MCU’s on-chip ADC module. Typically, the time needed for ADC sampling is much longer than the conversion time. The more time spent in active mode, the more current is consumed. However, some MCUs have ADC modules that allow conversions in sleep mode, which saves power by minimizing the time spent in active mode.
Some MCUs integrate a wide variety of low-power active modes. These modes provide the option to turn off or reduce the speed of the core processor, while selectively keeping the system clock active for the on-chip peripherals.
One frequently heard statement is “the higher the performance of the core, the faster the execution of the tasks, then the sooner it can return to sleep mode.” While this might be true in some cases, there is a flaw to this logic. We have to remember that the core consumes more power than any other module in the MCU. Additionally, all of the tasks that require the core must be executed sequentially (FIFO), regardless of the speed. Therefore, the core can’t be turned off until the last task is completed. When a microcontroller can perform the required tasks in parallel, using integrated peripherals that can operate without the core, then it makes the speed of the core irrelevant while significantly reducing the overall power usage. After all, the majority of these new peripherals are fully functional while the MCU’s core is in sleep mode.
Designing battery-powered applications has become more complex, due to their increasing functionality. Engineers should analyze and fully understand the current-consumption profile of each component in different power and activity modes, in order to achieve the highest battery usage efficiency. The new peripheral sets in the next generation of 8-bit microcontrollers enable engineers to be creative with their designs, without sacrificing performance.
Microchip Technology, Chandler, AZ. (480) 792-7200. www.microchip.com