Close

Adjusting the Clocks

A project log for Coin Cell Powered Temperature/Humidity Display

Using an ePaper Display, investigate getting the lowest possible current usage from an STM32L0.

Kevin KesslerKevin Kessler 04/13/2018 at 15:100 Comments

The STM32 series has a complicated clock setup. Configuring the clocks is made much easier by using the STMCubeMX tool, and I initially configured the clocks to use the High Speed Internal 16Mhz clock. The current usage for the device in this configuration looks like:

This chart shows the higher current usage when the device is reading the sensor and displaying the data, and lower, flat line current usage when the device delays for 10 seconds, before repeating the process. Using some primitive calculus, the area under the active phase shows the device consumes 0.0132 mAh of energy (5.66 mA average current consumption during this period). Using an idealized CR2032 cell with a capacity of 240 mAh, this means that the device could run 18237 display updates before depleting the battery (ignoring any idle time between the updates). The average current usage during the idle time is 3.49 mA, which equates to depleting a coin cell in 68.7 hours, if the device just continuously idled.

The low powered STM32L series of processors have another internal clock, know as the MSI, Multi-Speed Internal clock. Switching to that clock is just a matter of clicking the MSI in the STMCubeMX clock configuration screen, and selecting the speed. I set the MSI to 2.097Mhz, and got the following current utilization:

Here the energy consumption during the display phase was 0.00813 mAh (2.36 mA average current during this period), which is a 16.25% decrease in energy usage. This is somewhat surprising, since, because of the lower clock rate, the display phase, with its heavier current usage, is 4 seconds longer than with the faster clock (12.4 seconds vs. 8.4). Using the MSI means that a CR2032 has the energy to do 29520 display updates.

Unsurprisingly, the idle current with the slower clock dropped to 0.745 mA, leading to a vast improvement of battery life of a totally idling system to 322 hours.

Finally, I set the MSI clock from 2.097Mhz to 1.048Mhz (yes, kind of weird frequencies, but that is what is available):

At this point, diminishing returns have finally caught up with us. While the average current during the display phase has dropped to 1.92 mA, it takes 19.2 seconds to complete the display update, so the total energy for the display phase at 1.048Mhz is 0.0103 mAh, meaning a coin cell can only do about 23200 updates, more than 6300 less than the faster 2.097Mhz clock.

The average idle current is less, at 0.562 mA, but we have better ways to reduce the idle current.

Note: The ST-Link programmer must be disconnected during these test. When the programmer is connected it the circuit, it draws a lot of extra current.

Discussions