More Vatrer LiFePO4 BMS problems
Last year I documented problems with the Bluetooth interface to the Vatrer LiFePO4 battery management system (BMS). This year I almost lost the unattended telemetry system to a more insidious problem with their BMS.
If you draw small amounts of current the BMS does not accurately account for it in the State of Charge (SOC). This can let you have a battery which reports of 95% SOC but is in fact nearly depleted and its voltage has dropped below 12v.
On the BMS Battery Voltage graph you can see around 12/2 the batteries in my 4 battery 24v bank collapsing while still merrily reporting 95% SOC. Eventually the "042" battery hits some limit under 12v and decides it is actually empty and changes its SOC to 0%.
Following you see a little sunlight hit a solar panel, then me remotely flip some relays to start the 48v bank's generator and start a ~400 watt DC/DC transfer unit between the 48v bank and the 24v bank. Disaster averted.
But how did we get here?
Those batteries might discharge at 300 amps (for a few seconds), so when you feed an analog to digital converter it needs to go up to at least 300. Let's say we have an 8 bit converter, that means each step in our 8 bit current number is 1.17 amps. If we are running less than 1.17 amps through then we are going to get a 0 and it won't look like we are discharging at all.
So if the BMS tracks SOC by integrating current in and out it will be oblivious to low current discharges.
I'm not sure which Jiabaida BMS unit they are using, and thus not sure which battery management IC they are using, or how it works. But it is blind to light loads.
So How Could This Be Fixed?
A more sensitive analog to digital conversion process would help. Being able to sense any load big enough to have a material effect on the SOC would help. But there is an interesting way to cope with a low resolution ADC.
If you add about 1 bit of random noise to your analog signal, then sometimes those 0/256 readings will turn in to 1/256 readings. The probability of getting a 1/256 instead of a 0/256 is proportional to the how close the analog signal was to actually being a 1. Your integration just works. You need to take the 1/2 (on average) out in your integration accumulator, so make sure it has finer resolution than your ADC.
A Random Analog Noise Source Sounds Like Money
Sure, you could make one for $0.15 of components on the board, but you can also be tricky. You probably have an extra output pin on your microcontroller. Connect it to the analog input through a resistor. Your analog input pin has some amount of capacitance hanging on it (from your lowpass filter, you did put in a low pass filter, right? Or at least something parasitic.) So flick that pin on for brief intervals randomly, or for a random interval some time before sampling. Size your resistor so your pin contributes 0/256 to 1/256 on your ADC input.
There you go. One extra surface mount resistor on your board and you are no longer going to destroy your customer's battery bank when it has to run unattended with small loads.
But What Else Is Wrong?
Any kind of integrating SOC system is going to get out of whack. Those batteries don't give back all that comes in and maybe you have a tiny bias in measuring positive and negative currents so it is always going to drift. You can see these batteries coping by snapping to 100% when they look at their voltage and current and figure they must be full. Likewise you can see the snap to 0% from 95% in my graph for an empty.
Surely we can do better? For days that battery could have known it was mostly depleted. It was looking <13 volts at negligible discharge. That can't be 95% charged. The battery chemistry to SOC is complicated depending on voltage, current, and temperature. But also on the recent history of the voltage and current. But its just modeling and data. If the integrated SOC is persistently off from the model by a significant margin, then it is reasonable to adjust the integrated SOC to something at least plausible.
Developing that model is left as an exercise for the reader. In this case me. I'm going to have to build that model in to my power controller system because I sure can't depend on the one in the battery.
There will be updates to jimstudt/power4: Power controller for ESP32 relay controllers. next Spring when the site becomes available again. Until then I'll cope by monitoring the banks and manually authorizing power generation and transfers.