Electric Car BMS Controller

This post is about a Battery Management System (BMS) Controller that I have designed, built and tested for the Lithium batteries in my Electric Car. I recently installed some SkyEnergy Lithium batteries in my EV. Lithium batteries are sensitive to overcharge and undercharge so some sort of Battery Management System (BMS) is required.

A BMS Controller (aka BMS Master Unit) disconnects the chargers when the batteries are full and warns you when they are empty. For a bit of fun I designed most of the logic using transistors and diodes rather than using a microcontroller or regular logic chips. It has been designed on fail-safe principles to best protect my expensive new Lithium battery pack.

The BMS controller works with BMS modules that sit on every cell. I use the CM090 BMS modules from EV Works. Here is a photo of 4 of the BMS modules installed on 4 cells:

The BMS modules are the red PCBs with the components in translucent plastic. Note the thin blue wire connecting each module. This wires snakes through every one of the 36 BMS modules and forms a “dead mans switch” normally closed loop. If any one of the modules detects an over volt (4.1V) or under volt (2.5V) condition it opens the loop. The BMS Controller then does something sensible with this open loop information. When charging this means stop charging. When driving this means stop driving. Otherwise you can kill your cells or in the worst case even start a fire.

Every cells is slightly different, so you need one BMS module per cell. The BMS modules also function as series regulators. As the cell reaches 3.6V during charging the BMS module starts bypassing some of the charge current. This helps bring all cells to a similar state of charge.

Re-cycling Lead Acid Chargers

Now most people installing Lithium batteries would go out and buy a commercial BMS controller and a suitable charger for their battery pack. However I made a promise to my long suffering, EV supporting (and EV-driving) wife that the entire Lead-acid to Lithium conversion would cost no more than $6,500, which was about the cost of the Lithium cells and CM090 BMS modules.

That meant I had to re-cycle the chargers I had laying around, which amounted to a 96V (8 by 12V) AGM charger and a bunch of 12V dual-stage Jaycar M-3612 chargers. Lead acid chargers usually charge to around 14.7V per 12V battery. So the AGM charger that is rated at 96V actually charges to around (96/12)(14.7) = 117.6V.

I ordered 36 Lithium cells which have a nominal voltage of 3.2V. After some reading and a few emails to the helpful EV-works guys I determined that the Lithium cells are just about fully charged at 3.6V. So we need a charger (or chargers) capable of a total of 36(3.6)=129.6V.

This just happens to break down nicely to the AGM charger (117.6V) plus one 12V charger. However each charger will charge at a different rate. So this means I need two BMS Controllers, one for the 32 cells connected to the AGM charger, and one for the 4 cells connected to the 12V charger. Each would have a separate loop of BMS cell modules to monitor.

BMS Controller Requirements

I came up with these requirements for the BMS Controller:

  1. During charging independent monitoring and cut off of the two BMS module loops.
  2. When driving sound a buzzer if we get a low voltage situation. This buzzer shouldn’t fire when charging. I like the idea of an annoying buzzer. My wife was quite good at “driving through” visual warnings of low batteries with my lead acid pack!
  3. When a BMS module loop opens charger power should be cut and stay cut. It shouldn’t start charging again if the cell voltage drops (which they do just after charging), as I don’t want the whole system cycling off and on all night.
  4. It should handle up to 100 ohms of loop resistance from the series connected CM090 BMS modules.
  5. It shouldn’t draw significant power from the car’s battery pack or 12V battery when not in use.

Analog versus Microcontroller

Many people have developed Lithium BMS systems. An obvious choice for each cell module is a little microcontroller that communicates with it’s peers using some sort of serial bus. Then as well as BMS functions you could report the voltage and temperature of each cell, and do all sorts of other magic. The EV Works guys have taken the KISS approach and used an analog design, which I guess is a bunch of voltage references and comparators plus a big transistor to dump the heat during series regulation. They argue that in the heavy duty EMI environment of an EV it’s too easy to crash a microcontroller and screw up digital communications. Software can also be a source of problems. Would be a bummer to set instead of reset a bit and burn down your garage from an overcharge fire.

I have experienced EMI problems in my EV – my microcontroller based voltmeter/ammeter instrumentation goes nuts when I accelerate and often resets itself while I drive.

However there are plenty of cases where microcontrollers have worked for years in high EMI environments. For example a petrol car’s fuel injection computer operates just fine while located a few inches away from a 10kV spark ignition system. So I think the analog idea has some merit and is likely to have less bugs and be easier to develop, although I wouldn’t rule out microcontrollers. Using analog instead of a microcontroller also has a kind of retro appeal.

So I decided to try using transistor and diode logic, and no microcontrollers. I almost got away with it, too.

State Machine

I like state machines, they are a relatively error-free way of designing complex logic. I use them widely in software and hardware projects. This project needs a simple state machine, but the implementation (using discretes) is complex. So before heating up the soldering iron it’s a good idea to have a very clear idea about the logic. This approach let me break down the circuit into clear logic blocks (flip flop, inverter, diode gates), each that was implemented as a separate chunk of hardware. Divide and conquer.

When power is applied we start charging (CHARGE State), and any break in the BMS module loop causes us to switch off the charger (OFF state). Once we have switched off we stay off, no matter what happens to the loop. Two states can be expressed with a 1 bit flip flop, which brings us to the schematic.

Schematic description

Here is the BMS controller schematic PDF. I also have the gschem files if anyone wants them.

There are two BMS Controllers, one for each loop. The BMS LOOP2 Controller at the bottom is the easiest to understand. Q6 and Q7 form a Set-Reset flip-flop. You pull the base of Q6 low to set the flip flop, and the base of Q7 is taken low to reset the flip flop. When power is applied, C6 sets the flip flop, putting it in the CHARGE state. Led D12 lights when the flip-flip is set (CHARGE state).

When the flip flop is set, the collector of Q7 is close to 0V. This pulls the base of Q9 low via D18 and R22, allowing current to flow through the relay that controls the AC power for the LOOP2 charger.

Note that the relay current flows through the BMS module loop. This is an extra layer of safety – even if the flip flop gets stuck on, if any of the BMS modules open the loop then charging will stop. The BMS modules can handle 100mA and the relays chosen use 70mA. A fuse in the BMS cell module loop is a good idea.

When the BMS module SLOOP2 opens R19 pulls the base of Q8 high which causes Q8 to switch on. The collector drops to near 0V and pulls the base of Q7 low via D13, resetting the discrete flip flop. The system is now in the OFF state and even if SLOOP2 closes again power to the relay and hence charging will be disabled.

D14 and D15 in the base circuit of Q8 make sure that Q8 stays off when nominal currents are flowing from the relay circuit through RLOOP2. For LOOP1 (32 BMS modules) RLOOP1 was measured at 20.5 Ohms, with 70mA flowing 1.4V is induced, enough to switch on Q8 if D14 and D15 weren’t present.

I built the first version using a piece of PCB with squares cut using a Dremel:

But this soon became unwieldy and I was concerned about shorts. So I rebuilt it using veroboard which was neater and I hope more reliable in the long term:

The left hand side controls the AGM charger, the right hand the 12V charger. Only one side would be needed for a single charger. The electronic parts total just a few $, the relays are probably the most expensive part.

This board was mounted in a plastic box with the relays, AC power sockets, terminal strips etc. Crimped automotive lug-type connectors connect the BMS Controller with the sense loops in the car, 12V ignition power, and car ground. These connectors can be removed in a few seconds so I can take the BMS Controller inside to mess with it. Until recently, this happened a lot!

Taming a too-smart AGM charger

The BMS LOOP1 controller is a little more complex. After trying the BMS controller I noticed the AGM charger would stop charging after about 90 minutes with a “battery error” warning. I think this is because of the different charge characteristics of Lithium batteries compared to lead acid. Lithium cells seem to charge very slowly between 3.3 and 3.4V until very near the end of the charge. For example a cell might remain at 3.34V for hours while it charges. The voltage of a lead acid pack moves more linearly as a the pack charges, unless the pack has dead cells in it. My AGM charger is “smart” and thought it had a lead-acid pack with dud cells. So it stopped charging and raised an alarm.

The AGM charger could be reset by power cycling it, so I included a timer to do just that. What I needed was an oscillator with an on time of 90 minutes and an off time of 30 seconds. I looked around for an analog design but chips like the NE555 are limited to a few 10’s of minutes due to analog effects like capacitor leakage. So I relaxed my analog-only approach and used a PIC microcontroller, here is the PIC source code.

In the BMS LOOP1 circuit D9, D10 and R12 form a two-input AND gate, ensuring the AGM charger (Charger 1) is only turned on when both the PIC timer output and flip flop are set. Diode AND gates effectively clamp the “low” voltage to 0.6V, so D8 ensures the base of Q4 is less than 0.6V keeping Q6 off.

BTW it is really, really important not to confuse the SLOOP1 and SLOOP2 wires when installing in the car – we don’t want the wrong charger switching off!

Drive Mode

The schematic discussion above deals with Charge Mode, where the idea is to stop charging when the BMS modules open the BMS loop due to one of the cells being over 4.1V. In Drive mode, the BMS module loop opens when any cell drops beneath 2.5V. This will probably happen during acceleration with nearly-flat cells, due to the internal resistance of the cells.

In Drive Mode we don’t want the flip flop or relays to be active, we just want to sound a buzzer when either SLOOP1 or SLOOP2 opens. So in Drive Mode we just power the inverter circuits (Q3 and Q8). Diodes such as D19, D22, D21, D1, D6 and D20 isolate the Drive Mode circuit from the Charge mode circuit.

In Charge Mode the circuit is powered from a 12V plug pack. In Drive Mode the 12V “Ignition” rail from the car powers the circuit. This ensures there is no drain on the cars traction or accessory battery when we are not driving. The “Ignition” circuit is just the 12V rail of the car that becomes active when you switch the ignition key to “On”. The term “Ignition” is a bit of a misnomer in an EV but you get the idea.

Testing and Development

I developed the BMS Controller circuit over a few weeks as a pleasant part time activity. At first I didn’t pass the relay current through the loop, I had it wired in the collector lead of the flip-flop Q2. However one day I had a near-death experience where I had somehow zapped Q3 without knowing so the flip-flop never flopped into the OFF state. Luckily I was monitoring the batteries at the time and no damage was done. However it convinced me to add the redundancy of passing the relay current through the BMS module loop.

Initially I had the AGM charger connected to 32 cells and one 12V charger connected to 4 cells. However I noticed that the AGM charger took much longer to finish the charge. The reason was the current from the AGM charger was only 7A, compared to about 12A from the 12V chargers. With 32 cells the AGM charger was seeing about 32(3.3) = 105.6V so it was “tapering” the charge current to the lead acid cells it thought it was charging. So I tried connecting the AGM charger to 28 cells and added another 12V charger. This brought the AGM charger current up to about 10.5A – much better. The 2nd 12V charger was added to the LOOP2 circuit, as I reasoned that identical 12V chargers charge at about the same rate.

The only problem with running the AGM charger on just 28 cells is that it doesn’t taper the current towards the end of the charge. The series regulators in the BMS modules have only limited bypass capability (700mA) so for effective equalisation we would like a final charge current of just a few A. I’ll need to watch that over time, to see if the cells drift apart in state-of-charge. A proper Lithium charger would be adjusted to taper the current off the whole pack to a point where the BMS modules could effectively equalise on every charge.

Here are the chargers mounted in the back of the EV. Just two were mounted when this photo was taken:

And a close up looking down on the (three) chargers:

Jaycar MB-3612 Charger and Lithiums

The low cost 12V lead-acid chargers I have used are really well suited to blocks of 4 Lithium cells. Curiously, these chargers work better for Lithium cells than for the lead acid batteries that they are designed for (see EV Bugs post)!

These chargers have a simple two-stage tapered current design. When the voltage they see is close to 12V, they charge at about 12A. As the lead acid battery charges and the terminal voltage rises this drops linearly to a few A as the battery reaches 14.7V, which results in rather slow charging and no equalisation for lead-acid batteries.

However this profile just happens to be very good for Lithiums. My Lithuim cells stick to around 3.2-3.3V for most of the charge (hours), then they quickly shoot up to 3.6V (plus) in the last 20 minutes. However as the voltage rises, the MB3612 tapers it’s current off. This allows the BMS module series regulators to shunt current around cells that are a little ahead of the curve. The result is the over voltage cut out never fires for the 12V chargers, and the cells are always nicely equalised. I guess the small number of cells under each charger (just 4 per charger) also helps.

In practice the LOOP2 controller never switches to the OFF state, as the 12V chargers stop charging before any one Lithium cell reaches 4.1V. The LOOP1 AGM BMS controller always switches to the OFF state, as one of the 28 cells charges a little earlier than the others. The lack of tapering of the charge current means full charge current is applied right to the end, when the 28 cells are at about 101V.

Note: my MB-3612 12V chargers have been modified to allow series-string connection (removed ground wire from negative lead, making the output fully floating), and tweaked to charge to 14.7V instead of the rather low 14.1V they were initially set to (trim-pot in middle of PCB).

Next Steps

The BMS controller has been working nicely since I put the Lithium-powered EV on the road 2 weeks ago. Next I would like to design a PIC or Atmel based voltmeter/ammeter/Ah meter. As you can see I enjoy messing with electronics and the EV, so I am just looking for an excuse to build some of my own instrumentation.

An Amp-Hour counter would be really useful for Lithiums as they are not afflicted by the Puerkert effect like lead acid batteries. This would make a AH counter a really useful indicator of “fuel” remaining.


Thanks Mithro for lending me his PIC programmer and PIC collection when he migrated to Sydney – has been very useful for this and a few other PIC projects.


Lithium Batteries for my EV – converting my EV from lead acid to Lithium
David’s EV Page
EV Bugs Post

5 thoughts on “Electric Car BMS Controller”

  1. A lot of people don’t trust that dead man’s switch approach. There are cell monitors being built now using low power wireless chips, because of bad experiences with other schemes. Each cell’s monitor chats with a central controller by 2.4GHz or <1GHz radio. Two way communication ensures that all the cell monitors are known to be genuinely alive.

    You still have to trust that none of the cell monitors are making measurements based on bogus data. Radio interference is also a potential issue. Still, this approach seems to be catching on for battery sets in things like cellular base stations.


  2. Looks like 7 more Jaycar chargers might work better :-) You might be able to flog off your PbA charger for more than 7 Jaycar chargers?
    Great write-up!

  3. @Steve – the nice thing about the dead-man switch approach in the loop configuration is it’s redundancy. If one BMS cell module fails to detect an over volt situation, the next next cell to reach 4.1V will open the loop. The chances of all 36 BMS cell modules failing is very low.

    Although, yes, I like the idea of each cell module having to check in every x seconds, or charging stops. That’s one advantage of an intelligent approach over the pure analog cell modules I am using.

    @Woody – Yes you are right! This is a strange full-circle for me. I started out with 10 x Jaycar chargers for my lead acid pack.

  4. Someone I spoke to recently, who is making detectors with low power wireless, said they had abandoned the dead man’s scheme because too many shorts in the mess that is the real world had caused their older loop based systems to fail. Although any element in the chain can open the loop, apparently they had too many situations where the loop was shorted to something external, or blocked at source.

    The wireless approach adds over $1 to each node, so they have a serious need if they are eager to bear such a high cost.


  5. Yes there is a similar weakness in my design – if any part of the loop is shorted to ground the loop will look like it’s OK. The advantage of this approach was simpler wiring, for example one end of the loop at the front of car can be connected to ground and just one wire run to the BMS controller in the rear.

    Other weaknesses are something causing the relay controlling the chargers to get stuck on. Although most failure mechanisms I can think of cause charging to stop.

    As well as wireless some sort of serial multi-drop bus could be used.

    – David

Comments are closed.