Hat off to you. 
Very good work, i will now look at implementing it in my code ofcourse.
Very good work, i will now look at implementing it in my code ofcourse.
0x460: 1 3 1-3 300#XX.00.00.00.00.00.00.00 01 02 04
0x470: 1 3 4-6 300#XX.00.00.00.00.00.00.00 08 10 20
0x461: 1 4 7-10 300#00.XX.00.00.00.00.00.00 08 04 02 01
0x471: 1 4 11-14 300#00.XX.00.00.00.00.00.00 80 40 20 10
0x462: 1 4 15-18 300#00.00.XX.00.00.00.00.00 01 02 04 08
0x472: 1 4 19-22 300#00.00.XX.00.00.00.00.00 10 20 40 80
0x463: 1 4 23-26 300#00.00.00.XX.00.00.00.00 01 02 04 08
0x473: 1 4 27-30 300#00.00.00.XX.00.00.00.00 10 20 40 80
Thanks but it was really just luck.That is some great work!
How did you find the the relevant labels (0x300, 0x310, 0x200)?
void BMSModuleManager::balanceCells()
{
for (int c = 0; c < 8; c++)
{
msg.buf[c] = 0;
}
for (int y = 1; y < 9; y++)
{
if (modules[y].isExisting() == 1)
{
int balance = 0;
for (int i = 1; i < 9; i++)
{
if (getLowCellVolt() < modules[y].getCellVoltage(i))
{
balance = balance | (1 << i);
}
}
msg.buf[y - 1] = balance;
}
}
msg.id = 0x300;
msg.len = 8;
Can0.write(msg);
for (int c = 0; c < 8; c++)
{
msg.buf[c] = 0;
}
for (int y = 1; y < 9; y++)
{
if (modules[y].isExisting() == 1)
{
int balance = 0;
for (int i = 1; i < 9; i++)
{
if (getLowCellVolt() < modules[y].getCellVoltage(i))
{
if (y < 11 || i < 4)
{
balance = balance | (1 << i);
}
else
{
balance = balance | (1 << (i+1));
}
}
}
msg.buf[y - 8] = balance;
}
}
msg.id = 0x310;
msg.len = 5;
Can0.write(msg);
}
Slightly off topic:Looking at the build up of the balancing messages its really straight forward.
Atleast that is if you take the reporting message IDs to build your voltage arrays.
I literally just take the report message id - 459 and then use that to bit shift the cell positions in to the various bytes of the messages.
Luckily there is logic between how they number and report out cell voltages and how they structure the balancing requests.
Anyone want to sniff around in my code:
Full bms code: https://github.com/tomdebree/AmperaBattery/tree/master/VoltBMSV2Code:void BMSModuleManager::balanceCells() { for (int c = 0; c < 8; c++) { msg.buf[c] = 0; } for (int y = 1; y < 9; y++) { if (modules[y].isExisting() == 1) { int balance = 0; for (int i = 1; i < 9; i++) { if (getLowCellVolt() < modules[y].getCellVoltage(i)) { balance = balance | (1 << i); } } msg.buf[y - 1] = balance; } } msg.id = 0x300; msg.len = 8; Can0.write(msg); for (int c = 0; c < 8; c++) { msg.buf[c] = 0; } for (int y = 1; y < 9; y++) { if (modules[y].isExisting() == 1) { int balance = 0; for (int i = 1; i < 9; i++) { if (getLowCellVolt() < modules[y].getCellVoltage(i)) { if (y < 11 || i < 4) { balance = balance | (1 << i); } else { balance = balance | (1 << (i+1)); } } } msg.buf[y - 8] = balance; } } msg.id = 0x310; msg.len = 5; Can0.write(msg); }
Actually, we're talking CAN. There are many ways to speak CAN to the BMS. I'm using a CAN adapter on a Raspberry Pi with Python. Tom has his own custom board (that uses the Arduino IDE tool chain I think).Slightly off topic:
wait....this is all c++...since when is automotive code not in asm? Is this for a custom board or for an arduino? Where can I find out more about how you guys are putting this stuff together and compiling code?
Sorry for derailing the convo a bit.
Well, it would if I could actually follow what you're doing.Nice, Tom. That'll make it a lot easier to use balancing. Thanks.
where did you get your adapter? Where can I learn more about this stuff?Actually, we're talking CAN. There are many ways to speak CAN to the BMS. I'm using a CAN adapter on a Raspberry Pi with Python. Tom has his own custom board (that uses the Arduino IDE tool chain I think).
There's a ton of info on using various computing platforms to read/write CAN. Just start with your favorite SBC and add "CAN bus" to the google search. All kinds of videos and tutorials will pop up.where did you get your adapter? Where can I learn more about this stuff?
awesome, thanks for this info!There's a ton of info on using various computing platforms to read/write CAN. Just start with your favorite SBC and add "CAN bus" to the google search. All kinds of videos and tutorials will pop up.
Personally, I've used both a Raspberry Pi with a Canberry
http://www.industrialberry.com/canberrydual-v2-1/
as well as a MUCH cheaper chinese adaptor with equal success.
https://www.aliexpress.com/item/She...978.html?spm=a2g0s.9042311.0.0.7c364c4d1GtTku
The canberry is a lot more plug-and-play and appropriate for starting out.
Great job done! I take off my hat))Thanks, guys.
Here are the details.
0x300 takes 8 bytes of data
0x310 takes 5 bytes.
......
I'm not aware that anyone has seen the BECM initiate balancing on its own. It needs a command from somewhere else to do that.I have recently bought a Gen 1 Volt battery set. I am working on putting it in my S10 that has been sitting parked with no batteries for about 5 years. Here are a few questions I have about cell balancing:
1. If I leave the set originally wired (96 cells in series) and I give 12V power and ignition signal to BEMC (and it starts communicating with slaves - confirmed) will it (BEMC) take care of cell balancing if needed? Or, does it need to talk to someone else, or … ?
2. If so …. and if I re-wire the set into two strings of 48 cells each (first 30 and last 18 will make one string and the rest will be the other) would BEMC be bothered by it or will it continue to monitor/balance the cells?
Thanks