Friday, 4 December 2026

Testing CAN bus on Mint Linux laptop

[Fri 4th Dec 2026]

(09:59) Will next get my Waveshare code to decode SOC and SOH and Total Voltage. And get it under local git..





(base) coderdojo@rhubarb:~/Arduino/Waveshare ESP32-S3-RS485-CAN/WAVESHARE Sungrow v1/Arduino/examples/MAIN_WIFI_STA$ ls
MAIN_WIFI_STA.ino  WS_CAN.cpp  WS_CAN.h  WS_GPIO.cpp  WS_GPIO.h  WS_Information.h  WS_MQTT.cpp  WS_MQTT.h  WS_Secrets.h  WS_Struct.h  WS_WIFI.cpp  WS_WIFI.h
(base) coderdojo@rhubarb:~/Arduino/Waveshare ESP32-S3-RS485-CAN/WAVESHARE Sungrow v1/Arduino/examples/MAIN_WIFI_STA$  
(base) coderdojo@rhubarb:~/Arduino/Waveshare ESP32-S3-RS485-CAN/WAVESHARE Sungrow v1/Arduino/examples/MAIN_WIFI_STA$  
(base) coderdojo@rhubarb:~/Arduino/Waveshare ESP32-S3-RS485-CAN/WAVESHARE Sungrow v1/Arduino/examples/MAIN_WIFI_STA$ git status
On branch master
nothing to commit, working tree clean
(base) coderdojo@rhubarb:~/Arduino/Waveshare ESP32-S3-RS485-CAN/WAVESHARE Sungrow v1/Arduino/examples/MAIN_WIFI_STA$  
(base) coderdojo@rhubarb:~/Arduino/Waveshare ESP32-S3-RS485-CAN/WAVESHARE Sungrow v1/Arduino/examples/MAIN_WIFI_STA$ date
Fri 04 Dec 2026 10:12:39 GMT
(base) coderdojo@rhubarb:~/Arduino/Waveshare ESP32-S3-RS485-CAN/WAVESHARE Sungrow v1/Arduino/examples/MAIN_WIFI_STA$ 


Nice punchy GIT guide

https://rogerdudler.github.io/git-guide/


(10:43) Now back to coding and inline documenting...

https://www.doxygen.nl/manual/starting.html


(base) coderdojo@rhubarb:~/Arduino/Waveshare ESP32-S3-RS485-CAN/WAVESHARE Sungrow v1/Arduino/examples/MAIN_WIFI_STA$  
(base) coderdojo@rhubarb:~/Arduino/Waveshare ESP32-S3-RS485-CAN/WAVESHARE Sungrow v1/Arduino/examples/MAIN_WIFI_STA$ git status
On branch master
nothing to commit, working tree clean
(base) coderdojo@rhubarb:~/Arduino/Waveshare ESP32-S3-RS485-CAN/WAVESHARE Sungrow v1/Arduino/examples/MAIN_WIFI_STA$  
(base) coderdojo@rhubarb:~/Arduino/Waveshare ESP32-S3-RS485-CAN/WAVESHARE Sungrow v1/Arduino/examples/MAIN_WIFI_STA$ git log
commit 992db2b1d9adfd83278f0ac2161db8b0adf32120 (HEAD -> master)
Author: Tony Walsh <kilnageer@gmail.com>
Date:   Fri Dec 4 15:53:38 2026 +0000

   (Fri 4th Dec 2026 15:45) Sungrow CAN & MQTT v1.5

commit af2580ea59897a87c92640473d7859fe2f0f2dfc
Author: Tony Walsh <kilnageer@gmail.com>
Date:   Fri Dec 4 10:12:04 2026 +0000

   (Thu 3rd Dec 2026 21:52) Sungrow CAN & MQTT v1.4
(base) coderdojo@rhubarb:~/Arduino/Waveshare ESP32-S3-RS485-CAN/WAVESHARE Sungrow v1/Arduino/examples/MAIN_WIFI_STA$  
(base) coderdojo@rhubarb:~/Arduino/Waveshare ESP32-S3-RS485-CAN/WAVESHARE Sungrow v1/Arduino/examples/MAIN_WIFI_STA$ git tag 1.4.0 992db2b1d9
(base) coderdojo@rhubarb:~/Arduino/Waveshare ESP32-S3-RS485-CAN/WAVESHARE Sungrow v1/Arduino/examples/MAIN_WIFI_STA$ date
Fri 04 Dec 2026 15:55:39 GMT
(base) coderdojo@rhubarb:~/Arduino/Waveshare ESP32-S3-RS485-CAN/WAVESHARE Sungrow v1/Arduino/examples/MAIN_WIFI_STA$

Have stuff to fix!


15:46:59.833 -> Build:Mar 27 2021
15:46:59.833 -> rst:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT)
15:46:59.833 -> Saved PC:0x40378eb4
15:46:59.833 -> SPIWP:0xee
15:46:59.833 -> mode:DIO, clock div:1
15:46:59.833 -> load:0x3fce2820,len:0x10cc
15:46:59.833 -> load:0x403c8700,len:0xc2c
15:46:59.903 -> load:0x403cb700,len:0x30c0
15:46:59.903 -> entry 0x403c88b8
15:47:01.059 -> (Fri 4th Dec 2026 15:45) Sungrow CAN & MQTT v1.5 
15:47:01.059 -> CAN Driver installed
15:47:01.059 -> CAN Driver started
15:47:01.059 -> CAN Alerts reconfigured
15:47:03.115 -> ..Connect to the Tola Park WiFi network at IP Address: 192.168.1.186
15:47:04.143 -> MQTT connection established
15:47:04.640 -> Message queued for transmission
15:47:04.640 -> Message queued for transmission
15:47:04.640 -> Message queued for transmission
15:47:04.640 -> Message queued for transmission
15:47:04.640 -> Message queued for transmission
15:47:04.640 -> Message queued for transmission
15:47:04.673 -> Alert: TWAI controller has become error passive.
15:47:05.038 -> Note if there are other devices on the CAN bus (other devices must be present) and that the rate of the device is the same as set in this program
15:47:05.635 -> Failed to queue message for transmission
15:47:06.629 -> Failed to queue message for transmission
15:47:07.624 -> Failed to queue message for transmission
15:47:08.652 -> Failed to queue message for transmission
15:47:09.646 -> Failed to queue message for transmission
15:47:10.044 -> Note if there are other devices on the CAN bus (other devices must be present) and that the rate of the device is the same as set in this program
15:47:10.641 -> Failed to queue message for transmission


(19:09) Problems with code. Some kind of internal Arduino errors. Maybe best to move to PlatformIO so I can do clean builds and get full visibility!





[Thurs 3rd Dec 2026]

(12:30) Sent captured Sungrow CAN comms to Gemini to decode :)



The Sungrow SH3.0RS is using the Sungrow / BYD High-Voltage (HV) CAN bus protocol at 500 kbps (which differs from the Pylontech HV protocol that typically uses 0x4200/0x4210 extended IDs, or Pylontech LV which uses 0x305/0x351/0x355/0x356).

Specifically, the inverter is broadcasting its heartbeats and inverter state/info frames (0x102 and 0x103) every second while waiting for the BMS to continuously broadcast its telemetry frames (0x150–0x190). It does not require a strict synchronous "request-reply" handshake; instead, it expects a periodic stream of BMS frames.

1. Breakdown of the Inverter's Frames in Your Capture

 * CAN ID 0x102 (Inverter Status / Command):

   * Payload: 0x52 0x00 0x00 0x01 0x05 0x00 0x04 0x00

   * Meaning: Byte 0 (0x52 = ASCII 'R') indicates the inverter is Ready / Standby and polling for a valid battery. The remaining bytes convey inverter operating mode, contactor state requests, and fault/status flags.

 * CAN ID 0x103 (Inverter Model / Serial Info):

   * Payload: 0x00 0x41 0x32 0x32 0x34 0x32 0x35 0x30

   * Meaning: Bytes 1–7 decode directly to the ASCII string A224250, which is part of your SH3.0RS inverter's serial number/model identifier.

2. Required BMS Response Frames (Sungrow / BYD HV Protocol)

To clear the battery communication fault (Error 703 / 714) and bring the DC bus online, your BMS emulator needs to transmit the following Standard 11-bit CAN frames at 500 kbps every 200 ms to 1000 ms (little-endian byte order for multi-byte values):

| CAN ID | Frame Purpose | Byte Layout (8 Bytes) & Scaling |

|---|---|---|

| 0x150 | Charge / Discharge Limits | • Bytes 0–1: Max Charge Voltage (0.1 V per bit, e.g., 400.0 V = 4000 = 0xA0 0x0F)

• Bytes 2–3: Min Discharge Voltage (0.1 V per bit, e.g., 320.0 V = 3200 = 0x80 0x0C)

• Bytes 4–5: Max Charge Current (0.1 A per bit, e.g., 25.0 A = 250 = 0xFA 0x00)

• Bytes 6–7: Max Discharge Current (0.1 A per bit, e.g., 25.0 A = 250 = 0xFA 0x00) |

| 0x151 | SOC, SOH & Capacity | • Bytes 0–1: SOC (0.1% per bit, e.g., 80.0% = 800 = 0x20 0x03)

• Bytes 2–3: SOH (0.1% per bit, e.g., 100.0% = 1000 = 0xE8 0x03)

• Bytes 4–5: Remaining Capacity (0.1 Ah per bit)

• Bytes 6–7: Total Capacity (0.1 Ah per bit) |

| 0x152 | Battery Voltage, Current & Temp | • Bytes 0–1: Pack Voltage (0.1 V per bit)

• Bytes 2–3: Pack Current (0.1 A per bit, signed int16; positive = discharge, negative = charge, or vice versa depending on firmware—verify on first live read)

• Bytes 4–5: Average Cell Temp (0.1 °C per bit, signed int16, e.g., 25.0 °C = 250 = 0xFA 0x00)

• Bytes 6–7: Status / Contactor State (0x01 0x00 or 0x02 0x00 for normal/ready) |

| 0x153 | Cell Extremes (Min/Max) | • Bytes 0–1: Max Cell Voltage (1 mV per bit, e.g., 3350 mV = 0x16 0x0D)

• Bytes 2–3: Min Cell Voltage (1 mV per bit, e.g., 3340 mV = 0x0C 0x0D)

• Bytes 4–5: Max Cell Temp (0.1 °C per bit)

• Bytes 6–7: Min Cell Temp (0.1 °C per bit) |

| 0x154 | Alarms & Warnings | • Bytes 0–7: Bitmask of protection/warning flags. Send all zeros (0x00 × 8) when healthy. |

| 0x190 | BMS Manufacturer / Version | • Bytes 0–7: Battery brand/firmware identifier (e.g., ASCII "BYD" or "SUNGROW" padded with 0x00 or 0x20, sent every 1–2 seconds). |

3. Quick Verification Tips for Your Setup

 * Switch Protocol Definition: Because your inverter is sending 0x102 and 0x103, its battery setting is configured for Sungrow / BYD HV (not Pylontech HV, which uses 29-bit extended frames like 0x04210000 / 0x1871). Make sure your Python script uses is_extended_id=False in python-can.

 * Voltage Range Check: The SH3.0RS is a high-voltage hybrid inverter with a battery input window of roughly 80 V to 460 V (nominal ~200 V–400 V). If your emulated 0x150 / 0x152 voltage is outside the inverter's configured battery minimum/maximum threshold, the inverter will acknowledge the CAN frames (clearing the comms error) but refuse to close its DC relay.

 * Testing via the Web UI: You can test whether the inverter recognizes the bus right from that web interface (192.168.4.1) by sending a burst of 0x150, 0x151, and 0x152 frames—the inverter will typically change Byte 0 of 0x102 from 0x52 ('R') once it sees valid 0x150–0x154 traffic.

Would you like a quick python-can snippet formatted with these exact 0x150–0x190 byte packers to test against your SH3.0RS?

(14:18) So job one is to get data from JK-BMS. I will use ESPHome and a ESP32-C3 to get this into MQTT...

Then I will update the Waveshare Arduino IDE code to monitor this MQTT JK-BMS 96V battery data and compose suitable CAN messages to keep the Sungrow inverter happy :)


(base) coderdojo@rhubarb:~$  
(base) coderdojo@rhubarb:~$  
(base) coderdojo@rhubarb:~$  
(base) coderdojo@rhubarb:~$ mosquitto_sub -h <LOCAL HA IP> -p 1883 -u homeassistant -P <HA_PASSWORD> -t esp32c3-96v-jk-bms/# -v
esp32c3-96v-jk-bms/debug [D][jk_bms_ble:1303]: Battery voltage: 128.54 V
esp32c3-96v-jk-bms/binary_sensor/charging/state ON
esp32c3-96v-jk-bms/binary_sensor/discharging/state ON
esp32c3-96v-jk-bms/binary_sensor/balancing/state ON
esp32c3-96v-jk-bms/binary_sensor/heating/state OFF
esp32c3-96v-jk-bms/binary_sensor/dry_contact_1/state OFF
esp32c3-96v-jk-bms/binary_sensor/dry_contact_2/state OFF
esp32c3-96v-jk-bms/binary_sensor/online_status/state ON
esp32c3-96v-jk-bms/number/smart_sleep_voltage/state 4.150000
esp32c3-96v-jk-bms/number/cell_voltage_undervoltage_protection/state 2.820000
esp32c3-96v-jk-bms/number/cell_voltage_undervoltage_recovery/state 2.850000
esp32c3-96v-jk-bms/number/cell_voltage_overvoltage_protection/state 4.200000
esp32c3-96v-jk-bms/number/cell_voltage_overvoltage_recovery/state 4.170000
esp32c3-96v-jk-bms/number/balance_trigger_voltage/state 0.010000
esp32c3-96v-jk-bms/number/cell_soc100_voltage/state 4.180000
esp32c3-96v-jk-bms/number/cell_soc0_voltage/state 2.840000
esp32c3-96v-jk-bms/number/cell_request_charge_voltage/state 4.190000
esp32c3-96v-jk-bms/number/cell_request_float_voltage/state 4.100000
esp32c3-96v-jk-bms/number/cell_request_charge_voltage_time/state 0.500000
esp32c3-96v-jk-bms/number/cell_request_float_voltage_time/state 5.000000
esp32c3-96v-jk-bms/number/re-bulk_soc/state 1.000000
esp32c3-96v-jk-bms/number/cell_count/state 32.000000
esp32c3-96v-jk-bms/number/total_battery_capacity/state 40.000000
esp32c3-96v-jk-bms/number/balancing_start_voltage/state 3.000000
esp32c3-96v-jk-bms/number/power_off_voltage/state 2.800000
esp32c3-96v-jk-bms/number/max_balance_current/state 0.600000
esp32c3-96v-jk-bms/number/max_charge_current/state 100.000008
esp32c3-96v-jk-bms/number/max_discharge_current/state 100.000008
esp32c3-96v-jk-bms/number/charge_overcurrent_protection_delay/state 60.000000
esp32c3-96v-jk-bms/number/charge_overcurrent_protection_recovery_time/state 60.000000
esp32c3-96v-jk-bms/number/discharge_overcurrent_protection_delay/state 300.000000
esp32c3-96v-jk-bms/number/discharge_overcurrent_protection_recovery_time/state 60.000000
esp32c3-96v-jk-bms/number/short_circuit_protection_delay/state 5.000000
esp32c3-96v-jk-bms/number/short_circuit_protection_recovery_time/state 5.000000
esp32c3-96v-jk-bms/number/charge_overtemperature_protection/state 70.000000
esp32c3-96v-jk-bms/number/charge_overtemperature_protection_recovery/state 60.000000
esp32c3-96v-jk-bms/number/discharge_overtemperature_protection/state 70.000000
esp32c3-96v-jk-bms/number/discharge_overtemperature_protection_recovery/state 60.000000
esp32c3-96v-jk-bms/number/charge_undertemperature_protection/state -10.000000
esp32c3-96v-jk-bms/number/charge_undertemperature_protection_recovery/state 0.000000
esp32c3-96v-jk-bms/number/discharge_undertemperature_protection/state -35.000000
esp32c3-96v-jk-bms/number/discharge_undertemperature_protection_recovery/state -30.000000
esp32c3-96v-jk-bms/number/mosfet_overtemperature_protection/state 80.000000
esp32c3-96v-jk-bms/number/mosfet_overtemperature_protection_recovery/state 70.000000
esp32c3-96v-jk-bms/number/discharge_precharge_time/state 5.000000
esp32c3-96v-jk-bms/number/heating_start_temperature/state -10.000000
esp32c3-96v-jk-bms/number/heating_stop_temperature/state 0.000000
esp32c3-96v-jk-bms/number/smart_sleep_delay/state 24.000000
esp32c3-96v-jk-bms/number/emergency_duration/state 30.000000
esp32c3-96v-jk-bms/status online
esp32c3-96v-jk-bms/sensor/cell_voltage_1/state 4.017
esp32c3-96v-jk-bms/sensor/cell_voltage_2/state 4.014
esp32c3-96v-jk-bms/sensor/cell_voltage_3/state 4.017
esp32c3-96v-jk-bms/sensor/cell_voltage_4/state 4.017
esp32c3-96v-jk-bms/sensor/cell_voltage_5/state 4.018
esp32c3-96v-jk-bms/sensor/cell_voltage_6/state 4.018
esp32c3-96v-jk-bms/sensor/cell_voltage_7/state 4.015
esp32c3-96v-jk-bms/sensor/cell_voltage_8/state 4.017
esp32c3-96v-jk-bms/sensor/cell_voltage_9/state 4.017
esp32c3-96v-jk-bms/sensor/cell_voltage_10/state 4.015
esp32c3-96v-jk-bms/sensor/cell_voltage_11/state 4.024
esp32c3-96v-jk-bms/sensor/cell_voltage_12/state 4.021
esp32c3-96v-jk-bms/sensor/cell_voltage_13/state 4.017
esp32c3-96v-jk-bms/sensor/cell_voltage_14/state 4.017
esp32c3-96v-jk-bms/sensor/cell_voltage_15/state 4.035
esp32c3-96v-jk-bms/sensor/cell_voltage_16/state 4.015
esp32c3-96v-jk-bms/sensor/cell_voltage_17/state 4.015
esp32c3-96v-jk-bms/sensor/cell_voltage_18/state 4.014
esp32c3-96v-jk-bms/sensor/cell_voltage_19/state 4.014
esp32c3-96v-jk-bms/sensor/cell_voltage_20/state 4.017
esp32c3-96v-jk-bms/sensor/cell_voltage_21/state 4.021
esp32c3-96v-jk-bms/sensor/cell_voltage_22/state 4.014
esp32c3-96v-jk-bms/sensor/cell_voltage_23/state 4.012
esp32c3-96v-jk-bms/sensor/cell_voltage_24/state 4.014
esp32c3-96v-jk-bms/sensor/cell_voltage_25/state 4.014
esp32c3-96v-jk-bms/sensor/cell_voltage_26/state 4.067
esp32c3-96v-jk-bms/sensor/cell_voltage_27/state 4.012
esp32c3-96v-jk-bms/sensor/cell_voltage_28/state 4.014
esp32c3-96v-jk-bms/sensor/cell_voltage_29/state 4.011
esp32c3-96v-jk-bms/sensor/cell_voltage_30/state 4.014
esp32c3-96v-jk-bms/sensor/cell_voltage_31/state 4.011
esp32c3-96v-jk-bms/sensor/cell_voltage_32/state 4.011
esp32c3-96v-jk-bms/sensor/cell_resistance_1/state 0.195
esp32c3-96v-jk-bms/sensor/cell_resistance_2/state 0.191
esp32c3-96v-jk-bms/sensor/cell_resistance_3/state 0.196
esp32c3-96v-jk-bms/sensor/cell_resistance_4/state 0.190
esp32c3-96v-jk-bms/sensor/cell_resistance_5/state 0.173
esp32c3-96v-jk-bms/sensor/cell_resistance_6/state 0.163
esp32c3-96v-jk-bms/sensor/cell_resistance_7/state 0.162
esp32c3-96v-jk-bms/sensor/cell_resistance_8/state 0.222
esp32c3-96v-jk-bms/sensor/cell_resistance_9/state 0.204
esp32c3-96v-jk-bms/sensor/cell_resistance_10/state 0.173
esp32c3-96v-jk-bms/sensor/cell_resistance_11/state 0.163
esp32c3-96v-jk-bms/sensor/cell_resistance_12/state 0.175
esp32c3-96v-jk-bms/sensor/cell_resistance_13/state 0.166
esp32c3-96v-jk-bms/sensor/cell_resistance_14/state 0.195
esp32c3-96v-jk-bms/sensor/cell_resistance_15/state 0.176
esp32c3-96v-jk-bms/sensor/cell_resistance_16/state 0.170
esp32c3-96v-jk-bms/sensor/cell_resistance_17/state 0.179
esp32c3-96v-jk-bms/sensor/cell_resistance_18/state 0.177
esp32c3-96v-jk-bms/sensor/cell_resistance_19/state 0.163
esp32c3-96v-jk-bms/sensor/cell_resistance_20/state 0.208
esp32c3-96v-jk-bms/sensor/cell_resistance_21/state 0.181
esp32c3-96v-jk-bms/sensor/cell_resistance_22/state 0.166
esp32c3-96v-jk-bms/sensor/cell_resistance_23/state 0.168
esp32c3-96v-jk-bms/sensor/cell_resistance_24/state 0.214
esp32c3-96v-jk-bms/sensor/cell_resistance_25/state 0.187
esp32c3-96v-jk-bms/sensor/cell_resistance_26/state 0.184
esp32c3-96v-jk-bms/sensor/cell_resistance_27/state 0.178
esp32c3-96v-jk-bms/sensor/cell_resistance_28/state 0.179
esp32c3-96v-jk-bms/sensor/cell_resistance_29/state 0.207
esp32c3-96v-jk-bms/sensor/cell_resistance_30/state 0.208
esp32c3-96v-jk-bms/sensor/cell_resistance_31/state 0.170
esp32c3-96v-jk-bms/sensor/cell_resistance_32/state 0.209
esp32c3-96v-jk-bms/sensor/temperature_sensor_1/state 19.1
esp32c3-96v-jk-bms/sensor/temperature_sensor_2/state 19.5
esp32c3-96v-jk-bms/sensor/temperature_sensor_5/state 21.0
esp32c3-96v-jk-bms/sensor/balancer_status_bitmask/state 1
esp32c3-96v-jk-bms/sensor/min_cell_voltage/state 4.011
esp32c3-96v-jk-bms/sensor/max_cell_voltage/state 4.067
esp32c3-96v-jk-bms/sensor/min_voltage_cell/state 29
esp32c3-96v-jk-bms/sensor/max_voltage_cell/state 26
esp32c3-96v-jk-bms/sensor/delta_cell_voltage/state 0.056
esp32c3-96v-jk-bms/sensor/average_cell_voltage/state 4.018
esp32c3-96v-jk-bms/sensor/total_voltage/state 128.540
esp32c3-96v-jk-bms/sensor/current/state 0.00
esp32c3-96v-jk-bms/sensor/power/state 0.00
esp32c3-96v-jk-bms/sensor/charging_power/state 0.00
esp32c3-96v-jk-bms/sensor/discharging_power/state 0.00
esp32c3-96v-jk-bms/sensor/mosfet_temperature/state 21.0
esp32c3-96v-jk-bms/sensor/state_of_charge/state 94
esp32c3-96v-jk-bms/sensor/state_of_health/state 100
esp32c3-96v-jk-bms/sensor/capacity_remaining/state 37.437
esp32c3-96v-jk-bms/sensor/full_charge_capacity/state 40
esp32c3-96v-jk-bms/sensor/charging_cycles/state 0
esp32c3-96v-jk-bms/sensor/total_charging_cycle_capacity/state 0.001
esp32c3-96v-jk-bms/sensor/total_runtime/state 53396
esp32c3-96v-jk-bms/sensor/power_on_count/state 42
esp32c3-96v-jk-bms/sensor/balancing_current/state 0.63
esp32c3-96v-jk-bms/sensor/emergency_time_countdown/state 0
esp32c3-96v-jk-bms/sensor/smart_sleep_countdown/state 86400
esp32c3-96v-jk-bms/sensor/heating_current/state 0.00
esp32c3-96v-jk-bms/sensor/charge_status_id/state 0
esp32c3-96v-jk-bms/sensor/charge_status_time_elapsed/state 0
esp32c3-96v-jk-bms/sensor/detail_log_entry_count/state 206
esp32c3-96v-jk-bms/sensor/battery_type_id/state 1
esp32c3-96v-jk-bms/sensor/uart1_protocols_enabled_bitmask/state 92159
esp32c3-96v-jk-bms/sensor/uart2_protocols_enabled_bitmask/state 26623
esp32c3-96v-jk-bms/sensor/uart3_protocols_enabled_bitmask/state 0
esp32c3-96v-jk-bms/sensor/can_protocols_enabled_bitmask/state 4095
esp32c3-96v-jk-bms/sensor/errors/state Modify password in time
esp32c3-96v-jk-bms/sensor/errors_bitmask_hex/state 0x00080000
esp32c3-96v-jk-bms/sensor/balancer_status/state Charge balancing
esp32c3-96v-jk-bms/sensor/total_runtime_formatted/state 14h
esp32c3-96v-jk-bms/sensor/charge_status/state Bulk
esp32c3-96v-jk-bms/sensor/software_version/state 20.11
esp32c3-96v-jk-bms/sensor/hardware_version/state 20H
esp32c3-96v-jk-bms/sensor/battery_type/state Li-ion
esp32c3-96v-jk-bms/sensor/device_model/state JK-BD6A32S10P
esp32c3-96v-jk-bms/sensor/manufacturing_date/state 20260917
esp32c3-96v-jk-bms/sensor/serial_number/state 604135B6C00
esp32c3-96v-jk-bms/switch/charging/state ON
esp32c3-96v-jk-bms/switch/discharging/state ON
esp32c3-96v-jk-bms/switch/balancer/state ON
esp32c3-96v-jk-bms/switch/emergency/state OFF
esp32c3-96v-jk-bms/switch/heating/state OFF
esp32c3-96v-jk-bms/switch/disable_temperature_sensors/state OFF
esp32c3-96v-jk-bms/switch/display_always_on/state ON
esp32c3-96v-jk-bms/switch/smart_sleep/state OFF
esp32c3-96v-jk-bms/switch/disable_pcl_module/state ON
esp32c3-96v-jk-bms/switch/timed_stored_data/state OFF
esp32c3-96v-jk-bms/switch/charging_float_mode/state OFF
esp32c3-96v-jk-bms/switch/emergency_button_trigger/state OFF
esp32c3-96v-jk-bms/switch/dry_contact_alarm_intermittent/state OFF
esp32c3-96v-jk-bms/switch/discharge_overcurrent_protection_2/state ON
esp32c3-96v-jk-bms/switch/discharge_overcurrent_protection_3/state ON
esp32c3-96v-jk-bms/switch/gps_locked_charging/state OFF
esp32c3-96v-jk-bms/switch/gps_locked_discharging/state OFF
esp32c3-96v-jk-bms/switch/enable_bluetooth_connection/state ON
esp32c3-96v-jk-bms/select/uart1_protocol/state 4G-GPS Remote module Common protocol V4.2
esp32c3-96v-jk-bms/select/uart2_protocol/state JK BMS RS485 Modbus V1.0
esp32c3-96v-jk-bms/select/uart3_protocol/state JK BMS LCD Protocol V2.0
esp32c3-96v-jk-bms/select/can_protocol/state JK BMS CAN Protocol (250K) V2.0
esp32c3-96v-jk-bms/select/lcd_buzzer_trigger/state MOSFET Over Temperature
esp32c3-96v-jk-bms/select/dry1_trigger/state Battery Over Temperature
esp32c3-96v-jk-bms/select/dry2_trigger/state Off
esp32c3-96v-jk-bms/select/protocol_mode/state CAN
esp32c3-96v-jk-bms/debug [I][jk_bms_ble:1066]: Cell info frame (version 3, 300 bytes) received
esp32c3-96v-jk-bms/sensor/cell_voltage_1/state 4.015
esp32c3-96v-jk-bms/sensor/cell_resistance_1/state 0.195
esp32c3-96v-jk-bms/sensor/cell_voltage_2/state 4.014
esp32c3-96v-jk-bms/sensor/cell_resistance_2/state 0.191
esp32c3-96v-jk-bms/sensor/cell_voltage_3/state 4.014
esp32c3-96v-jk-bms/sensor/cell_resistance_3/state 0.196
esp32c3-96v-jk-bms/sensor/cell_voltage_4/state 4.017
esp32c3-96v-jk-bms/sensor/cell_resistance_4/state 0.190
esp32c3-96v-jk-bms/sensor/cell_voltage_5/state 4.021
esp32c3-96v-jk-bms/sensor/cell_resistance_5/state 0.173
esp32c3-96v-jk-bms/sensor/cell_voltage_6/state 4.017
esp32c3-96v-jk-bms/sensor/cell_resistance_6/state 0.163
esp32c3-96v-jk-bms/sensor/cell_voltage_7/state 4.017
esp32c3-96v-jk-bms/sensor/cell_resistance_7/state 0.162
esp32c3-96v-jk-bms/sensor/cell_voltage_8/state 4.018
esp32c3-96v-jk-bms/sensor/cell_resistance_8/state 0.222
esp32c3-96v-jk-bms/sensor/cell_voltage_9/state 4.017
esp32c3-96v-jk-bms/sensor/cell_resistance_9/state 0.204
esp32c3-96v-jk-bms/sensor/cell_voltage_10/state 4.017
esp32c3-96v-jk-bms/sensor/cell_resistance_10/state 0.173
esp32c3-96v-jk-bms/sensor/cell_voltage_11/state 4.024
esp32c3-96v-jk-bms/sensor/cell_resistance_11/state 0.163
esp32c3-96v-jk-bms/sensor/cell_voltage_12/state 4.024
esp32c3-96v-jk-bms/sensor/cell_resistance_12/state 0.175
esp32c3-96v-jk-bms/sensor/cell_voltage_13/state 4.012
esp32c3-96v-jk-bms/sensor/cell_resistance_13/state 0.166
esp32c3-96v-jk-bms/sensor/cell_voltage_14/state 4.015
esp32c3-96v-jk-bms/sensor/cell_resistance_14/state 0.195
esp32c3-96v-jk-bms/sensor/cell_voltage_15/state 4.033
esp32c3-96v-jk-bms/sensor/cell_resistance_15/state 0.176
esp32c3-96v-jk-bms/sensor/cell_voltage_16/state 4.014
esp32c3-96v-jk-bms/sensor/cell_resistance_16/state 0.170
esp32c3-96v-jk-bms/sensor/cell_voltage_17/state 4.015
esp32c3-96v-jk-bms/sensor/cell_resistance_17/state 0.179
esp32c3-96v-jk-bms/sensor/cell_voltage_18/state 4.015
esp32c3-96v-jk-bms/sensor/cell_resistance_18/state 0.177
esp32c3-96v-jk-bms/sensor/cell_voltage_19/state 4.014
esp32c3-96v-jk-bms/sensor/cell_resistance_19/state 0.163
esp32c3-96v-jk-bms/sensor/cell_voltage_20/state 4.017
esp32c3-96v-jk-bms/sensor/cell_resistance_20/state 0.208
esp32c3-96v-jk-bms/sensor/cell_voltage_21/state 4.021
esp32c3-96v-jk-bms/sensor/cell_resistance_21/state 0.181
esp32c3-96v-jk-bms/sensor/cell_voltage_22/state 4.012
esp32c3-96v-jk-bms/sensor/cell_resistance_22/state 0.166
esp32c3-96v-jk-bms/sensor/cell_voltage_23/state 4.014
esp32c3-96v-jk-bms/sensor/cell_resistance_23/state 0.168
esp32c3-96v-jk-bms/sensor/cell_voltage_24/state 4.014
esp32c3-96v-jk-bms/sensor/cell_resistance_24/state 0.214
esp32c3-96v-jk-bms/sensor/cell_voltage_25/state 4.014
esp32c3-96v-jk-bms/sensor/cell_resistance_25/state 0.187
esp32c3-96v-jk-bms/sensor/cell_voltage_26/state 4.023
esp32c3-96v-jk-bms/sensor/cell_resistance_26/state 0.184
esp32c3-96v-jk-bms/sensor/cell_voltage_27/state 4.012
esp32c3-96v-jk-bms/sensor/cell_resistance_27/state 0.178
esp32c3-96v-jk-bms/sensor/cell_voltage_28/state 4.015
esp32c3-96v-jk-bms/sensor/cell_resistance_28/state 0.179
esp32c3-96v-jk-bms/sensor/cell_voltage_29/state 4.012
esp32c3-96v-jk-bms/sensor/cell_resistance_29/state 0.207
esp32c3-96v-jk-bms/sensor/cell_voltage_30/state 4.014
esp32c3-96v-jk-bms/sensor/cell_resistance_30/state 0.208
esp32c3-96v-jk-bms/sensor/cell_voltage_31/state 4.012
esp32c3-96v-jk-bms/sensor/cell_resistance_31/state 0.170
esp32c3-96v-jk-bms/sensor/cell_voltage_32/state 4.153
esp32c3-96v-jk-bms/sensor/cell_resistance_32/state 0.209
esp32c3-96v-jk-bms/sensor/min_cell_voltage/state 4.012
esp32c3-96v-jk-bms/sensor/max_cell_voltage/state 4.153
esp32c3-96v-jk-bms/sensor/max_voltage_cell/state 32
esp32c3-96v-jk-bms/sensor/min_voltage_cell/state 13
esp32c3-96v-jk-bms/sensor/delta_cell_voltage/state 0.141
esp32c3-96v-jk-bms/sensor/average_cell_voltage/state 4.021
esp32c3-96v-jk-bms/sensor/mosfet_temperature/state 21.0
esp32c3-96v-jk-bms/sensor/total_voltage/state 128.661
esp32c3-96v-jk-bms/sensor/current/state 0.00
esp32c3-96v-jk-bms/sensor/power/state 0.00
esp32c3-96v-jk-bms/sensor/charging_power/state 0.00
esp32c3-96v-jk-bms/sensor/discharging_power/state 0.00
esp32c3-96v-jk-bms/sensor/temperature_sensor_1/state 19.1
esp32c3-96v-jk-bms/sensor/temperature_sensor_2/state 19.5
esp32c3-96v-jk-bms/sensor/errors_bitmask_hex/state 0x00080000
esp32c3-96v-jk-bms/sensor/errors/state Modify password in time
esp32c3-96v-jk-bms/sensor/balancing_current/state 0.64
esp32c3-96v-jk-bms/sensor/balancer_status_bitmask/state 1
esp32c3-96v-jk-bms/sensor/balancer_status/state Charge balancing
esp32c3-96v-jk-bms/sensor/state_of_charge/state 94
esp32c3-96v-jk-bms/sensor/capacity_remaining/state 37.437
esp32c3-96v-jk-bms/sensor/full_charge_capacity/state 40
esp32c3-96v-jk-bms/sensor/charging_cycles/state 0
esp32c3-96v-jk-bms/sensor/total_charging_cycle_capacity/state 0.001
esp32c3-96v-jk-bms/sensor/state_of_health/state 100
esp32c3-96v-jk-bms/debug [D][jk_bms_ble:1257]: User alarm: 0x00 0x00 (always 0xC5 0x09?)
esp32c3-96v-jk-bms/sensor/total_runtime/state 53402
esp32c3-96v-jk-bms/sensor/total_runtime_formatted/state 14h
esp32c3-96v-jk-bms/debug [D][jk_bms_ble:1270]: User alarm 2: 0x0000
esp32c3-96v-jk-bms/debug [D][jk_bms_ble:1284]: Temperature sensor presence bitmask: 0xFF
esp32c3-96v-jk-bms/debug [D][jk_bms_ble:1296]: Discharge current correction factor: 1
esp32c3-96v-jk-bms/debug [D][jk_bms_ble:1297]: Charging current sensor voltage: 0.000
esp32c3-96v-jk-bms/debug [D][jk_bms_ble:1298]: Discharging current sensor voltage: 0.000
esp32c3-96v-jk-bms/debug [D][jk_bms_ble:1300]: Battery voltage correction factor: 2.486148
esp32c3-96v-jk-bms/debug [D][jk_bms_ble:1303]: Battery voltage: 128.66 V
esp32c3-96v-jk-bms/sensor/heating_current/state 0.00
esp32c3-96v-jk-bms/sensor/smart_sleep_countdown/state 86400
esp32c3-96v-jk-bms/sensor/emergency_time_countdown/state 0
esp32c3-96v-jk-bms/sensor/temperature_sensor_5/state 21.0
esp32c3-96v-jk-bms/sensor/detail_log_entry_count/state 206
esp32c3-96v-jk-bms/sensor/battery_type_id/state 1
esp32c3-96v-jk-bms/sensor/battery_type/state Li-ion
esp32c3-96v-jk-bms/sensor/charge_status_time_elapsed/state 0
esp32c3-96v-jk-bms/sensor/charge_status_id/state 0
esp32c3-96v-jk-bms/sensor/charge_status/state Bulk


So next need to access this from the Waveshare code and generate the send these messages every 500mSec..


| 0x150 | Charge / Discharge Limits | • Bytes 0–1: Max Charge Voltage (0.1 V per bit, e.g., 400.0 V = 4000 = 0xA0 0x0F)

• Bytes 2–3: Min Discharge Voltage (0.1 V per bit, e.g., 320.0 V = 3200 = 0x80 0x0C)

• Bytes 4–5: Max Charge Current (0.1 A per bit, e.g., 25.0 A = 250 = 0xFA 0x00)

• Bytes 6–7: Max Discharge Current (0.1 A per bit, e.g., 25.0 A = 250 = 0xFA 0x00) |

So 0x150 [0x96, 0x00], 130V [0x82, 0x00] max charge voltage (32x 4.1V), 115V [0x73, 0x00] min discharge voltage (32x 3.6), 0.5A max charge current 10 [0x05, 0x00], 0.5A max discharge current [0x05, 0x00], 

0x96, 0x00,   0x82, 0x00,   0x73, 0x00,   0x05, 0x00,   0x05, 0x00,    xxxxxxxxx 


| 0x151 | SOC, SOH & Capacity | • Bytes 0–1: SOC (0.1% per bit, e.g., 80.0% = 800 = 0x20 0x03)

• Bytes 2–3: SOH (0.1% per bit, e.g., 100.0% = 1000 = 0xE8 0x03)

• Bytes 4–5: Remaining Capacity (0.1 Ah per bit)

• Bytes 6–7: Total Capacity (0.1 Ah per bit) |

So 0x151 [0x97, 0x00], 96% [0xC0, 0x03] SOC, 100% [0xE8, 0x03] SOH, 33.1 (3.5Ah x 96%) remaining capacity 3500mAh [0x21, 0x00], 3.5Ah total capacity [0x23, 0x00], 

0x97, 0x00,   0xC0, 0x03,   0xE8, 0x03,   0x21, 0x00,   0x23, 0x00,   xxxxxxxxx


| 0x152 | Battery Voltage, Current & Temp | • Bytes 0–1: Pack Voltage (0.1 V per bit)

• Bytes 2–3: Pack Current (0.1 A per bit, signed int16; positive = discharge, negative = charge, or vice versa depending on firmware—verify on first live read)

• Bytes 4–5: Average Cell Temp (0.1 °C per bit, signed int16, e.g., 25.0 °C = 250 = 0xFA 0x00)

• Bytes 6–7: Status / Contactor State (0x01 0x00 or 0x02 0x00 for normal/ready) |



| 0x153 | Cell Extremes (Min/Max) | • Bytes 0–1: Max Cell Voltage (1 mV per bit, e.g., 3350 mV = 0x16 0x0D)

• Bytes 2–3: Min Cell Voltage (1 mV per bit, e.g., 3340 mV = 0x0C 0x0D)

• Bytes 4–5: Max Cell Temp (0.1 °C per bit)

• Bytes 6–7: Min Cell Temp (0.1 °C per bit) |



| 0x154 | Alarms & Warnings | • Bytes 0–7: Bitmask of protection/warning flags. Send all zeros (0x00 × 8) when healthy. |



| 0x190 | BMS Manufacturer / Version | • Bytes 0–7: Battery brand/firmware identifier (e.g., ASCII "BYD" or "SUNGROW" padded with 0x00 or 0x20, sent every 1–2 seconds). |


Started coding Arduino IDE sketch to monitor CAN (from inverter) and MQTT (from battery) and respond on CAN to inverter with current SOC, SOH, etc.

22:08:08.373 -> (Thu 3rd Dec 2026 21:52) Sungrow CAN & MQTT v1.4 
22:08:08.373 -> CAN Driver installed
22:08:08.373 -> CAN Driver started
22:08:08.373 -> CAN Alerts reconfigured
22:08:10.429 -> ..Connect to the Tola Park WiFi network at IP Address: 192.168.1.186
22:08:11.425 -> ..returned from WiFi setup. MQTT next..
22:08:11.425 -> MQTT connection established







(10:26) Will connect the Waveshare to Sungrow to see if I get any blue LED flickers and anything on serial port log on laptop,

Documentation says pin 5 (CAN L) and pin 4 (CAN H) of RJ45 socket on Sungrow SH3.0RS (same as Gemini AI reported for JK-BMS  P-Link CR CAN RJ45 socket. But for JKBMS I had to use pin 4 (blue) of my RJ45 cable to CAN H and pin 5 (light blue / white) to CAN L so get CAN activity on Waveshare.

But lets try blue (pin 4) to CAN H and l.blue/white (pin 5) to CAN L (as documented) to begin with.

Swapped around cables and got CAN frame data at 250Kb/s and 500Kb/s.





[Tues 1st Dec 2026]

(20:12) 

  1. Will use Waveshare to monitor (and maybe talk to) JK-BMS over CAN bus RJ45 connector.
  2. Do the same thing to the Sungrow SH3.0RS hybrid inverter

So asking Gemini AI about the CAN bus on a JK-BMS gave the answer..


"So CAN L is pin 4 and CAN H is pin 5JK BMS CAN Bus RJ45 Pinout

https://share.gemini.google/PmX90JNSwgyS

Created with Auto 30 November 2026 at 20:12

Published on 30 November 2026 at 20:29

What is the rj45 pin out fir can bus for a jkbms


On JK BMS models that have a dedicated CAN RJ45 socket (such as the JK-PB inverter BMS series or a P-Link-CR interface board), the standard pinout on the JK BMS RJ45 plug (pins 1–8) is:


Pin 4: CAN_L (CAN low / negative)


Pin 5: CAN_H (CAN high / positive)


Pin 7: GND (Signal ground — often optional/unconnected on the inverter end)


Pins 1, 2, 3, 6, 8: NC (Not connected)"


So pin 4 is CAN L and pin 5 is CAN H with the pin out when looking at the socket on the P-Link CR socket being..


Using my breakout cable pin 4 is blue and pin 5 is light blue/white

Well. I wired it all up but no comms received by Waveshare monitor

what frame ids does the jk-bms can protocol (250K) V2.0 send


The JK-BMS CAN Protocol (250K) V2.0 uses CAN 2.0A with 11-bit standard identifiers at 250 kbps and a fixed 8-byte payload (DLC = 8). All multi-byte fields use little-endian byte ordering.   

lifepo4.com.au


It transmits four frame IDs (with default BMS source address 0xF4):   

www.jk-bms.com


Frame ID Message Name Cycle / Trigger Payload Contents

0x02F4 BATT_ST (Battery Status) Periodic (20 ms)

• Bytes 0–1: Pack voltage (0.1 V/bit, unsigned)

• Bytes 2–3: Pack current (0.1 A/bit, offset -400 A)

• Byte 4: State of Charge (1 %/bit, 0–100%)

• Byte 5: Reserved

• Bytes 6–7: Discharge time (1 h/bit)

I do see a blue LED flash when I first send CAN ID 0x00000000 data 12 from my phone via 192.168.4.1

(20:59) So failed test. What next?

Could get UART baseline test to work either..

(base) coderdojo@rhubarb:~/Documents/2026 10 JKBMS/Python/jkbmsrs485/src$ python -m jkbmsrs485 monitor --port /dev/ttyACM0
[21:03:14] Opened /dev/ttyACM0 @ 115200 baud                                                                                                                                               cli.py:112
          Polling JK BMS every 2.0s...      


So turned off / on battery and retried baseline test... With RS485 adaptor plugged in rather than Waveshare! And all is good.


When I plug in Waveshare to laptop USB port I see a couple of blue LED CAN flashes. But I would expect it to be constant!


1. Physical Layer & Data ConventionsStandard: 

CAN 2.0A (11-bit standard identifier)   Baud Rate: 250 kbps   Payload Length (DLC): Fixed at 8 bytes (0 to 7)   

Communication Mode: One-way broadcast from the BMS to peripheral/display nodes (no request/polling frames required).   

Endianness: Little-endian (LSB first) for all multi-byte values.   

Identifier Structure: Formed by combining the 3-bit Function Code (FUNC) and the 8-bit BMS Source Address (SA, default 0xF4 when Device Address = 0).   If a non-zero Device Address is configured in the JK-BMS app or DIP switches, the transmitted ID shifts upward by that offset ($\text{Transmitted ID} = \text{Base ID} + \text{Device Address}$).Unused / Reserved Bytes: Transmitted as 0x00 or 0xFF (XX in vendor documentation) and should be ignored by the receiver.   


http://www.jk-bms.com/Upload/2022-05-19/1619062896.pdf

So the pin 4 / 5 or the cable must be wrong? But it does send something at the start. So maybe Waveshare firmware not great?


Sawpped CAH H and L on Waveshare and blue LED started flashing like crazy when connected to JK-BMS RJ45. Happt days! But Waveshare WiFi crashes. Maybe due to webserver on 192.168.4.1 receive CAN bus buffer overflow?


(21:41) So next let's create an ESP32-S3 firmware for it ESPHome? Would be nice to be able to filter some of the messages!


https://esphome.io/components/canbus/esp32_can/

Lots of useful stuff! Which pins of the ESP32-S3 are connected to the CAN txvr?

https://files.waveshare.com/wiki/ESP32-S3-RS485-CAN/ESP32-S3-RS485-CAN-Schematic.pdf





So RXD2 (IO 16) and TXD2 (IO 15) are used 


https://www.waveshare.com/wiki/ESP32-S3-RS485-CAN#Features


Lists how to configure "ESP32S3 Dev Module" Board for Arduino IDE (from its defaults)

(22:31) Built successfully..


Driver installed
22:31:30.487 -> AP IP address: 192.168.4.1
22:31:30.487 -> Web server started
22:31:30.719 -> Now you can read it in your phone!
22:31:30.719 -> Connect to the WIFI network named "ESP32-S3-RS485-CAN" and access the Internet using the connected IP address!!!


Now let's see what happens when I connect the RJ45 cable and the WiFi crashes....


22:33:01.561 -> Message is in Standard Format
22:33:01.561 -> ID: 2f4
22:33:01.561 -> Byte:CAN Read Data: 09 05 a0 0f 5e 00 00 00 

22:33:01.561 -> Message is in Standard Format
22:33:01.561 -> ID: 4f4
22:33:01.561 -> Byte:CAN Read Data: c0 0f 08 12 10 1f 00 00 

22:33:01.594 -> Message is in Extended Format
22:33:01.594 -> ID: 18f128f4
22:33:01.594 -> Byte:CAN Read Data: 76 01 90 01 00 00 00 00 

22:33:01.627 -> Message is in Standard Format
22:33:01.627 -> ID: 2f4
22:33:01.627 -> Byte:CAN Read Data: 06 05 a0 0f 5e 00 00 00 

22:33:01.627 -> Message is in Standard Format
22:33:01.627 -> ID: 4f4
22:33:01.627 -> Byte:CAN Read Data: b8 0f 1b ed 0f 0e 00 00 

22:33:01.627 -> Message is in Extended Format
22:33:01.627 -> ID: 18f128f4
22:33:01.660 -> Byte:CAN Read Data: 76 01 90 01 00 00 00 00 

22:33:01.660 -> Message is in Extended Format
22:33:01.660 -> ID: 1f21400
22:33:01.660 -> Byte:CAN Read Data: 43 32 00 00 c4 00 00 00 

22:33:01.693 -> Message is in Standard Format
22:33:01.693 -> ID: 2f4
22:33:01.693 -> Byte:CAN Read Data: 06 05 a0 0f 5e 00 00 00 

22:33:01.759 -> Message is in Standard Format
22:33:01.759 -> ID: 4f4
22:33:01.759 -> Byte:CAN Read Data: b7 0f 1b ed 0f 0e 00 00 
22:33:01.792 -> Message is in Standard Format
22:33:01.792 -> ID: 2f4
22:33:01.792 -> Byte:CAN Read Data: 06 05 a0 0f 5e 00 00 00 
22:33:01.859 -> Message is in Standard Format
22:33:01.859 -> ID: 4f4
22:33:01.859 -> Byte:CAN Read Data: b7 0f 1b ed 0f 0e 00 00 
22:33:01.859 -> Message is in Extended Format
22:33:01.859 -> ID: 18f128f4
22:33:01.859 -> Byte:CAN Read Data: 76 01 90 01 00 00 00 00 
22:33:01.859 -> Message is in Extended Format
22:33:01.859 -> ID: 1f21400
22:33:01.859 -> Byte:CAN Read Data: 43 32 00 00 c4 00 00 00 
22:33:01.925 -> Alert: The RX queue is full causing a received frame to be lost.
22:33:01.925 -> RX buffered: 5 RX missed: 7 RX overrun 0

Lots to unpack there!!!!

The specification comes from Jikong (JK-BMS) CAN communication protocol documentation—specifically the BMS-CAN Communication Protocol (V2.0 / V2.1) PDFs published by JK-BMS and mirrored on documentation/manual sites.

Key details in those specification documents match what was shared above:

  • Protocol IDs & Cycle Behavior: 0x02F4 (BATT_ST), 0x04F4 (CELL_VOLT), 0x05F4 (CELL_TEMP), and event-triggered 0x07F4 (ALM_INFO) over CAN 2.0A at 250 kbps with 8-byte little-endian frames and default source address 0xF4.

  • Reference Test Frames: The sample hex payloads and expected display values (such as 02F4 13 01 D7 11 33 XX 64 00 for 27.5 V, 56.7 A, 51% SOC, 100 h; 04F4 8C 0A 05 92 09 08 XX XX for 2700 mV at cell 5 and 2450 mV at cell 8; and 07F4 43 00 20 00 XX XX XX XX) come straight from the test-case tables in the JK-BMS CAN protocol specification.

  • V2.1 Notes: The revision notes in the V2.1 specification document describe the evolution from V2.0 and the added extended frames (such as 0x18F128F4 and temperature frames).


http://www.jk-bms.com/Upload/2022-05-19/1619062896.pdf


22:33:01.561 -> ID: 2f4, Read Data: 09 05 a0 0f 5e 00 00 00 

Translates to BATT_ST  0x0590 (142.4V), 0x0f0a (385.0 - 400A = -15.0A), 0x5e (94%), .... (LSB transmissions)

Expect 128.65V, 0.00A and 94% SoC. But getting -15.0A

And discharge time of 0 hours with extra byte at end! Expect 14H and no extra byte. Same for other 3 0x02F4 messages!

Their example has: 02F4 13 01 D7 11 33 XX 64 00 Represents: voltage 27.5V, current 56.7A (precision: 0.1A), SOC51%, discharge time 100h


22:33:01.561 -> ID: 4f4, Read Data: c0 0f 08 12 10 1f 00 00 

Translates to CELL_VOLT  0x0fc0 (4032mV), 0x08 (position 8), 0x1012 (4114mV), 0x1f (position 31)

Why two trailling 0x00 bytes? Their example also has this: 

For example: 04F4 8C 0A 05 92 09 08 XX XX Represents: the highest cell voltage is 2700mV, corresponding cell number is 5;The lowest cell voltage is 2450mV, andthecorresponding cell

22:33:01.627 -> Message is in Extended Format
22:33:01.627 -> ID: 18f128f4
22:33:01.660 -> Byte:CAN Read Data: 76 01 90 01 00 00 00 00 

22:33:01.660 -> Message is in Extended Format
22:33:01.660 -> ID: 1f21400
22:33:01.660 -> Byte:CAN Read Data: 43 32 00 00 c4 00 00 00 

 

(22:59) I will take that as a win for now :)


Will next program the ESP32 to decode these frames without overflowing!

Will then test receiving and then sending commands on another CAN protocol

Finally sending CAN data using Dryness HV protocol to SH3.0RS inverter 









[Sun 29th Nov 2026]

(18:32) Would like to get CAN comms going under Python on my laptop to perhaps a Waveshare DIN device before testing on my Sungrow SH3.0RS hybrid inverter (which has two wires L and H on a RJ45 socket)


The JK-BMS breakout board also has a CAN (as well as a RS485-EXT which works to laptop). But what voltage does it work at?

Let's look at the Waveshare specs: https://docs.waveshare.com/ESP32-S3-RS485-CAN. The schematic https://files.waveshare.com/wiki/ESP32-S3-RS485-CAN/ESP32-S3-RS485-CAN-Schematic.pdf shows it uses a TJA1051T/3/1J chip which accepts +/- 58V (max) from a 5V supply! https://www.nxp.com/docs/en/data-sheet/TJA1051.pdf

So I think CAN L and H are differential from 0V to 5V.

(base) coderdojo@rhubarb:~/Documents/2026 10 JKBMS/Python$ mkdir CAN
(base) coderdojo@rhubarb:~/Documents/2026 10 JKBMS/Python$  
(base) coderdojo@rhubarb:~/Documents/2026 10 JKBMS/Python$ pip install python-can
Collecting python-can
 Downloading python_can-4.6.1-py3-none-any.whl.metadata (8.6 kB)
Requirement already satisfied: wrapt~=1.10 in /home/coderdojo/anaconda3/lib/python3.13/site-packages (from python-can) (1.17.0)
Requirement already satisfied: packaging>=23.1 in /home/coderdojo/anaconda3/lib/python3.13/site-packages (from python-can) (25.0)
Requirement already satisfied: typing_extensions>=3.10.0.0 in /home/coderdojo/anaconda3/lib/python3.13/site-packages (from python-can) (4.15.0)
Downloading python_can-4.6.1-py3-none-any.whl (276 kB)
Installing collected packages: python-can
Successfully installed python-can-4.6.1
(base) coderdojo@rhubarb:~/Documents/2026 10 JKBMS/Python$

Arduino IDE shows this on /dev/ttyUSB0 with current firmware on ESP32-S3-RS485-CAN ..


19:08:19.609 ->        0.198 transmitter registered, total: 1

19:08:19.609 ->        0.198 CAN receiver registered, total: 1

19:08:19.609 ->        0.198 Requesting 500 kbps for inverter CAN interface (CAN)

19:08:19.609 ->        0.198 transmitter registered, total: 2

19:08:19.609 ->        0.198 CAN receiver registered, total: 2

19:08:19.609 ->        0.199 Native Can ok

19:08:19.609 ->        0.199 Bit Rate prescaler: 4

19:08:19.609 ->        0.200 Time Segment 1:     13

19:08:19.609 ->        0.200 Time Segment 2:     6

19:08:19.609 ->        0.200 RJW:                4

19:08:19.609 ->        0.200 Triple Sampling:    no

19:08:19.609 ->        0.200 Actual bit rate:    500000 bit/s

19:08:19.609 ->        0.200 Exact bit rate ?    yes

19:08:19.609 ->        0.200 Sample point:       70%

19:08:19.609 ->        0.201 The board was reset from a power-on event. Normal operation (event)

19:08:19.609 ->        0.202 MQTT initialized successfully.

19:08:19.609 ->        0.202 Setup complete!

19:08:19.609 ->        0.268 Creating Wi-Fi AP: battery-emulator-0280 (password set with 9 chars)

19:08:19.609 ->        0.330 Access Point using default password!

19:08:19.609 ->        0.330 The AP will be disabled after 5 idle minutes. Change default password to keep AP constantly on! (event)

19:08:19.609 ->        0.330 [452 CAN frames not printed]

19:08:20.099 -> (104.00) TX11 3010 [8] 01 00 00 00 00 00 00 00

19:08:20.099 -> (104.00) TX11 4200 [8] 01 00 00 00 00 00 00 00

19:08:20.099 -> (104.00) TX11 8200 [8] AA 00 00 00 00 00 00 00

19:08:20.099 -> (104.00) TX11 8210 [8] AA 00 00 00 00 00 00 00

19:08:21.095 -> (105.00) TX11 3010 [8] 01 00 00 00 00 00 00 00

19:08:21.095 -> (105.00) TX11 4200 [8] 02 00 00 00 00 00 00 00

19:08:21.095 -> (105.00) TX11 8200 [8] AA 00 00 00 00 00 00 00

19:08:21.095 -> (105.00) TX11 8210 [8] AA 00 00 00 00 00 00 00

19:08:21.095 -> (105.00) TX11 19B50100 [1] 00

19:08:21.095 -> (105.00) TX11 19B50300 [1] 00

19:08:22.090 -> (106.00) TX11 3010 [8] 01 00 00 00 00 00 00 00

19:08:22.090 -> (106.00) TX11 4200 [8] 00 00 00 00 00 00 00 00

19:08:22.090 -> (106.00) TX11 8200 [8] AA 00 00 00 00 00 00 00

19:08:22.090 -> (106.00) TX11 8210 [8] AA 00 00 00 00 00 00 00

19:08:23.086 -> (107.00) TX11 3010 [8] 01 00 00 00 00 00 00 00

19:08:23.086 -> (107.00) TX11 4200 [8] 01 00 00 00 00 00 00 00

19:08:23.086 -> (107.00) TX11 8200 [8] AA 00 00 00 00 00 00 00


Looking on Fritz router I see:

battery-emulator-0280   Wi-Fi 2.4 GHz → 72 Mbit/s 192.168.1.186 28:84:85:B4:02:80

Found this Arduino IDE code at:

/home/coderdojo/Arduino/Waveshare ESP32-S3-RS485-CAN/Battery-Emulator but looks like platformio code files...


Yep. Opened in Visual Code Studio and the project was there.''


I'm confused. So I will download the standard .bin file from /home/coderdojo/Documents/2026 10 JKBMS/ESP32-S3-RS485-CAN/Firmware using Web installer..

https://www.espboards.dev/tools/program/

Flash Address 0x1000  ESP32-S3-RS485-CAN.bin

Flashed but failed to run...

(base) coderdojo@rhubarb:~$  
(base) coderdojo@rhubarb:~$ wine /home/coderdojo/Documents/2026\ 10\ JKBMS/ESP32-S3-RS485-CAN/flash_download_tool/flash_d
ownload_tool_3.9.11.exe

Following flashing instructions at:
https://docs.waveshare.com/ESP32-S3-RS485-CAN/Firmware-Flashing

(19:52) Couldn't select the COM port for /dev/ttyUSB0


Downloaded .bin using https://esptool.spacehuhn.com/

But terminal output not great!




Hurrah! Flashed .bin to 0x000 using https://www.espboards.dev/tools/program/

Writing at 0x131990... (75%)

Writing at 0x136b3b... (77%)

Writing at 0x13ba03... (79%)

Writing at 0x140de7... (80%)

Writing at 0x1460ff... (82%)

Writing at 0x14ba37... (83%)

Writing at 0x151506... (85%)

Writing at 0x156b76... (87%)

Writing at 0x15d2a5... (88%)

Writing at 0x165979... (90%)

Writing at 0x16da62... (91%)

Writing at 0x172c9d... (93%)

Writing at 0x17acb4... (95%)

Writing at 0x18004d... (96%)

Writing at 0x185b95... (98%)

Writing at 0x18b4d9... (100%)

Wrote 1629920 bytes (1006898 compressed) at 0x0 in 10.766 seconds.

Hash of data verified.

Leaving...

Hard resetting via RTS pin...

ESP-ROM:esp32s3-20210327

Build:Mar 27 2021

rst:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT)

Saved PC:0x40378d06

SPIWP:0xee

mode:DIO, clock div:1

load:0x3fce3818,len:0x508

load:0x403c9700,len:0x4

load:0x403c9704,len:0xad0

load:0x403cc700,len:0x29e4

entry 0x403c9880

Driver installed

Driver started

CAN Alerts reconfigured

PCF85063 is running,state :1

AP IP address: 192.168.4.1

Web server started

Now you can read it in your phone!

Connect to the WIFI network named "ESP32-S3-RS485-CAN" and access the Internet using the connected IP address!!!


Then connected my phone to WiFi SSID "ESP32-S3-RS485-CAN" all OK




So can I use this to talk to JK-BMS CAN RJ45 socket?





Will try this tomorrow..
































Saturday, 28 November 2026

Finished housing 96V test battery

 [Sat 28th Nov 2026]

(19:59) Finally, finished housing the 96V (32 x 18650 Li-Ion) battery.









Have UART (RS485-EXT) connection working to Python script and checked over BME using JK-BMS Android app.


(base) coderdojo@rhubarb:~$ cd ~/Documents/2026\ 10\ JKBMS/Python/jkbmsrs485
(base) coderdojo@rhubarb:~/Documents/2026 10 JKBMS/Python/jkbmsrs485$  
(base) coderdojo@rhubarb:~/Documents/2026 10 JKBMS/Python/jkbmsrs485$ date
Sat 28 Nov 2026 20:13:19 GMT
(base) coderdojo@rhubarb:~/Documents/2026 10 JKBMS/Python/jkbmsrs485$ source .venv/bin/activate
(.venv) (base) coderdojo@rhubarb:~/Documents/2026 10 JKBMS/Python/jkbmsrs485$  
(.venv) (base) coderdojo@rhubarb:~/Documents/2026 10 JKBMS/Python/jkbmsrs485$ python -m jkbmsrs485 monitor --port /dev/ttyUSB0
[20:13:59] Opened /dev/ttyUSB0 @ 115200 baud                                                                             cli.py:112
          Polling JK BMS every 2.0s...                                                                                  cli.py:113
┏━━━━━━┳━━━━━━━━━━┓
┃ Cell ┃ Volt (V) ┃
┡━━━━━━╇━━━━━━━━━━┩
│  1   │   4.032V │
│  2   │   4.035V │
│  3   │   4.033V │
│  4   │   4.032V │
│  5   │   4.035V │
│  6   │   4.041V │
│  7   │   4.036V │
│  8   │   4.036V │
│  9   │   4.036V │
│ 10   │   4.032V │
│ 11   │   4.065V │
│ 12   │   4.038V │
│ 13   │   4.033V │
│ 14   │   4.036V │
│ 15   │   4.044V │
│ 16   │   4.035V │
│ 17   │   4.035V │
│ 18   │   4.035V │
│ 19   │   4.124V │
│ 20   │   4.035V │
│ 21   │   4.064V │
│ 22   │   4.033V │
│ 23   │   4.032V │
│ 24   │   4.033V │
│ 25   │   4.033V │
│ 26   │   4.032V │
│ 27   │   4.032V │
│ 28   │   4.041V │
│ 29   │   4.030V │
│ 30   │   4.032V │
│ 31   │   4.038V │
│ 32   │   4.030V │
├──────┼──────────┤
│ Ave  │   4.039V │
│ Tot  │   129.2V │
│ Bal  │  ±0.094V │
└──────┴──────────┘
20:14:00
┏━━━━━━┳━━━━━━━━━━┓
┃ Cell ┃ Volt (V) ┃
┡━━━━━━╇━━━━━━━━━━┩
│  1   │   4.032V │
│  2   │   4.033V │
│  3   │   4.035V │
│  4   │   4.033V │
│  5   │   4.032V │
│  6   │   4.041V │
│  7   │   4.035V │
│  8   │   4.038V │
│  9   │   4.036V │
│ 10   │   4.033V │
│ 11   │   4.067V │
│ 12   │   4.038V │
│ 13   │   4.033V │
│ 14   │   4.036V │
│ 15   │   4.042V │
│ 16   │   4.036V │
│ 17   │   4.033V │
│ 18   │   4.032V │
│ 19   │   4.132V │
│ 20   │   4.035V │
│ 21   │   4.062V │
│ 22   │   4.032V │
│ 23   │   4.033V │
│ 24   │   4.033V │
│ 25   │   4.033V │
│ 26   │   4.035V │
│ 27   │   4.033V │
│ 28   │   4.039V │
│ 29   │   4.030V │
│ 30   │   4.032V │
│ 31   │   4.038V │
│ 32   │   4.033V │
├──────┼──────────┤
│ Ave  │   4.040V │
│ Tot  │   129.2V │
│ Bal  │  ±0.102V │
└──────┴──────────┘
20:14:04
^C[20:14:05] Interrupted                                                                                                   cli.py:1
63
(.venv) (base) coderdojo@rhubarb:~/Documents/2026 10 JKBMS/Python/jkbmsrs485$



Next to get ESPHome BLE monitoring for Home Assistant and test Python script to CAN (RS485 connector)