Master CAN module for Hankzor balancers
-
- Posts: 3337
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 84 times
- Been thanked: 262 times
- Contact:
Re: Master CAN module for Hankzor balancers
It seems i did the modules injustice. Its sensory part is very precise IF you calibrate it beforehand. It seems to look to AD differences between cells and takes complete scale with respect to that. Whrn you use a good multimeter ti measure module voltage you insert that in the application and it will then follow that value.
But regarding longevitl i would say it ran for over a year with balancers allways on. Then mosfets failed and consecutively resistor fuses. Now mosfets failed on 24S wired models not 16S. Those are still running strong.
This leads me to believe it shouldnt be used as 24S. Maybe rather 20S. Transistor gap is too small for 90V and mosfets are 100V rated. We need more margin...
But regarding longevitl i would say it ran for over a year with balancers allways on. Then mosfets failed and consecutively resistor fuses. Now mosfets failed on 24S wired models not 16S. Those are still running strong.
This leads me to believe it shouldnt be used as 24S. Maybe rather 20S. Transistor gap is too small for 90V and mosfets are 100V rated. We need more margin...
-
- Posts: 1449
- Joined: Fri Mar 01, 2019 9:15 pm
- Location: Bristol
- Has thanked: 120 times
- Been thanked: 266 times
Re: Master CAN module for Hankzor balancers
Ah okay, quite a shame to have to run it under capacity. It does say its rated at 100V which of course literally will be the max voltage of a package and not the design itself.
Did you publish your decoding and control publicly?
Did you publish your decoding and control publicly?
-
- Posts: 1449
- Joined: Fri Mar 01, 2019 9:15 pm
- Location: Bristol
- Has thanked: 120 times
- Been thanked: 266 times
Re: Master CAN module for Hankzor balancers
Sorry answered my own question.
A bit bulky code, will look into making a bit more "dynamic" as in not fixed and fully configurable.
https://github.com/arber333/ESP32-VCU/b ... 32BMSa.ino
A bit bulky code, will look into making a bit more "dynamic" as in not fixed and fully configurable.
https://github.com/arber333/ESP32-VCU/b ... 32BMSa.ino
-
- Posts: 3337
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 84 times
- Been thanked: 262 times
- Contact:
Re: Master CAN module for Hankzor balancers
Yes i am no coder... i changed it multiple times. I want to use flags as i need the code selectively turn on.tom91 wrote: ↑Fri Jan 20, 2023 6:30 pm Sorry answered my own question.
A bit bulky code, will look into making a bit more "dynamic" as in not fixed and fully configurable.
https://github.com/arber333/ESP32-VCU/b ... 32BMSa.ino
For my first objective i tried to turn balancers on and off as i drive or charge.
For second objective i want to get all cell values and store them in an array. There i can compare them and choose the highest and lowest cell and its position.
For third objective i will take temp values and make some alarms from all data.
For rest of steps i would like to put filtered data to Wifi or Bluetooth.
Would you need one sample board for testing?
-
- Posts: 1449
- Joined: Fri Mar 01, 2019 9:15 pm
- Location: Bristol
- Has thanked: 120 times
- Been thanked: 266 times
Re: Master CAN module for Hankzor balancers
I will first get it working on my SimpBMS Teensy 3.2 probably starting with VW code base.
Then I will look at working out how to best share this with others, dont want to go rewriting your whole code as I do not know the "I/O functions".
Then I will look at working out how to best share this with others, dont want to go rewriting your whole code as I do not know the "I/O functions".
-
- Posts: 3337
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 84 times
- Been thanked: 262 times
- Contact:
Re: Master CAN module for Hankzor balancers
Ah ok BMS is just sensing ENABLE and PP signals and possibly 12V level on AD rest are outputs for interfacing with the car.
When you test your code and it works please report back on how it works as i may copy your hard work.
-
- Posts: 1449
- Joined: Fri Mar 01, 2019 9:15 pm
- Location: Bristol
- Has thanked: 120 times
- Been thanked: 266 times
Re: Master CAN module for Hankzor balancers
First draft created. https://github.com/Tom-evnut/SimpBMS-JK
It reads the info and can command balancing.
Balancing is done here, they need to be set once so using a simple integer to do this.
BMS section handles the sending of the can message, it first checks which modules are known to exist.
Requesting info, currently is just a shotgun approach not cyclic like you probally want to implement it.
The variable settings.NumModules is a setting to assign amount of modules that should be requested.
The decoding happens as follows. It merely looks for a message in the right range and passes it on.
Again a simple pass along to the right section using the message id as the module id.
Here is how I decode the message, it puts all the variables into the right places to allow it to function in the SimpBMS code frame work.
It reads the info and can command balancing.
Balancing is done here, they need to be set once so using a simple integer to do this.
Code: Select all
if (balancecells == 1)
{
if (SetBal == 2 || SetBal == 0)
{
bms.balanceCells(1, 0); //1 is debug
SetBal = 1;
}
}
else
{
if (SetBal == 1 || SetBal == 0)
{
bms.balanceCells(0, 0); //1 is debug
SetBal = 2;
}
}
Code: Select all
void BMSModuleManager::balanceCells(bool balance, int debug)
{
for (int y = 1; y < MAX_MODULE_ADDR; y++)
{
if (modules[y].isExisting() == 1)
{
OUTmsg.id = y;
OUTmsg.len = 2;
OUTmsg.ext = 0;
OUTmsg.buf[0] = 0xF6;
OUTmsg.buf[1] = balance;
Can0.write(OUTmsg);
delay(1);
}
}
}
The variable settings.NumModules is a setting to assign amount of modules that should be requested.
Code: Select all
void sendcommand()
{
for (int I = 1; I < (settings.NumModules + 1); I++)
{
msg.id = I;
msg.len = 1;
msg.buf[0] = 0xFF;
Can0.write(msg);
delay(1);
}
}
Code: Select all
if (inMsg.id < 0x00F)//Can Messages from modules
{
if (candebug == 1)
{
bms.decodecan(inMsg, 1); //Can Messages from modules
}
else
{
bms.decodecan(inMsg, 0); //Can Messages from modules
}
}
Code: Select all
void BMSModuleManager::decodecan(CAN_message_t &msg, int debug)
{
int CMU, Id = 0;
CMU = msg.id;
if (debug == 1)
{
Serial.println();
Serial.print(CMU);
Serial.print(" | ");
}
modules[CMU].setExists(true);
modules[CMU].setReset(true);
modules[CMU].decodecan(msg);
}
Code: Select all
void BMSModule::decodecan(CAN_message_t &msg)
{
uint8_t Id = 0;
Id = msg.buf[0];
switch (Id)
{
case 1:
temperatures[0] = msg.buf[2] + msg.buf[1] * 256;
break;
case 2:
balstat = msg.buf[3];
break;
case 4:
cellVolt[msg.buf[1]] = (msg.buf[3] + msg.buf[2] * 256) * 0.001;
cellVolt[msg.buf[1] + 1] = (msg.buf[5] + msg.buf[4] * 256) * 0.001;
cellVolt[msg.buf[1] + 2] = (msg.buf[7] + msg.buf[6] * 256) * 0.001;
break;
default:
break;
}
}
-
- Posts: 3337
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 84 times
- Been thanked: 262 times
- Contact:
Re: Master CAN module for Hankzor balancers
I think in the past i promised the DIP switch address table:
Re: Master CAN module for Hankzor balancers
Hi Tom!tom91 wrote: ↑Sat Jan 21, 2023 2:14 pm First draft created. https://github.com/Tom-evnut/SimpBMS-JK
It reads the info and can command balancing.
Balancing is done here, they need to be set once so using a simple integer to do this.BMS section handles the sending of the can message, it first checks which modules are known to exist.Code: Select all
if (balancecells == 1) { if (SetBal == 2 || SetBal == 0) { bms.balanceCells(1, 0); //1 is debug SetBal = 1; } } else { if (SetBal == 1 || SetBal == 0) { bms.balanceCells(0, 0); //1 is debug SetBal = 2; } }
Requesting info, currently is just a shotgun approach not cyclic like you probally want to implement it.Code: Select all
void BMSModuleManager::balanceCells(bool balance, int debug) { for (int y = 1; y < MAX_MODULE_ADDR; y++) { if (modules[y].isExisting() == 1) { OUTmsg.id = y; OUTmsg.len = 2; OUTmsg.ext = 0; OUTmsg.buf[0] = 0xF6; OUTmsg.buf[1] = balance; Can0.write(OUTmsg); delay(1); } } }
The variable settings.NumModules is a setting to assign amount of modules that should be requested.
The decoding happens as follows. It merely looks for a message in the right range and passes it on.Code: Select all
void sendcommand() { for (int I = 1; I < (settings.NumModules + 1); I++) { msg.id = I; msg.len = 1; msg.buf[0] = 0xFF; Can0.write(msg); delay(1); } }
Again a simple pass along to the right section using the message id as the module id.Code: Select all
if (inMsg.id < 0x00F)//Can Messages from modules { if (candebug == 1) { bms.decodecan(inMsg, 1); //Can Messages from modules } else { bms.decodecan(inMsg, 0); //Can Messages from modules } }
Here is how I decode the message, it puts all the variables into the right places to allow it to function in the SimpBMS code frame work.Code: Select all
void BMSModuleManager::decodecan(CAN_message_t &msg, int debug) { int CMU, Id = 0; CMU = msg.id; if (debug == 1) { Serial.println(); Serial.print(CMU); Serial.print(" | "); } modules[CMU].setExists(true); modules[CMU].setReset(true); modules[CMU].decodecan(msg); }
Code: Select all
void BMSModule::decodecan(CAN_message_t &msg) { uint8_t Id = 0; Id = msg.buf[0]; switch (Id) { case 1: temperatures[0] = msg.buf[2] + msg.buf[1] * 256; break; case 2: balstat = msg.buf[3]; break; case 4: cellVolt[msg.buf[1]] = (msg.buf[3] + msg.buf[2] * 256) * 0.001; cellVolt[msg.buf[1] + 1] = (msg.buf[5] + msg.buf[4] * 256) * 0.001; cellVolt[msg.buf[1] + 2] = (msg.buf[7] + msg.buf[6] * 256) * 0.001; break; default: break; } }
What’s the status on the Jkbms/balancer integration to simpbms? Do you have it up and running?
Thanks
Rikard
-
- Posts: 1449
- Joined: Fri Mar 01, 2019 9:15 pm
- Location: Bristol
- Has thanked: 120 times
- Been thanked: 266 times
Re: Master CAN module for Hankzor balancers
Ok, so loading the evsbms with SimpJK.ino.TEENSY32.hex would do it?
When using more than 24s I guess that the jk-balancers needs to be connected like this in order for all cells to be balanced evenly?
![Image](https://www.jkbms.com/wp-content/uploads/2019/10/figure7.jpg)
-
- Posts: 1449
- Joined: Fri Mar 01, 2019 9:15 pm
- Location: Bristol
- Has thanked: 120 times
- Been thanked: 266 times
Re: Master CAN module for Hankzor balancers
NO that is for the SimpBMS as it says and the previous posts mention. If you need it to work on EVS-BMS hardware that can be looked at too, do you have an EVS-BMS?
Re: Master CAN module for Hankzor balancers
Ok, I haven’t decided on the bms to use yet, still looking though options.
Thanks
-
- Posts: 8
- Joined: Tue Feb 06, 2024 3:55 pm
- Location: Melbourne, Australia
- Has thanked: 9 times
- Been thanked: 1 time
Re: Master CAN module for Hankzor balancers
I've been looking around for BMS options and have landed on this project. I'm trying to prioritize cost and this seems most effective.
Have been in contact with JK-bms sales reps to try to aks more details out of them. Basically the same info that we already have.
From what ive told, the CAN option doesnt support more than one connection?? Whats the point of going CAN then. Anyways from this I assumed they meant the units don't have isolated CAN, so the GND of each of the units is the bottom most cell in that group. Can anyone confirm if this is the case? If so what did you do for isolation?
Is this still being developed?
Have been in contact with JK-bms sales reps to try to aks more details out of them. Basically the same info that we already have.
From what ive told, the CAN option doesnt support more than one connection?? Whats the point of going CAN then. Anyways from this I assumed they meant the units don't have isolated CAN, so the GND of each of the units is the bottom most cell in that group. Can anyone confirm if this is the case? If so what did you do for isolation?
Is this still being developed?
-
- Posts: 3337
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 84 times
- Been thanked: 262 times
- Contact:
Re: Master CAN module for Hankzor balancers
I am working on this its just that i dont have much spare time.thomaa wrote: ↑Wed Jun 26, 2024 2:17 am I've been looking around for BMS options and have landed on this project. I'm trying to prioritize cost and this seems most effective.
Have been in contact with JK-bms sales reps to try to aks more details out of them. Basically the same info that we already have.
From what ive told, the CAN option doesnt support more than one connection?? Whats the point of going CAN then. Anyways from this I assumed they meant the units don't have isolated CAN, so the GND of each of the units is the bottom most cell in that group. Can anyone confirm if this is the case? If so what did you do for isolation?
Is this still being developed?
I have some problems with ESP32 randomly freezing on receiving from more than 4 modules
Like i said those JK modules are not BMS but rather independent balancers with cell parameters reporting. That reporting can be done via Bluetooth or CAN.
CAN protocol is determined and it works really good. The issue is that those modules need to be set for unique ID number. Normaly this is set via DIP swithes by the balancer side. Table of values i posted here.
When IDs are determined each module needs to be pinged for it to reply with package of values. Those values i intend to package into a cell array and i can do lots with those values.
My intention is simple BMS report via 8byte CAN telegram:
- Pack voltage
- Pack temperature
- Vmax cell
- Vmax position in pack
- Vmin
- Vmin position in pack
- Balancer Error state
- ID Balancer in error
Error states would include:
- Cell UV
- Cell OV
- Balancer Overtemp
- any other error state reported from balancers
After that would work i intend to use an LILYGO® T-Display-S3 AMOLED ESP with CAN bus to display data from BMS and possible other inputs from CAN
- midway
- Posts: 87
- Joined: Mon Feb 15, 2021 3:52 pm
- Location: Ural
- Has thanked: 6 times
- Been thanked: 10 times
Re: Master CAN module for Hankzor balancers
The Kan bus in the balancers is isolated, according to the datasheet up to 1000 Voltsthomaa wrote: ↑Wed Jun 26, 2024 2:17 am I've been looking around for BMS options and have landed on this project. I'm trying to prioritize cost and this seems most effective.
Have been in contact with JK-bms sales reps to try to aks more details out of them. Basically the same info that we already have.
From what ive told, the CAN option doesnt support more than one connection?? Whats the point of going CAN then. Anyways from this I assumed they meant the units don't have isolated CAN, so the GND of each of the units is the bottom most cell in that group. Can anyone confirm if this is the case? If so what did you do for isolation?
Is this still being developed?
-
- Posts: 3337
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 84 times
- Been thanked: 262 times
- Contact:
Re: Master CAN module for Hankzor balancers
Just so that there is no doubt; I get traffic from modules, its just that after some 4th module report my ESP32 goes tits up and watchdog resets. As of yet I couldnt solve this issue.
Does anyone know of why such reset would happen? Allways at similar range....
I am leaning on to try with different chip, maybe STM32, but i need to build my board first...
- uhi22
- Posts: 793
- Joined: Mon Mar 14, 2022 3:20 pm
- Location: Ingolstadt/Germany
- Has thanked: 112 times
- Been thanked: 481 times
Re: Master CAN module for Hankzor balancers
The usual suspects when the ESP crashes are
- bad power supply of the ESP (unlikely in your situation I guess)
- bad espressif "CAN" driver software. Had some "nice" hours debugging, roughly documented here: https://github.com/uhi22/wifican/blob/m ... rashlog.md and came to the conclusion, that using ESP32 for CAN is like gambling, you may win or you may loose.
- bad espressif "CAN" hardware. This runs in undefined state when it gets the messages faster than the controller reads it. Fine for some single messages, bad for fast bursts. In my case this did not lead to crash, just the CAN reception was dead until restart.
- Finally a reset could also be triggered if you write some data into memory and declared the variable too small, so that you overwrite stack or OS data. E.g. if you declare an array of 10 bytes and write 100 bytes into it.
- bad power supply of the ESP (unlikely in your situation I guess)
- bad espressif "CAN" driver software. Had some "nice" hours debugging, roughly documented here: https://github.com/uhi22/wifican/blob/m ... rashlog.md and came to the conclusion, that using ESP32 for CAN is like gambling, you may win or you may loose.
- bad espressif "CAN" hardware. This runs in undefined state when it gets the messages faster than the controller reads it. Fine for some single messages, bad for fast bursts. In my case this did not lead to crash, just the CAN reception was dead until restart.
- Finally a reset could also be triggered if you write some data into memory and declared the variable too small, so that you overwrite stack or OS data. E.g. if you declare an array of 10 bytes and write 100 bytes into it.
Github: http://github.com/uhi22 --- Patreon: https://www.patreon.com/uhi22
-
- Posts: 8
- Joined: Tue Feb 06, 2024 3:55 pm
- Location: Melbourne, Australia
- Has thanked: 9 times
- Been thanked: 1 time
Re: Master CAN module for Hankzor balancers
Thanks for the prompt updates!
It looks like the sales rep I was speaking to didn't really know what they were talking about, so the inbuilt CAN is isolated. Does anyone have the datasheet?
I've ordered a few of these units, different vendor (directly off JK taobao store, JK B2A24S) and would love to help with the development of this once I get them. I had the same idea as arber for what the final product would be with the MCU master putting data onto the vehicle CAN, to be read by a cell status display and possibly VCU to impose power limits.
Is this project documented in more depth elsewhere? I saw the github links tom and arber have put up so far but that seems to be for software side. Sorry if this info is already here and im misinterpreting but is the BMS host/master integrated into the ESP32 VCU hardware that arber has designed?
It looks like the sales rep I was speaking to didn't really know what they were talking about, so the inbuilt CAN is isolated. Does anyone have the datasheet?
I've ordered a few of these units, different vendor (directly off JK taobao store, JK B2A24S) and would love to help with the development of this once I get them. I had the same idea as arber for what the final product would be with the MCU master putting data onto the vehicle CAN, to be read by a cell status display and possibly VCU to impose power limits.
Is this project documented in more depth elsewhere? I saw the github links tom and arber have put up so far but that seems to be for software side. Sorry if this info is already here and im misinterpreting but is the BMS host/master integrated into the ESP32 VCU hardware that arber has designed?
-
- Posts: 3337
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 84 times
- Been thanked: 262 times
- Contact:
Re: Master CAN module for Hankzor balancers
Thanks for the thoughts.uhi22 wrote: ↑Wed Jun 26, 2024 1:32 pm The usual suspects when the ESP crashes are
- bad power supply of the ESP (unlikely in your situation I guess)
- bad espressif "CAN" driver software. Had some "nice" hours debugging, roughly documented here: https://github.com/uhi22/wifican/blob/m ... rashlog.md and came to the conclusion, that using ESP32 for CAN is like gambling, you may win or you may loose.
- bad espressif "CAN" hardware. This runs in undefined state when it gets the messages faster than the controller reads it. Fine for some single messages, bad for fast bursts. In my case this did not lead to crash, just the CAN reception was dead until restart.
- Finally a reset could also be triggered if you write some data into memory and declared the variable too small, so that you overwrite stack or OS data. E.g. if you declare an array of 10 bytes and write 100 bytes into it.
For a while now i suspected MCP2515 controler is not up to the task with code from Collin Kidder. After a brief discusion with him i decided to replace 2515 with MCP2517FD chip. It seems that is more supported with his code.
After some time fiddling with circuit i sent some new boards to be made to JLPCB. After soldering i tested the new board. Inbuilt CAN works great, but external SPI module wouldnt start. It all came down to oscillator. I use 20Mhz crystal and in code i had SPI speed set to 20Mhz. It seems that is not ideal. 10Mhz is better i guess. After i played with the settings in header file i set "#define FD_SPI_SPEED 10000000"
I also tweaked my Watchdog code so that it will observe shorter period of 2s. It seems this works better.
Now both CAN bus lines work at different speeds. CAN0 meant for BMS operates at 250kbaud and CAN1 meant to transmitt 0x285 telegram will work at 500kbaud. I need to test this for integration... will get back to you.
![Cool 8-)](./images/smilies/icon_cool.png)
EDIT: Seems the best crystal to use with Collin Kidders code would be 40Mhz. I just need to get one crystal to test...
- midway
- Posts: 87
- Joined: Mon Feb 15, 2021 3:52 pm
- Location: Ural
- Has thanked: 6 times
- Been thanked: 10 times
Re: Master CAN module for Hankzor balancers
The balancer has a VP1050 chip installedthomaa wrote: ↑Wed Jun 26, 2024 2:04 pm Thanks for the prompt updates!
It looks like the sales rep I was speaking to didn't really know what they were talking about, so the inbuilt CAN is isolated. Does anyone have the datasheet?
I've ordered a few of these units, different vendor (directly off JK taobao store, JK B2A24S) and would love to help with the development of this once I get them. I had the same idea as arber for what the final product would be with the MCU master putting data onto the vehicle CAN, to be read by a cell status display and possibly VCU to impose power limits.
Is this project documented in more depth elsewhere? I saw the github links tom and arber have put up so far but that seems to be for software side. Sorry if this info is already here and im misinterpreting but is the BMS host/master integrated into the ESP32 VCU hardware that arber has designed?
- Attachments
-
0e04cae0a3a92de461730477.pdf
- (1.19 MiB) Downloaded 23 times