How to BETTER sense cell voltages - 6s - for a microcontroller? - Page 1
Forum section: electronics / projects

author: Odd
author_rank: Regular Contributor
timestamp: August 01, 2024, 07:08:57 am
content: This is how I currently sense 6S cell voltages:Basically, get the difference using opamp - and feed it into AD pins.pros and cons:+fewer different components+little calibration in calibration data. (all dividers are spot on/equal, can convert to correct voltage using same multiplier)-opamp is powered by full battery voltage, more prone to user error.I would like to sense 6s using an opamp that works of 5v, (cheaper, more likely to find a 6x package)Who got a nice resistor solution for making a 5v opamp produce good output for 6S ?

author: RoGeorge
author_rank: Super Contributor
timestamp: August 01, 2024, 07:20:12 am
content: If your application allows it, the standard way is to use dedicated Battery Management ICs. They can usually do more than only voltage sensing, they can balance, charge, protect, measure instantaneous current and/or the energy put in/out, etc. depending on each IC. All these are measured with 14-18bits, and can be read at any time digitally, usually by SMB (System Management Bus, derived from I2C).They can be powered from the cells they supervise, and the digital levels can be 5V (or 3.3V with a level shifter - in practice works without dedicated level shifting). Being a relatively low speed I2C link, galvanic/optical isolation is possible if needed. A single IC can handle between 1-9 cells (or more), and can be sourced from various western or eastern manufacturers.Random example (first search result) for a 6s battery management IC:https://www.ti.com/product/BQ756506-Q1

author: Zero999
author_rank: Super Contributor
timestamp: August 01, 2024, 07:43:56 am
content: I've not seen six op-amps in one package. I would either use two quad or three dual packages, depending on the requirements for the PCB layout and cost.What's the maximum cell voltage? If it's 1.6V for NiMH, then you'll be fine with 5V op-amps as it is, because the common mode range is half the supply voltage.If it's lithium ion, then you op-amp needs a supply volage of at least 13V. I would keep the circuit as it is. You could use a lower gain, say1/6but that would result in a loss of resolution.Adding resistors to the inputs is another possibility.

author: Odd
author_rank: Regular Contributor
timestamp: August 01, 2024, 08:10:55 am
content: I did not use BMS IC's because I just need to monitor cells, those are not charged/maintained/balanced in the application.This is for 6 x Li-Po cells. (4.2v max) 25.2v total. This makes me use LM324QTAFAIK - the opamps needs to be driven by the full voltage, otherwise it will have trouble diffing the highest cells.I might really need to look for LM324 alternatives that are high voltage...

author: Zero999
author_rank: Super Contributor
timestamp: August 01, 2024, 08:35:15 am
content: Quote from: Odd on August 01, 2024, 08:10:55 amThere's no need for a higher voltage op-amp. The LM324 will work up to 32V. It will also not be damaged if the input voltage is higher than the supply.The cicuit I posted previously will work with 5V op-amps, because it sales the input voltages to the op-amps down by a factor of 51/3.The only reason to use a 5V op-amp is in case something goes wrong with the op-amp circuit and a higher voltage is sent the ADC pin of the microcontroller, but your circuit has a 56k resistor on the output which will limit the current through the ESD protection diodes inside the MCU to a safe level.

author: Odd
author_rank: Regular Contributor
timestamp: August 01, 2024, 08:47:31 am
content: yep, that's exactly why I used the 56k between opamp output and ADC in.I just hoped to use cheaper opamps, and at the same time run them of 5v, but I believe doing so will quickly end up with lots of strange-valued resistors, or odd scaling (making 4v on every cell result in for example 3.8..4.2 outputs based on how good resistor values I could find)

author: Chalcogenide
author_rank: Regular Contributor
timestamp: August 01, 2024, 11:26:35 am
content: A different approach might be to use high-voltage analog muxes to connect a capacitor to a cell, "store" the voltage on said floating capacitor, then disconnect said capacitor from the cell, finally connect the capacitor to ground and to the ADC of the MCU. You should be able to measure all voltages very accurately and avoid most of the quiescent current related to resistive dividers. The system could even double as a (very slow) cell balancing system, as it can effectively become a charge pump.

author: max_torque
author_rank: Super Contributor
timestamp: August 01, 2024, 11:51:23 am
content: The "Problem" with this ^^^ arrangement is that you are UNBALANCING your cells continuously! The upper cells have a higher potential to stack 0v, so there is more leakage current through those cells. Now if you have huge cells, and you use massive resistors (>1Meg) this can be minimised, but the setup you have their has significant leakage current, so if you have small Ah cells, you'll find you always have the top cell going flat first. This is REALLY important if you are using the cells for a device that has a long "on time" and a small current draw, ie you'll waste most of the energy in your cells!What you need to have is a circuit that is entirely powered off the full cell series stack, so equal current is pulled from all the cells, and then only pulls a TINY amount of current, evenly from each cell during measurement. This is not a trivially thing to sort out, it rapidly gets very very complex. Hence i'd suggest just using a COTS cell monitoring IC as previously suggested. Plenty to choose from these days, and whilst those chips might look expensive in low volumes (can be as much as $10 per IC or more!) when you add up the BOM cost, and dev time to make a home-brewed solution work, nah, it's just about never worth it!

author: David Hess
author_rank: Super Contributor
timestamp: August 01, 2024, 01:59:32 pm
content: Quote from: Chalcogenide on August 01, 2024, 11:26:35 amThat is what I was going to suggest. It also removes the divider and common mode errors, so calibration is much simpler. A low input bias current operational amplifier may be needed as a buffer, but could be a 5 volt device.Unfortunately the total cost might be higher.

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 01, 2024, 04:31:48 pm
content: A BMS IC will probably be:1 - Cheaper2 - More simple to interface through spi/i2c

author: max_torque
author_rank: Super Contributor
timestamp: August 01, 2024, 07:06:13 pm
content: Quote from: David Hess on August 01, 2024, 01:59:32 pmWatch out for the charge injection as an analogue switch, er, switches! Can be significant depending on the sample hold capacitor size!

author: Zero999
author_rank: Super Contributor
timestamp: August 01, 2024, 09:07:53 pm
content: Good point, regarding the cell balancing.I doubt you can get cheaper than the LM324.Just add buffers to the inputs of the differential amplifiers. The one on the highest voltage cell can be missed out, because the LM324's inputs need to be 2V below the power supply to work properly and the current through it will be supplied by all of the batteries. The differential amplifier can also probably omitted from the lowest battery, assuming the voltage drop on the negative line is negligible.

author: ArdWar
author_rank: Frequent Contributor
timestamp: August 02, 2024, 06:59:09 am
content: Another idea, with fewer critical resistors (but now you need transistors lol). You can also buffer the sense inputs like the previous ideas if you need the lower vampiric losses.However I do prefer using actual battery management ICs. Unless you're cost optimizing in mass production BQ76907 is only 2 buck a pop and it gives you alot.

author: Zero999
author_rank: Super Contributor
timestamp: August 02, 2024, 10:11:02 am
content: Quote from: ArdWar on August 02, 2024, 06:59:09 amThe advantage of that is it doesn't rely on resistor matching for good performance.That still has the problem of mismatching the cells because the current draw through each one of them differs.Buffering the inputs, as you've hinted at in your post would solve that.By the way, it's odd that when I open your schematic it appears a bit mangled. I suspect it's an issue with the font setting on your machine, since I get the same result both under Windoes and WINE.

author: David Hess
author_rank: Super Contributor
timestamp: August 02, 2024, 07:25:59 pm
content: Quote from: max_torque on August 01, 2024, 07:06:13 pmThe sample capacitor may be quite large so charge injection should not be a problem.