syssi / esphome-jk-bms

ESPHome component to monitor and control a Jikong Battery Management System (JK-BMS) via UART-TTL or BLE
Apache License 2.0
483 stars 163 forks source link

How to implement the offset of the `JK02_32S` frame (software version 11) #326

Closed sralus closed 1 year ago

sralus commented 1 year ago

Hello I know that there is a slightly different protocol here, but maybe you can help me with these two values? I got a new JKBMS: (JK-BMS has the hardware ver V11.XW - software ver V11.26 and version V4.10.1) and had to increase all receivedBytes_main by 32 so that I can read the values.

This works:

Average_Cell_Voltage = (((int)receivedBytes_main[91] << 8 | receivedBytes_main[90])*0.001);
//Average_Cell_Voltage = (((int)receivedBytes_main[59] << 8 | receivedBytes_main[58])*0.001);

all data are read except these two: This not ?:

Delta_Cell_Voltage = (((int)receivedBytes_main[93] << 8 | receivedBytes_main[92])*0.001);
//Delta_Cell_Voltage = (((int)receivedBytes_main[61] << 8 | receivedBytes_main[60])*0.001);

and this does not work either:

//MOS_Temp = (((int)receivedBytes_main[135] << 8 | receivedBytes_main[134])*0.1);
if(receivedBytes_main[167] == 0xFF) {
MOS_Temp = ((0xFF << 24 | 0xFF << 16 | (int)receivedBytes_main[167] << 8 | (int)receivedBytes_main[166])*0.1);
}
else {
MOS_Temp = (((int)receivedBytes_main[167] << 8 | (int)receivedBytes_main[166])*0.1);
}

does one of you have an idea which values should I use for Delta_Cell_Voltage & MOS_Temp have to register?

Thank you in advance

syssi commented 1 year ago

Power tube / mosfet temperature: https://github.com/syssi/esphome-jk-bms/blob/main/components/jk_bms_ble/jk_bms_ble.cpp#LL555C1-L555C119

You should find the mosfet temperature starting at position 112 + 32 (2 bytes).

https://github.com/syssi/esphome-jk-bms/blob/main/components/jk_bms_ble/jk_bms_ble.cpp#L539

The delta cell voltage starts a position 60 + 16 (2 bytes).