Estimating the state of charge of a battery in a DIY bicycle light - Page 1
Forum section: electronics / beginners

author: e100
author_rank: Frequent Contributor
timestamp: October 13, 2023, 03:47:22 pm
content: A web search says that getting accurate results is complicated. In addition I've made it harder for myself by choosing a LiFePO4 battery for the design.Do you think coulomb counting, combined with voltage and temperature measurements would allow me to calculate a SOC to within 10% or thereabouts?If achievable this would be significantly more accurate than most bike lights.

author: BeBuLamar
author_rank: Super Contributor
timestamp: October 13, 2023, 05:53:33 pm
content: How you count coloumb? and integral of current x time?

author: e100
author_rank: Frequent Contributor
timestamp: October 14, 2023, 03:32:02 am
content: Quote from: BeBuLamar on October 13, 2023, 05:53:33 pmYes.

author: Terry Bites
author_rank: Super Contributor
timestamp: October 14, 2023, 08:05:17 am
content: Yes its a simple integration but hard to implement without a dedicated ic.Loads of LTC4150 modules out there for a couple of quid. See Aliexpress.This may add a silly amount of complexity and expense to a bicycle light.It does beg the equestion of how you're going to power it.You'd need a separate battery or micropower DC/DC conveter to suck out a few volts from a flat battery.The battery discharge curve can be used to estimate the state of charge- 10% is pushing it though.Trywww.jackery.com/blogs/knowledge/ultimate-guide-to-lifepo4-voltage-chart. Check the data sheet for your battery type.You current draw is fairly predictable I guess. So a simple digital meter module would do. Its not hard to set the scale and offset of these things.

author: BILLPOD
author_rank: Frequent Contributor
timestamp: October 14, 2023, 01:16:33 pm
content: This B6 charges and discharges and displays much information, which includes mAH.https://www.amazon.com/Hobby-Fans-Professional-Balance-Discharger/dp/B09XC91BWJ/ref=sr_1_11_sspa?keywords=iMAX+B6+Charger&qid=1697289155&sr=8-11-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9tdGY&psc=1

author: Dan123456
author_rank: Regular Contributor
timestamp: October 14, 2023, 02:06:15 pm
content: I’m not sure if this helps at all but remembered this old video from Great Scott!I imagine there is probably something similar to this in an SMD package out there if you prefer

author: e100
author_rank: Frequent Contributor
timestamp: October 14, 2023, 03:06:04 pm
content: Quote from: BILLPOD on October 14, 2023, 01:16:33 pmThe idea is that the SOC measurement will be done while light is being used.The goal is to display the minutes remaining at the current brightness level.

author: Siwastaja
author_rank: Super Contributor
timestamp: October 14, 2023, 03:09:43 pm
content: Coulomb counting (charge integration) gives good results if you give it enough reset points. It totally falls apart in some use patterns, such as people never fully charging the battery (which is otherwise a sane way to use a li-ion battery).

author: e100
author_rank: Frequent Contributor
timestamp: October 14, 2023, 03:28:15 pm
content: Quote from: Dan123456 on October 14, 2023, 02:06:15 pmI'm using a LiFePO4 cell instead of a LiPO cell. I could see voltage measurements being useful for the beginning and end of the voltage curve, but a LiFePO4 cell only changes by by a few millivolts during the almost flat middle portion, which is why I looked at coulomb counting as a way of filling in missing information.

author: Nusa
author_rank: Super Contributor
timestamp: October 14, 2023, 07:48:52 pm
content: Millivolts can still be measured. Once you know how a battery behaves, it may be a valid indicator of charge state. Either by itself, or as a sanity check on other methods.

author: amyk
author_rank: Super Contributor
timestamp: October 15, 2023, 07:35:24 am
content: Richtek has a series of interesting lithium-ion fuel gauges that don't require coulomb counting. Look at RT9428 for example.

author: Siwastaja
author_rank: Super Contributor
timestamp: October 15, 2023, 08:39:16 am
content: Quote from: Nusa on October 14, 2023, 07:48:52 pmThe problem is the voltage varying as a function of load current. You sure can add current measurement and compensate for the internal resistance, which then is a function of temperature, so then you can measure temperature and compensate for it, and then the internal resistance varies with aging, so you can try to auto adjust. Algorithms that are accurate get very complex, and simple algorithms are not accurate.And once you have added current measurement, you can simply add coulomb counting, which is really fineifyou can guarantee it enough regular reset points. If you can't, then you can't avoid using a complex algorithm.Battery chemistries that have steeper SoC vs. voltage curves do not completely avoid these issues but are much easier to deal with, especially if the load currents are not ridiculously high; with usual NCA/NCM/LMO/LCO chemistries (where the difference in open-circuit voltage between full and empty is around 0.8V, not 0.2V like on LFP), one easily gets some +/-10% SoC indication with voltage measurement alone, using a calibrated curve, even ignoring load current variation completely (assuming some typical current and maybe simply temporally averaging the voltage reading over a minute).

author: e100
author_rank: Frequent Contributor
timestamp: October 15, 2023, 10:57:13 am
content: Quote from: amyk on October 15, 2023, 07:35:24 amMy application is using a LiFePO4 battery which has different characteristics compared to a Li-ion (or LiPo) battery.