Mux for battery monitoring

I would like to set up a battery tester/monitor. It's for a 16 cell 48V Lifepo4 battery. I have been planning on doing it with an Arduino, and my current idea is two CD74HC4067 Mux boards alternately switching to each side of each cell, so one is only checking the voltage on one cell at a time (around 3V). As long as the 48v battery and the monitor don't share a ground, the high voltage won't be apparent at the Arduino (or the Muxes). The problem is that, although the Muxes are only connecting one lead through at a time, all 16 are connected to the Mux at a time, and I don't know if they'll "notice" the 48V across them.

I'd be really interested in hearing from some more experienced people?


Not experienced in BMS, but I think there are special ICs needed to do this.
Like this one.

Well, I know there are such things, and that's an interesting one, thanks for that. I was sort of thinking of a data logger that monitored/recorded the performance of the BMS as well as the battery itself. I can't tell if I could do that with that cell, and I can definitely tell it's a lot more than I'm capable of biting off to design a system based on that chip. Still, interesting.

I guess my question comes down to: are the inputs of a Mux sufficiently isolated that high voltages on the multi-side across different "branches" (um, I suppose you can tell how little I know about these by now) don't fry the chip...


AFAIK, the switch inputs/outputs of a 40xx have to be within the limits of the power supply (< 18volts).
You could try designing a circuit with stacked 40xx ICs (4051, 4052, 4053, 4066 etc.).
I once tried and failed.
Another idea I had was using small relays to transfer charge (a small cap) from cell level to ground level, and measure that.
Sample that not very often, and only during charge/discharge of the pack.
That small cap could also be used, after sampling, to add or remove charge to one cell for cell balancing

This comes up from time to time you should search for the long discussions it provokes.
Basically your idea will not work and will fry both the multiplexes and the arduino if you try it. The multiplexers offer no protection from the high voltages in the later cells and exceed the maximum voltage for the chip. Read the data sheet.

Mike, you have lived up to your name! Seriously though, thanks, I'll see if I can find those threads. Yeah, that's what I was beginning to suspect.

I suppose I could use a dvm chip that's capable of the total voltage of the battery, and a relay board that steps through the cell junctions, measure the voltage from ground and do the math...

Thanks for the warning.

Yes watch out for a relay design as if you get more than one relay energizing then the whole thing shorts out.

I was on my iPad for the previous answer so I could not look things up but this is one such thread:-

@ kc2u
In post #3 is was talking about a DPDT relay.
A small 1uF cap is connected via two normally closed contacts to one cell of the battery.
When the relay switches on, the negative of the cap is moved to ground, and the positive to the A/D input.
The voltage on the cap is measured, and the relay can be turned off again.
Each cell has it's own relay and sample cap.
The cells can be sampled in sequence.
AFAIK, the same is done in the specialised ICs.
The charge of a sampling cap is brought down to ground level, where it can be measured.

Your problem is, that integrated chips cannot stand higher voltages than 15-18 Volts. Maybe my solutions sounds very oldfashioned, but it will work and solve your problem.

Use 16 mini relays with 2 independant ON/OFF switches. Each one connects to the positive and negative side of a single battery. The output of all relays are shared. One side is connected to ground and the other side to an analog input of your arduino.

At any time only one relay will be active, so a shared output is no problem.

This way you will never see more than 3 Volts.

Use two 8-bit shift registers to control the 16 relays. Do not forget the flyback diodes.

The code would look like this:

Activate one relay at a time and measure the voltage. Make sure you have at least a 100ms delay when you switch between relays. The relays might not release the contact immediately. And you do not want to have any shortcuts.

Because of your high voltage of 48V i cannot think of an easy 100% electronic solution right now. However, there is probably also an elecronic solution. I simply doubt, that it will be easier to implement and use less parts.

I just saw, that Grumpy_Mike and wawa had the same idea. So they were first. I just responded to the basic answer without reading all the posts.
My design does not require capacitors.

The danger of connecting one cell at the time to the Arduino A/D your way is that you can't share grounds.
When you measure the "highest" cell, there might be a high/dangerous voltage between Arduino ground and battery ground.
Unless I understand it wrong.

Using sample capacitors is like using opto couplers.
There is never a physical connection between battery and Arduino.
Even if multiple relays are on.

Using relays and capacitors like proposed is sometimes called a "Flying Capacitor" measurement.


there might be a high/dangerous voltage between Arduino ground and battery ground.

Well if there is a "dangerous" voltage it's between battery positive and battery ground. So long as the Arduino par of the circuit is treated as part of the "high" voltage circuitry and build to the same standard then there's no danger at all.

hi wawa

in my design you do not have a common ground with the battery array.

the relay will switch the negative side of a single battery to the arduino ground and the positive side to the analog input. The ONLY common ground you will ever have is the negative side of a single battery and arduino.

that is why each relay must have two switches. one connects to one side of a single battery and the other one to the other side.

this is like using a voltmeter across the two poles of a single battery.

you have no shared ground with the battery array.

...the relay will switch the negative side of a single battery to the arduino ground and the positive side to the analog input.

I think you mean "the negative side of a single cell".
And that could be a problem.

Maybe the negative of the whole battery is grounded somewhere. e.g. the 200volt battery in an electric vehicle.
And you're sitting in the car, holding your Arduino, that is just sampling one of the highest cells :frowning:
A flying capacitor, as LarryD called it, never connects the battery to the arduino.
Imagine you holding a 1uF capacitor across one cell for a second.
Then remove it, and quickly measure it with a DMM.
You will see the cell voltage on your DMM.
One DPDT relay per cell can do that for you.

Yes what you described is viable and in fact is done to measure battery voltages in many many industrial UPS battery banks.
Obviously sampling of the cells too fast can drive you crazy. Click, click, click . . .

hi wawa

if you measure the voltage between the negative pole and the positive pole of a battery with a voltmeter that has just 2 contacts, there is NO other connection to ground.

And connecting your voltmeter directly or using relays to connect an Arduino which will be used as a Voltmeter (analog input) will NOT make a difference.

The only common ground in this design is battery GND and Arduino GND.

The GND of the complete battery array is NOT the common GND you will use for your measurement. No connection at all.

THe GND in this case is just the negative pole of the battery.

Please draw your circuit, using the 200volt electric car battery I mentioned.
Where the car battery negative is connected to the chassis.
And you're holding the Arduino while the highest cell in the stack is being sampled.
The cell potentials being 196volt and 200volt in respect to the car chassis.

i have never seen a 200 volts CAR battery.

and it would be quite complicated to measure the voltage between the cells that are inside.

And all my answers are not concerning any problems YOU might have
but ONLY and ONLY the first and primary question in this thread.

I consider this to be sort of a technical answer.

If you do not like my answer I would prefer that you send me a personal message.
I prefer to keep personal things OUT of the forum.

True, I think electric car batteries are usually a bit more. 300-400volt.

I was just pointing out a safety fact.
If you measure batteries in a stack, the stack's negative (or positive, or midpoint) and the Arduino ground could be shared.
OP mentioned a 16 cell 48V Lifepo4 battery. Shared ground could give fireworks.
The "flying capacitor" way avoids problems.

car batteries are 12 volts / sometimes 24 volts (trucks)

you talk about 200 volts and 300-400volts (your last post)

hmm? (a simple "hmm" instead of a comment)