3 Tips to Lowering Your Embedded Systems Power Consumption
Designing an embedded system for low power consumption is critical whether you are planning for a battery-operated device or not.
July 23, 2024
A device that poorly manages power can cost customers extra money, result in overdesign for heat dissipation, and even stress the power grid.
It’s pretty typical for embedded teams to ignore power consumption until the end of their development cycle. Unfortunately, minimizing a device's energy consumption requires developers to design their hardware and software architectures to achieve minimal power usage.
Let’s examine three tips for lowering your embedded power consumption. These tips will help you minimize your power consumption with the least effort.
Tip #1: Leverage Power Domains
Software can do a lot to optimize an embedded system's power consumption, but hardware also needs to contribute. One technique that I have found to be extremely helpful is to split the hardware up into power domains.
The idea behind a power domain is that the hardware is segmented into different regions that can be individually enabled and disabled. For example, a system might consist of a microcontroller, a radio, non-volatile memory, etc. Each of these major components in the hardware design would be segmented so that they could be enabled or disabled based on the system's power state.
If the system was in a low-power state, there might not be a need to keep the radio powered. So, instead of letting it consume power, the microcontroller could use a GPIO signal to turn off the radio's power. The result would be conserving power that otherwise would be wasted.
When you decide to use power domains, it’s important to consider the following carefully:
Will the power-up time of the power domain meet the system's real-time requirements?
Will powering up the device still conserve energy? Basically, is the power used to start up the device less than just putting it into a low-power state?
Could any components be “back powered” on accident, causing a waste of power?
Power domains can be a handy tool if appropriately leveraged. Just be careful to leave your design simple and avoid causing your bill of material costs up to unacceptable levels. There’s always a trade-off that you’ll have to optimize.
Tip #2: Carefully Manage Your Peripherals
Our next tip for lowering your embedded systems’ power consumption is carefully managing your peripherals. Every microcontroller has a variety of peripherals, such as GPIO, SPI, I2C, USART, timers, and so forth. All peripherals are not created equally!
A microcontroller will have some peripherals that are specifically designed to be used for low-power applications. For example, you may find that your microcontroller has an LP timer, an LP USART, etc. The LP stands for low power! These peripherals were designed to use less energy than a typical peripheral version. Instead of using a general-purpose peripheral, start by using the low-power version.
In addition to using low-power peripherals, you’ll want to see what additional “helpers” your microcontroller provides. For example, many devices today come with hardware accelerators, specialized hardware units designed to speed up operations. These could be cryptographic accelerators, CRC calculators, and so forth.
The accelerator might increase power consumption, but in many cases, it’ll use less power than the CPU to perform the same operation. So, enabling the accelerator will have an overall net effect of lowering power consumption. It’s slightly counterintuitive because we raise the power consumption by allowing the accelerator but save power overall by completing the operation faster.
There are plenty of other techniques you can use to lower power consumption as well, such as:
Disabling or powering down unused peripherals.
Lowering clock speeds.
Leveraging direct memory access (DMA) to speed up transfers.
When lowering your device’s power consumption, the key is identifying ways to speed up operations that allow the system to enter a lower power state.
Tip #3: Optimize Your Firmware
The software on your device plays a critical role in how much power it consumes. The CPU is one of the most significant power-consuming devices in most products. That means you must use less CPU to lower your embedded system's power consumption. There are several ways that you can help your CPU work less.
First, enable your compiler optimizations. I can’t tell you how often I see teams that leave their optimization levels at -O0. That’s no optimizations! At a minimum, you should be using -Og, which consists of basic optimizations that don’t affect debugging. If you are concerned with power consumption, you want to optimize your code for speed. That would require you to use optimization level -O2 or -O3. If you really want to push the envelope, you could use -Ofast, but it might violate strict standards compliance. Your code will run a lot faster, though.
Another technique I’ve found helps when you want to use fewer CPU cycles is a commercial compiler. I know software developers don’t like to pay for things! However, I have found that you can increase code execution by 10 – 40% using a commercial compiler. The results dramatically depend on what you are doing and what compiler you choose, but it’s still an often-overlooked option.
From there, there is a whole range of techniques you can use to lower power consumption such as:
Using an event-driven software architecture.
Creating a power manager to manage power states.
Use tickless mode if your RTOS supports it.
Leverage WFI instruction on Arm processors.
Leverage zero wait RAM.
These are just a few examples of optimizations that you can use to help improve your software. You can use countless other techniques, but these are the most overlooked and powerful ones.
Taking Your Next Steps
In today’s post, we’ve explored several tips for lowering embedded systems' power consumption. Optimizing for power consumption can be treated like a challenge or a game.
I typically follow these steps to optimize for power consumption:
Measure the current power consumption of the device.
Develop new features or perform optimizations.
Measure the result of the changes and quantify the difference.
Repeat.
It’s essential to measure and quantify any changes in power consumption. When you start down the path of lowering your embedded system power consumption, it can become addicting! Before you know it, you’ll spend a lot of time squeezing every coulomb of charge or joule of energy from your device. However, there is a trade-off between time and power consumption.
I recommend that you track the optimization improvements and calculate the percent improvement. You’ll eventually discover that new changes result in very little improvements, and at that point, you’ve optimized your device enough such that any additional time investment probably isn’t worth it.
If you follow these tips, you should on your way to getting the lowest score possible for your device. (Probably the only time you ever want to have the lowest score!)
About the Author
You May Also Like