ESPHome - Daly BMS using UART Guide

Hi All,

I would like to share my knowledge regarding Daly BMS that have UART functionality to be integrated using ESP base board (NodeMCU) to Home Assistant.

List of guide and links that I use to make it happen. Credit to them!

  1. ESPHome Daly BMS

  2. ESPHome UART

  3. DIYsolarforum

For starters, below is the list of items that needed:

  1. Daly BMS (with UART) sometimes they share it with Bluetooth port

  2. ESP base board (I’m using NodeMCU ESP32)

  3. Wire Connector Universal

  4. PH2.0 Mini Micro JST 2.0 Connector (The connector may vary base on BMS model)

  5. Dupont Jumper Line Wire Male To Female

Wiring

  1. Cut the dupont Male connector

  2. Strip the cable and plug into the Wire Connector

  1. Base on the guide, we need to plug the RX, TX, 3.3V and GND, but in my case i just need RX, TX and GND. I have issues when connecting the 3.3V it wont boot. My NodeMCU ESP32 will be powered from the standard Micro USB.

  1. For extra precautions, i did a continuity test using my multi-meter end to end of the wiring. This should be compulsory for those who have a multi-meter.

ESPHome Configuration

  1. Below is the yaml config file for my setup. Do note that this is for NodeMCU ESP32. You may refer to ESPHome Daly BMS for ESP8266

#General
esphome:
  name: hall-daly-bms

esp32:
  board: nodemcu-32s

#Logging
logger:
  level: DEBUG
  baud_rate: 0

#Network
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: 172.16.0.14
    gateway: 172.16.0.1
    subnet: 255.255.255.128

# Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp-Demo Fallback Hotspot"
    password: "11sOsn77e2G1"

#Sensor
sensor:
  - platform: daly_bms
    voltage:
      name: "Battery Voltage"
    current:
      name: "Battery Current"
    battery_level:
      name: "Battery Level"
    max_cell_voltage:
      name: "Max Cell Voltage"
    max_cell_voltage_number:
      name: "Max Cell Voltage Number"
    min_cell_voltage:
      name: "Min Cell Voltage"
    min_cell_voltage_number:
      name: "Min Cell Voltage Number"
    max_temperature:
      name: "Max Temperature"
    max_temperature_probe_number:
      name: "Max Temperature Probe Number"
    min_temperature:
      name: "Min Temperature"
    min_temperature_probe_number:
      name: "Min Temperature Probe Number"
    remaining_capacity:
      name: "Remaining Capacity"
    cells_number:
      name: "Cells Number"
    temperature_1:
      name: "Temperature 1"
    temperature_2:
      name: "Temperature 2"

#Binary Sensor
binary_sensor:
  - platform: daly_bms
    charging_mos_enabled:
      name: "Charging MOS"
    discharging_mos_enabled:
      name: "Discharging MOS"   

#UART
uart:
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 9600

daly_bms:
  update_interval: 20s

text_sensor:
  - platform: daly_bms
    status:
      name: "BMS Status"

#Others    
api:
ota:

  1. Update - yaml config with my ESP8266

#General
esphome:
  name: yard-esp8266-multisensor
  platform: ESP8266
  board: nodemcuv2

#Logging
logger:
  level: DEBUG
  baud_rate: 0

#Network
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: 172.16.0.16
    gateway: 172.16.0.1
    subnet: 255.255.255.128

# Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp-Demo Fallback Hotspot"
    password: "11sOsn77e2G1"

#i2c
i2c:
  sda: 4
  scl: 5

#Sensor  
sensor:
  - platform: daly_bms
    voltage:
      name: "BMS Battery Voltage"
    current:
      name: "BMS Battery Current"
    battery_level:
      name: "BMS Battery Level"
    max_cell_voltage:
      name: "BMS Max Cell Voltage"
    max_cell_voltage_number:
      name: "BMS Max Cell Voltage Number"
    min_cell_voltage:
      name: "BMS Min Cell Voltage"
    min_cell_voltage_number:
      name: "BMS Min Cell Voltage Number"
    max_temperature:
      name: "BMS Max Temperature"
    max_temperature_probe_number:
      name: "BMS Max Temperature Probe Number"
    min_temperature:
      name: "BMS Min Temperature"
    min_temperature_probe_number:
      name: "BMS Min Temperature Probe Number"
    remaining_capacity:
      name: "BMS Remaining Capacity"
    cells_number:
      name: "BMS Cells Number"
    temperature_1:
      name: "BMS Temperature 1"
    temperature_2:
      name: "BMS Temperature 2"

  - platform: bmp280
    temperature:
      name: "yard-esp8266-multisensor BMP280 Temperature"
      oversampling: 2x
    pressure:
      name: "yard-esp8266-multisensor BMP280 Pressure"
    address: 0x76
    update_interval: 15s   

  - platform: dht
    model: DHT22_TYPE2
    pin: 13
    temperature:
      name: "yard-esp8266-multisensor DHT22 Temperature"
  #    filters:
  #    - calibrate_linear:
  #        - 0.0 -> 0.0
  #        - 20.0 -> 19.0
  #        - 23.0 -> 21.9
  #        - 27.0 -> 25.7
  #        - 31.0 -> 29.7      
    humidity:
      name: "yard-esp8266-multisensor DHT22 Humidity"
    update_interval: 15s   

  - platform: wifi_signal
    name: "yard-esp8266-multisensor RSI"
    update_interval: 15s   

#Binary Sensor
binary_sensor:
  - platform: gpio
    pin: 12
    name: "yard-esp8266-multisensor AM312 PIR"
    device_class: motion

  - platform: daly_bms
    charging_mos_enabled:
      name: "BMS Charging MOS"
    discharging_mos_enabled:
      name: "BMS Discharging MOS"   

#UART
uart:
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 9600

daly_bms:
  update_interval: 20s

text_sensor:
  - platform: daly_bms
    status:
      name: "BMS Status"

#Others
api:
ota:

  1. Flash it with any mean necessary (I’m using ESPHome-Flasher)

  2. Add it in your HA environment, in the Integration (ESPHome)

  3. Done!

List of sensor

charging

2 Likes

I have a compilation error

Hey there, i made everything as u showed. the problem is when i try to add it on the HA i dont get anything there, also when i go to integration and visit the device i got no data there.
What do you think i made wrong :frowning:

Hi can you show the the picture of your connection on the BMS and to ESP. Also please provide the config files

hey i manage to make it but there are a few problems, i got 0 voltage reading on
BMS Battery Current
BMS Number Cells
BMS Max Voltage Cell
BMS Min Voltage Cell
BMS Battery Voltage

esphome:
  name: esphome-web-dd6b3c

esp8266:
  board: esp01_1m


# Enable Home Assistant API
api:

ota:


logger:
 baud_rate: 0

wifi:
  ssid: Highmob
  password: abcd1234highmob

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-Dd6B3C"
    password: "LaN0M0ZqkmAx"


captive_portal:

# Example configuration entry (ESP8266)
uart:
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 9600

daly_bms:
  update_interval: 20s

sensor:
  - platform: daly_bms
    voltage:
      name: "Battery Voltage"
    current:
      name: "Battery Current"
    battery_level:
      name: "Battery Level"
    max_cell_voltage:
      name: "Max Cell Voltage"
    max_cell_voltage_number:
      name: "Max Cell Voltage Number"
    min_cell_voltage:
      name: "Min Cell Voltage"
    min_cell_voltage_number:
      name: "Min Cell Voltage Number"
    max_temperature:
      name: "Max Temperature"
    max_temperature_probe_number:
      name: "Max Temperature Probe Number"
    min_temperature:
      name: "Min Temperature"
    min_temperature_probe_number:
      name: "Min Temperature Probe Number"
    remaining_capacity:
      name: "Remaining Capacity"
    cells_number:
      name: "Cells Number"
    temperature_1:
      name: "Temperature 1"
    temperature_2:
      name: "Temperature 2"
    cell_1_voltage:
      name: "Cell 1 Voltage"
    cell_2_voltage:
      name: "Cell 2 Voltage"
    cell_3_voltage:
      name: "Cell 3 Voltage"
    cell_4_voltage:
      name: "Cell 4 Voltage"

text_sensor:
  - platform: daly_bms
    status:
      name: "BMS Status"


binary_sensor:
  - platform: daly_bms
    charging_mos_enabled:
      name: "Charging MOS"
    discharging_mos_enabled:
      name: "Discharging MOS"

This is the settings i have and i get wrong readings

Also the button BMS Charghing MOS not working, if i click on it it says :Failed to call service binary_sensor/turn_off. Service not found
And if i try to connect the bluetooth to check the bms the app (SMART BMS) crash

Green one goes on TX from the board White one goes on RX and Black goes on Ground

I found the problem, seems i broke my bms. I tested with another BMS and it works.
it reads only the Battery Current, Max, Temperature 1 and BMS Status.
I think i might need to buy a new BMS since i cant even reconect the bluetooth dongle to connect.
Do you know why Discharge and Charge buttons not working? someone says i need to add some lines on config yaml

In my understanding, the MOS button was only for displaying the status, is not meant to be interactive.

May i know what happen to your BMS?

Regarding the Bluetooth, i never had crash issues. But i did notice whenever i reboot/update my ESP, it will encounter some weird value in HA, but it will become normal after awhile. I reckon that we need to safely unplug the ESP from BMS before doing any reboot/update.

Can you share me the link on the statement for the button to works by adding some lines in config?

Just an update, my configuration is still going strong without any issues since the implementation (about 2 months).

i think i have unpluged the bms from the battery first then i unplug the balance wire so it bricked, what do you mean safely unplug esphome form bms?
So the CMOS button will never work ?:smiley:

My version of safely unplug is just power off my ESP (unplug the microUSB cable) then safely remove the balance lead from the BMS. Usually i use this to update the ESP.

Maybe in the future the button would work hopefully, so we can do some automation on it. I’ll update if there’s any changes, especially on the button.

allright :slight_smile: il stay in touch :smiley:

Worked perfectly! Thank you!

I did add a female micro-usb module so that I didn’t have to cut the provided cable. I feel like I would like the ability to go back to the original bluetooth adapter even though I probably never will.

Hi all,
after struggling for quite some time to get this running (while doing everything precisely as mentioned here) I stumbled upon another discussion that solved the communication not working for me, so I wanted to share my experiences. For me the values in HA would appear but not show any data (something like “not available”).
FIX: In some cases it may be necessary to decouple the BMS and the ESP electrically via an ADUM1201 (or similar). The reason being that some DALYs do not have enough power to correctly pull down the RX pin and thus communication simply fails. Since the different DALYs use widely different chips and configurations, some might work without, but mine (8s 100A) would not.
Simply connect the ADUM1201 between BMS and ESP, 3.3V and ground are shared connections between all three components. Here is the site that shows it in detail: https://github.com/softwarecrash/DALY-BMS-to-MQTT

Thank you for finding the fix. As i mention in my post under ‘Wiring’ that i had trouble connecting the 3.3v.
My solution at that time was powered from the standard Micro USB to my ESP board.

I need to buy several ADUM1201 to test out, Thanks again!

Hi, thanks for the guide. I like the approach to communicate with the BMS using the ESP microcontroller, this way it gets Wifi capability and no need for long wires.

I created my own add-on to communicate with the BMS over bluetooth directly (so it doesnt need extra hardware) . https://github.com/fl4p/batmon-ha . Please let me know what you think

Hi. I am trying to connect two BMS to a ESP32. I did open a extra topic for this to keep this part small.

Just hope anyone has a good idea to solve this …