Author Topic: How to BETTER sense cell voltages - 6s - for a microcontroller?  (Read 1060 times)

0 Members and 1 Guest are viewing this topic.

Offline OddTopic starter

  • Regular Contributor
  • *
  • Posts: 51
  • Country: no
This is how I currently sense 6S cell voltages:

2326979-0

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 ?


 

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 6637
  • Country: ro
Re: How to BETTER sense cell voltages - 6s - for a microcontroller?
« Reply #1 on: August 01, 2024, 07:20:12 am »
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
« Last Edit: August 01, 2024, 07:37:12 am by RoGeorge »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19842
  • Country: gb
  • 0999
Re: How to BETTER sense cell voltages - 6s - for a microcontroller?
« Reply #2 on: August 01, 2024, 07:43:56 am »
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, say 1/6 but that would result in a loss of resolution.

Adding resistors to the inputs is another possibility.


« Last Edit: August 01, 2024, 01:21:32 pm by Zero999 »
 

Offline OddTopic starter

  • Regular Contributor
  • *
  • Posts: 51
  • Country: no
Re: How to BETTER sense cell voltages - 6s - for a microcontroller?
« Reply #3 on: August 01, 2024, 08:10:55 am »
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 LM324QT
AFAIK - 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...
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19842
  • Country: gb
  • 0999
Re: How to BETTER sense cell voltages - 6s - for a microcontroller?
« Reply #4 on: August 01, 2024, 08:35:15 am »
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 LM324QT
AFAIK - 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...
There'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 5 1/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.
 

Offline OddTopic starter

  • Regular Contributor
  • *
  • Posts: 51
  • Country: no
Re: How to BETTER sense cell voltages - 6s - for a microcontroller?
« Reply #5 on: August 01, 2024, 08:47:31 am »
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)
 

Offline Chalcogenide

  • Regular Contributor
  • *
  • Posts: 165
  • Country: it
Re: How to BETTER sense cell voltages - 6s - for a microcontroller?
« Reply #6 on: August 01, 2024, 11:26:35 am »
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.
 

Offline max_torque

  • Super Contributor
  • ***
  • Posts: 1322
  • Country: gb
    • bitdynamics
Re: How to BETTER sense cell voltages - 6s - for a microcontroller?
« Reply #7 on: August 01, 2024, 11:51:23 am »
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!
 

Online David Hess

  • Super Contributor
  • ***
  • Posts: 17073
  • Country: us
  • DavidH
Re: How to BETTER sense cell voltages - 6s - for a microcontroller?
« Reply #8 on: August 01, 2024, 01:59:32 pm »
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.

That 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.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6183
  • Country: es
Re: How to BETTER sense cell voltages - 6s - for a microcontroller?
« Reply #9 on: August 01, 2024, 04:31:48 pm »
A BMS IC will probably be:
1 - Cheaper
2 - More simple to interface through spi/i2c
« Last Edit: August 01, 2024, 07:12:06 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline max_torque

  • Super Contributor
  • ***
  • Posts: 1322
  • Country: gb
    • bitdynamics
Re: How to BETTER sense cell voltages - 6s - for a microcontroller?
« Reply #10 on: August 01, 2024, 07:06:13 pm »
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.

That 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.

Watch out for the charge injection as an analogue switch, er, switches!  Can be significant depending on the sample hold capacitor size!
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19842
  • Country: gb
  • 0999
Re: How to BETTER sense cell voltages - 6s - for a microcontroller?
« Reply #11 on: August 01, 2024, 09:07:53 pm »
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.
« Last Edit: August 01, 2024, 10:08:02 pm by Zero999 »
 

Online ArdWar

  • Frequent Contributor
  • **
  • Posts: 644
  • Country: sc
Re: How to BETTER sense cell voltages - 6s - for a microcontroller?
« Reply #12 on: August 02, 2024, 06:59:09 am »
Another idea, with fewer critical resistors (but now you need transistors lol ;D). You can also buffer the sense inputs like the previous ideas if you need the lower vampiric losses.

2327967-0

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 a lot.
 
The following users thanked this post: oPossum

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19842
  • Country: gb
  • 0999
Re: How to BETTER sense cell voltages - 6s - for a microcontroller?
« Reply #13 on: August 02, 2024, 10:11:02 am »
Another idea, with fewer critical resistors (but now you need transistors lol ;D). You can also buffer the sense inputs like the previous ideas if you need the lower vampiric losses.

(Attachment Link)

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 a lot.
The 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.
 

Online David Hess

  • Super Contributor
  • ***
  • Posts: 17073
  • Country: us
  • DavidH
Re: How to BETTER sense cell voltages - 6s - for a microcontroller?
« Reply #14 on: August 02, 2024, 07:25:59 pm »
Watch out for the charge injection as an analogue switch, er, switches!  Can be significant depending on the sample hold capacitor size!

The sample capacitor may be quite large so charge injection should not be a problem.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf