Categories
Battery

Battery Balancing

Since my battery had been out of a car for at least a year the cells were pretty unbalanced (more than 70mv difference).

The commands necessary to get the battery modules (BICM) to balance have been found. Nobody has been able to figure out what the ECU sends to the main battery frontend (BECM) to get it to start balancing. I tried a couple of guesses, but was never able to get it to start.

So I decided to try a man in the middle attack on the CAN traffic. I had a Teensy 4 CAN board from earlier testing that I wired up to the BICMs. I saw that SimpBMS had implemented support for talking directly to the BICMs and doing the balancing, but it had quite a bit of code I didn’t need since it wasn’t going to be the full BMS. I found someone else who had simplified the code quite a bit and forked it for my use case.

I messed around with balancing algorithms and I my primary finding was that you needed to let it rest for a second and take new measurements before you could trust the readings to make decisions about which cells need to be balanced. When you balance a cell the voltage on the adjacent cells spikes up. So if you just chase the highest cell all of the time you’ll just slowly drain the whole thing. If I wanted to go fast I’d select everything from max to max – threshold to balance. Once we started to get within 2 x threshold that stopped working and I just started balancing all the cells that were at the highest voltage reading. This managed to get everything back within 5ms.

To be able to live with this long term I need the BECM to be able to talk to the BICMs, so I had to get the pass through mode working. Initially I was using interrupt driven CAN traffic and the timing ended up being so inconsistent that the BECM really didn’t like it. So I went back to polling and it was happy again. I also spent a bunch of time trying to keep the BECM happy while I balanced thinking the problem was the format of the packets and not just the timing, eventually I realized I could just wait for the 0x300 and 0x301 packets came by from the BECM and modify the data to do the balancing.

I also ordered the male and female connectors that the BICM and BECM used and built a little harness that just connects all of the non-CAN pins directly to the other one. I forked 5V and GND to power the teensy and ran the CAN from the BICM side to Can0 and the BECM side to Can1 on the Teensy.

Eventually I want to need to figure out a more permanent mounting location for the MiTM Teensy, but it is working great for now.

Leave a Reply

Your email address will not be published. Required fields are marked *