I open-sourced my EV Li-on Battery Management System
github.com
github.com
I'm not sure I understand the balancing code. It looks to me like the gate is turned on for any cell over 3.509 V (the conditionals all depend on constants). Doesn't this unnecessarily drain your cells?
From 20 to 80% state of charge. The cell voltage will be around 3.3v. When the battery gets charged to more than 3.5v, it is pretty much full. The bms will cut the charger off when the first cell reach 3.6v. Most cells will still be around 3.5. So the ones that are above 3.5 will get drain down to 3.5v and in turn balances there battery pack.
balancing battery is tricky, and this is just one simple algorithm I find to work fairly well.
I can send a pull request if you'd like to do some benchmarking. :)
That also seems like a small voltage swing. Do you have any more information on the cells you're using? Maybe a voltage vs. SoC chart?
Edit: wording
The numbers I'm getting is for LiFePo4. There are many other chemistry of Li-on variant, and LiFePo4 so far is the safest. It does not burn up like the ones in your laptop, but at the cost of slightly less energy density.
The type of batteries we had in our EV was these ones made by Winston Battery: http://en.winston-battery.com/index.php/products/power-batte...
They were kind enough to donate almost $20,000 worth of these babies to us. We had 160Ah x 3 in parallel.
An open-source BMS could play a huge role in the advancement of battery technology. If only automakers would do the same. :)
Thanks for open sourcing this!