pixelpop
Posts: 94
Joined: Mon Jan 22, 2018 8:15 am

Battery Level Indicator -- While Charging

Sun Oct 20, 2019 4:11 am

I've searched the forum and can't quite find an answer to this. I have a project that contains an RPi and a Lipo battery. The GPIO is occupied by an RGB LCD hat. I purchased a simple 4-segment battery level indicator to incorporate into the project. The indicator has two pinouts--battery + and -. It works well for reading the level of a battery plugged into it.

But I am curious about how it will function (or how I should incorporate it) in the system. Specifically, what will it read while the battery is charging from a 5V power supply? It would seem that if I ganged the wiring from the battery, the RPI and the 5V input, it will always indicate 100% while charging which would not be ideal. I need to know when the battery is fully charged without having to remove the 5V power supply. I haven't tested this, but can anyone shed any light on this conundrum?
Last edited by pixelpop on Sun Oct 20, 2019 11:04 am, edited 1 time in total.

drgeoff
Posts: 10111
Joined: Wed Jan 25, 2012 6:39 pm

Re: Battery Level Indicator -- While Charging

Sun Oct 20, 2019 9:09 am

pixelpop wrote:
Sun Oct 20, 2019 4:11 am
... if I ganged the wiring from the battery, the RPI and the 5V input ....
Surely a dc-dc converter is required between the LiPo and the 5 volt input of the RPi?

User avatar
davidcoton
Posts: 4434
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Battery Level Indicator -- While Charging

Sun Oct 20, 2019 10:28 am

The battery capacity of a LiPo battery cannot be measured simply by voltage. Firstly, you need to measure the actual battery voltage, not the 5V converter output. Secondly, the voltage remains roughly constant through most of the battery capacity, then drops rapidly as the battery runs out. AIUI most charge level indicators calculate from time and current used.
Signature retired

User avatar
TimG
Posts: 295
Joined: Tue Apr 03, 2012 12:15 am
Location: Switzerland

Re: Battery Level Indicator -- While Charging

Sun Oct 20, 2019 11:33 am

Most LiPo chargers have a charging status indicator. It won’t tell you what the charge level is, only when charging is complete.

The detection is done by voltage levels: as the cell approaches it’s maximum voltage the charging current is reduced and then stopped at around 4.2V.

More sophisticated chargers track the integrated current into and out-of the battery, but they also need to be matched to the precise characteristics of the battery. I don’t know of any hobbyist chargers which do this.

Look on Adafruit’s website for lots of detail on lipo chargers.

pixelpop
Posts: 94
Joined: Mon Jan 22, 2018 8:15 am

Re: Battery Level Indicator -- While Charging

Sun Oct 20, 2019 11:52 am

To help clarify, attached is a power distribution diagram. Note there are three modules--ops, power and charge, and that the ops and charge modules cannot be connected simultaneously. The way it works is this:

Scenario 1: If the ops module is connected, power flows from the battery to the boost converter to the Pi (blue arrows). The battery indicator is monitoring the output of the battery.

Scenario 2: If the ops module is disconnected and the charge module is connected, power flows from the external source thru the charge module to the battery (green arrows).

The question is: in scenario 2, how can the battery indicator show the progress of charging if it is connected to the output of the charge module?

The indicator should display an accurate battery level while the ops module is connected. But for the charge scenario, I'm sure I am missing either a wiring correction/addition or a switching module of some sort. Just wondering if anyone else had encountered this and how they solved it.
power_distribution.jpg
power_distribution.jpg (63.02 KiB) Viewed 1080 times

User avatar
davidcoton
Posts: 4434
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Battery Level Indicator -- While Charging

Sun Oct 20, 2019 4:27 pm

pixelpop wrote:
Sun Oct 20, 2019 11:52 am
The question is: in scenario 2, how can the battery indicator show the progress of charging if it is connected to the output of the charge module?
It can't. Read the two previous replies again. LiPo battery level indication requires a measurement of charge/discharge current and time, and a detailed knowledge of the battery characteristics. You cannot deduce anything (except full charge and empty) from the battery voltage alone.
Signature retired

pixelpop
Posts: 94
Joined: Mon Jan 22, 2018 8:15 am

Re: Battery Level Indicator -- While Charging

Sun Oct 20, 2019 5:34 pm

Well, I didn't pay a lot of money for it so I won't be too upset if it doesn't work. But there sure are a lot of them being sold without many negative (doesn't work) comments/reviews. The one that I got is the 4-segment type that has this spec:

Displays the battery power parameters:(N is the quantity of battery cells)
Battery voltage is more than NX3.3V (1 unit power will be bright)
Battery voltage is more than NX3.5V (2 unit power will be bright)
Battery voltage is more than NX3.7V (3 unit power will be bright)
Battery voltage is more than NX3.9V (4 unit power will be bright)

So I guess I'll just try it and see what happens.

hippy
Posts: 6552
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Battery Level Indicator -- While Charging

Mon Oct 21, 2019 1:15 pm

pixelpop wrote:
Sun Oct 20, 2019 4:11 am
The indicator has two pinouts--battery + and -. It works well for reading the level of a battery plugged into it.

It would seem that if I ganged the wiring from the battery, the RPI and the 5V input, it will always indicate 100% while charging which would not be ideal.
That is correct, the monitor will always read what's being put into the battery; 100%.

You would need to temporarily disconnect the charger from the battery to read the actual battery itself.

Added : Though that might not always be true if a less than 100% charged battery pulls the charging voltage down. That's the trick for monitoring SLA batteries but I have no idea about LiPo's. Probably depends on the LiPo charging circuit, where/how the battery is being monitored.

Whether battery voltage, or whatever is being read by the monitor, is any kind of useful or accurate information is a separate issue. If you are happy with your monitor that's good enough.

Here's a very simplified representation of how it could be done. The charge switch would be digitally controlled, and the monitor would only display when the charge switch was open or there was no charge voltage present -

Code: Select all

                 /
Charge >---.---o/  o----.----.---|>|---.---> V+
           |          __|__  |         |
           |           -.-   `---------|---> Vbat >-----.
           |            |              |           .----^----.
           `------------|--------|>|---'           | Monitor |
                        |                          `----.----'
    0V >----------------^------------------> 0V   >-----'

drgeoff
Posts: 10111
Joined: Wed Jan 25, 2012 6:39 pm

Re: Battery Level Indicator -- While Charging

Mon Oct 21, 2019 2:09 pm

hippy wrote:
Mon Oct 21, 2019 1:15 pm
pixelpop wrote:
Sun Oct 20, 2019 4:11 am
The indicator has two pinouts--battery + and -. It works well for reading the level of a battery plugged into it.

It would seem that if I ganged the wiring from the battery, the RPI and the 5V input, it will always indicate 100% while charging which would not be ideal.
That is correct, the monitor will always read what's being put into the battery; 100%.

You would need to temporarily disconnect the charger from the battery to read the actual battery itself.

Added : Though that might not always be true if a less than 100% charged battery pulls the charging voltage down. That's the trick for monitoring SLA batteries but I have no idea about LiPo's. Probably depends on the LiPo charging circuit, where/how the battery is being monitored.

Whether battery voltage, or whatever is being read by the monitor, is any kind of useful or accurate information is a separate issue. If you are happy with your monitor that's good enough.

Here's a very simplified representation of how it could be done. The charge switch would be digitally controlled, and the monitor would only display when the charge switch was open or there was no charge voltage present -

Code: Select all

                 /
Charge >---.---o/  o----.----.---|>|---.---> V+
           |          __|__  |         |
           |           -.-   `---------|---> Vbat >-----.
           |            |              |           .----^----.
           `------------|--------|>|---'           | Monitor |
                        |                          `----.----'
    0V >----------------^------------------> 0V   >-----'
The voltage of a LiPo (or Li-Ion) does increase as it is being charged. Put "lipo battery charging curve" into Google and select "Images".

PhatFil
Posts: 1481
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Battery Level Indicator -- While Charging

Mon Oct 21, 2019 2:33 pm

Voltage level is afaik a valid method of evaluating a lipo cells charge.
Battery charging involves applying a target voltage which will be higher than the undercharged battery voltage. during charging the battery voltage will rise to that of the charge voltage until it hits its peak at 4,2v iirc vor the usual lipo cell.

any voltage level meter applied during charging will display the charge voltage. so if you want to have an accurate indication of the battery state during the charge you will need to disconnect the charge power measure the battery voltage and then continue charging if applicable.

User avatar
clicky
Posts: 419
Joined: Thu Oct 25, 2012 7:34 am

Re: Battery Level Indicator -- While Charging

Mon Oct 21, 2019 3:17 pm

PhatFil wrote: Voltage level is afaik a valid method of evaluating a lipo cells charge.
Battery charging involves applying a target voltage which will be higher than the undercharged battery voltage. during charging the battery voltage will rise to that of the charge voltage until it hits its peak at 4,2v iirc vor the usual lipo cell.

any voltage level meter applied during charging will display the charge voltage. so if you want to have an accurate indication of the battery state during the charge you will need to disconnect the charge power measure the battery voltage and then continue charging if applicable.
Charging LiPo batteries has two stages: constant current and constant voltage.

In first stage, constant current (current is limited!) is applied allowing battery voltage to go from current state to 4.2V per cell. When battery voltage reaches 4.2V per cell, second stage is applied. In second stage voltage is kept constant while current is monitored. When current drops to, let's say 10mA, then battery is pronounced charged.

Now, if you have appropriate LiPo charger which has all of it already built in (and these days, they do), then monitoring battery voltage won't tell you if battery is charged or not. Monitoring current that is delivered to battery will give you far more!

pixelpop
Posts: 94
Joined: Mon Jan 22, 2018 8:15 am

Re: Battery Level Indicator -- While Charging

Mon Oct 21, 2019 3:30 pm

Thank you for the last couple of comments. Based on the first responses I received, I was feeling sort of like a dolt. 😞

The ones I picked up came from Amazon (https://smile.amazon.com/gp/product/B07 ... UTF8&psc=1) but I assume they are the same as most of these being sold. For instance, the same (apparent) one sold at Banggood (https://www.banggood.com/3_7V7_4V-11_1V ... rehouse=CN) has a bit more "design" information and states, "Specifically designed to monitor the power level of battery while charging or discharging."

It makes sense that momentarily disconnecting Vin from the charging circuit would allow the meter to get a reading on the battery voltage. I'll try both ways (with and without a switch) and report back. Thanks!

drgeoff
Posts: 10111
Joined: Wed Jan 25, 2012 6:39 pm

Re: Battery Level Indicator -- While Charging

Mon Oct 21, 2019 4:51 pm

1. At moderate charging current the voltage will be almost the same whether charging or off-load.

2. The voltage can give an indication of where in the charging cycle the cell is. It alone will not tell you how much charge is in the cell or how much charge it would deliver, ie how long it would operate something.

pixelpop
Posts: 94
Joined: Mon Jan 22, 2018 8:15 am

Re: Battery Level Indicator -- While Charging

Mon Oct 21, 2019 5:08 pm

drgeoff wrote:
Mon Oct 21, 2019 4:51 pm
The voltage can give an indication of where in the charging cycle the cell is. It alone will not tell you how much charge is in the cell or how much charge it would deliver, ie how long it would operate something.
Maybe that's where the first responses got confused. I know that a battery's run time depends on the load and the current it is drawing. I have already calculated that for this project. I have also calculated the charge time from discharged to 100%. I just need the indicator to tell me (or the user) where it is in the cycle. For instance, if I know that a 100% battery will run the project for 4 hours, then the indicator will give an estimate of time remaining. If it takes two hours to charge from dead to 100% and the indicator shows 50%, it will take approximately an hour to top it off.

It ain't rocket science. 🚀😉

My initial inquiry was just about measuring the battery level when charging.

Return to “General discussion”