Files
esphome-yambms/documents/README/BMS_JK-B_UART_solution.md
T
2024-12-23 22:42:35 +01:00

7.8 KiB

YamBMS - JK-B BMS UART Solution

Badge License: GPLv3 Badge Version GitHub stars GitHub forks GitHub watchers

External component

esphome-jk-bms by @syssi

Schematic and setup instructions

Caution

The GND of the JK-B GPS port is directly connected with the B- of your battery. Even if your BMS is in protection or stopped you can measure the full voltage between this GND and B+. This therefore presents a risk of bypass of the BMS P- and can be dangerous if the GND of your ESP32 is connected to the GND of your inverter or a measurement shunt for example. I therefore strongly advise you to achieve galvanic isolation between your ESP32 and the UART-TTL of the JK-B GPS port.

Galvanic isolation of the UART-TTL connection

Caution

Please read this page about setting up galvanic isolation of the UART-TTL connection.

Atom S3 (ESP32-S3)

Caution

The diagram below does not show the galvanic isolation of the UART-TTL connection !

The GPIOs are preconfigured in the packages/board/board_atom-s3-lite.yaml file.
You need to import this YAML into the main YAML.

              UART-TTL               RS232-TTL                   CAN BUS
┌──────────┐            ┌──────────┐             ┌────────────┐              ┌──────────┐
│          │<TX------RX>│2        5│<TX-------TX>|            |              |          |
│  JK-BMS  │<RX------TX>│1        6│<RX-------RX>| CA-IS3050G |<---CAN H --->| Inverter |
│          │<----GND--->│   ESP32  │             |    CAN     |<---CAN L --->|          |
│          │     5V---->│5V     3V3|             |            |              |          |
└──────────┘            └──────────┘             └────────────┘              └──────────┘

Atom Lite (ESP32-PICO)

Caution

The diagram below does not show the galvanic isolation of the UART-TTL connection !

The GPIOs are preconfigured in the packages/board/board_atom-lite.yaml file.
You need to import this YAML into the main YAML.

              UART-TTL               RS232-TTL                   CAN BUS
┌──────────┐            ┌──────────┐             ┌────────────┐              ┌──────────┐
│          │<TX------RX>│26      22│<TX-------TX>|            |              |          |
│  JK-BMS  │<RX------TX>│32      19│<RX-------RX>| CA-IS3050G |<---CAN H --->| Inverter |
│          │<----GND--->│   ESP32  │             |    CAN     |<---CAN L --->|          |
│          │     5V---->│5V     3V3|             |            |              |          |
└──────────┘            └──────────┘             └────────────┘              └──────────┘

Generic ESP32 DevKit V1 30 pin

Caution

The diagram below does not show the galvanic isolation of the UART-TTL connection !

The GPIOs are preconfigured in the packages/board/board_esp32-devkit-v1.yaml file.
You need to import this YAML into the main YAML.

3V3 CAN bus

              UART-TTL               RS232-TTL                 CAN BUS (3V3)
┌──────────┐            ┌──────────┐             ┌────────────┐              ┌──────────┐
│          │<TX------RX>│16      23│<TX-------TX>|            |              |          |
│  JK-BMS  │<RX------TX>│17      22│<RX-------RX>| SN65HVD230 |<---CAN H --->| Inverter |
│          │<----GND--->│   ESP32  │<----GND---->|    CAN     |<---CAN L --->|          |
│          │     5V---->│VIN    3V3│<----3V3---->|            |              |          |
└──────────┘            └──────────┘             └────────────┘              └──────────┘


5V CAN bus

              UART-TTL               RS232-TTL                 CAN BUS (5V)
┌──────────┐            ┌──────────┐             ┌────────────┐              ┌──────────┐
│          │<TX------RX>│16      23│<TX-------TX>|            |              |          |
│  JK-BMS  │<RX------TX>│17      22│<RX--4K7--RX>|  TJA1050   |<---CAN H --->| Inverter |
│          │<----GND--->│   ESP32  │<----GND---->|    CAN     |<---CAN L --->|          |
│          │     5V---->│VIN    VIN│<----5V----->|            |              |          |
└──────────┘            └──────────┘             └────────────┘              └──────────┘

Schematic with addition of the UART-TTL to RS485 adapter sold by Jikong


              UART-TTL                  RS485              RS485-TTL              RS232-TTL                CAN BUS
┌──────────┐            ┌───────────┐           ┌────────┐           ┌─────────┐             ┌─────────┐              ┌──────────┐
│          │<----TX---->│Y    JK   Y│<A------A+>│        │<TX-----RX>│16     23│<TX-------TX>|         |              |          |
│  JK-BMS  │<----RX---->│W  RS485  W│<B------B->│ RS485  │<RX-----TX>│17     22│<RX--4K7--RX>| TJA1050 |<---CAN H --->| Inverter |
│          │<----GND--->│B Adaptor B│<---GND--->│To 3.3V │<---GND--->|         |<----GND---->|   CAN   |<---CAN L --->|          |
│          │<----VBAT-->│R          │           │        │<---3V3--->|  ESP32  |<----5V----->|         |              |          |
└──────────┘            └───────────┘           └────────┘           └─────────┘             └─────────┘              └──────────┘

JK-B BMS UART-TTL GPS port

The GPS port sometimes called RS485 is not an RS485 port but 3V3 UART-TTL.

# UART-TTL GPS port on JK-BMS (4 pin, JST 1.25mm pitch)
┌─── ─────── ────┐
│                │
│ O   O   O   O  │
│GND  RX  TX VBAT│ 
└────────────────┘
  │   │   │   └ VBAT is full battery volatge eg 51.2V (possible to use it via an isolated DC-DC converter)
  │   │   └──── TX  to TTL-isolator AI (input)
  │   └──────── RX  to TTL-isolator AO (output)
  └──────────── GND to TTL-isolator GND

The UART-TTL (labeled as GPS) socket of the BMS can be attached to any UART pins of the ESP.
A hardware UART should be preferred because of the high baudrate (115200 baud).
The connector is called 4 pin JST with 1.25mm pitch.

Image