Simplify the battery gauge with a 1-dot bar graph display

Article By : Benabadji Mohammed Salim

This display uses a cheap six-pin microcontroller and a tri-color LED to realize a simple alternative to the usual four-LED bar graph battery gauge.

With the rapid growth of embedded systems, and, in particular, IoT devices, there has been a growing need for improvements in the rechargeable battery systems that power them. In particular, many applications could benefit from a cost-effective, but accurate battery charge gauge. While most automotive, medical, and military applications require the functionality of a complete battery management system (BMS), many other products would be well-served by a much simpler battery gauge that simply tells the user how much charge is available to power the device.

This Design Idea is a 1-dot bar graph display that provides a simple, compact, low-cost, and low-power alternative to the usual four-LED bar graph battery gauge [1]. It consists of a surface-mount (SMD) style RGB LED, driven by an ultra-small-form-factor microcontroller, in this case, a Microchip PIC10F220 or PIC10F222 in a 6-pin package. The resulting solution can be implemented on a PCB as small as 3.1 × 3.2 mm2 or easily integrated into an existing design (Figure 1).

1-dot bar graph display for battery gaugeFigure 1 A 1-dot bar graph display provides a compact and low-power alternative to the usual bar graph battery gauge.

The prototype board’s small size makes it easy to be added to existing products that currently lack a battery gauge. In this example, it is mounted inside the case of a Li-ion battery power bank where the PIC measures the battery’s voltage (sensed at its own Vdd pin) using its internal 0.6V band gap reference. A measurement taken with the ADC, represents the 0.6V reference as a percentage of the voltage senses at the Vdd input. As Vdd increases, the resulting number will decrease and vice versa, resulting in a “1/x” relationship between sensed voltage and the A/D’s output value. The calculations for deriving the actual value of the sensed voltage from the A/D output are available in Microchip application note AN1072 [2].

Wow the engineering world with your unique design: Design Ideas Submission Guide

As with any state-of-charge gauge, this design must account for the non-linear voltage vs. state of charge curve exhibited by Li-ion batteries [3] when selecting the threshold voltages at which the microcontroller will display the color that corresponds to the battery’s state of charge (red, yellow, green, or blue). In order to avoid the difficulties involved with using PIC’s limited math capabilities to calculate the state of charge each time Vdd is measured, we created a lookup table that can be stored in the PIC’s program memory. The table (available here) was created with Microsoft Excel and only covers the range of voltages expected from the battery pack, in this case 2.9 to 4.3V. When measured by the PIC’s 8-bit ADC, these voltages will produce output values between 52 and 35.

a lookup table can simplify state-of-charge calculationsFigure 2 Using a lookup table can simplify state-of-charge calculations.

In order to minimize power consumption, the design uses a high-brightness RGB LED [4] and configures the microcontroller to remain in sleep mode until it receives a periodic interrupt from its watchdog timer (about once per second). Once woken from sleep mode, the controller measures the voltage present on its Vdd pin and blinks the appropriate LED briefly (1 msec pulses every 0.25 s) by driving the LED’s pins associated with the color corresponding to the value of the most recent measurement.

read more design ideasTwo versions of the assembler source code listings for the microcontroller are available for download, enabling the design to drive either common anode or common cathode RGB LEDs. The code listings are fully commented, optimized in size, and use macros to ease reading. In addition, they are compact, requiring only 85 program words and 3 data bytes, making it easy to implement the application on nearly any other pin-limited PICmicro. Note that, with a little experimentation, it should be possible to modify the program provided here to interpolate between threshold values and proportionally illuminate two LEDs according to a battery’s state of charge.

Benabadji Mohammed Salim is working on his master’s degree in computer science at the University of Sciences and Technology in Oran, Algeria.

References

  1. Novel technology to accurately gauge battery state-of-charge, EDN, May 3, 2017.
  2. Application Note AN1072: Measuring Vdd using the 0.6V reference, Microchip Technology Inc, 2007
  3. Discharge Characteristics of Li-ion, Battery University
  4. OSTA71A1D-A OPTOSUPPLY Superflux Tri-Color LED

Related articles:

Leave a comment