Running Power Consumption Measurements on Embedded Systems
Running power consumption tests can be a valuable way to test thermal solutions and to get power usage approximations under different conditions. Ideally, power consumption tests should be done under multiple operating conditions, and in an environment similar to its expected use.
NOTE: This post will discuss power consumption measurements using the 820 SOM dev kit as an example, but the same method can be used for other products with minor modifications.
The development boards for the 820 SOMs have a three-pin PWR PROBE header (J86), shown below outlined in red:
This header is connected to a power sense resistor, and can be used to measure both the SOM supply voltage and the SOM current draw. Pin 1 (the far left pin when viewed as above) is the positive terminal of the power sense resistor. Pin 2 (the middle pin) is the negative terminal of the power sense resistor, and also the SOM supply voltage. Pin 3 (the far right pin when viewed as above) is ground.
Measuring the voltages of Pins 1 and 2 relative to Pin 3 (ground), one can obtain the instantaneous power consumption of the SOM using the following formula:
Where is the voltage measured on Pin 1, and is the voltage measured on Pin 2. 𝑅𝑠𝑒𝑛𝑠𝑒, for the 820 Dev Board, is 5mΩ (0.005Ω).
To get an accurate evaluation of average power consumption under certain operating conditions, measurements should be taken regularly over a significant period of time. The more often measurements are taken, the less likely it is that time-limited power spikes can be missed. This becomes important if the conditions you are testing the SOM under may result in varying loads on the CPU. Additionally, measuring over a significant time period (such as 30min) decreases the likelihood that infrequent power spikes or anomalies will be missed.
As an example, the Keithley 2701 Multimeter can be used with the Keithley 7706 Data Acquisition Unit (DAQ) as a data collection tool for this task. This particular multimeter can be controlled via commands sent over a network connection, and therefore can be controlled by scripts. This DAQ also has several channels, making it easy to record the variation of two separate voltages over a long period of time. Using a Python script to automatically take measurements through the DAQ can be a very good way to record regular measurements over the test period.
Python can also be used to automatically present collected data in a convenient format. Packages such as xlsxwriter allow the script to programmatically fill out a spreadsheet. Below is an example of an automatically generated spreadsheet made using xlsxwriter, complete with a generated graph of power consumption over time.
One useful test to perform is loading the CPU as much as possible. This gives an idea of the maximum power consumption in a certain environment. There are several android applications that can be used to automatically load the CPU. One of these applications is StabilityTest. This android application runs all cores with a full load, making it an ideal tool for testing maximum temperature and power consumption figures.
When running power consumption tests, especially extreme tests like maximum load, it is important to eliminate as many external factors as possible. The exact same thermal solution should be used for each test – this includes ambient temperature, airflow, heatsink, and anything else that could impact the thermal dissipation. The device under test should also be allowed time to cool between tests, so that the starting temperature is consistent.
Here is an example test procedure:
1. Ensure the device is turned on, no applications are running, airplane mode is enabled, the screen brightness is at minimum, and the device is at a stable temperature
2. Start StabilityTest and press “Classic Stability Test”
3. Turn off the screen
4. Record power consumption for 30 minutes
When running suspend (low power) tests, it is useful to know whether there is activity on the processor. This can be the case even when the display is off, for example if activity is happening in the background or driven by network activity. The best way to check for a truly suspended device is to use the UART debug console.
When running high load tests, it is important to check to see if the device under test is thermal throttling. Thermal throttling occurs when the CPU must slow down in order to keep the temperature from becoming unsafe. This is best detected by measuring CPU clock frequency and/or CPU temperature. This can, depending on the specific device and software, be done programmatically through the Linux or Android sysfs filesystem. Both CPU temperatures and core clock frequencies can be found there, reported by the operating system. These are not necessarily guaranteed to be the most precise measurements, but should be enough to know if thermal throttling is an issue. It is important to realize, however, that reading from the filesystem is a process done by the CPU. Because of this, the act of reading these figures can significantly impact power consumption when under conditions that typically only provoke a low CPU load. Temperatures can alternatively be measured externally through separate sensors, if thermal information is needed for precise CPU loads.
Thermal throttling is suspect when observed temperatures abruptly flatten after climbing rapidly. This usually means that a critical temperature was reached and the CPU had to throttle to maintain that temperature. Another sign of thermal throttling is when one or more of the CPU clock frequencies maintains a consistent value for a length of time, before changing behavior and either dropping to a lower frequency or starting to oscillate back and forth between high and low frequencies.
When thermal throttling occurs, power consumption measurements will not necessarily accurately represent maximum power usage of the unit. To fix this and get a better measure of maximum power consumption, the thermal solution should be improved until the CPU stops thermal throttling.
Procedures like this are an important diagnostic tool that should be used in development of embedded projects to gain a clear thermal understanding of the system. Knowing the thermal characteristics and capabilities can allow improvements in performance of the end product.
If you would like assistance with power consumption testing, python scripting or advice on thermal performance, Intrinsyc offers two support plan packages which can be found HERE.