SOC measurement for a Lithium-Ion battery system - Page 1
Forum section: electronics / projects

author: alanapar
author_rank: Newbie
timestamp: December 13, 2021, 09:09:46 pm
content: Sorry for the really long post, but thank you if you have the patience to read all this and comment!I have a small electronics project I will be working on. I’m a retired experimental physicist by training and did a lot of hobby-level electronic and more professional power electrical engineering stuff in the past, but have been almost completely out of the electronic loop for several decades (having grown up on vacuum tubes and transitioned to semiconductors!). So I will appreciate any help to bring me up to speed.I’m putting together a large lithium-ion battery and inverter-charger system for our boat. One thing I want to do is to attempt better SOC (state of charge) monitoring than I’ve encountered in commercial systems. (Note that with Lithium-Ion batteries, the voltage discharge curve is too flat for good SOC estimation from just the voltage.)For instance, on my previous boat, I used Mastervolt LFP batteries. These are nicely put together with an integral BMS and monitoring system, which connects to external monitoring and control with Mastervolt’s proprietary CAN Bus setup. The batteries have an internal shunt and internally integrate the current measurement to determine the charge removed from or added back into the battery. The flaw is that there is clearly too much offset (and offset variation) in the shunt measurement, so that when batteries are sitting for some days, the SOC reading soon departs significantly from reality and eventually becomes nonsensical (or as Elon would say, ludicrous). When you are cycling the batteries, the SOC monitor resets to 100% after it sees the batteries have had a full charge, but in shipboard operation, you often don’t do a full charge for various reasons, plus cycling up to 100% regularly is not ideal for cycle life, and doing it at high current challenges the active balancing in the BMS.Thus my basic need is to measure the battery current with as little zero error as possible. The current measurement would then be digitally integrated. In addition, the current measurement needs to be highly linear over a large dynamic range, so that if you say remove a given amount of charge slowly over some days (various small loads or parasitic drain) and replace it quickly (in say an hour or two, using the boat’s AC generators), the net change in charge should be accurately computed (the coulombic efficiency of LFP batteries is good, but small corrections could be made digitally for charge vs. discharge currents). At the same time, the final SOC value does not need to be particularly accurate – a few percent is good enough.There are then two parts to the project: (1) measure the current, and (2) process and integrate the current measurement.Re current measurement, the normal thing is to interpose a shunt. Commercial high current shunts with low temperature coefficients are expensive and introduce significant undesirable voltage drop (and also suffer from the resultant self-heating). Plus, I will have maybe 4 parallel strings of batteries, and I want to measure each string individually. Instead, I plan on utilizing the voltage drop in the negative (grounded side) battery cables which are sort of freebie shunts.Roughly speaking I expect each battery string to have about 400uOhm negative lead resistance. The peak current to be handled is about 300A per string (this amount would only happen on extreme load transients, like AC motor starting, but it’s important that no saturation occur ahead of the integrator). So we have a maximum voltage drop of about 120mV. If this “shunt” voltage can be measured with better than 1uV zero drift with temperature and time, then the SOC value will have less than 1.8Ah per month error (each battery string will have about 330Ah nominal capacity). This is probably better than the uncertainty in the self-discharge rate of the batteries (another thing to correct for!).There is however one difficulty with this idea, and that is the relatively large thermal variation of the resistivity of copper (about 0.4%/C). To correct for this, I plan to run a thin copper wire alongside and bundled with the current-carrying lead, and effectively measure the resistance of this wire to correct the current measurement. The self-heating of the battery cables should be modest (the maximum sustained current would cause less than 1W dissipation per foot of cable per string and ordinarily it will be much less). The main temperature variation will probably be due to changes in ambient temperature. Originally, I was thinking of having one such “temperature sensing” wire per battery string, but I think I can get away with just a single sense wire for all strings, as all the cables will run near each other.I’ve attached a hand sketch of the proposed design (sorry, betraying my age by not doing CAD). One thing not shown is that I would plan to lead all the sense wires to the “cable shunts” back along the cable to where the main ground junction occurs, to minimize magnetic pickup. Likewise, the temperature sensing wire would lead from the ground junction along the cable and then back again.Here are my questions:(1) What are the best op-amps to employ for the front end? Max4238? Other possibilities (more expensive, even)? Note that constant zero offset can be digitally corrected. The magnetically-latched contactors are normally closed, but can be opened on demand to achieve genuinely zero battery current for offset measurement. What matters is drift over time and with ambient temperature. Noise should not be critical with integration.(2) What ADC’s to employ? I think I probably need 20-bit, with the dynamic range involved.(3) How to filter the ADC input / operate the ADC so as not to have aliasing, etc. issues? Note that the inverter-chargers make a *ton* of AC current ripple on the DC side. In invert mode, the inverter "DC" current approximates a full-wave rectified sine wave, peak value pi/2 times the average DC value (filtered to some small extent by capacitors in the inverters). The fundamental component of this is then at twice line frequency, and we will have a main 60Hz inverter pair, plus a secondary 50Hz inverter running mostly lighter loads. Thus an integrating ADC will not necessarily null out line components unless it has a long integration interval which is a multiple of both 60 and 50Hz periods. To make matters worse, if we are running off a generator (60Hz), the inverters pass through the generator power, synchronize with it, and can augment the generator on peak loads. In this case they operate at the generator frequency which is mechanically governed and can range a good couple of Hz away from nominal. At the same time, the digital current output can have relatively slow response (maybe a time constant of a second), and the integration for the charge calculation will effectively filter everything, as long as there are not aliasing, etc. errors ahead of the integration.(4) What computer to employ? I’d like to do a Raspberry Pi project (I have not worked with one before). I’m wondering about interfacing 4x20bits ADC input, plus the ADC (maybe fewer bits) for the temperature compensating signal. Does this device have enough horsepower (depends on ADC sample rate, of course)? It would be nice if this device could also monitor the system DC voltage and maybe a few other parameters as well.

author: alanapar
author_rank: Newbie
timestamp: December 14, 2021, 03:36:34 am
content: So I'm going to try a Raspberry Pi 4 with a Waveshare hat (Onboard ADS1256, 8ch 24bit high-precision ADC (4ch differential input), 30ksps sampling rate. Onboard DAC8532, 2ch 16bit high-precision DAC).I wonder about how well this will perform in a noisy digital environment, but will try it out. The ADC can be set to reject either 50 or 60Hz and harmonics thereof, so setting it to 60Hz will at least partly deal with my signal filtering issues.NOTE: I later realized that Waveshare have another hat using the ADS1263, which hat lacks the DAC channels, but the ADC appears to have superior features, including a FIR filter designed to attenuate simultaneously both 50 and 60Hz components on the input. So I will try this as well.I would be very interested to hear if anyone has experience with these devices (the hats, or the ADC's they use).