Check battery capacity with a simple test method

Most handheld devices use alkaline or rechargeable batteries, and measuring the battery capacity is a crucial feature of such designs. Most of the time, however, using a battery level monitoring IC may be a luxury for budget-tight projects. Here is a simpler, less expensive alternative.

Today, even the least expensive microcontrollers often include an internal analog-to-digital converter (ADC) module, and it is not used all the time because of its (relatively) low resolution and high level of noise. But one of those unused internal ADC’s channels is enough to perform a test to decide whether the battery is still usable or not.

The method for detecting the battery’s health is called electrochemical dynamic response (EDR) (Reference 1) and was patented by Cadex Electronics (Reference 2).

EDR compares the battery’s condition under load with stored parameters relating to battery performance by applying a load pulse and evaluating the battery’s response time on attack and recovery. As shown in Figure 1, a good battery has strong recovery characteristics, while the near-depleted battery has higher discharge slope and less robust recovery. There are several reasons for these differences in the depleted battery’s response, such as increased internal resistance.

Comparing the response to a temporary load pulse by batteries at various charge states demonstrates their differences in EDR.
Figure 1. Comparing the response to a temporary load pulse by batteries
at various charge states demonstrates their differences in EDR.

Using the EDR theory, sampling the battery voltage to find the minimum battery level at a specific time, for example when maximum power consumption occurs, gives information on battery health. A system’s initial turn-on time, aka the “greeting,” is an especially good opportunity for measuring the battery’s health. The battery level may seem to be in safe operating levels before the system fully activates, yet, if the battery is nearly empty, it may immediately drop below a safe level when the system reaches full load. The device will start in normal mode without performing the EDR test, but will turn off uncontrollably (i.e., voltage drops to the critical battery level as marked in Figure 1) at the first heavy load.

This simplified schematic shows the general design of an EDR test implementation.
Figure 2. This simplified schematic shows the general design of an EDR test
implementation.

A simplified harware version of an EDR test implementation appears in Figure 2. The load resistor is chosen to represent the full system load, so its value can change from system to system. The system that generated the data presented here required a 10 Ω value. Resistors R1 and R2 are used as voltage dividers for the battery voltage (VCC) measurement, while a booster circuit ensures that the ADC’s reference remains constant, even if the battery voltage drops during the test. Resistor R3 is a pull-down for the switching transistor.

The test system samples the battery voltage for a set time period, around 200 milliseconds (msec). Under firmware control, the MOSFET is turned on for only half the measurement period, then turned off. This allows the system to measure both the voltage under full load and the battery’s recovery response when the load is minimal. (The time periods can be altered in the firmware, but I found that 200 msec was enough for adequately evaluating battery capacity.) When the measurement is completed, the results can be read out over the UART link.

In the example system I built to demonstrate EDR, I used two AA alkaline batteries, which gives a maximum for VCC of 3.2 V. The boost voltage, VDD, was set to be a constant 3.6 V. The system normally draws 55 milliamps (mA), but under full load draws 127 mA. Oscilloscope traces taken during tests of the system using “good” (Figure 3a) and “bad,” i.e., depleted (Figure 3b) batteries, demonstrate how significant the differences in under-load voltage can be.

Load testing of battery voltage shows significant differences between the response of a fully-charged battery (a) and a nearly-depleted one (b). Load testing of battery voltage shows significant differences between the response of a fully-charged battery (a) and a nearly-depleted one (b).
Figure 3. Load testing of battery voltage shows significant differences between the response of a fully-charged battery (a)
and a nearly-depleted one (b).

The example design, which I have used in some of my projects, is based on an STM32F303 microcontroller with firmware written in C using the Keil IDE. The firmware can be found on GitHub page (Reference 3).

A flowchart for the test code appears in Figure 4. The test gets executed once the UART receives an “S” character. The ADC sampling frequency is set to 250 Hertz and, as mentioned earlier, the test period is about 200 msec.

The EDR test code turns on the load, samples for half the test time, then turns off the load and completes the sampling period.
Figure 4. The EDR test code turns on the load, samples for half the test time, then turns off
the load and completes the sampling period.

This code simply conducts the test and collects the data. There are many options for what to do with the data. In the simplest case, you can look at the data’s minimum value and compare that with the system’s safe operating voltage level, aka the critical level. If the battery voltage approaches the critical level during the test, you can warn the system’s user that it is time to replace the battery.

A more comprehensive algorithm can be written to precisely determine the battery health, such as for displaying a battery level indicator. In order to update and show the user proper data on the display or battery indicator, however, the acquired data should be filtered. Load variations make the raw data totally useless without proper filtering. A slow infinite impulse response (IIR) filter will smooth the signal properly.

In summary, with a very basic ADC from the microcontroller it is possible to inexpensively detect battery health thanks to the EDR method. A battery reading of around 200 msec during initial power up time is enough to implement a basic battery health test for almost any system.

References

  1. Battery Rapid-test Methods
  2. Pulse-discharge battery testing methods and apparatus, U.S. Patent No. 7,622,929.
  3. EDR_method_test_code/Source/

EDN

EMS supplier