From 7d45aa482e9e29046cc71f322c5b11ebd3cc173b Mon Sep 17 00:00:00 2001
From: Sleeper85 <153944466+Sleeper85@users.noreply.github.com>
Date: Wed, 30 Oct 2024 22:24:04 +0100
Subject: [PATCH] Update README (SoC and CAN bus link)
---
README.md | 12 ++++---
documents/README/YamBMS_behavior.md | 55 ++++++++++++++++++++++++-----
2 files changed, 53 insertions(+), 14 deletions(-)
diff --git a/README.md b/README.md
index 13fe9b8..fb7a782 100644
--- a/README.md
+++ b/README.md
@@ -15,13 +15,15 @@
| ESPHome application to monitor BMS and communicate with inverters
supporting CAN bus protocol compatible with Pylontech, GoodWe, SMA,
Victron or Luxpower (EG4). |
|
| :--- | --- |
-| **Note: Pylontech uses 15S/48V and many others uses 16S/51.2V !**
Other battery profiles that utilise the **`PYLON`** protocol with different cell counts
may also work, e.g. Alpha Ess Smile, BYD Battery-Box LV Flex Lite.
Select the correct battery profile in the inverter to match your battery pack !
The **`ESP32`** communicates with the BMS using the **`BLE / UART / RS485`**
protocol and then sends the CAN bus data to the inverter via the
[CAN bus transceiver](documents/README/Supported_devices.md#supported-can-bus-transceiver). |
|
+| **Note: Pylontech uses 15S/48V and many others uses 16S/51.2V !**
Other battery profiles that utilise the **`PYLON`** protocol with different cell counts
may also work, e.g. Alpha Ess Smile, BYD Battery-Box LV Flex Lite.
Select the correct battery profile in the inverter to match your battery pack !
The **`ESP32`** communicates with the BMS using the **`BLE / UART / RS485`**
protocol and then sends the CAN bus frames to the inverter via the
[CAN bus transceiver](documents/README/Supported_devices.md#supported-can-bus-transceiver). |
|
**Sends over CAN bus to inverter:**
- Battery Voltage
- Battery Current (+charge, -discharge)
- - State of Charge (SOC)
- - State of health (SOH)
+ - [State of Charge (SoC)](documents/README/YamBMS_behavior.md#state-of-charge) **`SoC 100% will be sent to your inverter only when the battery is fully charged`**
+ - State of Health (SoH)
+ - Max cell V. and ID
+ - Min cell V. and ID
- BMS temperature
- Charging voltage
- Charging max amps
@@ -30,8 +32,8 @@
- Battery name
- Alarms: Cell over/under voltage, Charge/discharge over current, High/low Temp, BMS fault
-**Note:** this code support `multi-BMS` connection per inverter with a `single ESP32` and should work with inverters that support
-the CAN bus protocol `PYLON`, `SMA`, `Victron` or `LuxPower` (EG4). I'm only testing it with my `Deye SUN-6K-SG03-LP1-EU` inverter.
+**Note:** this code support `multi-BMS` and `multi-shunt` connection per inverter with a `single ESP32` and should work with inverters that support the CAN bus protocol `PYLON`, `SMA`, `Victron` or `LuxPower` (EG4). I'm only testing it with my `Deye SUN-6K-SG03-LP1-EU` inverter.
+
**This project is still in development and testing...
**
[Dedicated topic on DIY Solar Forum](https://diysolarforum.com/threads/yambms-jk-bms-can-with-new-cut-off-charging-logic-open-source.79325/)
diff --git a/documents/README/YamBMS_behavior.md b/documents/README/YamBMS_behavior.md
index ea5796b..ed35ffc 100644
--- a/documents/README/YamBMS_behavior.md
+++ b/documents/README/YamBMS_behavior.md
@@ -37,6 +37,51 @@ Combine condition :
If one of these three conditions is not met, the BMS is automatically decombined.
+## State of Charge
+
+The `SoC` is slightly manipulated before reaching `0%` or `100%`.
+SoC `100%` will be sent to your inverter only when the battery is `fully charged` (useful for some inverters stopping charging when the SoC reaches 100%).
+
+SoC behavior:
+1) If `min_cell_v <= cell_uvpr` SoC 0% is sent
+2) Else if `SOC < 1%` SoC 2% is sent (false 0% sending 2%)
+3) Else if `SOC < 99%` real SoC is sent
+4) Else if `the battery is fully charged` real SoC is sent
+5) Else SoC `98%` is sent
+
+## CAN bus link
+
+For the CAN bus link to be established with your inverter, the two conditions below must be met:
+1) At least one BMS is in service (the number of combined BMS must be `> 0`)
+2) Your inverter sends an `ACK 0x305` every `1s` (the link will be faulty if no ACK is received for 5s)
+
+If these conditions are not met, the application waits `120s` before trying to connect again.
+
+### Extra infos
+
+Sending CAN frames continues without an inverter connected is problematic and will lead to ESP32 crash.
+
+During boot the CAN bus links are activated directly if at least one BMS is combined and the inverter responds to the sending of CAN frames within a `5s` delay.
+This `5s` delay represents the time during which the link is valid, this timer is reset each time an `ACK 0x305` is received from the inverter.
+This `5s` delay can be modified in the configuration when importing the canbus package.
+
+```YAML
+ canbus1: !include
+ file: packages/yambms/yambms_canbus.yaml
+ vars:
+ # YamBMS ID
+ yambms_id: 'yambms1'
+ # CANBUS vars
+ canbus_id: 'canbus1'
+ canbus_name: 'CANBUS 1'
+ canbus_node_id: 'canbus_node1'
+ canbus_light_id: 'esp_light'
+ # The CANBUS link will be considered down if no response from the inverter (ID 0x305) for 5s
+ canbus_link_timer: '5'
+```
+
+If the inverter does not respond with an `ACK 0x305` within this `5s` delay the sending of CAN frames is paused for `120s` this delay cannot be modified when importing the canbus package but you can modify it in the code if you need to.
+
## BMS alarms
> [!IMPORTANT]
@@ -50,12 +95,4 @@ As long as at least one BMS is working normally the system will continue to work
YamBMS will display BMS alarms as `Warning`.
If all BMS are in alarm, they are all uncombined and in this case the sending of instructions on the `CAN bus` is also stopped.
-YamBMS will display BMS alarms as `Alarm`.
-
-## CAN bus link
-
-For the CAN bus link to be established with your inverter, the two conditions below must be met:
-1) At least one BMS is in service (the number of combined BMS must be `> 0`)
-2) Your inverter sends an `ACK 0x305` every `1s` (the link will be faulty if no ACK is received for 5s)
-
-If these conditions are not met, the application waits `120s` before trying to connect again.
+YamBMS will display BMS alarms as `Alarm`.
\ No newline at end of file