diy solar

diy solar

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

How do you program the esp32 without using home assistant as I got rid of HA. Cheers
 
For the Atom Lite, which just arrived, what is the recommended tool to connect and flash it from MacOS (M series processor)? Excited to get this going. Assume putty or something will work fine to get to the serial ports. Just got this M2 MBAir so not sure exactly what works with it.
 
Last edited:
Yes that's right, you take my latest YAML V1.16.1 file and you modify the code like in the example below.

YAML:
# GPIO pins your CAN bus transceiver ATOMIC CANBus Base (CA-IS3050G)
  can_tx_pin: GPIO22
  can_rx_pin: GPIO19
# GPIO pins your JK-BMS RS485(TTL) is connected to the grove port of ATOM lite
  tx_pin: GPIO32
  rx_pin: GPIO26
 
  esp32:
  board: m5stack-atom
  framework:
    type: arduino
@Sleeper85
It's not liking the framework: add
1705695211967.png
 
You must respect the indentation (space) in front of the text, it's important.

YAML:
  esp32:
  board: m5stack-atom
  framework:
    type: arduino
 
Big thanks to @Sleeper85 and @arzaman. This was super easy once I wrapped my head around it and actually saw the parts laying out in front of me. It's reporting from my JK to HA no problem. Need to make a cable from inverter to CAN pins on adapter...will do that after dinner. Not bad for $20 in parts and about 2 hours including soldering.

Still messing with a dashboard, just cool to see it populating from the Atom-Lite
1705703879658.png
IMG_4464.jpeg
 
Attached is the Wire and Bluetooth version of YAML V1.16.2 (beta).

Attention ! when the ESP32 is connected via Bluetooth to JK-BMS you cannot use the JK application (only one connection).

Works for me with ESP32 DevKit V1.

Important: the "esp-idf" framework is used by default now, otherwise the Bluetooth connection is unstable.

Framework Arduino vs ESP-IDF ?
 
Last edited:
@Sleeper85 I gave up trying to get my Growatt SPF 3000 to connect using CAN H/L (BMS port pins 4 and 5 respectively from manual). If you have any other suggestions to try let me know but this is my test inverter and expectations are always low with this unit. Tried Pylon 1.2 and 1.3 options in the YAML with multiple protocol options on inverter. Will test with Victron next weekend.

Through my multiple reflashes trying different yaml configs, I noted the setting I did in Home Assistant (charge rate, discharge rate, etc) don't persist. I need to reset them each time I power it back up. Let me know if I'm doing something wrong here.

Again, thanks for your effort. This is really cool.

Update: looks like the SPF 3000TL LVM-48p is RS485 only. Odd because it clearly says what pins are for CAN on the BMS port in the manual.
1705716229499.png
 
Last edited:
Through my multiple reflashes trying different yaml configs, I noted the setting I did in Home Assistant (charge rate, discharge rate, etc) don't persist. I need to reset them each time I power it back up. Let me know if I'm doing something wrong here.

Each time the ESP32 is stopped or restarted, it loads the values you have defined in the YAML file.

This is the normal behavior, the ESP32 is not supposed to restart in production (like the BMS).

One important thing you should monitor during your testing is the stability of the ESP32, if it is properly powered it should not restart.

In the example below my ESP32 under test with the Bluetooth version (flashed 12 hours ago). You will find this info in HA.

1705751840971.png

You can set other values in the YAML before flashing the ESP32.

YAML:
# +--------------------------------------+
# | Battery Charge Settings              |
# +--------------------------------------+
# This is max charging amps eg 100A, for Bulk - Constant Current charging(CC), should be at least 10A less than BMS change current protection, 0.5C max
# 100A * 50V = 5000W
  charge_a: "100"
# Float Voltage : corresponds to the voltage at which the battery would be maintained at the end of the absorption phase. (53.6v eg 3.35v/cell for 16 cells 48V battery)
  float_v: "53.6"
# Absorption Voltage : corresponds to the Bulk voltage that will be used to charge the battery. (55.2v eg 3.45v/cell for 16 cells 48V battery)
  absorption_v: "55.2"
# Absorption time in minutes to hold charge voltage after charge voltage is reached eg 30
  absorption_time: "30"
# Absorption offset, x Volts below absorption voltage battery will start the absorption timer, eg 55.2-0.05 = 52.15v
  absorption_offset_v: "0.05"
# Rebulk offset, x Volts below absorption voltage battery will request rebulk, eg 55.2-2.5 = 52.7v
  rebulk_offset_v: "2.5"
# +--------------------------------------+
# | Battery Discharge Settings           |
# +--------------------------------------+
# Max discharge amps eg 120, should be at least 10A less than BMS over discharge current protection, 0.5C max
# 120A * 50V = 6000W
  discharge_a: "120"
# Minimum discharge voltage eg 48v/16 = 3V per cell
  min_discharge_v: "48"
 
V1.16.2 on GitHub

The Wire and Bluetooth version is now available, so there are now two different YAML.

Instead of doing even more YAML, I added a config folder with the specific configuration for different boards like Atom, etc.

The README has been updated to explain all of this in detail including how to install esphome to flash the YAML file.

1705792708211.png
 
Just chiming in to report success with my LuxPower SNA 5k unit.

Hardware Specifications:
  • LXP SNA 5k
  • JK-BD6A24S10P, HW V10.XW, SW V10.09 (16S CALB L160F100)
  • JST 1.25mm pitch 4 PIN connector
  • ESP32 DEVKITV1
  • SN65HVD230 CAN transceiver

IMG_20240121_160125751_AE.jpgIMG_20240121_160115223_HDR_AE.jpg
It still reports Battery capacity at 50 Ah for some reason. I think it has to do with a conservative 0.5C limit set by me in the YAML.

In the YAML, I used CAN BMS name "1" and CAN Protocol # 2 : SEPLOS 1.0, PYLON 1.3, GOODWE 1.5

And using Battery brand 0 2 in the inverter setting.
inverter set .png

Suggestions for others doing this:
  • In the web server, Sensor listing order goes from A-Z and then a-z. It is useful for organizing sensor values.
    sorting order.png
  • Similarly, prefix 0 before Cell count, (eg. 05) to list them all sequentially.
  • Action sliders can be disabled if desired for Production setups by commenting the code in the YAML.
  • I'd advise not to use Logger level above INFO in production to prevent random freeze/crashes in ESPHome.
Next in line, trying to implement proper LFP charging model, because why not?!
 
Last edited:
Glad to hear it's working for you.

It still reports Battery capacity at 50 Ah for some reason. I think it has to do with a conservative 0.5C limit set by me in the YAML.

Regarding the capacity I think I know why.

I had to make choices in the YAML regarding the selection of the protocol.
For Victron, Sol-Ark and Luxpower you need ID 0x379 to display capacity.

Try replacing line 1213 with the code below:

C++:
lambda: return ((id(can_msg_counter) == 9) & ((${can_protocol} == 2) | (${can_protocol} == 4)));

This will be added in version 1.16.3 if it works for you.
 
Last edited:
Thanks for that. I have installed esphome with python but how do I run esphome now I have installed it ??
If you installed esphome on your computer, I had some PATH weirdness I had to fix on my MAC even though I had esphome path correct, just follow the steps @Sleeper85 has in the readme. Clone down his repo, modify for your use, test the config, run to flash the device.
 
Back
Top