Sunday, January 19, 2014

Battery Monitoring System Fully Functional

It's been a long road, but I'm very happy to say that my battery monitoring system is finally fully functional!  There have been quite a few things that happened recently, so here's the whole timeline.

April-May 2013 - Installed all the wires that lead to the + and - terminals of all the batteries.

June-July - I completed the schematics for the BMS, ordered all the parts, and built the circuit boards.

August - Completed the preliminary code for the system and tested it on the bench.

Sept-Oct - Installed the BMS in the car and routed all the necessary wires.  Continued to work on the code.  Got the code working, but there's too much noise for it to work.

November - I was able to filter enough of the noise to get the BMS to work while the charger is running, but still won't work if the throttle is pressed at all.  I decide to reroute the signal wire (master bus) inside the car to shield it from the high voltage cables.  Just before I reroute the wires, something happens and I have some fried parts on the circuit boards.

Thanksgiving break - I figure out that two of the microcontrollers on the slave boards have shorted out.  In the process of testing I burn up a couple other parts on the boards.  I order new parts.

Early December - I get the new parts and install them.  The BMS is working again, but rerouting the wires did nothing to improve the EMI (noise) problem.

Christmas Break - I relocate the master board to see if that helps with the noise and it doesn't.  Then I try hooking up just the slave board at the front of the car (so it doesn't need the long wires going to the back of the car).  In the process I accidentally hook up two wires that shouldn't have touched and poof! two microcontrollers blow up!  Interesting enough, it's the same two micros that stopped working just before Thanksgiving...hmm, I might be onto something.  I think about it a bit and realize that I have two wires in a bundle that have around 150v differential between them.  It's conceivable that the insulation on the wires is not rated for that kind of voltage, so that could have been the reason why those two micros fried.  Luckily I had the foresight to order a few spares so I have just enough parts to rebuild the boards.  I retest with just the front slave board (careful not to cross the wires I did last time) and it works!  I'm successfully able to drive the car around and monitor 24 batteries!  Joe has an idea for me on how to fix the problem for the other 46 batteries, so it's time for another parts order.

Early January - And here we are now (so you know that it must have worked).  Joe's brilliant idea is that the noise is coming from the wires that go the length of the car (acting like antennae) that are directly connected to the master board.  There is a +12v, ground, and signal wire that do this.  His theory is that if these are completely isolated from the master board that the noise won't propagate in.  So I build a simple circuit that provides isolated power for the slave boards (that's what the 12v and ground was for), and has an optocoupler that isolates the signal.  I hook that up and bam, works like a charm!  Here's a couple pictures of the prototype board:



After I could tell it was working I soldered all the parts to an actual PCB and mounted it in the car.


Here's that baby in action!  It shows the min, average, and max cell voltages, the temperature for the three battery clusters, the BMS allowable charge current (x10), and the cell number that it's currently checking.  I changed something on each of the circuit boards and the calibration is off a bit.  That's why it's reading a range of 0.15 volts.  They're actually quite a bit closer than that.


I also wired up the necessary wires to get the BMS to talk to the charger.  The purpose is that the BMS makes sure no individual battery goes over 3.65v.  If one gets up there, it tells the charger to slow down and/or shut off to protect it.  At first when I got this hooked up, I had some "nuisance faults."  This is a different data line than the master bus line, so I added a capacitor and that helped a lot, but not enough.  So I changed the code on the charger.  The way it works, the BMS sends a square wave to the charger.  The lower the frequency, the more current it's allowing, and vice versa.  If the charger waits too long, it thinks the BMS came disconnected or stopped working and shuts down.  If there's a really short time period (like from noise on the line) it will think one of the voltages is too high and could shut down.  To fix this, I did two things.  To deal any errant short pulse I make the charger average 8 signals before making a change.  To deal with a long pulse that sneaks in (I'm not sure how this happens), I make it require 4 bad signals like that to happen in a minute for it to shut down.  I don't have to worry about it taking too long because 8 signals is still a small fraction of a second.  I tested it out by disconnecting a wire and it instantly shuts off.

So after having the car out of commission for a while, I'm finally back in business!  I plan to drive in to work again tomorrow morning.  Woo hoo!

No comments:

Post a Comment