Hardware & setup
Prepare the board and wiring following the guide below, then flash the firmware from your browser in the Automatic Setup section.
Required hardware
The gateway needs an ESP32 board, an RS485 transceiver, and (optionally) a CAN transceiver, wired per the tables below. The exact pin numbers are defined in the firmware's src/BoardPins.h — change them there if you wire it differently.
What you need
- Any ESP32 dev board (e.g. ESP32-WROOM-32, 38-pin DevKit) or an ESP32-S3-DevKitC-1 N8R2 (same RS485 pins, CAN and LED on GPIO5/6/7 instead of 25/26/27)
- A MAX485 / MAX3485 TTL-to-RS485 transceiver (3.3 V version, with DE and RE tied together on one pin)
- An SN65HVD230 (3.3 V) CAN transceiver — only needed if you also want to read the inverter's CAN broadcast
- An RJ45 cable into the BMS's combined 485/CAN port
- A 5V power supply for the ESP32 board
Optional: a ready-made KiCad carrier board combining the ESP32 DevKit, both transceivers, screw terminals (CAN, RS485, power) and a WiFi status LED on one board sized for a DIN-rail housing.
Wiring: MAX485 (RS485) → ESP32
| MAX485 pin | ESP32 pin | ESP32-S3 pin | Notes |
|---|---|---|---|
| VCC | 3.3V | Both transceivers are native 3.3V parts — don't power them from 5V, it could overdrive the ESP32's RX pin. | |
| GND | GND | ||
| DI (driver in) | GPIO17 (TX2) | ||
| RO (receiver out) | GPIO16 (RX2) | ||
| DE + RE (tied together) | GPIO4 | HIGH = transmit, LOW = receive | |
| A | BMS RS485-A (RJ45 pin 2/7) | ||
| B | BMS RS485-B (RJ45 pin 1/8) | ||
Wiring: SN65HVD230 (CAN) → ESP32
| SN65HVD230 pin | ESP32 pin | ESP32-S3 pin | Notes |
|---|---|---|---|
| 3 VCC | 3.3V | Both transceivers are native 3.3V parts — don't power them from 5V, it could overdrive the ESP32's RX pin. | |
| 2 GND | GND | ||
| 1 D (TXD) | GPIO25 | GPIO5 | CAN_TX_PIN |
| 4 R (RXD) | GPIO26 | GPIO6 | CAN_RX_PIN |
| 8 Rs | 10 kΩ → GND | ||
| 5 Vref | — | ||
| 7 CANH / 6 CANL | BMS CAN-H / CAN-L | ||
BMS combined 485/CAN port (RJ45)
The JK-PB2A16S20P has one combined "485/CAN" RJ45 port that carries both buses at once:
| RJ45 pin | Signal |
|---|---|
| 1, 8 | RS485-B |
| 2, 7 | RS485-A |
| 3 | NC |
| 4 | CAN-H |
| 5 | CAN-L |
| 6 | GND |
The carrier board has screw terminals instead of RJ45 jacks. Wire a cut RJ45 cable (or an RJ45 breakout adapter) to them like this:
| RJ45 pin | Board terminal |
|---|---|
| 4 (CAN-H) | J3 pin 1 (CH) |
| 5 (CAN-L) | J3 pin 2 (CL) |
| 6 (GND) | J3 pin 3 / 4 (GND), J4 pin 3 (GND) |
| 2, 7 (RS485-A) | J4 pin 4 (A) |
| 1, 8 (RS485-B) | J4 pin 5 (B) |
Board power: terminal J4, pin 1 = VIN+ (7–60 V), pin 2 = GND; pin 6 is unused. Terminal pins are numbered left to right as seen from the wire side of that edge. Terminal J4 is protected against reversed polarity by the series diode D3 — wired backwards the board simply stays dark.
Important notes
- The firmware listens to the CAN bus passively (listen-only) — it never transmits, so it's safe to connect even to a live bus between the BMS and inverter.
- Only add the 120 Ω CAN termination resistor if the ESP32 is a real end of the bus. If it's just a stub on a bus the BMS and inverter already terminate, leave it out.
- CAN bitrate defaults to 500 kbit/s (JK default) and can be changed at runtime on the dashboard's CAN tab or via
POST /api/can/config. - The BMS only broadcasts CAN when a CAN protocol is selected and enabled in its menu. Use “Deye low-voltage protocol” (48 V) — the Pylontech-compatible frames at 500 kbit/s; the firmware decodes exactly that by default.
Automatic Setup — JK BMS Web Gateway
For classic ESP32 boards (ESP32-WROOM-32, 4 MB flash). Have an ESP32-S3? Use the “JK BMS S3” tab.
Version offered: R1-V1.03s
We recommend Google Chrome or Microsoft Edge — the Web Serial API works there with no extra setup. In Firefox you need to enable serial-port access first (an experimental feature, turned on via about:config → dom.serial.enabled), otherwise the button below won't work.
From version R1-V1.03p (JK BMS) and R1-V1.01m (DEYE) the gateway updates itself from its dashboard: press Check for newer firmware in the footer. You then need this page only for the first installation or when an update fails.
Step-by-step
- Connect the ESP32 board to your computer with a USB cable (on an ESP32-S3-DevKitC-1 use the USB port labelled UART).
- Click "Connect and flash" and allow the browser's serial-port permission prompt.
- Select the "JK BMS Web Gateway" install and confirm.
- Wait about 2 minutes for the firmware and filesystem to finish flashing.
- The device reboots into the "JK-BMS-Setup" WiFi portal — connect to it and enter your home WiFi details.
You must be signed in to download or flash.
Manual Setup — JK BMS Web Gateway
If the automatic browser-based update doesn't work for you, you can also run the update from the command line / PowerShell — just change the PORT number your ESP32 board is listening on.
Flash the files below with:
esptool.py --chip esp32 --port PORT write_flash \
0x1000 bootloader.bin \
0x8000 partitions.bin \
0xe000 boot_app0.bin \
0x10000 firmware.bin \
0x290000 littlefs.bin
You must be signed in to download or flash.
Automatic Setup — JK BMS Web Gateway (ESP32-S3)
For ESP32-S3-DevKitC-1 N8R2 boards (8 MB flash, more headroom for future features). Have a classic ESP32? Use the “JK BMS” tab.
Version offered: R1-V1.03s
We recommend Google Chrome or Microsoft Edge — the Web Serial API works there with no extra setup. In Firefox you need to enable serial-port access first (an experimental feature, turned on via about:config → dom.serial.enabled), otherwise the button below won't work.
From version R1-V1.03p (JK BMS) and R1-V1.01m (DEYE) the gateway updates itself from its dashboard: press Check for newer firmware in the footer. You then need this page only for the first installation or when an update fails.
Step-by-step
- Connect the ESP32 board to your computer with a USB cable (on an ESP32-S3-DevKitC-1 use the USB port labelled UART).
- Click "Connect and flash" and allow the browser's serial-port permission prompt.
- Select the "JK BMS Web Gateway (ESP32-S3)" install and confirm.
- Wait about 2 minutes for the firmware and filesystem to finish flashing.
- The device reboots into the "JK-BMS-Setup" WiFi portal — connect to it and enter your home WiFi details.
You must be signed in to download or flash.
Manual Setup — JK BMS Web Gateway (ESP32-S3)
If the automatic browser-based update doesn't work for you, you can also run the update from the command line / PowerShell — just change the PORT number your ESP32 board is listening on.
Flash the files below with:
esptool.py --chip esp32s3 --port PORT write_flash \
0x0 bootloader.bin \
0x8000 partitions.bin \
0xe000 boot_app0.bin \
0x10000 firmware.bin \
0x670000 littlefs.bin
You must be signed in to download or flash.
Automatic Setup — DEYE Web Gateway
Version offered: R1-V1.01w
We recommend Google Chrome or Microsoft Edge — the Web Serial API works there with no extra setup. In Firefox you need to enable serial-port access first (an experimental feature, turned on via about:config → dom.serial.enabled), otherwise the button below won't work.
From version R1-V1.03p (JK BMS) and R1-V1.01m (DEYE) the gateway updates itself from its dashboard: press Check for newer firmware in the footer. You then need this page only for the first installation or when an update fails.
Step-by-step
- Connect the ESP32 board to your computer with a USB cable (on an ESP32-S3-DevKitC-1 use the USB port labelled UART).
- Click "Connect and flash" and allow the browser's serial-port permission prompt.
- Select the "DEYE Web Gateway" install and confirm.
- Wait about 2 minutes for the firmware and filesystem to finish flashing.
- The device reboots into the "DEYE-Setup" WiFi portal — connect to it and enter your home WiFi details.
You must be signed in to download or flash.
Manual Setup — DEYE Web Gateway
If the automatic browser-based update doesn't work for you, you can also run the update from the command line / PowerShell — just change the PORT number your ESP32 board is listening on.
Flash the files below with:
esptool.py --chip esp32 --port PORT write_flash \
0x1000 bootloader.bin \
0x8000 partitions.bin \
0xe000 boot_app0.bin \
0x10000 firmware.bin \
0x290000 littlefs.bin
You must be signed in to download or flash.