High-current battery: a short circuit can start a fire. Put a fuse next to the battery plus, use thick enough wires and respect the BMS limits.
Read the BMS, do not argue with it
A JK or Daly BMS already knows everything: each cell’s voltage, the current, the temperatures and the state of charge. The job of the ESP32 is to read it and pass it on. It is much better than guessing the charge from the pack voltage.
Connecting safely
JK boards have an RS485 or a TTL port, Daly boards a UART; the protocols are different and so is the pinout, so read the documentation of your exact model before you plug anything in. Use a 3.3 V RS485 transceiver, and never feed the ESP32 from the BMS port unless the manual says that pin is a supply. ESPHome has ready components for JK BMS over RS485 or BLE.
Start read-only. Sending write commands to change protection settings can disable the safety you bought the BMS for.
Watch the cell voltage difference: a spread that grows past about 50 mV at the top of the charge points to a weak cell or a balancer problem.
Send alerts for low temperature when charging; charging LiFePO4 below 0 °C damages it.
Components
ESP32 DevKit V1 (30 pin, WROOM-32)
Wiring
Module
Module pin
ESP32 pin
Note
JK BMS
Bluetooth LE
built into ESP32
no wires for the BLE variant; keep the ESP32 within 5 m
MAX3485 module (optional UART/RS485 variant)
RX / TX
GPIO16 / GPIO17
only if you use the BMS RS485 port instead of BLE
OLED SDA / SCL (optional)
I2C
GPIO21 / GPIO22
Power
5V
USB charger 5V 2A
never from the battery directly
Code
# JK BMS over Bluetooth LE with the community component syssi/esphome-jk-bms.
# Check the component README for the newest option names and your BMS protocol version.
esphome:
name: jk-bms-monitor
esp32:
board: esp32dev
framework:
type: esp-idf
external_components:
- source: github://syssi/esphome-jk-bms@main
refresh: 0s
logger:
api:
encryption:
key: !secret api_key
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
esp32_ble_tracker:
ble_client:
- mac_address: AA:BB:CC:DD:EE:FF # MAC of your JK BMS (see the nRF Connect app)
id: client0
jk_bms_ble:
- ble_client_id: client0
protocol_version: JK02_32S # JK04, JK02_24S or JK02_32S depending on the BMS
throttle: 5s
id: bms0
sensor:
- platform: jk_bms_ble
jk_bms_ble_id: bms0
total_voltage:
name: "Battery voltage"
current:
name: "Battery current"
power:
name: "Battery power"
state_of_charge:
name: "State of charge"
min_cell_voltage:
name: "Min cell voltage"
max_cell_voltage:
name: "Max cell voltage"
delta_cell_voltage:
name: "Cell voltage delta"
temperature_sensor_1:
name: "Battery temperature 1"
power_tube_temperature:
name: "BMS power tube temperature"
Build tips
Find the BMS MAC address with the nRF Connect app and pick the right protocol_version for your BMS.
Keep the ESP32 within a few meters; for Daly or RS485 variants see the component README of the same author.
Other countries: order these parts on AliExpress with the links below.
Some links are affiliate links: we may earn a commission at no extra cost to you.
Related ideas
⛔ High risk
Mains 220–230 V can kill. Work with the power off, use certified isolated modules in an enclosure, fuse the line, and ask a qualified electrician if you are not sure.
Mains 220–230 V can kill. Work with the power off, use certified isolated modules in an enclosure, fuse the line, and ask a qualified electrician if you are not sure.
Comments
No comments yet. Share your experience or ask a question.