Thursday, December 5, 2013

Update 120513

I have batteries!



I'm using 16 60Ah LiFePO4 cells, 3.3 volts nominal for a total of ~52 volts. Lithium batteries are difficult to charge since they must be kept from overcharging, which can happen if the individual cells become unbalanced (some cells undercharged, some overcharged, but pack voltage looks normal). This can happen over several charge/discharge cycles.

The best way to fix it is with a battery management system. This measures the voltage of each cell and can charge/discharge individual cells to keep them all balanced. The cheaper way uses cell balancers, an isolated circuit for each cell which shunts 500 mA across the cell if it reaches the 3.6 volt "overcharged" threshold.

Guess which way I'm doing it? Actually a combination of both. Even with balancers the cells can overcharge. 500 mA across a cell won't stop the cell from charging with a 15 Amp charge current, it'll just slow it down. To remedy this, I'm building a management system that can shut off the charger should any of the cells begin to balance. After the cell voltage drops below the 3.6v threshold, the charger starts again, bringing up the rest of the cells. After repeating this (probably many times), the cells will eventually remain in pretty close balance.

I'm using a Cypress PSoC 3 microcontroller to control this and a few other things on the bike. In a TQFP100 package it's not very easy to develop with, but the high IO count allows me to do a lot of things with it. I've soldered this to a generic TQFP100 breakout board (I'm quite proud of my ability to solder .5mm pitch 100 pin IC :D )

TQFP100 .5mm pitch!
The cell balancers have a red LED which light when they're balancing. I'm using the voltage at this LED as a signal to tell the microcontroller which cell is balancing. Since each balancer is isolated and has its own ground level, I'm using optoisolators to levelshift to the microcontroller IO levels.

Testing with 4 of the cells.
Character display shows which cells are balancing and overall pack voltage.

The microcontroller is also reading overall pack voltage (pretty close, it's difficult to measure 50 volts with a 5 volt microcontroller and ADC) and can time how long each cell has been balancing. The row of numbers along the bottom of the display represent the balancing state of each cell. 1 is balancing, 0 is not balancing. Once a cell begins balancing, the microcontroller can wait a preset amount of time, shut off the charger with a relay or over CAN (depending on how sophisticated my charger is), and then being charging again when the cell has balanced.

I could also add to the microcontroller the ability to turn on and off the balancing circuit on each cell. The balancers turn off when the cell voltage drops to 3.57 volts, so if the other cells are quite below this, it'd take many cycles of charging, waiting, charging, waiting before all the cells are balanced. We'll see how this works first.

After prototyping with a breakout board and 4 cells, I designed a PCB for the microcontroller and optocouplers. I spent too much time on this layout, but symmetry is beauty and it's $/inch^2.

layout
render