DSPRelated.com
Forums

How to monitor battery capacity

Started by Afinko February 14, 2011
Hi,

I have own hardware with Analog Devices DSP and STM32 CORTEX-M3.
It is powered from battery and it has graphical OLED display.
I am wondering how to add "battery icon" on display.
I can measure the battery voltage by ADC. It is 4.1V LI-On battery
2000mAh.

As you can see here:
http://www.candlepowerforums.com/vb/showthread.php?s=47c0cb73aa368639e94e34d6d077d7fa&t=84980
the voltage of battery is not linear with the actual battery capacity (what
capacity still left). Moreover, the battery is very depending on actual
battery current load.

Any ideas how to program the software that can show the classical "battery
icon" that can be seen on all mobile phones? Some software flow diagram, or
even ideas would be great...

Thanks in advance.
Afi
Afinko <afinko@n_o_s_p_a_m.gmail.com> wrote:
 
> I have own hardware with Analog Devices DSP and STM32 CORTEX-M3. > It is powered from battery and it has graphical OLED display. > I am wondering how to add "battery icon" on display. > I can measure the battery voltage by ADC. It is 4.1V LI-On battery > 2000mAh.
(snip)
> Any ideas how to program the software that can show the classical "battery > icon" that can be seen on all mobile phones? Some software flow diagram, or > even ideas would be great...
It isn't easy. Have you ever had your phone "battery low" icon come on just a few seconds before it shut down? I don't know the characteristics for Li-ion, for NiCd it is very hard to do. -- glen
>It isn't easy. Have you ever had your phone "battery low" icon >come on just a few seconds before it shut down? I don't know the >characteristics for Li-ion, for NiCd it is very hard to do.
It is not easy and definitely it is not precise. But this is what I need. Just very rough orientation about what capacity of battery still left. If it will be precise as on normal mobile phone, it would be great.
On 02/14/2011 11:11 AM, Afinko wrote:
> Hi, > > I have own hardware with Analog Devices DSP and STM32 CORTEX-M3. > It is powered from battery and it has graphical OLED display. > I am wondering how to add "battery icon" on display. > I can measure the battery voltage by ADC. It is 4.1V LI-On battery > 2000mAh. > > As you can see here: > http://www.candlepowerforums.com/vb/showthread.php?s=47c0cb73aa368639e94e34d6d077d7fa&t=84980 > the voltage of battery is not linear with the actual battery capacity (what > capacity still left). Moreover, the battery is very depending on actual > battery current load. > > Any ideas how to program the software that can show the classical "battery > icon" that can be seen on all mobile phones? Some software flow diagram, or > even ideas would be great...
AFAIK most battery monitors measure the current going into/out of the battery, and may or may not combine that information with battery voltage to get the whole picture. You can get battery management ICs that do this. Based on my user experience, informed with trying to do this task in the past, it looks like at least some of these intelligently adapt to circumstances -- I know that both my cell phone and my laptop battery monitors are more accurate right after I've run the juice all the way out of them and recharged than they are before. The best way to get an idea of the state of charge of a battery where you _haven't_ been monitoring current is to draw current from it with stepwise changes, and look at the amount that the battery voltage changes as a consequence of the step -- but even this is peculiar to the particular battery, and still prone to error. Do you have enough flexibility to add battery current measurement or a battery management IC to your system? If not, then probably the best you can do is to just look for the battery voltage to drop below a threshold, then issue a low battery warning. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
On Feb 14, 1:11&#4294967295;pm, "Afinko" <afinko@n_o_s_p_a_m.gmail.com> wrote:
> Hi, > > I have own hardware with Analog Devices DSP and STM32 CORTEX-M3. > It is powered from battery and it has graphical OLED display. > I am wondering how to add "battery icon" on display. > I can measure the battery voltage by ADC. It is 4.1V LI-On battery > 2000mAh. > > As you can see here:http://www.candlepowerforums.com/vb/showthread.php?s=47c0cb73aa368639... > the voltage of battery is not linear with the actual battery capacity (what > capacity still left). Moreover, the battery is very depending on actual > battery current load. > > Any ideas how to program the software that can show the classical "battery > icon" that can be seen on all mobile phones? Some software flow diagram, or > even ideas would be great... > > Thanks in advance. > Afi
Most discharge curves I've seen have a fairly constant voltage-decay rate (dv/dt), Discharges less than 1C usually have a similar rate. Then 1C has a slightly different rate, and anything above 1C (2C - 3C) has a third, but fairly similar, rate. The dv/dt changes dramatically near the knee. Can you exploit this? Maybe coupled with battery voltage?
>Most discharge curves I've seen have a fairly constant voltage-decay >rate (dv/dt), Discharges less than 1C usually have a similar rate. >Then 1C has a slightly different rate, and anything above 1C (2C - 3C) >has a third, but fairly similar, rate. The dv/dt changes dramatically >near the knee. Can you exploit this? Maybe coupled with battery >voltage?
The maximum application current consumption is 500mA, what is 1/4 of battery capacity (2000mAh). But the consumption varies from 0.1A to 0.5A. from that picture: http://www.edn.com/photo/288/288434-Battery_stack_monitor_IC_s_scrutinize_the_cells_figure_a.gif it can be very hard to obtain the information about capacity/time left from Voltage measurement. I do not have hardware to measure the current from battery (at this version of hardware). I will try to do the best (in software) to not be pressed to implement current measurement.
On Feb 14, 2:11&#4294967295;pm, "Afinko" <afinko@n_o_s_p_a_m.gmail.com> wrote:
> Hi, > > I have own hardware with Analog Devices DSP and STM32 CORTEX-M3. > It is powered from battery and it has graphical OLED display. > I am wondering how to add "battery icon" on display. > I can measure the battery voltage by ADC. It is 4.1V LI-On battery > 2000mAh. > > As you can see here:http://www.candlepowerforums.com/vb/showthread.php?s=47c0cb73aa368639... > the voltage of battery is not linear with the actual battery capacity (what > capacity still left). Moreover, the battery is very depending on actual > battery current load. > > Any ideas how to program the software that can show the classical "battery > icon" that can be seen on all mobile phones? Some software flow diagram, or > even ideas would be great... > > Thanks in advance. > Afi
The software solution is not going to work very well. A fuel guage using a Coulomb Counter is preferred. John
Batteries lose capacity with time, so even a coulomb counter eventually fails. As long as one can work and there is a known constant drain, a timer works as well.

Jerry
-- 
Engineering is the art of making what you want from things you can get.
On 02/16/2011 10:55 AM, Jerry Avins wrote:
> Batteries lose capacity with time, so even a coulomb counter eventually fails. As long as one can work and there is a known constant drain, a timer works as well.
I know that both of my laptops (an Acer running Ubuntu, and a Dell running Windows) recalibrated themselves whenever the battery ran low enough that they could see what was going from the battery voltage. The Dell, in fact, both warned me that the battery was toast when it got down to 30% of rated capacity, and told me that it couldn't tell me how much charge there was until a full cycle or two when I replaced the battery. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
I think I can see how to do most of that with a running-time accumulator, a way to read the battery voltage, and some non-volatile memory. The major difficulty will arise with partial recharge.

Jerry
-- 
Engineering is the art of making what you want from things you can get.