my first big project - BMS - is it possible?

Hi all,

You can scroll to the Essence if you want.

Short "me" story:
I'm a newly registered member, in a "trying to figure out arduino" status, being baffled about the possibilities.
My business is computers and Arduino seems a good way to break out of "the box".
I learned about "some" basics in electronics (I understand things like voltage, current, resistors, diodes, transistors, but that's about it)
and about Java programming (a long time ago, so the Arduino environment looks just a bit familiar).
I essentially discovered and received an Arduino board a few weeks ago, and took some time to read the basics on the Arduino website (and successfully practiced some examples mostly by copying and adapting existing code).
I still have to discover a lot of the possibilities.

I also happen to posess an EV (a 2008 150V Nimh Vectrix (, but older model); now with about 12000kms on it.) . This fact triggered my curiosity about battery technology, so I started to get into the matter (ie a lot of forum reading).
It seems my beloved vehicle has no battery management system, and one battery pack after another gets destroyed by unbalanced cells (mine survives still, but certainly won't last forever either).
The separate cells with a lower SOC (state of charge) tend to get "reversed charged" and die when the pack is drained beyond a certain point.
(there are other issues like temperature and systematic overcharging, but that aside)
The only system used for balancing is so called top-balancing, where systematic overcharging the whole pack should pull up the lower SOC cells.


Picture an Electric Vehicle with 102 Nimh cells @ 1,4V (when fully charged) and no "battery management system (BMS)"
I want to avoid that the cells get out of balance with each other.
My first thought was to connect all separate cells to an Arduino (with som I/O extenders?), measure the voltages, compare them and act upon differences. (ie. warn me or something)

I'm afraid that Arduino has a too limited number of Analog inputs to realise that.
So maybe I'll just have to compare groups of cells instead. (accuracy will go down)

I know this is vague, but I prefer to check the main story first. then go on with some details.
I also realize that this may be to big for me as a beginner, but I'm not scared to learn, and I'm not in a hurry.

Am I in any good direction?? Can such a thing be done, and how?

Any help or better ideas are welcome.



I'm no expert, but as faar as I know, theres ways of getting more digital and analog inputs, by buying certain chips. I've not gotten to the input part yet, but I will.
Right now I'm working on using several outputs. I figured out how to link shift registers and thereby use 3 digital ports to run 320+ outputs on 3 digital ports.

Your idea should be possible. Though I'm wondering what kind of output system you're thinking of having?
I recommend either LCD, or 7 segment displays.

I haven't gotten into LCD's yet, and i believe they're harder to set up and program.
7 segment, 4 digit displays are easier to manage then I thought. Just don't get stuck in the thought that
"I don't get the different digits to show different values".

If you just want a graph output, there's the led bars. Though, you'd probably need lots of outputs for these as well.

I already managed to control such a display. I pulled it from an old decoder, and got it to work with multiplexing. ( again by adapting existing code)
So yes I was planning to use it to show me what cell is failing and Soc data

There are special chips, design to do such things, like monitoring individual cell in the battery string, equalization, balancing. Arduino could be in this case a log/monitor Manager . :slight_smile:
I'm not an expert in this area, but you can dig in web-sites maxim and I think, TI. Look through their application notes, sometimes it's really helpful for quick-learning.

There's no practical limit to the number of analogue inputs you can have if you add some external hardware.

However I assume these cells are wired in series? If so you have problems with measuring very high voltages and that probably means isolating the inputs which starts to get complicated.


Or set the arduino up as a floating meter and measure across each individually.
We had a huge thread going on this in the old forum.
My suggestion was a series of relays for 100% isolation, arduino ground becomes - of battery being measured, Analog-in connects to battery+ (which is battery- of next in line, but so what?) Work it just like a multimeter with a relay multiplexer in front of it.

Yep I remember that thread, what a marathon.

I think the relay idea works as long as the Arduino is floating and not sitting on the battery bank GND. This probably means an isolated PSU for the Arduino.

Can turok afford 104 relays :slight_smile:


Sure, he's been saving on gas money for 3+ years, driving around on inexpensive electricity :D, or something like that 8)

I don't know what this page says, I think selected Nederlands for language.
Can search for similar - 5V, 250ohm coil (20mA to turn on), 30V, 1A.
Maybe look around for similar spec part but at lower cost.
Need a relay per battery.
NO side of relay connects to battery. Call that pins 4 to B+s & 7 to B-s.

Then all pin 3s get connected together and go to Analog in.
All pin 8s get connected together and to arduino Gnd.

Then the multplex circuitry turns on 1 relay at a time, connecting B+ and B- to Analog In & Gnd.
Make the measurement, turn off the relay, on to the next device.

I think it would be very important to use proper hardware decoder chips (74xx138/74xx154 style) so there is absolutely no chance that two relays can be turned on at the same time.

This would need 8 154s enabled by a single 138.


Yes, for sure you only want 1 enabled at a time. but with more current capability, or more efficient relays.

Perhaps, 64mA sink capability.

ok! thanks for all the replies, greatly appreciated!

I don't fully understand everything, but it seems like you all agree that a method of multiplexing is the best solution.
seems like a good idea to me.
Let's see if I understand this:

Instead of reading all cells at the same time, I would connect every cell briefly to the Arduino by switching 102 relays with a separate IC?

something like this?

@ Greynomad, I don't mind buying a lot of relays (they're cheap enough), but I don't have a LOT of space in the Vectrix. Worries for later though..
@ CrossRoads, indeed :slight_smile:
@ Magician, I know there are ready-available BMS systems, but this one, I'd like to learn and understand instead..

If I’ve got this correctly you will have to switch both the analogue input and the GND. Note how your drawing has GND going to one battery, what happens for the others? So you need double-pole relays.

Also the Arduino has to be powered from a power supply that is isolated from these batteries.

Another thing to think of is when do you read these voltages. If you are going to compare readings against each other or indeed any other data you have to have a known and constant load. Meaning that I think you can’t really take a reading while driving as the load will vary a lot I would think.



Good point

If the cells are being read out in a short amount of time (a few milliseconds) there shouldn't be a problem I guess.
If the BMS gives me a warning while I'm accelerating or braking (regenerating) I could guess there might be another reason than actual imbalance.
I guess It would be quite reliable when cruising at a more or less fixed speed (even at top speed = limited to 110kph).
I can also choose/adapt the tolerance for the difference between voltages.
I could also program the arduino to give a secondary alarm if the voltage of one cell drops below a safe point.

An external power supply shouldn't be a problem (I also have a 12V circuit in the Vectrix).
I'd make the circuit so I can put it on when I want (not all the time)

This is the system I was discussing.
The MAX6921 might be used, or the other demux chips discussed above.
Note how each battery is connected to nothing until a relay is closed.
A change is needed in the the Gnd for the battery WOULD NOT the GND for the Arduino, demux, & relay coils.
The two would be isolated so that the measuring electronics only connect to the battery under measurement +/- terminals.

I'm reluctant to be negative towards the relay idea because I don't have a better one to replace it, but how much room is 102 relays going to take up? I mean if it was a car, then yeah just stick it in the boot, but it's a scooter, and there isn't much storage room on a bike...

Scooter?!? What the ... Okay, I never opened that link, thought we talking a car.
Anyway, whole thing could fit on three 80mmx80mm PCBs, so not too big.

In a link, I posted above, data sheet for MAX11068. I didn’t look myself earlier, 82 pages…, yet now I get curious and open it. It took a moment to find out on page 10 all analog front end in full details, plus a lot of useful information.
Instead of electromechanical relay - MOSFET multiplexer. The same company produce a chips, high voltage mux, MAX378/379.
It’s not 150V, but could be other producers/manufacturers. Or just one ! electromechanical relay to switch a half battery.

It never hurt to study/research first what is already exist on a market, instead of inventing a bike. :slight_smile:

A Mux doesn't give you the detailed voltage needed for ech battery.
You need contacts across each battery with ground isolated from the string of battery ground so that the arduino 5V input limit is not exceeded.

Yes, I understand.
There is quote :

The MAX378 8-channel single-ended (1-of-8) multiplexer
and the MAX379 4-channel differential (2-of-8) multiplexer

Looks like this "differential" is a key, one channel - input, another - commutate a ground. It's all shown on page 10.
Exactly like you try to design it.
And I just dig up one create on their web site: MAX4800, 8x - 200V switch.

I had some reading to do to understand what you guys are talking about :slight_smile:

Crossroads; I understand your scematic, and it makes sense to me.

From what I understand from the rest, I derive that the other chips wouldn't need the relays, because they switch like a transistor (or Mosfet?). correct?

The part I don't understand, is the high voltage issue; I thought, though they are in series, if every cell is connected (with both poles) separately (like measuring them one after another with a voltmeter) the maximum voltage involved should be 1,4 V -or- the voltage of one cell?
Or am I wrong when I assume that? Or missing something?

sorry if my questions seem stupid.. I'm learing a lot here.