diy solar

diy solar

JK BMS CAN bus comms now possible for inverters that support Goodwe and Pylontech batteries

uksa007

Solar Enthusiast
Joined
May 26, 2022
Messages
239
After much searching I found the JK BMS, with it's 2A built-in active balancer it was just what I was looking for.
I wanted to connect my JK-BMS to my inverter like a commercial battery to ensure the inverter knows what the battery is up to in terms of Charging, Discharging, Alarms etc.
If you buy the CAN model, it does not support any standard battery protocol that energy storage inverters support.

All that changes now, as I have enabled CAN bus support for standard JK BMS RS485 models.
This will allow your JK BMS to communicate with any inverters that support Goodwe and Pylontech Low voltage batteries via CAN bus (Protocol compatible with Pylontech V1.3 and Goodwe V1.5)

New: Hardware interface kit(plug and play) info here
Thought this may help some others who would like inverter comms with their JK BMS.
My work can be found here: jk-bms-can

Sends over CAN bus to inverter:
  • Battery Voltage
  • Battery Current (+charge, -discharge)
  • State of Charge (SOC)
  • State of health (SOH)
  • BMS Temperature
  • Charging Voltage
  • Charging Amps
  • Discharge min Voltage
  • Battery name
  • Alarms: Cell over/under voltage, Charge/discharge over current, High/low Temp, BMS fault
  • Charging logic: Charging logic, now charges with constant current(CC) to the absorption voltage, then has an absorption timer (Constant Voltage, user configurable time), with rebulk feature (user configurable offset from absorption voltage). The charging logic is designed to stop charging once absorption phase has completed (no keeping the battery on float) and reduce micro cycling.
Note:- Support for only one BMS CAN connection per inverter, see here more info on creating larger capacity packs
Early stages are under way to support multiple BMS, but need funding to purchase additional hardware, please consider supporting me if you would like to see this functionally, early access code with be made available in the Alpha testers membership once funding goals are reached:
see here for more info: Multi BMS info

NOTE: ESP32 has a bug that causes WDT reboot if no other devices on CAN bus to ACK the packets.
If you try to run without inverter it will not work as it will constantly WDT reboot!
There is an early access beta version available that works around no inverter(CAN bus requires 2 devices to work).

Home Assistant native integration via ESPHome:
  • Battery control switches to manage battery remotely
    • Charging request status
    • Absorption voltage (slider)
    • Charging current max (slider)
    • Charging enabled/disabled
    • Discharging enabled/disabled
    • Charging manually (top balancing)
  • All BMS sensor values
Homeassistantbatery_s_new.jpg

I'm using it in my production environment which consists of:
  • Goodwe GW5000S-BP 5kW inverter
  • Goodwe GM3000 3 phase Smart meter cabled back to inverter (you can also use the GM1000 if you have single phase)
  • 16 * EVE LF280K batteries in series for nominal 51.2v
  • JK-BMS 150A model JK-B2A24S15P
  • JK RS485 module (you don't need this if your ESP32 is near the JK-BMS)
  • ESP32 model esp32doit-devkit-v1
  • TJA1050 CAN bus to TTL module 4.7K resistor for 5V to 3.3v level shift.
  • RS485 to TTL module (you don't need this if your ESP32 is near the JK-BMS)
  • Various safety devices: Fuse and ZJ Beny125A DC circuit breaker etc.
I have set up Pateron to help fund future development.
Additional info will be published to "Be in the know" Pateron membership levels and above like:

What development is coming soon
Development that has been completed and is in Alpha/Beta testing
Get early access to Alpha/Beta code for testing (in those tiers)
Polls to determine future features etc.
Help fund goals to purchase additional hardware like multiple BMS support
 
Last edited:
I love it, thank you. I'd been attempting something similar with my JBD BMS. I completed all the code to convert between the protocols and set up the necessary hardware, however my Growatt SPF inverter simply wouldn't work with it. Through the oscilloscope I could see the data being sent over CAN, but never acknowledged or processed by the inverter.
The Growatt had option 5 set to Li, and option 36 to L52, which should have allowed CAN communication using the Pylon protocol.

In any case I've moved on to a JK BMS with a much larger cell pack. The new hardware is on the way, so I'll give this a test once it's all here.
 
In any case I've moved on to a JK BMS with a much larger cell pack. The new hardware is on the way, so I'll give this a test once it's all here
If the Growatt is communicating correctly it should respond every second in ESP32 logs with:
[canbus:070]: received can message (#1) std can_id=0x305 size=8

You could even test comms with the inverter before your BMS/batteries arrive, my code will simulate BMS data by setting:
enable_fake_traffic: true

Let me know if you get it communicating or need any further help.
 
Let me know if you get it communicating or need any further help.

Do you happen to have a copy of the Pylontech V1.3 protocol mentioned on your GitHub page?
I've been using a v1.2 document as reference, and my output looks somewhat similar in structure, but not the same as what you have in test-esp32-send-can.yaml
 
Let me get this straight:
From my understanding, I will need an ESPHome device, to connect to JK (via BT?) to get the JK data, then this ESPHome device connects to inverter, translate JK data to Pylontech data.
Therefore, I need an ESPHome device...
 
From my understanding, I will need an ESPHome device, to connect to JK (via BT?) to get the JK data, then this ESPHome device connects to inverter, translate JK data to Pylontech data.
Therefore, I need an ESPHome device...

ESPHome is free software that makes it easier to install firmware on microprocessors and optionally integrate with Home Assistant.
I do not recommend Bluetooth, you should use a cable to connect to the JK BMS RS485 port.

You Need:
ESP32 microprocessor, development board is best I use esp32doit devkit v1
TJA1050 CAN bus transceiver
4.7K resistor
4 Pin, JST 1.25mm pitch cable to connect to the JK BMS or buy the JK RS485 adaptor and use a RS485 to TTL converter.
A way to connect it all together (solder is the best)
A box to put it in.
 
Last edited:
Thank you for providing this, works great!
I was able to use the MCP2515 transceiver in place of the TJA1050 with minimal modifications.
 
can you add pylontech rs484 protocol too ;-)
Not at this stage, still perfecting the CAN protocol and charging profiles.
CAN seems to be the preferred option for BMS to inverter comms.
 
Thank you for providing this, works great!
I was able to use the MCP2515 transceiver in place of the TJA1050 with minimal modifications.
That's great, can you let me know the changes so I can add it to the doco.
 
That's great, can you let me know the changes so I can add it to the doco.

Certainly! Here's the key difference: platform esp32_can => mcp2515
canbus:
- platform: mcp2515
cs_pin: ${can_cs_pin}

Substitutions to maintain structure:
substitutions:
can_cs_pin: GPIO33

Also, SPI configuration appears to be required. These are the SPI pins I used for my specific esp32 board:
spi:
clk_pin: GPIO25
mosi_pin: GPIO26
miso_pin: GPIO27

Documentation: https://esphome.io/components/canbus.html#mcp2515-component
 
If the JK BMS has CAN connection, can a TJA1050 be used between JKbms and the ESP32 for conversion and then another TJA1050 between the ESP32 and inverter ? (please don't throw rocks if my question is stupid).
 
If the JK BMS has CAN connection, can a TJA1050 be used between JKbms and the ESP32 for conversion and then another TJA1050 between the ESP32 and inverter ? (please don't throw rocks if my question is stupid).
No, the JK BMS CAN port is not active unless you buy the CAN model and their CAN adaptor, the port is TTL level and the protocol is non standard for energy storage inverters.
There would be no point in converting it to CAN then converting it back to TLL for the ESP32 and then decoding the non standard CAN protocol, and it wouldn't work for most people as they don't buy the CAN model.

My code uses the RS485 port, which is TTL level, enabled by default and can be connected directly to the ESP32.
A second serial port on the ESP32 is connected to the TJA1050 for connection to the inverter.

If you want to extend the distance between the JK BMS and ESP32 you can use RS485 adaptors, which is what I do, makes it easier for development, my ESP32 has a RS485 adaptor and then a long cat5 run to the JK RS485 adaptor in the battery box.
 
Last edited:
Add a hardware list plus Amazon affiliate links
Thanks for the suggestion, not sure how that works internationally with all the different amazons eg UK, US Europe etc, will have to check it out.

I do have the Patreon link!
 
Last edited:
Back
Top