Battery pack monitor for an electric car?

Although I have experience with building circuits and code, it was way back in the days of the intel 8008 and 8080 ics, and I have to admit to being way out of date and 'rusty'!

Before delving into this project, an explanation of the problem I hope to solve will probably help.

I've just finished converting a car from ICE to all electric. This project has taken me the last 18 months, and the car has been taxed and on the road for the last week. My concern now is to monitor the individual batteries, both when charging and in real time while driving.

Since I couldn't afford the 20 or 30K plus for an AC motor and high tech batteries, I went with a 8inch diam series DC electric motor and 11 12v deep cycle lead acid batteries. Since electric motors develop their max torque at start/stall, it develops about 80hp at start although only a 17hp rated motor when at it's design speed. It accelerates well from a standing start as a result!

The 11 batteries are wired in series, and when fully charged give me 143Volts DC, ie approx 13 volts each. The charger puts out 155V when charging.

In order to not stress the batteries and help them last as long as possible, it is recommended that the batteries are never discharged below 80% of their normal charge, which is 114.4V total.

There are very expensive battery monitoring systems out there which can be hooked across each battery ( one board per battery) and which talk to each other and the charger/dash display by serial bus, but I would like to see if I can build something myself, and wonder if the arduino could be put to the task.

So before I dive in I'd ask for some advice please.

My initial requirements are to be able to monitor voltage of each the 11 traction batteries, and display the results. When the vehicle is stationary, or the pack is on charge, I'd like to be able to view the actual voltage of any battery. (Say by simply selecting it with a 12 way rotary switch, and to view the total pack Voltage in the 12th position of the switch.) I realize that I could do this with no Arduino;-)

But when driving it is really useful to have real time monitoring of each battery, and display each by means of leds in a bar graph, one vertical row of 10 per battery. Automatically switching through the whole pack several times a second.

If a particular battery starts to 'fail' or droop with reference to the others when driving, it would then be visible in use as a drop in the bar for that battery.

Using green leds for the top 8 and red for the bottom 2, and setting the threshold V between red and green to that 80%V, would quickly tell if a battery was in danger, dropping below the average under load or acceleration.

Because the arduino only has a limited number of inputs, I visualize multiplexing the battery inputs into just one, and because of the serial connection of batteries in the pack, and high total voltage involved I visualize opto isolating each battery to just get 'it's value. Rather than trying to read the total pack voltage, I can see using the arduino to 'sum' the individual 11 voltages each time it scans through the pack.

So, before gong further, is the arduino a good choice for such a project? If so would anyone care to help?

Electric car conversions are becoming more common, and I would like to open source the project, with variants, (many home built evs use either 8V or 6V golf cart traction batteries, so battery numbers can reach into the 20s) so there would need to be a built in plan for more (or less, I've seen 72v cars with just 6 12V batteries) inputs and 'various' input voltages.

I also would like to store the data for downloading to a pc, at first by the USB Serial, but later by wifi, so for example on arriving home the car could upload it's trip data and my pc could store it. Perhaps even emailing me details if a battery was going down!

Thank for reading this, if you can help with advice on chips, opto isolators etc, I'd appreciate hearing from you!

Colin McC
Whistler
BC
Canada.

Random thoughts:

  • Congratulations...this is quite an achievement.
  • I don't think optoisolation is necessary because of the high voltage. Even a simple voltage divider string will be good enough to bring the voltage within range.
  • You will need some kind of analog multiplexer (e.g., 74HC4066, 74LV4051, etc.) due to not having enough ADC inputs on the Arduino.

Thanks for the swift response!

You write: "I don't think optoisolation is necessary because of the high voltage. Even a simple voltage divider string will be good enough to bring the voltage within range."

I'm not sure about that. There are a few points (probably many :wink: ) that I didn't mention.

  • There is no 0 volt reference for the battery pack, ie the battery pack's most neg point is not grounded to the vehicle chassis. This is standard in evs as far as I know.)

  • The charger http://www.manzanitamicro.com/chargers3.htm is several thousand $ worth of beast. It will take 110v or 220V in and draw up to 20A from that supply. (There is a variable input control on the mains input current to turn it 'down' if needed) It's main drawback as such is that when charging the DC NEG to the battery pack is connected directly to the input bridge, so the battery pack is live to the incoming mains supply while charging. Ie there can be NO direct electrical connection from the batteries to the vehicle or it's electronics. This is standard in evs. (I'm not happy with it, but can't change it! I've been zapped once already trying to measure battery voltages while on charge)

  • I have a DC to DC converter which takes the main battery pack V in and puts out approx 14v to charge a small 12v accessory battery, which in turn powers lights, stereo etc. It IS isolated ip to op so there is no passage through it from battery pack to the vehicle's electrics.

So if I power the arduino from the 12v supply, I don't want it to make any electrical connection to the battery pack. Hence the opto isolators.

This sounds like a cool project you should put it up on the net. The arduino should be more capable and cost you a lot less. This could even be the makings of a new shield. EVBATshield :wink:

Well, if isolation is necessary you'll either need a linear isolator or put a separate A/D converter on the battery pack side (powered off your 12V accessory battery) and communicate over a digital isolation barrier to the microcontroller.

Nice project. Congratulations on getting it on the road!

Are you opposed to brewing up a custom circuit board to attach to each battery?

What I'm suggesting is power a small circuit board from each battery. Each one would be isolated from the others by virtue of never having any common electrical connection except for where the negative of one battery connected to the positive of the other and that wouldn't matter.

The circuit boards would all be the same and would consist of a small Arduino compatible microcontroller, a milliohm current shunt, and a pair of back to back optoisolators, plus ancillary hardware like voltage regulators and voltage spike protection devices. Each circuit board, or node, would have a unique address.

A buss similar to RS485 would connect all the nodes together through the optoisolators and could terminate in a standard Arduino, which could be powered by the twelfth battery if I understand the isolation problem correctly. Else, another level of isolation would be necessary.

Each node would be capable of monitoring charge and run voltages per battery as well as charge and run currents if you can tolerate the addition of the shunt in series with each battery.

The master Arduino could take care of your bar graph displays as well as coordinating the information from the slave nodes.

Edit:

When I first wrote this post, it seemed that during discharge, each battery could contribute a different amount of current to the load. In retrospect, while that might be true, does that mean that the current flowing into and out of each battery can be different? That seems to be somehow contradictory. Or is current "consumed" in some of the batteries to be made up by some of the others?

Also, I fully intended the current "shunt" to be of the Hall effect type to provide isolation but it occurred to me that 80 hp would be over 400 amps at the battery voltage and that will require a little bit of a trick with the current sensor but not one that poses any serious implementation problems.

I like EJ's idea, in general, but would change it a little bit.

Instead of putting an Arduino-compatible CPU on each board, use a much-cheaper ATTiny13A. It has 10-bit ADCs, too, but less RAM, flash, and other resources you don't really need. Each board would have identical software, except for a one-byte ID code (which could be in flash, or programmed into EEPROM as part of an "initial configuration" process).

Each board would have 2 opto-isolators: one to daisy-chain a "Go" signal to the next board, and one that's wire-ANDed to send serial data back to the single Arduino that controls the show.

The Arduino also has an an opto-isolator. At the start of each battery-check cycle, that's turned on to send the "Go" to the first battery monitor in the chain. That board bit-bangs its ID and ADC reading(s)* through its "serial" opto-isolator, then passes the "Go" signal to the next board in the chain.

The Arduino can either be programmed with the number of batteries, or watch for the "Go" from the last board to know when the cycle is complete. It would then turn off its "Go" output, which would percolate down the chain and get everybody ready for the next round.

As with any system that uses this sort of daisy-chaining, there's a risk that the failure of any one board will screw up the operation of all the boards downstream from it. But, since this part of the system is not critical to operation (i.e., it won't stop the car dead, or disable any safety features), I would consider it an acceptable trade-off for the simplicity and the cost savings.

Ran

  • Since you've already got a CPU and a couple of spare ADC channels, you might want to add some sort of temperature and/or other sensor to monitor its health and happiness.

Hi folks,

Thank you for taking time to reply.

Since the traction batteries are wired in series (using 2/0 welding cable) the same current flows through each one. If one goes bad and develops a bad cell/high resistance etc it will pull the whole pack's ability to source current down. That is one of the main reasons to monitor each battery in use.

I have one 500A shunt in series with the pack, it drops 50mv across it when it is conducting 500A so I have a a 50mv meter across it scaled as amps..

I brought leads from each battery terminal (12 for 11 batteries) to a central point behind the dash, so while I can see that a monitor board fitted to each battery, talking to the arduino (perhaps achieving isolation by using fiber optic) would be neat, for my purposes that would, I think be overkill at this point. Actually I've been getting feedback from an EV newsletter I posted to telling me that a better OS project would be a controller for more modern batteries since 'lead acid' is almost obsolete in ev terms. ( Probably true in the commercial world, but not in the DIY 'till prices drop.The tesla for example uses over 3000 laptop type cells (and costs $100,000.00 ;))

However for now lead acid is at a price point I can afford, and it's what I have got to work with for the next few years 'till they die. At which point maybe better batteries will have come down in price.

So for now I'm going to stick to my idea of 11 opto isolators ie one strapped across each battery, feeding just one analog ip of the arduino via a multiplexer.

After reading one pass of the 11, I'll update the display and sum the 11 voltages, then repeat etc.

I can also read the voltage drop across the current shunt and display amps drawn.

So, my main query bearing in mind the resolution of the arduino, is if I really am only interested in and want to measure voltages in the range of 10V to 15V, can someone suggest a circuit that would condition an input to ignore the first 10v and only present voltages in the 10V to 15V range to the multiplexer?

I'm not electronically experienced, but wonder if a simple voltage divider would do. Or do I need some sort of fixed 10v reference (just a Zenner in series with my divider resistor leg?) to measure against?

BTW there is a commercial product rather similar tho more complex to what I visualize at:

http://www.jstraubel.com/BatteryMonitor/monitor.htm

Thanks again!

So for I'm going to stick to my idea of 11 opto isolators ie one strapped across each battery, feeding just one analog ip of the arduino via a multiplexer.

Edit: nevermind, found it. That makes your project a lot simpler not because of the opto but because of the new info that you have all the battery outputs brought out to a single point.

I'd like to see a link to the data sheet for this linear analog opto isolator. Could be useful in a lot of projects.

Bear in mind that a 10-bit ADC like on the Arduino will give you 15 mV resolution for 15V full scale, you may want to not incur the additional expense/complexity to shift the range. You can deal with the display part of your requirement in software.

Hi Emily Jane,

This is where I show my ignorance, I haven't tried to track down a suitable linear opto isolator as such, I was hoping that someone would suggest one! I also think that if it wasn't linear the lack of linearity over the small range I'm interested in could be resolved in software.

I take your point about 15 mV resolution being sufficient, I hadn't divided 15v by the 1000 (approx) steps that 10 bit resolution allows.

That's okay. It was a good bluff. :smiley:

Actually, Clare makes a few. You can use the google to look up their LOC110/LOC210 series.

To use them you'll need to make a circuit up with a low current power supply with proper circuitry to protect from the battery voltage spikes (not difficult), a resistive voltage divider to scale your battery voltage to the range of 0-2V, a single supply op amp to drive the opto and the opto itself. Then, running from the Arduino power source you will need another op amp to condition the opto isolated signal.

At the Arduino, you'll put your multiplexer.

I won't make you work too hard. Here's a link to the Clare app note:

http://www.clare.com/home/pdfs.nsf/www/AN-107.pdf/$file/AN-107.pdf

I also think that if it wasn't linear the lack of linearity over the small range I'm interested in could be resolved in software.

If only I had a nickel for every time I have heard that one. ;D

Several replies have come in to me via email from members of VEVA (the Vancouver Electric Vehicle Association)

As lithium batteries become more affordable and more of us seek it for conversions, battery management systems will be the next hurdle for us hobbyist to conquer.
Some products have been released recently to greatly simplifying the
implementation of these systems.[ch65533] Specifically, LTC6802:
Mixed-signal and digital signal processing ICs | Analog Devices
It integrates cell monitoring and passive balancing control, and is
compatible with high voltage packs.
Integrating modules of these, to be connected to a centralized
controller that interfaces to charger control and display, would be an
interesting and likely highly valued project.[ch65533] Personally, I can't
contribute a lot of time right now, but I suggest you start a wiki to
start gathering and discussing requirements.

And another:

Analog Devices, www.analog.com, has just come out with a new set of front end chips for Battery Management Systems. Perhaps have a look through it and see how it could interface with the arduino.

And another:

I would agree that the Arduino is a good platform to use, but its application to lead acid battery control is a project of too limited a shelf life to possibly interest too many people.
I am stress-testing Arduino now in a battery charger project of my own (unrelated to what you are planning.) I keep rebooting it and its attached page server keeps bringing up an applet image that says it's still alive and ticking, in spite of the licking of periodically changing development software.

Thank you to all those here and in the EV 'hobbyist' industry for your contributions. Time to order an arduino I think! (Probably several, one to blow up, and one to not do to whatever I did to blow the first one up, I've been down that road before!) :smiley:

That's the spirit!

At the Arduino, you'll put your multiplexer.

Personally, I'd put the mux in the battery compartment: it's a significant savings in wiring complexity.

But I still think the ATTiny13 solution is better: it's cheaper, simpler, and works with any number of batteries (i.e., it could be produced as a product and sold to other EV builders). It's more susceptible to the component tolerance of the voltage regulator affecting absolute A/D accuracy, but that's easily fixed by adding a calibration table to the Arduino. Or possibly even to the ATTiny, itself: you could program it to read a precision voltage reference, and remember a scaling factor, during production test.

And, as a free bonus, the basic architecture is easily expanded to include other types of sensors (so you don't forget, send in your protocol specification before midnight 8-)).

Ran

I brought leads from each battery terminal (12 for 11 batteries) to a central point behind the dash

He already has the wiring done. If that were not the case, I would agree, put the mux where the batteries are.

I think his idea to use the linear optoisolators simplifies the system considerably. For one thing, the sensors on the battery side are now "dumb" and there is no need for any sort of communication protocol. In the case of a sensor failure, there is no possibility of bringing down the whole network. The system can be scaled easily, simply by varying the number of mux channels.

Colin, is your battery compartment the sort of corrosion factory that surrounds a lead-acid battery under the hood of an internal combustion engine vehicle?

Hmmm, I didn't notice that bit about the wiring. I guess I should add "Eliminates risk that the monitoring system will kill you and/or set fire to your car" to the selling points for the "distributed intelligence" approach...

"... but doesn't necessarily eliminate the risk of getting electrocuted during installation."

:smiley:

One probably needs to exercise extreme caution at all times around all that DC. The fact that the traction battery is not grounded to anything on the car makes it much safer. Kind of like transformer isolation. You have to work extra hard to get into too much trouble.

One probably definately needs to exercise extreme caution at all times around all that DC.

When I was a youngster, I accidentally dropped a wrench on top of a car battery and shorted it. That was an extremely unpleasant experience! :o I can't even imagine what 11 batteries would do under similar circumstances.

If you create a circuit between the "test taps" for, say, batteries 2 and 10, you get a source that's good for about 100V at hundreds of Amps for multiple minutes.

If that circuit is created by the wires being abraded where they pass through the firewall, you've got a good chance of blowing up a wire before it sets the car on fire. If that circuit is created by you touching the terminals, you've got a good chance at being nominated for a Darwin Award.

If this were a bench setup, or even a stationary system like a solar-powered pumping plant, I'd be closer to your level of concern. But in a car? Not just "No", but "Hell, no!".

Ran