diff --git a/README.md b/README.md index 62b5a21..2bf90e7 100644 --- a/README.md +++ b/README.md @@ -69,10 +69,10 @@ This project works with various `ESP32` variants and also with the `Raspberry Pi Pico (RP2040)`. Note that merging data from multiple BMS, balancers and shunts is resource-intensive, so I highly recommend a board based on the `ESP32-S3` with `PSRAM`. -| [LilyGo T-Connect](documents/README/Board_LilyGo_T-Connect.md) | [Waveshare RS485-CAN](documents/README/Board_Waveshare_ESP32-S3-RS485-CAN.md) | [M5Stack AtomS3R](https://docs.m5stack.com/en/core/AtomS3R) | +| [LilyGo T-Connect](documents/README/Board_LilyGo_T-Connect.md) | [Waveshare RS485-CAN](documents/README/Board_Waveshare_ESP32-S3-RS485-CAN.md) | [M5Stack AtomS3R](documents/README/Board_M5Stack_AtomS3.md) | | --- | --- | --- | | - ESP32-S3
- 8MB PSRAM
- 3x RS485 port
- 1x CAN port
- 15x GPIOs | - ESP32-S3
- 8MB PSRAM
- 1x RS485 port
- 1x CAN port
- 1x SH1.0 connector
- 16x GPIOs | - ESP32-S3
- 8MB PSRAM
- 1x BASE port (**for adding RS485/CAN base**)
- 1x UNIT HY2.0 port (**for adding RS485/CAN unit**)
- 6x GPIOs | -| | | | +| | | | ### Single-node diff --git a/documents/README/BMS_JK-PB.md b/documents/README/BMS_JK-PB.md index 66f533a..07852d6 100644 --- a/documents/README/BMS_JK-PB.md +++ b/documents/README/BMS_JK-PB.md @@ -11,12 +11,6 @@ > Using **DIP switch addresses 1 to 15** does not reliably guarantee that the **UART2 (RS485-2)** port protocol will be automatically configured to **001 - JK BMS RS485 Modbus V1.0**, which allows **YamBMS** to access BMS informations. > YamBMS users have confirmed that it is possible to resolve this issue by performing an [Erase History Data](BMS_JK-PB.md#erase-history-data) from the JK app on a smartphone. - -> The alternative solution is to use the **UART1 (RS485-1)** port configured with the **001 - JK BMS RS485 Modbus V1.0** protocol from the JK application. -> Downgrading to **V19.10** does not guarantee to correct this problem, [please read this information before downgrading](BMS_JK-PB.md#downgrading-to-1910). - - - > [!IMPORTANT] > The most important thing for proper functioning of YamBMS is that **the voltage of your BMS is well calibrated**. > YamBMS logic is based on the `min_cell_voltage` and `max_cell_voltage` voltages of your BMS. diff --git a/documents/README/Supported_devices_Build_your_own_PCB.md b/documents/README/Board_Build_your_own_PCB.md similarity index 77% rename from documents/README/Supported_devices_Build_your_own_PCB.md rename to documents/README/Board_Build_your_own_PCB.md index 9fc793e..5f1d66b 100644 --- a/documents/README/Supported_devices_Build_your_own_PCB.md +++ b/documents/README/Board_Build_your_own_PCB.md @@ -9,17 +9,21 @@ > [!IMPORTANT] > BMS monitoring with `UART` or `RS485` is recommended. -## Number of BMS supported +## BMS Support Capacity -* 2x BMS with `Bluetooth` (BLE stack consumes significant amount of RAM on device and can cause crash and reboot) -* 3x `JK-B` BMS with `UART/RS485` -* several `JK-PB` BMS with `RS485` (already tested with 7 BMS) +Based on hardware limitations and testing, this board supports: -Note: these are theoretical limits, not all combinations have been tested. +| Communication Method | Maximum BMS | Notes | +|----------------------|-------------|-------| +| **RS485** | Multiple BMS | Best option for monitoring many BMS units | +| **UART** | 3× BMS | Must be connected to the GPIOs header | +| **Bluetooth (BLE)** | 3× BMS (ESP32-S3) | BLE stack consumes significant RAM, may cause crashes/reboots | + +**Note:** These are theoretical limits. Not all combinations have been tested. ## UART/IO Expander -It would be possible to add one or more [WK2168 4x UART expander](https://esphome.io/components/weikai.html) to increase the number of BMS monitored with `UART`. +It would be possible to add one or more [WK2168 4x UART expander](https://esphome.io/components/weikai.html) to increase the number of `UART` port. ## Build your own PCB diff --git a/documents/README/Board_LilyGo_T-Connect.md b/documents/README/Board_LilyGo_T-Connect.md index a7d89d3..c399841 100644 --- a/documents/README/Board_LilyGo_T-Connect.md +++ b/documents/README/Board_LilyGo_T-Connect.md @@ -20,7 +20,8 @@ The LilyGo T-Connect is a multi-functional development board based on the ESP32- - Rich Interfaces: Integrated APA102 LED driver, QWIIC expansion interface - Industrial Design: Wide voltage input (7V-12V DC), 4 positioning holes for easy installation -![LilyGo T-Connect Board](../..//images/MCU_ESP32-S3_LilyGo-T-Connect.jpg) + + ## Board Specifications @@ -45,6 +46,22 @@ The T-Connect is available as a single version with the following specifications **Note:** The T-Connect supports switching configuration between CAN and RS485 modules through onboard jumpers, allowing maximum flexibility with up to 3 RS485 ports + 1 CAN port simultaneously. +## BMS Support Capacity + +Based on hardware limitations and testing, this board supports: + +| Communication Method | Maximum BMS | Notes | +|----------------------|-------------|-------| +| **RS485** | Multiple BMS | Best option for monitoring many BMS units | +| **UART** | 3× BMS | Must be connected to the GPIOs header | +| **Bluetooth (BLE)** | 3× BMS | BLE stack consumes significant RAM, may cause crashes/reboots | + +**Note:** These are theoretical limits. Not all combinations have been tested. + +## UART/IO Expander + +It would be possible to add one or more [WK2168 4x UART expander](https://esphome.io/components/weikai.html) to increase the number of `UART` port. + ## Power Supply The LilyGo T-Connect board can be powered using two methods: @@ -105,12 +122,12 @@ The CAN bus port is positioned at location **No.4** (see photo at the beginning To connect an RS485 device to any of the configured RS485 ports: -| RS485 Port | Terminal Block | +| RS485 | Terminal Block | | --- | --- | -| SG | Shield/Signal Ground (optional but recommended) | -| L pin | RS485 A (Data+) | -| H pin | RS485 B (Data-) | -| DG | Data/Device Ground (optional but recommended) | +| - | SG : Shield/Signal Ground (optional but recommended) | +| A + | L (RS485 A, Data+ non-inverting) | +| B - | H (RS485 B, Data- inverting) | +| GND | DG : Data/Device Ground (optional but recommended) | **Wiring Steps:** 1. Ensure the port is configured for RS485 mode using the onboard jumpers @@ -142,19 +159,19 @@ To connect an RS485 device to any of the configured RS485 ports: To connect a CAN bus device to the CAN port: -| CAN Port | Terminal Block | +| CAN bus | Terminal Block | | --- | --- | -| SG | Shield/Signal Ground (optional but recommended) | -| L pin | CAN L (CAN Low) | -| H pin | CAN H (CAN High) | -| DG | Data/Device Ground (optional but recommended) | +| - | SG : Shield/Signal Ground (optional but recommended) | +| CAN L | L (CAN Low) | +| CAN H | H (CAN High) | +| GND | DG : Data/Device Ground (optional but recommended) | **Wiring Steps:** 1. Ensure the port is configured for CAN mode using the onboard jumpers 2. Identify the CAN H and CAN L wires from your CAN device 3. Connect the **CAN H wire** to the **H pin** of the CAN port 4. Connect the **CAN L wire** to the **L pin** of the CAN port -5. **Connect the ground wire** to the **DG pin** for common reference (highly recommended) +5. **Connect the ground wire** to the **DG pin** for common reference (optional but recommended) 6. If using **shielded cable**, connect the shield to the **SG pin** (recommended for noisy environments) **Ground Connection Best Practices:** @@ -316,12 +333,12 @@ For a typical YamBMS setup with the LilyGo T-Connect board: ### Waveshare ESP32-S3-RS485-CAN vs LilyGo T-Connect | Feature | Waveshare | LilyGo T-Connect | -| --- | --- | --- | +| ------- | --------- | ---------------- | | RS485 Ports | 1 (isolated) | Up to 3 (isolated) | | CAN Ports | 1 (isolated) | 1 (isolated) | | Built-in Termination | ✅ Yes (120Ω jumper-selectable) | ❌ No (external resistors required) | -| Power Isolation | ✅ Yes | Unknown | -| Signal Isolation | ✅ Yes (RS485 & CAN) | Likely yes | +| Power Isolation | ✅ Yes | ❌ No | +| Signal Isolation | ✅ Yes (RS485 & CAN) | ✅ Yes (RS485 & CAN up to 2500V) | | Enclosure | ✅ DIN rail ABS case included | ❌ No enclosure | | Power Input | 7-36V DC or USB-C | 7-12V DC or USB-C | | LED Indicators | PWR, RS485 TX/RX, CAN | PWR, APA102 support | diff --git a/documents/README/Board_M5Stack_AtomS3.md b/documents/README/Board_M5Stack_AtomS3.md new file mode 100644 index 0000000..4e9c47d --- /dev/null +++ b/documents/README/Board_M5Stack_AtomS3.md @@ -0,0 +1,470 @@ +# YamBMS - M5Stack AtomS3 + +[![Badge License: GPLv3](https://img.shields.io/badge/License-GPLv3-brightgreen.svg)](https://www.gnu.org/licenses/gpl-3.0) +[![Badge Version](https://img.shields.io/github/v/release/Sleeper85/esphome-yambms?include_prereleases&color=yellow&logo=DocuSign&logoColor=white)](https://github.com/Sleeper85/esphome-yambms/releases/latest) +![GitHub stars](https://img.shields.io/github/stars/Sleeper85/esphome-yambms) +![GitHub forks](https://img.shields.io/github/forks/Sleeper85/esphome-yambms) +![GitHub watchers](https://img.shields.io/github/watchers/Sleeper85/esphome-yambms) + +> [!IMPORTANT] +> **GPIO Limitation:** AtomS3 provides **very few GPIOs**. This solution works best for: +> - **Supervising multiple RS485 BMS** +> - Limited number of UART BMS (3 maximum) +> - Applications where compact size is priority + +## Overview + +The M5Stack **AtomS3** combined with the **Atomic CAN Base** provides a compact and powerful solution for YamBMS applications. This combination offers CAN bus communication with isolation, a built-in display, and expandability through additional M5Stack units. + +**Key Features:** +- Compact design (24×24×13mm AtomS3 footprint) +- ESP32-S3 with 8MB Flash +- Built-in 0.85" IPS display (128×128 pixels) +- Isolated CAN bus communication (up to 1Mbps) +- 6-axis IMU (MPU6886) +- Expandable with M5Stack Units (RS485, CAN, etc.) +- Programmable button +- Multiple development platforms supported + +## Board Variants & Components + +### AtomS3 Controllers + +Choose one AtomS3 controller to clip onto the Atomic CAN Base: + +| [AtomS3 Lite](https://docs.m5stack.com/en/core/AtomS3%20Lite) | [AtomS3](https://docs.m5stack.com/en/core/AtomS3) | [AtomS3R (8MB PSRAM)](https://docs.m5stack.com/en/core/AtomS3R) | +| --- | --- | --- | +| | | | + +| Model | Flash | PSRAM | Display | IMU | Best For | +|-------|-------|-------|---------|-----|----------| +| **[AtomS3 Lite](https://docs.m5stack.com/en/core/AtomS3%20Lite)** (C124) | 8MB | No | 0.85" IPS | MPU6886 | Budget projects | +| **[AtomS3](https://docs.m5stack.com/en/core/AtomS3)** (C123) | 8MB | No | 0.85" IPS | MPU6886 | Standard applications | +| **[AtomS3R](https://docs.m5stack.com/en/core/AtomS3R)** (C126) | 8MB | **8MB** | 0.85" IPS | MPU6886 | **Recommended** (extra RAM) | + +**Recommendation:** Choose **AtomS3R (C126)** if using Bluetooth BLE for BMS communication, as the extra 8MB PSRAM helps prevent crashes when the BLE stack consumes significant RAM. + +### Base & Communication Units + +| [Atomic CAN Base](https://docs.m5stack.com/en/atom/Atomic%20CAN%20Base) | [CAN Unit](https://docs.m5stack.com/en/unit/can) | [RS485 Unit](https://docs.m5stack.com/en/unit/iso485) | +| --- | --- | --- | +| | | | + +| Component | Type | Features | Use Case | +|-----------|------|----------|----------| +| **[Atomic CAN Base](https://docs.m5stack.com/en/atom/Atomic%20CAN%20Base)** (A103) | CAN Base | Isolated CAN, up to 1Mbps, 110 nodes | **Recommended** for inverter | +| **[CAN Unit](https://docs.m5stack.com/en/unit/can)** (U085) | HY2.0 Unit | Isolated CAN via Grove port | Alternative CAN solution | +| **[RS485-ISO Unit](https://docs.m5stack.com/en/unit/iso485)** (U094) | HY2.0 Unit | Isolated RS485, up to 500kbps, 256 nodes | For RS485 BMS or multi-node | + +## BMS Support Capacity + +Based on hardware limitations and testing, this board supports: + +| Communication Method | Maximum BMS | Notes | +|----------------------|-------------|-------| +| **RS485** | Multiple BMS | Best option for monitoring many BMS units | +| **UART** | 3× BMS | The 2nd and 3rd UARTs must be connected on Atomic CAN Base GPIOs | +| **Bluetooth (BLE)** | 3× BMS | BLE stack consumes significant RAM, may cause crashes/reboots | + +**Note:** These are theoretical limits. Not all combinations have been tested. For large installations with many BMS units, consider boards with more GPIOs like the LilyGo T-Connect or Waveshare ESP32-S3-RS485-CAN. + +## AtomS3 Specifications + +### Hardware Specifications + +| Specification | Details | +|--------------|---------| +| **Microcontroller** | ESP32-S3FN8 | +| **Processor** | Xtensa 32-bit LX7 dual-core @ up to 240MHz | +| **Flash** | 8MB | +| **PSRAM** | None (AtomS3 Lite/AtomS3) / 8MB Octal SPI (AtomS3R) | +| **Display** | 0.85" IPS LCD, 128×128 resolution | +| **IMU** | MPU6886 (6-axis gyro + accel, I2C 0x68) | +| **Button** | 1× Programmable button | +| **Infrared** | IR transmitter built-in | +| **USB** | USB Type-C (power + programming) | +| **DC-DC** | SY8089 (5V to 3.3V) | +| **Power Input** | 5V via USB Type-C | +| **Operating Temp** | 0°C ~ 40°C | +| **Dimensions** | 24.0 × 24.0 × 12.9mm | +| **Weight** | 6.9g | + +### GPIO Pinout + +**Available GPIOs (Bottom Pins):** +- **G5** / **G6** / **G7** / **G8** / **G38** / **G39** +- Power: **5V**, **3.3V**, **GND** + +**HY2.0-4P Expansion Port:** +| Pin | Color | Function | +|-----|-------|----------| +| 1 | Black | GND | +| 2 | Red | 5V | +| 3 | Yellow | G2 | +| 4 | White | G1 | + +**Internal Connections:** + +| Peripheral | GPIO Pins | Notes | +|-----------|-----------|-------| +| **LCD Display** | MOSI: G21, SCK: G17, CS: G15, RS: G33, RST: G34, BL: G16 | SPI interface | +| **MPU6886 (IMU)** | SDA: G38, SCL: G39 | I2C address 0x68 | +| **IR Transmitter** | Built-in | For infrared control | + +## Atomic CAN Base Specifications + +### Hardware Specifications + +| Specification | Details | +|--------------|---------| +| **CAN Transceiver** | CA-IS3050G (isolated) | +| **Maximum Rate** | 1 Mbps | +| **Supported Nodes** | Up to 110 nodes | +| **Loop Delay** | 150ns (low) | +| **Common-mode Voltage** | -12V to +12V | +| **Isolation** | Built-in isolated DC-DC | +| **Protection** | Signal protection + electrical line protection | +| **External Port** | VH3.96-4P terminal block | +| **Operating Temp** | 0°C ~ 40°C | +| **Dimensions** | 24 × 48 × 18mm | +| **Weight** | 11.1g | + +### Atomic CAN Base Pinout + +The Atomic CAN Base connects to AtomS3 through the bottom pins: + +| Pin | LEFT | RIGHT | Pin | +|-----|------|-------|-----| +| | | 1 | 3.3V | +| | 2 | 3 | UART_TX (CAN_TX) | +| | 4 | 5 | UART_RX (CAN_RX) | +| 5V | 6 | 7 | | +| GND | 8 | 9 | | + +**CAN Terminal Block (VH3.96-4P):** +- **CAN H** (CAN High) +- **CAN L** (CAN Low) +- **GND** (Ground) + +**Note:** The exact UART pins used depend on configuration. Check the schematic for GPIO assignment. + +## RS485-ISO Unit Specifications + +If you need RS485 communication (e.g., for RS485 BMS, multi-node), add the **RS485-ISO Unit (U094)**: + +| Specification | Details | +|--------------|---------| +| **Isolation Chip** | CA-IS3082W | +| **Maximum Rate** | 500 kbps | +| **Supported Nodes** | Up to 256 nodes | +| **Isolation Voltage** | 1000V RMS | +| **Protection** | Fail-safe, Overcurrent, Thermal shutdown, ±15kV ESD | +| **Connection** | HY2.0-4P Grove cable to AtomS3 | +| **Terminal** | VH-3.96 4P (A, B, GND, +V) | +| **Dimensions** | 56.0 × 24.0 × 10.2mm | +| **Weight** | 9.1g | + +**RS485-ISO Unit Pinout:** + +| HY2.0-4P | Black | Red | Yellow | White | +|----------|-------|-----|--------|-------| +| PORT.C | GND | 5V | UART_RX | UART_TX | + +**Termination Resistor:** The RS485-ISO Unit includes a **120Ω termination resistor** (provided separately) that can be connected when the unit is at an endpoint of the RS485 bus. + +## Wiring Instructions + +### Connecting CAN Bus (Atomic CAN Base) + +The Atomic CAN Base provides **isolated CAN communication** via a VH3.96-4P terminal block. + + +| CAN bus | Terminal Block (VH3.96-4P) | +|---------|----------------------------| +| CAN H | H (CAN High) | +| CAN L | L (CAN Low) | +| GND | GND (optional) | + +**Wiring Steps:** +1. Clip the AtomS3 onto the Atomic CAN Base (ensure proper alignment) +2. Identify CAN H and CAN L wires from your inverter or CAN device +3. Connect **CAN H** to **H** (CAN H terminal) +4. Connect **CAN L** to **L** (CAN L terminal) +5. Connect **GND** to **GND** for common reference (optional) + +**CAN Bus Best Practices:** +- The Atomic CAN Base features **built-in isolation** for protection +- CAN bus operates at up to **1 Mbps** data rate +- Supports up to **110 nodes** on the bus +- Use twisted pair cable (120Ω impedance recommended) +- **Termination:** Add 120Ω resistors at both ends of the CAN bus + - If the AtomS3 is at an endpoint, connect a termination resistor + - Check if your inverter has built-in termination before adding external resistors + +### Connecting RS485 (RS485-ISO Unit) + +If using the RS485-ISO Unit for RS485 devices: + +| RS485 | Terminal Block (VH3.96-4P) | +|-------|-----------------------------| +| A + | A (Data+ non-inverting) | +| B - | B (Data- inverting) | +| GND | GND (Ground reference) | + +**Wiring Steps:** +1. Connect the RS485-ISO Unit to the AtomS3 via the **HY2.0-4P Grove cable** (Yellow=RX, White=TX) +2. Identify A and B wires from your RS485 device (often labeled D+/D- or A/B) +3. Connect **RS485 A (D+)** to **Pin 1** (A terminal) +4. Connect **RS485 B (D-)** to **Pin 2** (B terminal) +5. Connect **GND** to **Pin 3** for common reference (recommended) + +**RS485 Best Practices:** +- The RS485-ISO Unit features **1000V isolation** for protection +- RS485 operates at up to **500 kbps** data rate +- Supports up to **256 nodes** on the bus +- Use twisted pair cable for noise immunity +- **Termination:** Connect the included **120Ω resistor** between A and B if the unit is at an endpoint +- The unit includes **fail-safe protection** (outputs high if input is open or shorted) + +## Power Supply + +### AtomS3 Power Options + +**USB Type-C Power:** +- Connect a USB Type-C cable for **5V power** +- Recommended for programming, debugging, and testing +- Built-in **SY8089 DC-DC converter** steps down 5V to 3.3V for ESP32-S3 +- Typical power consumption: 150-300mA (idle to active WiFi) + +**External 5V via HY2.0-4P Grove port:** +- Useful when powering the entire assembly from an external 5V supply + +## Programming & Development + +### Entering Download Mode + +If you have trouble uploading firmware to the AtomS3: + +**Manual Download Mode:** +1. **Press and hold the RESET button** (about 2 seconds) +2. Wait until the **internal green LED lights up** +3. **Release the button** +4. The device is now in download mode and ready for flashing + +![Download Mode Animation](https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/products/core/AtomS3/download%20mode1.gif) + +### LCD Backlight Control + +**Important:** The PWM signal frequency for the LCD backlight driver should be **500Hz**. A frequency that is too high may cause abnormal brightness adjustment functionality. + +**Backlight GPIO:** G16 + +## Display Features + +### Screen Specifications + +| Specification | Details | +|--------------|---------| +| **Size** | 0.85 inch IPS LCD | +| **Resolution** | 128 × 128 pixels | +| **Color Depth** | 65K colors | +| **Driver IC** | GC9107 | +| **Interface** | SPI | +| **Backlight** | PWM controlled (GPIO16) | + +### Display Control Parameters + +The AtomS3's display can be controlled with the following parameters (useful for YamBMS display management): + +**Backlight Settings:** +- **Backlight control**: Manual brightness control (0-100%) +- **Backlight max level**: Limit the maximum brightness in general +- **Backlight auto-dim level**: Desired brightness when dimmed down (set to 0 to switch off screen completely) +- **Backlight auto-dim time**: Time in minutes after which the screen will dim down (set to 0 to disable auto-dimming) + +**Behavior Notes:** +- Device restores last screen brightness after boot +- Auto-dim timer does not start automatically - it gets initially started by pressing the screen button +- Button press bumps brightness to 100% until the timer dims down again +- This provides a lightweight solution without complex automation + +## IMU (MPU6886) + +The AtomS3 includes a built-in **MPU6886** 6-axis IMU: + +| Sensor | Details | +|--------|---------| +| **Model** | MPU6886 | +| **Interface** | I2C (address 0x68) | +| **Pins** | SDA: GPIO38, SCL: GPIO39 | +| **Features** | 3-axis gyroscope + 3-axis accelerometer | + +**Use Cases for YamBMS:** +- Orientation detection +- Vibration monitoring +- Installation angle verification +- Advanced motion-based alerts (optional) + +**Note:** The I2C pins on the back of the AtomS3 share the same bus with the MPU6886. + +## Typical YamBMS Configuration + +### Configuration 1: AtomS3 + Atomic CAN Base + RS485-ISO Unit (Full Setup) + +**Best for:** Multiple RS485 BMS + inverter via CAN + +**Components:** +- AtomS3R (recommended) +- Atomic CAN Base (A103) +- RS485-ISO Unit (U094) + +**Connections:** +1. Clip AtomS3R onto Atomic CAN Base +2. Connect inverter to CAN terminal (CAN H/L) +3. Connect RS485-ISO Unit to AtomS3 via Grove cable (HY2.0-4P) +4. Connect BMS RS485 bus to RS485 terminals (A/B) +5. Power via USB Type-C +6. Add termination resistors at bus endpoints + +**GPIO Usage:** +- CAN: Uses UART pins via Atomic CAN Base +- RS485: Uses G1/G2 via HY2.0-4P Grove port +- Display: Internal SPI (pre-configured) + +### Configuration 2: BLE + CAN (Compact Wireless BMS) + +**Best for:** 2-3 BLE devices + inverter via CAN + +**Components:** +- AtomS3R (8MB PSRAM required for stable BLE) +- Atomic CAN Base (A103) + +**Connections:** +1. Clip AtomS3R onto Atomic CAN Base +2. Connect inverter to CAN terminal +3. Configure BMS via Bluetooth (up to 3× BMS maximum) +4. Power via USB Type-C + +**Limitations:** +- BLE stack consumes significant RAM +- May cause crashes/reboots with >2 BMS +- No physical RS485 connection + +## Troubleshooting + +### AtomS3 Not Entering Download Mode +- **Solution:** Press and hold RESET button (~2 seconds) until green LED lights up, then release +- Try different USB cable (must support data transfer) +- Check USB drivers are installed + +### CAN Bus Communication Issues +- Verify CAN H and CAN L are correctly connected (not swapped) +- Check that CAN bus has **exactly two 120Ω termination resistors** (one at each end) +- Verify CAN bus speed matches inverter (typically 500kbps) +- Measure resistance between CAN H and CAN L (should be ~60Ω with proper termination) +- Check isolation: the Atomic CAN Base has built-in isolation, but verify connections + +### RS485 Communication Issues +- Verify A and B wiring (try swapping if communication fails) +- Check baud rate matches all RS485 devices +- Ensure ground (GND) is connected for common reference +- Add 120Ω termination resistor at RS485-ISO Unit if at bus endpoint +- The RS485-ISO Unit has **fail-safe protection** - if input is open/shorted, receiver outputs high + +### BLE Connection Issues (Bluetooth BMS) +- AtomS3R (8MB PSRAM) strongly recommended for BLE +- BLE stack consumes significant RAM - limit to 3 BMS maximum +- May cause crashes/reboots if too many BLE connections +- Consider switching to RS485 for multiple BMS units + +### Display Issues +- **Backlight frequency:** Ensure PWM frequency is **500Hz** (not higher) +- **Brightness control:** Use manual control via button or software +- **Auto-dim not working:** Timer requires manual activation by pressing button after boot + +### GPIO Limitation Issues +- **Problem:** Not enough GPIOs for all sensors/devices +- **Solution:** Use I2C-based sensors (shares I2C bus with IMU) +- **Alternative:** Consider boards with more GPIOs (LilyGo T-Connect, Waveshare ESP32-S3-RS485-CAN) + +## Additional Resources + +### Official M5Stack Documentation +- [AtomS3 Official Docs](https://docs.m5stack.com/en/core/AtomS3) +- [AtomS3 Lite Official Docs](https://docs.m5stack.com/en/core/AtomS3%20Lite) +- [AtomS3R Official Docs](https://docs.m5stack.com/en/core/AtomS3R) +- [Atomic CAN Base Official Docs](https://docs.m5stack.com/en/atom/Atomic%20CAN%20Base) +- [RS485-ISO Unit Official Docs](https://docs.m5stack.com/en/unit/iso485) + +### Schematics & Datasheets +- [AtomS3 Schematic PDF](https://m5stack-doc.oss-cn-shenzhen.aliyuncs.com/472/Sch_M5_AtomS3_v1.0.pdf) +- [AtomS3 IMU Schematic PDF](https://m5stack-doc.oss-cn-shenzhen.aliyuncs.com/472/Sch_AtomS3_IMU.pdf) +- [ESP32-S3 Datasheet](https://m5stack-doc.oss-cn-shenzhen.aliyuncs.com/472/esp32-s3_datasheet_en.pdf) +- [MPU6886 Datasheet](https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/MPU-6886-000193%2Bv1.1_GHIC_en.pdf) +- [CA-IS3050G Datasheet](https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/unit/CA-IS3050G.pdf) (CAN transceiver) +- [CA-IS3082W Datasheet](https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/unit/IS3082W.pdf) (RS485 transceiver) + +### Software Libraries +- [M5AtomS3 Arduino Library](https://github.com/m5stack/M5AtomS3) +- [M5Unified Library](https://github.com/m5stack/M5Unified) +- [AtomS3 Factory Firmware](https://github.com/m5stack/M5AtomS3-UserDemo) + +### Where to Buy +- [M5Stack Official Store](https://m5stack.com/) +- [M5Stack AliExpress](https://m5stack.aliexpress.com/store/911661199) +- [M5Stack Amazon](https://www.amazon.com/shops/m5stack) +- [M5Stack Distributors](https://m5stack.com/distributor) + +## Product Comparison + +### AtomS3 vs Other YamBMS Boards + +| Feature | AtomS3 + Atomic CAN | LilyGo T-Connect | Waveshare ESP32-S3-RS485-CAN | +|---------|---------------------|------------------|------------------------------| +| **Size** | Very compact (24×24mm) | Medium (94×83mm) | Medium with DIN rail case | +| **Display** | ✅ 0.85" IPS (128×128) | ❌ No | ❌ No | +| **RS485 Ports** | 1 (via Unit) | Up to 3 | 1 (isolated) | +| **CAN Ports** | 1 (isolated) | 1 | 1 (isolated) | +| **Isolation** | ✅ Yes (CAN + RS485 Unit) | ✅ Yes (both) | ✅ Yes (both) | +| **Termination** | External | External | ✅ 120Ω jumper-selectable | +| **GPIOs** | ⚠️ Very limited | Moderate | Moderate | +| **PSRAM** | Optional (AtomS3R: 8MB) | 8MB | 8MB | +| **Best For** | Compact installations, display needed, RS485 BMS | Multiple RS485 ports | Industrial, built-in termination | +| **Price** | Moderate (modular) | Moderate | Moderate | + +**When to Choose AtomS3:** +- ✅ Compact size is critical +- ✅ Built-in display desired +- ✅ Modular expansion preferred +- ✅ BMS via RS485 (multiple units) +- ❌ Need many GPIOs +- ❌ Need multiple RS485 ports simultaneously + +## FAQ + +**Q: Which AtomS3 variant should I choose?** +A: For YamBMS, we recommend **AtomS3R (C126)** with 8MB PSRAM if using Bluetooth BLE, as it provides extra RAM to prevent crashes. For RS485-only applications, AtomS3 or AtomS3 Lite is sufficient. + +**Q: Can I use multiple RS485 and CAN simultaneously?** +A: Yes, but with limitations. AtomS3 has very few GPIOs. You can use Atomic CAN Base (CAN) + RS485-ISO Unit (RS485) simultaneously, but additional expansion is limited. + +**Q: How many BMS can I monitor via UART?** +A: Maximum 3× BMS via UART. The 2nd and 3rd UARTs requires soldering connections on the Atomic CAN Base. + +**Q: Does the Atomic CAN Base require external termination resistors?** +A: The Atomic CAN Base does not have built-in switchable termination. You must add external 120Ω resistors at both ends of the CAN bus. + +**Q: Why does my BLE connection crash after adding the 3rd BMS?** +A: The BLE stack consumes significant RAM. Use AtomS3R (8MB PSRAM) and limit to 3 BMS maximum. + +**Q: Can I power the AtomS3 from the CAN bus?** +A: No, you should power the AtomS3 via USB Type-C (5V). The CAN bus voltage is not suitable for directly powering the device. + +**Q: How do I control the screen backlight?** +A: Use PWM on GPIO16 at 500Hz frequency. Brightness can be controlled manually, and auto-dim requires button activation to start the timer. + +--- + +**License:** This documentation is part of the YamBMS project and follows the same GPLv3 license. + +**Acknowledgments:** Based on official M5Stack documentation and community contributions. diff --git a/documents/README/Board_Waveshare_ESP32-S3-RS485-CAN.md b/documents/README/Board_Waveshare_ESP32-S3-RS485-CAN.md index 158dea4..b732dd7 100644 --- a/documents/README/Board_Waveshare_ESP32-S3-RS485-CAN.md +++ b/documents/README/Board_Waveshare_ESP32-S3-RS485-CAN.md @@ -22,7 +22,8 @@ The Waveshare ESP32-S3-RS485-CAN is an industrial-grade WiFi wireless communicat - Wide voltage input range (7-36V DC) - DIN rail mountable protective enclosure -![LilyGo T-Connect Board](../..//images/MCU_ESP32-S3_WS-RS485-CAN.png) + + ## Board Specifications @@ -43,6 +44,22 @@ The Waveshare ESP32-S3-RS485-CAN is an industrial-grade WiFi wireless communicat | Enclosure | Rail-mounted ABS protective case | | Programming | USB Type-C (firmware download & debugging) | +## BMS Support Capacity + +Based on hardware limitations and testing, this board supports: + +| Communication Method | Maximum BMS | Notes | +|----------------------|-------------|-------| +| **RS485** | Multiple BMS | Best option for monitoring many BMS units | +| **UART** | 3× BMS | Must be connected to the GPIOs header | +| **Bluetooth (BLE)** | 3× BMS | BLE stack consumes significant RAM, may cause crashes/reboots | + +**Note:** These are theoretical limits. Not all combinations have been tested. + +## UART/IO Expander + +It would be possible to add one or more [WK2168 4x UART expander](https://esphome.io/components/weikai.html) to increase the number of `UART` port. + ## Power Supply The Waveshare ESP32-S3-RS485-CAN can be powered using two methods: @@ -116,14 +133,13 @@ To connect an RS485 device to the RS485 port: | RS485 | Terminal Block | | --- | --- | -| A (or +) | RS485 A / Data+ (non-inverting) | -| B (or -) | RS485 B / Data- (inverting) | - +| A + | RS485 A+ (Data+ non-inverting) | +| B - | RS485 B- (Data- inverting) | **Wiring Steps:** 1. Identify the A and B wires from your RS485 device (may be labeled as D+/D-, A/B, or +/-) -2. Connect the **A wire (D+ / Data+)** to the **A terminal** -3. Connect the **B wire (D- / Data-)** to the **B terminal** +2. Connect the **A wire (D+ / Data+)** to the **A+ terminal** +3. Connect the **B wire (D- / Data-)** to the **B- terminal** 4. Connect the **ground wire** to the **GND terminal** for common reference **RS485 Best Practices:** @@ -138,16 +154,16 @@ To connect an RS485 device to the RS485 port: To connect a CAN device to the CAN port: -| CAN | Terminal Block | +| CAN bus | Terminal Block | | --- | --- | -| H (CANH) | CAN High | -| L (CANL) | CAN Low | +| CAN H | CAN H (CAN High) | +| CAN L | CAN L (CAN Low) | **Wiring Steps:** 1. Identify the CAN H and CAN L wires from your CAN device 2. Connect the **CAN H wire** to the **H (CANH) terminal** 3. Connect the **CAN L wire** to the **L (CANL) terminal** -4. Connect the **ground wire** to the **GND terminal** for common reference +4. Connect the **ground wire** to the **GND terminal** for common reference (optional) **CAN Bus Best Practices:** - **Always connect the ground (GND)** for proper common mode voltage reference @@ -346,12 +362,12 @@ Waveshare provides demo firmware with a web interface: ### Waveshare ESP32-S3-RS485-CAN vs LilyGo T-Connect | Feature | Waveshare | LilyGo T-Connect | -| --- | --- | --- | +| ------- | --------- | ---------------- | | RS485 Ports | 1 (isolated) | Up to 3 (isolated) | | CAN Ports | 1 (isolated) | 1 (isolated) | | Built-in Termination | ✅ Yes (120Ω jumper-selectable) | ❌ No (external resistors required) | -| Power Isolation | ✅ Yes | Unknown | -| Signal Isolation | ✅ Yes (RS485 & CAN) | Likely yes | +| Power Isolation | ✅ Yes | ❌ No | +| Signal Isolation | ✅ Yes (RS485 & CAN) | ✅ Yes (RS485 & CAN up to 2500V) | | Enclosure | ✅ DIN rail ABS case included | ❌ No enclosure | | Power Input | 7-36V DC or USB-C | 7-12V DC or USB-C | | LED Indicators | PWR, RS485 TX/RX, CAN | PWR, APA102 support | diff --git a/documents/README/Supported_devices.md b/documents/README/Supported_devices.md index cc4d7aa..e789013 100644 --- a/documents/README/Supported_devices.md +++ b/documents/README/Supported_devices.md @@ -11,6 +11,7 @@ * `JK` BMS (BLE / UART / RS485) * `JBD` BMS (BLE / UART) * `Seplos V1 V2 V3` BMS (RS485) +* `PACE` BMS (RS485) * `BASEN` BMS (RS485) * `DEYE` BMS (CAN) @@ -35,21 +36,18 @@ ## Supported ESP32 -**Recommended: AtomS3 or ESP32-S3** +This project works with various `ESP32` variants and also with the `Raspberry Pi Pico (RP2040)`. +Note that merging data from multiple BMS, balancers and shunts is resource-intensive, so I highly recommend a board based on the `ESP32-S3` with `PSRAM`. -* [M5Stack AtomS3 dedicated documentation](Supported_devices_M5Stack_AtomS3.md) -* [PVbrain2 with ESP32-S3](https://github.com/SeByDocKy/pvbrain2) (up to 11 BMS monitored with `UART`) -* [Build your own PCB with ESP32 or ESP32-S3](Supported_devices_Build_your_own_PCB.md) - -| [AtomS3 Lite](https://docs.m5stack.com/en/core/AtomS3%20Lite) | [AtomS3](https://docs.m5stack.com/en/core/AtomS3) | [AtomS3R (8MB PSRAM)](https://docs.m5stack.com/en/core/AtomS3R) | +| [AtomS3 Lite](Board_M5Stack_AtomS3.md) | [AtomS3](Board_M5Stack_AtomS3.md) | [AtomS3R (8MB PSRAM)](Board_M5Stack_AtomS3.md) | | --- | --- | --- | | | | | -| [LilyGo T-CAN485 (ESP32)](https://github.com/Xinyuan-LilyGO/T-CAN485) | [LilyGo T-Connect (ESP32-S3)](https://github.com/Xinyuan-LilyGO/T-Connect) | [Waveshare ESP32-S3-RS485-CAN](https://www.waveshare.com/esp32-s3-rs485-can.htm) | +| [LilyGo T-CAN485 (ESP32)](https://github.com/Xinyuan-LilyGO/T-CAN485) | [LilyGo T-Connect (ESP32-S3)](Board_LilyGo_T-Connect.md) | [Waveshare ESP32-S3-RS485-CAN](Board_Waveshare_ESP32-S3-RS485-CAN.md) | | --- | --- | --- | -| | | | +| | | | -| [ESP32 DevKit-V1](https://a.aliexpress.com/_EG12CJ2) | [ESP32-S3 DevKitC-1](https://a.aliexpress.com/_EzFdrw3) | [ESP32-C3 ETH01-EVO](https://a.aliexpress.com/_Ey29fog) | +| [ESP32 DevKit-V1](Board_Build_your_own_PCB.md) | [ESP32-S3 DevKitC-1](Board_Build_your_own_PCB.md) | [ESP32-C3 ETH01-EVO](https://a.aliexpress.com/_Ey29fog) | | --- | --- | --- | | | | | diff --git a/documents/README/Supported_devices_M5Stack_AtomS3.md b/documents/README/Supported_devices_M5Stack_AtomS3.md deleted file mode 100644 index 8f40ca3..0000000 --- a/documents/README/Supported_devices_M5Stack_AtomS3.md +++ /dev/null @@ -1,56 +0,0 @@ -# YamBMS - M5Stack AtomS3, the Plug & Play solution (no welding) - -[![Badge License: GPLv3](https://img.shields.io/badge/License-GPLv3-brightgreen.svg)](https://www.gnu.org/licenses/gpl-3.0) -[![Badge Version](https://img.shields.io/github/v/release/Sleeper85/esphome-yambms?include_prereleases&color=yellow&logo=DocuSign&logoColor=white)](https://github.com/Sleeper85/esphome-yambms/releases/latest) -![GitHub stars](https://img.shields.io/github/stars/Sleeper85/esphome-yambms) -![GitHub forks](https://img.shields.io/github/forks/Sleeper85/esphome-yambms) -![GitHub watchers](https://img.shields.io/github/watchers/Sleeper85/esphome-yambms) - -> [!IMPORTANT] -> AtomS3 provides very few GPIOs. -> This solution is not the best for supervising a large number of `JK-B BMS` via `UART` but it works very well for supervising a large number of `JK-PB BMS` via `RS485`. - -> [!TIP] -> If you have `JK-PB BMS` (inverter BMS) and want to monitor them via `RS485`, please read the [BMS JK-PB RS485](BMS_JK-PB_RS485_solution.md) dedicated topic. - -## Number of BMS supported - -* 3x BMS with `Bluetooth` (BLE stack consumes significant amount of RAM on device and can cause crash and reboot) -* 2x `JK-B` BMS with `UART/RS485` (the second UART must be soldered on the Atomic CAN base on GPIOs G7 and G8) -* several `JK-PB` BMS with `RS485` (already tested with 7 BMS) - -Note: these are theoretical limits, not all combinations have been tested. - -## List of M5Stack components that can be used depending on needs - -> [!TIP] -> Choose an `AtomS3` to clip onto the `Atomic CAN Base`. -> Feel free to ask your question on the [DIY solar forum](https://diysolarforum.com/threads/yambms-jk-bms-can-with-new-cut-off-charging-logic-open-source.79325/) if you don't know what to choose. - -- [AtomS3 Lite - SKU:C124](https://docs.m5stack.com/en/core/AtomS3%20Lite) -- [AtomS3 - SKU:C123](https://docs.m5stack.com/en/core/AtomS3) -- [AtomS3R - SKU:C126 (8MB PSRAM)](https://docs.m5stack.com/en/core/AtomS3R) -- [Atomic CAN Base - SKU:A103 (recommended)](https://docs.m5stack.com/en/atom/Atomic%20CAN%20Base) -- [CAN Unit - SKU:U085](https://docs.m5stack.com/en/unit/can) -- [RS485 Unit - SKU:U094](https://docs.m5stack.com/en/unit/iso485) - -| [AtomS3 Lite](https://docs.m5stack.com/en/core/AtomS3%20Lite) | [AtomS3](https://docs.m5stack.com/en/core/AtomS3) | [AtomS3R (8MB PSRAM)](https://docs.m5stack.com/en/core/AtomS3R) | -| --- | --- | --- | -| | | | - -| [Atomic CAN Base (isolated)](https://docs.m5stack.com/en/atom/Atomic%20CAN%20Base) | [CAN Unit (isolated)](https://docs.m5stack.com/en/unit/can) | [RS485 Unit (isolated)](https://docs.m5stack.com/en/unit/iso485) | -| --- | --- | --- | -| | | | - -## Note regarding the sensors managing the display backlight (ili9xxx platform) - -* **Backlight control** : manual brightness control -* **Backlight max level** : limit the max brightness in general -* **Backlight Autodim level** : the desired brightness when dimmed down (set to 0 to switch off screen completely instead of dimming down) -* **Backlight Autodim time in min** : time in minutes, after the screen will dim down (set to 0 to disable Auto dimming) - -Device will restore last screen brightness after boot, but the timer script does not get start automatically. -The auto dim timer gets initially started by pressing the screen button (which bumps up the brightness to 100% until the timer dims down then). - -That seems to be the easiest and lightweight solution. -But i guess some user could be confused and expect from the device to react immediately after changing some parameters. diff --git a/images/MCU_ESP32-S3_LilyGo-T-Connect.jpg b/images/MCU_ESP32-S3_LilyGo-T-Connect_1.jpg similarity index 100% rename from images/MCU_ESP32-S3_LilyGo-T-Connect.jpg rename to images/MCU_ESP32-S3_LilyGo-T-Connect_1.jpg diff --git a/images/MCU_ESP32-S3_LilyGo-T-Connect_2.jpg b/images/MCU_ESP32-S3_LilyGo-T-Connect_2.jpg new file mode 100644 index 0000000..def2ffe Binary files /dev/null and b/images/MCU_ESP32-S3_LilyGo-T-Connect_2.jpg differ diff --git a/images/MCU_ESP32-S3_WS-RS485-CAN_1.png b/images/MCU_ESP32-S3_WS-RS485-CAN_1.png new file mode 100644 index 0000000..51a7f5d Binary files /dev/null and b/images/MCU_ESP32-S3_WS-RS485-CAN_1.png differ diff --git a/images/MCU_ESP32-S3_WS-RS485-CAN.png b/images/MCU_ESP32-S3_WS-RS485-CAN_2.png similarity index 100% rename from images/MCU_ESP32-S3_WS-RS485-CAN.png rename to images/MCU_ESP32-S3_WS-RS485-CAN_2.png