Site Tools


en:tech:jkbmscan

JK-BMS-CAN

Motivation

Part of the Solar System is the battery management system (BMS). In my case I used a Chinese company JKBMS that has made a name for itself online. One drawback was the missing link between BMS and inverter. Without this link the inverter can only estimate the battery charge level for instance. The following project closed the gap.

Planning

INVERTER

In order to allow two systems to talk to each other we have to find a compatible protocol or adapt one side to fit to the other. The inverter GROWATT SPF5000ES from my Solar System supports RS485 and CAN protocols.

Supported protocols

Connection

Unfortunately the battery manufacturer use own proprietary protocols. At least the protocol from PYLONTECH can be easily found in the internet (see download area). For GROWATT it's the protocol setup CAN L52 (Protocol)

BMS

The BMS B2A245-20P documentation describes a CAN interface but it's only optional (can be customised). But a RS485 interface is standard named GPS. In fact it's a serial interface with 3.3V level shifter inside and MODBUS protocol. JKBMS interfaces.

CAUTION: The power pin VCC at RS485/GPS connector is VBAT. That means we will see a voltage of 45-58V (=battery voltage) at this terminal.

The protocol description can be find in the download session.

The target job for our converter would be to request all mandatory data from BMS via MODBUS and send it via dedicated CAN messages to the inverter.

Solution

A lot of clever makers have already challenged this task. Here an incomplete list:

As I use Home Assistant for my home automation I preferred a ESPHome solution from Sleeper85. But because I am an enthusiast of compact solutions I designed my own PCB and case.

Hardware

The converter block diagram doesn't look too complicated.

JKBMS to CAN converter
                 UART-TTL                RS232-TTL                 CAN BUS (5V).
┌──────────┐                ┌──────────┐             ┌────────────┐              ┌──────────┐
│          │<TX----------RX>│16      23│<TX-------TX>|            |              |          |
│  JK-BMS  │<RX----------TX>│17      22│<RX--4K7--RX>|  TJA1050   |<---CAN H --->| Inverter |
│          │<-----GND------>│   ESP32  │<----GND---->|    CAN     |<---CAN L --->|          |
│          │<VBAT-+    +-5V>│VIN    VIN│<----5V----->|            |              |          |
└──────────┘      |    |    └──────────┘             └────────────┘              └──────────┘
                ┌────────┐
                │ Power  │
                │ Supply │
                └────────┘      

The converter should be always powered (as the BMS) to avoid dead locks. Therefore I like to use VBAT as power source. The power supply is based on a XL7015 Buck DC to DC Converter (0.8A 150KHz 80V) from XLSEMI. The 5V output voltage can be defined by two resistors (R1/R2). The CAN interface is implemented by well-known TJA1050 from NXP and a standard RJ45 plug. The heart of the converter is a 38-pin ESP32-DEVKIT.

Schematic

PCB

The final module in my 3D-printed case. The corresponding STL file is also attached in download area.

The final module

Software

As mentioned the software is based on ESPHome JK-BMS-CAN. I did only some slight modifications at the CAN protocol data.

jk-bms-can.yaml

Conclusion

This converter is now running since Aug-2023 without any issues. The live data in Home Assistant:

BMS data shown in Home Assistant

Downloads

If you like my articles feel to donate a cappuccino or so…

en/tech/jkbmscan.txt · Last modified: 2024/05/18 04:52 by bullar