Can I measure LiPo voltage with an analog multiplexer?

Hi, I'm making my first DIY electric longboard! Right now a Focbox Unity+ ESC is the main brains of it and I'm using an off-the-shelf PWM remote/receiver, but eventually I'll get Arduino involved for a number of reasons. One of the first things I want to do is monitor the voltage of individual cells, since I'm not using a BMS and had to set the Focbox's minimum cutoff voltage rather high (~3.6) to avoid unbalanced cells dropping below 3.3V (which I found out the hard way will indeed happen...) I'm using a 12S supply (2 x 6S in series) so there are a lot of cells to keep track of.

My thinking is... the 3.3-4.2V range is perfectly within the 0-5V range of the analog pins, so in theory I could plug each of the 12 balance cables into an input on a CD74HC4067 analog multiplexer, and have the Arduino read them one at a time (fast refresh rate is not critical, maybe 100ms or so between cells would be ok?)

Also, by doing that, when the Arduino is powered off and the multiplexer isn't letting any of the inputs through, the battery shouldn't leak any current, right? So theoretically I could leave it plugged in and powered off, and not need to worry about it draining overnight (at least no more than leaving it plugged into the ESC with a soft power button)?

Just want to make sure this all checks out in case I'm about to do something stupid!

Could You make schematics showing the setup where You want to do this measuring?
Circuits are best described by drawings, not words.

There are plenty of topics about measuring the power supplying batteries.....

1 Like

The CD74HC4067 connects to the incoming signals with common ground.
Cannot see how you could apply this to a "balance plug".
Awaiting your proposed circuit diagram also.

No, true the middle cells are 3.3 to 4.2, but not with respect to ground, only across the terminals of the cells.

So no matter how you route them, the middle cell voltages will need to go through a voltage divider each to bring them into the range of the analog input.

a7

Ok fresh out of Fritzing here is roughly the circuit I had in my head:

Does the above circuit still need a voltage divider? If so how would that look?

The analogue multiplexer can only switch voltages up to it's own supply (⩽ 5volt).
And you're shoveling 6*4.2= 25.2volt into it's inputs.
See the problem?
Leo..

1 Like

Plus, originally you mention running the 2 x 6 cells in series, (double that of above ) so your connection diagram would be incorrect ( 2 x grounds connected together)

No, it's 6s2p, which means two 6 cell batteries in parallel, so nominal voltage is 3.7 * 6 = 22.2 volts and the capacity is double the individual battery.

In some packs, the cells are connected straight across at each point in the stack. I still get a bit uneasy at cells wired in parallel, but it is common practice, as is placing batteries in parallel during charging.

Obligatory statement: don't do anything like this unless you are very sure you know what you are doing. These batteries are amazing and will release enormous energy in short periods of time variously. Which can sometimes def not be what you want.

a7

1 Like

NOT what the op said.........

1 Like

Also have a look at some other experiences on this forum of assembling home made battery management circuits e.g. I keep destroying my ADS1115 units, please help! [ SOLVED ]

is equal to

No, you are right, which moves the thing from dumb to dangerous!

I'm still to use anything beyond 11.1 3s batteries, fear is a factor.

a7

Thanks guys, a few clarifications:

  1. I have two big LiPo batteries, each 6S, and their main leads are connected in SERIES for a total of ~50V to the ESC.
  2. I am well aware of the dangers that come with working on stuff like this, hence I'm trying to get all my theory straight before testing anything. These things are 5.0Ah and 40C each, so in total (series) I could potentially get insane spikes of 5*40=200A, *50V=10kW :sweat_smile: Definitely not taking chances and being extremely cautious with any new things I try, with proper safety precautions including a fire extinguisher at arm's length.
  3. I was advised on E-Skate forums to NOT use a BMS, not for electrical safety but for physical safety. Reason being, if the BMS decides to cut power for any reason, I no longer have brakes, which could mean hurtling into a wall at 20mph or worse. That's why I want to do this with Arduino in the first place; I'd like a means of accurately MONITORING (or even logging) the cell voltages without taking automated action when it thinks they're too low. Ideally I'd like to send this data to a custom app on my phone along with other telemetry like temperatures, gyro data, etc.

I'm still a bit confused as to why I'd need a voltage divider... I haven't read very far into it but my understanding of the HC4067 is that it acts like a bunch of gates, only letting current through the input matching the incoming address pins. Wouldn't that mean it's handling no more than 4.2V at a time, even though there's more hooked up to it?

This kind of makes sense, but I'm not sure how to fix it. Would only one ground be connected? Would I run one ground into the first cell of the other battery? Neither of those seem right either... Keep in mind my end goal is still to only be reading one individual cell at a time; are you sure the balance cable grounds shouldn't both go directly to Arduino's ground? The mains are in series but connected to the ESC, not Arduino directly.

I took a glance at the linked topic, and seems like that might be on the right track... I chose the HC4067 because I have a few on hand, but would you recommend going for the ADS1115 instead? Is there an advantage other than higher resolution?

No.

In your diagram, remove the multiplexer and all the wires.

Now imagine you selected channel 8, this would be like placing a wire between cells 8 and 9 and putting it on the analog input.

That, I hope you see, would put more than 5 volts on the analog input.

The multiplexer just acts like a big rotary switch. And we haven't even pointed out that the mux is probably not rated for voltages beyond its supply voltage.

The ADS1115 is not a multiplexer, I don't see what you mean by swapping the use of one for the other.

You could use 3 of them and have 12 independent ADC channels, and feed each one from a tap on the battery but you'd have to cut the levels each down to size with a… wait for it… voltage divider.

Google voltage divider. If you are trying to measure voltages like 45 volts that is what you will need to use. We aren't making this stuff up.

a7

I have done something similar to measure the voltage on eight, series connected, 6 volt AGM batteries. I used an optocoupler for each battery "channel" and an 1-of-8 analog MUX.

In that application, I needed to measure the gain of the eight optos and provide a way to calibrate each battery channel in the "sketch" Optos, even of the same type and date-code, vary with respect to current transfer ratio (gain), and so you need to know that at least approximately and then provide calibrations constants for each channel in the "sketch".

If you take some care, you can get better than +/-1% accuracy for each channel.

I fuse each channel with a PICO fuse right at the battery clip so that wires are protected.

1 Like

Ohhhhhh ok first of all I totally forgot how balance ports actually work; I'm used to measuring the voltages with my little 6S LiPo LED voltage meter, which automatically converts the values to readable voltages on each cell, but in reality each successive cell would have the voltages of everything else between it and ground stacked on top of it. NOW I see why a divider is necessary!

Ok cool, I at least had that right.

Wawa did mention that earlier, and I had assumed that to be true already, I just wasn't seeing how there was actually that much voltage going into it (which as I mentioned was my misunderstanding of the balance cable).

I just mention that because it's what was used in the other thread; I wasn't sure if using an external ADC had any critical advantage over using Arduino's built-in ADC in this application. Makes sense that each input would need to be divided; but sounds like if I'm doing that anyway I may as well use the mux I have on hand.

Yep, I was planning to do something like that. Fortunately once the voltage dividers are in place I think I can be more relaxed and use trial-and-error for that part without much worry, since it's just adjusting what it does with the data.

Probably a good idea; I should look into that.

I'll look into how to apply the divider and post a new schematic when I think I've got something!

A "flying capacitor" circuit can be used to measure individual batteries in a stack.
They can come in IC or relay form.
Do a "flying capacitor" search on this site (lollypop on top if this page).

A Battery Management System can consist of several parts.

  1. an over-voltage protection circuit on each cell (charge protection).
  2. an over-current and/or under-voltage protection for each cell or for the whole pack.

Can't do without #1 if you don't want to set your house on fire.
Only #2 disconnect the battery, which could disable the electric brake.
Leo..

Interesting... At first glance it seems pretty complex so I'll look into that when I have more time.

I do have a proper "smart" balance charger which makes sure all cells are within 0.01V to a specified charge (I usually go to 4.18V), so assuming I don't start my run at the top of a giant hill on a full charge and brake the whole way down, I think that's ok. For the under-voltage/over-current protection, again that's why I'm getting Arduino involved - so I can have a PASSIVE protection system. It'll be able to alert me about those things without cutting power entirely.

The principle is easy.

  1. Connect a capacitor to a cell in the stack. It now has the same voltage as the cell.
  2. Fully disconnect the cap (two pins) from the cell and bring it to the Arduino to measure.
  3. Disconnect it from the Arduino and connect it to the next cell.

The cap is still charged, so it doesn't draw any power from subsequent cells.
This is not the case if you use a bunch of voltage dividers,
which also discharge cells in a pack unevenly.
Leo..

Good point. These are 5 AH batteries, and the voltage dividers needn't take much current at all, so I wonder if it is of much practical importance.

I like the flying capacitor, something to learn about.

Also, the calculation involving 40C… @Squirt_5432 please know that 40C is not a hard limit - if you were to place a good conductor across the terminals, the battery or cell might deliver more power than a simple calucultion might suggest while on its way to doing something exciting.

I see you are taking precautions and understand, excitement should only come from the joy of using whatever you are building, the good kind that is.

I have made mistakes without long term consequences but have tasted the potential.

It is good to charge to less than 4.2. At batteryuniversity.com is much info. I charge to 4.17 - there isn't really much between 4.1 and 4.2 watts-wise, and every 0.01 you leave off the top is better for the cells. I have lipos years old, friends go through theirs like popcorn.

Also at the other end, leaving some energy behind by cutting off at a relatively high voltage is also appreciated by you cells. I shoot for a recovery voltage of 3.7 volts, which for me means stopping when voltage under load is 3.1 - 3.4.

And obvsly staying well within the C rating whilst in use is good.

Last, not saying you don't know this, leave the cells at 3.7 - 3.8 volts for any period of non use. I balance my cells to 3.7 after use when they have cooled and fully recovered. If I'm lucky this usually means not doing anything at all.

Parallel charging was the hardest thing to accept the propriety of which. I don't hook cells > 0.01 volts different, which means 0.02 cause of digital meters.

Dispose of any dodgy cells, damaged, difficult to balance &.

I have repaired batteries, used "puffies" and rejuvenated cells, don't anymore… life too short, but I can understand wanting to with $$$ spendy batteries. I'm in the more money than the product of common sense and time phase of life, so.

a7