diy solar

diy solar

JK-BMS-CAN with new Cut-Off Charging Logic (open-source)

Well V1.16.4 works fine on it. Safe to assume 1.17.x will?
If you flash via USB only, I don't think there is something to worry about :) . Not regards to flashing process at least.

The automatic charge voltage control still needs some tuning IMHO.

I am testing @MrPablo updated branch of automatic voltage control and to be honest I do NOT remember how it behaved on "RAW" 1.17.5.
 
If you flash via USB only, I don't think there is something to worry about :) . Not regards to flashing process at least.

The automatic charge voltage control still needs some tuning IMHO.

I am testing @MrPablo updated branch of automatic voltage control and to be honest I do NOT remember how it behaved on "RAW" 1.17.5.
lol. Maybe I’ll wait
 
There's no reason you can't test out v1.17.5 and disable Auto Voltage Control, it will still send static voltages appropriate to each charging stage.
 
No 11.43 will not response to request data command as I have mentioned (my version 11.36, 11.42 does not work on wired connection anymore, the "4E:57:00:13:00:00:00:00:06:02:00:00:00:00:00:00:68:00:00:01:28" command does not work! I have not upgraded to V15 as guided by JK-BMS guy as I have not seen any guidance on that and not sure the V15 is supported the upgrading from V11. The only way that seems possible is to use Bluetooth for multiple BMS (my previous pose has the link but I have not tried yet)

@RostadKatt

All I can tell you is that the wired version works with this version:

JKB2A20S20P (heat + can) HW: V11.XW and SW: V11.285H.

What we are saying @paulsteigel is worrying... to my knowledge it is not possible to upgrade the JK-BMS (except the new JK-BMS inverter model).
 
Last edited:
1.: Thanks @Sleeper85, Actually, I used this approach for both ends but using 98 and the minimum SOC (not 2%) to reflect the SOC cut-off level needed for the Inverter to stop charging (.i.e Cut-off/ On-grid EOD set at 20% but JK SOC is lower when minimum cell voltage is still 3.1V or more, the SOC reporting to Inverter shall be kept at 21% till min cell voltage goes below 3.2 or 3.1 depending on user's prefer cut off voltage level). If I dont change the SOC at the EOD SOC, inverter will stop discharging when cell voltage is still high enough.
So the SOC changes is only at ends not during the charge/discharge process!
2.: MultiBMS: I have 2 battery (one with JK-BMS and one with Huawei brand (different BMS from Huawei). I wired them in parallel and have just an additional slider for defining the capacity of the battery in parallel. This will help regulating the total charging current limit sent to the Inverter. It would be better if we can monitor current at other battery but I found that my Lux inverter does have internal shunt for both voltage and current so I don't need to make it become more complicated. Principally, we can do wire connection (also require to keep the JST interface be longer) to several BMS using Software serial but the returning value is not much (only data about cell, alarm) while what we need is to control charge/discharge well enough. My recent observation is: new JKBMS Soft Version 11.36 and higher (11.XW) does not allow UART command query anymore (image from JKBMS technical staff).
View attachment 206862View attachment 206864
They recommended to upgrade to V15 but does not share further information at all.
Many thanks for your sharing!

@chaosnature

If I remember correctly you never managed to get the wire version to work?

what is the hardware and firmware version of your BMS?
 
Also, I'd like to add my two cents to this amazing project.

I've prepared a summary connection diagram for those who are going to use the M5Stack—a nice product that simplifies the wiring and connections, making the hardware part almost plug and play.
Both configurations have been tested and are stable

View attachment 198115
I tried connecting the JKBMS to the PIP-5048GEW via CAN Bus but it didn't work.
After about 2 minutes there was an error code 61 on the PIP-5048GE.
My device:
- Inverter MPPSolar PIP-5048GEW
- JKBMS JK-BD6A24S10P HW: 11.XW SW: 11.288
- ESP32 AtomS3 Lite
- CAN bus transceiver ATOMIC CANBus Base (CA-IS3050G)

Does anyone know the CAN BUS pinout of PIP-5048GEW.
Thank you in advance.

1000275224.jpg1000275025.jpg1000275098.jpg1000275097.jpg
 
Last edited:
I tried connecting the JKBMS to the PIP-5048GEW via CAN Bus but it didn't work.
After about 2 minutes there was an error code 61 on the PIP-5048GE.
My device:
- Inverter MPPSolar PIP-5048GEW
- JKBMS JK-BD6A24S10P HW: 11.XW SW: 11.288
- ESP32 AtomS3 Lite
- CAN bus transceiver ATOMIC CANBus Base (CA-IS3050G)

Does anyone know the CAN BUS pinout of PIP-5048GEW.
Thank you in advance.

View attachment 207615View attachment 207616View attachment 207617View attachment 207618
- Please CONFIRM the SKU part number of the M5Stack Controller (Atom S3 Lite) and especially the CANbus Isolated Adapter (one is UNIT the other is BASE). I was using the wrong one (UNIT/Base confusion, availability at suppliers, ...) so the GPIO pinout was wrong.

- Did you try reversing CAN_TX and CAN_RX ? Did you try reversing the GPIO pins on the ESP32 side in the config ?

- Did you try pin 2+3 or 6+7 ? Depending on how you look at the RJ45 Plug (from front or from back ? with "locking tab" facing up or down ? etc) or RJ45 Socket (from front or from back ? with space for the "locking tab" facing up or down ? etc) it can be different. And of course there are plenty of "opportunities" to switch everything around. I was VERY methodical for the RS485 Inverter Communication (NOT the CANbus where I got the pinout wrong ...), but it's VERY easy to get it backwards ...

This is for my Deye Modbus Port:
1712479942740.png

While the BMS (the one you are trying to use) is:

1712479993422.png

- Are you sure you are NOT making a Crossover cable by mixing TIA 568A and TIA 568B ?
1712480053134.png

- Did you add the Termination Resistor (120 Ohm) ?

- To check the basic communication if you are on GNU/Linux with some CANbus adapter lying around you could try "cansniff" command part of the "can-utils" package.

That's what I tried here: https://diysolarforum.com/threads/j...-logic-open-source.79325/page-37#post-1046211

EDIT 1: on your inverter I can see this at https://www.mppsolar.com/manual/PIP-GEW/3024_5048GEW manual-20230919.pdf
1712480609364.png

So the proper pins if you look at the RJ45 Plug with the locking tab facing DOWN (!!) are the pins on the RIGHT side.
Look at my Deye screenshot for more information (you need to turn the RJ45 Plug 180° to match the RJ45 socket, then the Pin 7+8 of the RJ45 Plug are on the right side [when the RJ45 locking tab is facing DOWN], just like the RJ45 Socket).
 
Last edited:
I tried connecting the JKBMS to the PIP-5048GEW via CAN Bus but it didn't work.
After about 2 minutes there was an error code 61 on the PIP-5048GE.
My device:
- Inverter MPPSolar PIP-5048GEW
- JKBMS JK-BD6A24S10P HW: 11.XW SW: 11.288
- ESP32 AtomS3 Lite
- CAN bus transceiver ATOMIC CANBus Base (CA-IS3050G)

Does anyone know the CAN BUS pinout of PIP-5048GEW.
Thank you in advance.

View attachment 207615View attachment 207616View attachment 207617View attachment 207618
According to the diagram you have attached, pin 6 is CANH and pin 7 is CANL. The picture is contacts side facing up towards the viewer.
these two wires should be connected to the module's CANH and CANL output pins respectively.
Also, I'm assuming you've already set the Inverter to the appropriate PYLONTECH battery mode.
1712481213288.png
 
Last edited:
I tried connecting the JKBMS to the PIP-5048GEW via CAN Bus but it didn't work.
After about 2 minutes there was an error code 61 on the PIP-5048GE.
My device:
- Inverter MPPSolar PIP-5048GEW
- JKBMS JK-BD6A24S10P HW: 11.XW SW: 11.288
- ESP32 AtomS3 Lite
- CAN bus transceiver ATOMIC CANBus Base (CA-IS3050G)

Does anyone know the CAN BUS pinout of PIP-5048GEW.
Thank you in advance.

View attachment 207615View attachment 207616View attachment 207617View attachment 207618

You can always try but according to my readings the PYLON protocol on Voltronic inverters like MPP Solar only works on RS485 and not on CAN bus. On the other hand, the can bus should work for two other battery models with a protocol completely different from what we use (therefore not supported).
 
@chaosnature

If I remember correctly you never managed to get the wire version to work?

what is the hardware and firmware version of your BMS?
Good memory,

Correct - Wire never worked for my , Tried GPIO1 and 3/ also the default 16/17...but no joy on any of the Code versions...(not tried it on the .17.x versions tho)
mine is JK2a24s15p

i just decided to stick with BLE instead...i know the risk , but its doing the job so far.
 
For those having issues with OTA failing to upload, like at 4% - 10% or so, the FIRST thing to check if your network connectivity, configuration, routing, firewall, etc.

I lost 2 days trying to sort out why OTA would fail, the watchdog getting triggered, then the device BRICKS without even resetting itself.

In some cases cycling USB Power Supply is enough to make it recover. But in some/most cases, you need to USB flash AGAIN.

The network connectivity seems fine, although if you ping long enough you can see the latency increasing dramatically.

But there is NOT really a network "failure" per se ...

Code:
root@MYHOSTNAME:~# ping -c 20 esp32-s3-base.local
PING esp32-s3-base.local (172.27.30.1) 56(84) bytes of data.
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=1 ttl=254 time=87.4 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=2 ttl=254 time=8.65 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=3 ttl=254 time=31.1 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=4 ttl=254 time=55.2 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=5 ttl=254 time=86.5 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=6 ttl=254 time=102 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=7 ttl=254 time=30.7 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=8 ttl=254 time=53.6 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=9 ttl=254 time=77.2 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=10 ttl=254 time=102 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=11 ttl=254 time=25.2 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=12 ttl=254 time=45.5 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=13 ttl=254 time=1810 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=14 ttl=254 time=787 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=15 ttl=254 time=296 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=16 ttl=254 time=421 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=17 ttl=254 time=750 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=18 ttl=254 time=466 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=19 ttl=254 time=285 ms
64 bytes from esp32-s3-base.local (172.27.30.1): icmp_seq=20 ttl=254 time=102 ms

--- esp32-s3-base.local ping statistics ---
20 packets transmitted, 20 received, 0% packet loss, time 19036ms
rtt min/avg/max/mdev = 8.649/281.088/1809.820/418.520 ms, pipe 2
root@MYHOSTNAME:~# traceroute esp32-s3-base.local
traceroute to esp32-s3-base.local (172.27.30.1), 30 hops max, 60 byte packets
 1  192.168.1.7 (192.168.1.7)  0.513 ms  0.431 ms  0.436 ms
 2  192.168.4.31 (192.168.4.31)  0.825 ms  0.884 ms  0.989 ms
 3  esp32-s3-base.local (172.27.30.1)  62.587 ms  66.768 ms  66.756 ms
root@MYHOSTNAME:~# tcptraceroute esp32-s3-base.local
Running:
    traceroute -T -O info esp32-s3-base.local
traceroute to esp32-s3-base.local (172.27.30.1), 30 hops max, 60 byte packets
 1  192.168.1.7 (192.168.1.7)  0.450 ms  0.450 ms  0.399 ms
 2  192.168.4.31 (192.168.4.31)  1.086 ms  0.880 ms  0.734 ms
 3  esp32-s3-base.local (172.27.30.1) <rst,ack>  53.865 ms  58.118 ms  61.274 ms

Out of desperation, I tried to flash the firmware from the Raspberry Pi that is running the AP, so it's DIRECTLY in the correct subnet for the esp32 device that it's trying to flash. Upload the firmware on the Raspberry Pi server first, you do NOT want to wait for all the time it takes for it to compile (Raspberry Pi 2 here ...):
Bash:
#!/bin/bash

# Activate Python venv
source ~/ESPHome/venv/bin/activate

# Flash Device
esphome upload esp32-s3-base.yaml --file firmware.bin --device esp32-s3-base.local

Root cause was to enable (on the Rock 5B in the Garage or the Raspberry Pi that I have in the House for some warmer-environment testing) in /etc/sysctl.conf (for Debian/Raspberry Pi OS/Ubuntu and similar GNU/Linux Distributions):
Code:
net.ipv4.ip_forward=1

That's probably causing some serious flooding of the different subnets which are now "merged" into one, without NAT/Masquerading or other stuff to take care of these conflicts.

In past versions this was done by iptables, but nowadays it got replaced by nftables, which is very different to configure.

That's what I need to figure out right now ....
 
Last edited:
I can flash my ESP32 S3 OTA no problems, and my BMS ( B2A20S20P-Heat-CAN HW v11.XA / SW v11.43 ) does send the SOC value over BLE correctly to my inverter ( 6000xp ) yet, the inverter will become very unstable, and reset after a few minutes/hours.

Was hoping a wired version would stabilize the inverter. Wonder why the rs485 port wont communicate in my HW / SW versions, I measured 48+ on the VBAT pin, so the port is not completely dead.

If I had more technical knowledge I would want to try to debug this, maybe with a tool such as cansniffer.
 
Well, Good news.

Think I managed get a wired connection to work, but now a new problemo, It disconnects after a minute or 2 and the inverter resets.

[19:39:20][D][sensor:094]: 'jk-bms-can charging low temperature recovery': Sending state 5.00000 °C with 0 decimals of accuracy
[19:39:20][D][sensor:094]: 'jk-bms-can discharging low temperature protection': Sending state -20.00000 °C with 0 decimals of accuracy

WARNING jk-bms-can @ 192.168.3.231: Connection error occurred: [WinError 64] The specified network name is no longer available
INFO Processing unexpected disconnect from ESPHome API for jk-bms-can @ 192.168.3.231
WARNING Disconnected from API
INFO Successfully connected to jk-bms-can @ 192.168.3.231 in 3.282s
INFO Successful handshake with esphome-web-5ea7e8 @ 192.168.3.231 in 0.020s
[19:44:20][ota:117]: Boot seems successful, resetting boot loop counter.
[19:44:20][D][esp32.preferences:114]: Saving 1 preferences to flash...
[19:44:20][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
 
Good memory,

Correct - Wire never worked for my , Tried GPIO1 and 3/ also the default 16/17...but no joy on any of the Code versions...(not tried it on the .17.x versions tho)
mine is JK2a24s15p

i just decided to stick with BLE instead...i know the risk , but its doing the job so far.

Please what is the HW: and SW: version of your two BMS? You can see it in the JK-BMS app.
 
I have never ever managed to keep an ESPhome device connected to my network for longer than a couple of minutes. I don't know what the hell I'm doing wrong but apparently everyone else is doing it wrong too.
 
Back
Top