Modbus project

Hi all!!
Im doing a project to read the information of my seplos BMS with a ESP32 and RS485 converter, and I have some problems and Im blocked for now (Im new with esphome).

I review all connection and the are ok, Im sure because i had connected the cable to the usb converter and works fine with the laptop and the battery monitor.

For now I received some information in the log, but honestly I not really sure if Im doing well and what I need for read and give format to the data.

this my script:

substitutions:
  device_name: battery 

esphome:
  name: ${device_name}
  platformio_options:
    platform: https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
    platform_packages:
      - framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.0
    build_flags: 
      - -DCONFIG_ARDUINO_LOOP_STACK_SIZE=32768
      
esp32:
  board: nodemcu-32s
  framework:
    type: arduino
    version: 2.0.0
# Enable logging
logger:
  level: DEBUG
# Enable Home Assistant API
api:
#  encryption:


ota:
  password: "xxxxxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  ap:
    ssid: "Battery Fallback Hotspot"
    password: "xxxxxxx"

captive_portal:

web_server:
  port: 80

uart:
  id: mod_bus
  tx_pin: GPIO17
  rx_pin: GPIO16
  baud_rate: 19200
  stop_bits: 1
  data_bits: 8
  parity: NONE
  rx_buffer_size: 384
  debug:
    dummy_receiver: false
    direction: BOTH
    after:
      delimiter: "\r"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);

modbus:
  id: modbus1
  uart_id: mod_bus
  send_wait_time: 500ms

modbus_controller:
  - id: epever
    address: 0
    modbus_id: modbus1
    setup_priority: -10
    update_interval: 10s


sensor:

  - platform: wifi_signal
    name: "modbus rssi"
    update_interval: 3600s

and I received in the log the next warning:

[22:05:43][C][logger:293]: Logger:
[22:05:43][C][logger:294]:   Level: DEBUG
[22:05:43][C][logger:295]:   Log Baud Rate: 115200
[22:05:43][C][logger:296]:   Hardware UART: UART0
[22:05:43][C][uart.arduino_esp32:108]: UART Bus 1:
[22:05:43][C][uart.arduino_esp32:109]:   TX Pin: GPIO17
[22:05:43][C][uart.arduino_esp32:110]:   RX Pin: GPIO16
[22:05:43][C][uart.arduino_esp32:112]:   RX Buffer Size: 384
[22:05:43][C][uart.arduino_esp32:114]:   Baud Rate: 19200 baud
[22:05:43][C][uart.arduino_esp32:115]:   Data Bits: 8
[22:05:43][C][uart.arduino_esp32:116]:   Parity: NONE
[22:05:43][C][uart.arduino_esp32:117]:   Stop bits: 1
[22:05:43][C][modbus:139]: Modbus:
[22:05:43][C][modbus:141]:   Send Wait Time: 500 ms
[22:05:44][C][captive_portal:088]: Captive Portal:
[22:05:44][C][web_server:125]: Web Server:
[22:05:44][C][web_server:126]:   Address: battery.local:80
[22:05:44][C][mdns:103]: mDNS:
[22:05:44][C][mdns:104]:   Hostname: battery
[22:05:44][C][ota:093]: Over-The-Air Updates:
[22:05:44][C][ota:094]:   Address: battery.local:3232
[22:05:44][C][ota:097]:   Using Password.
[22:05:44][C][api:138]: API Server:
[22:05:44][C][api:139]:   Address: battery.local:6053
[22:05:44][C][api:143]:   Using noise encryption: NO
[22:05:44][C][wifi_signal.sensor:009]: WiFi Signal 'modbus rssi'
[22:05:44][C][wifi_signal.sensor:009]:   Device Class: 'signal_strength'
[22:05:44][C][wifi_signal.sensor:009]:   State Class: 'measurement'
[22:05:44][C][wifi_signal.sensor:009]:   Unit of Measurement: 'dBm'
[22:05:44][C][wifi_signal.sensor:009]:   Accuracy Decimals: 0
[22:05:44][C][modbus_controller:275]: ModbusController:
[22:05:44][C][modbus_controller:276]:   Address: 0x00
[22:05:44][D][uart_debug:158]: <<< "~20004642E00200FD37\r"
[22:05:44][W][modbus:105]: Modbus CRC Check failed! F0D2!=4330
[22:05:44][D][uart_debug:158]: <<< "~2000460010960001100CCA0CCA0CC80CCB0CCB0CCA0CCB0CCA0CCA0CCB0CC90CC90CCA0CCA0CCB0CCA060B700B700B710B710B830B77FDB814762A050A76C0016176C0000203E81474000"
[22:05:44][D][uart_debug:158]: <<< "0000000000000DC84\r"
[22:05:44][D][uart_debug:158]: <<< "~20004644E00200FD35\r"
[22:05:44][W][modbus:105]: Modbus CRC Check failed! E68!=3630
[22:05:44][W][modbus:105]: Modbus CRC Check failed! 229B!=3030
[22:05:44][D][uart_debug:158]: <<< "~20004600806200011000000000000000000000000000000000060000000000000000140000000000000300000100000000000000000001EB32\r"
[22:05:45][D][uart_debug:158]: <<< "~20004642E00200FD37\r"
[22:05:45][W][modbus:105]: Modbus CRC Check failed! F0D2!=4330
[22:05:45][D][uart_debug:158]: <<< "~2000460010960001100CCA0CCA0CC80CCB0CCB0CCA0CCB0CCA0CCA0CCB0CC90CC90CCA0CCA0CCB0CCA060B700B700B710B710B830B77FDD914762A040A76C0016176C0000203E81474000"
[22:05:45][D][uart_debug:158]: <<< "0000000000000DC82\r"
[22:05:45][D][uart_debug:158]: <<< "~20004644E00200FD35\r"
[22:05:45][W][modbus:105]: Modbus CRC Check failed! E68!=3630
[22:05:45][W][modbus:105]: Modbus CRC Check failed! 229B!=3030
[22:05:45][D][uart_debug:158]: <<< "~20004600806200011000000000000000000000000000000000060000000000000000140000000000000300000100000000000000000001EB32\r"
[22:05:46][D][uart_debug:158]: <<< "~20004642E00200FD37\r"
[22:05:46][W][modbus:105]: Modbus CRC Check failed! 71D0!=4330
[22:05:47][D][uart_debug:158]: <<< "~2000460010960001100CCA0CCA0CC80CCB0CCC0CCA0CCB0CCA0CCB0CCB0CCA0CC90CCA0CCA0CCB0CCA060B700B700B710B710B830B77FDF214762A040A76C0016176C0000203E81475000"
[22:05:47][D][uart_debug:158]: <<< "0000000000000DC7C\r"
[22:05:47][D][uart_debug:158]: <<< "~20004644E00200FD35\r"
[22:05:47][W][modbus:105]: Modbus CRC Check failed! E68!=3630
[22:05:47][W][modbus:105]: Modbus CRC Check failed! 229B!=3030
[22:05:47][D][uart_debug:158]: <<< "~20004600806200011000000000000000000000000000000000060000000000000000140000000000000300000100000000000000000001EB32\r"
[22:05:48][D][uart_debug:158]: <<< "~20004642E00200FD37\r"
[22:05:48][W][modbus:105]: Modbus CRC Check failed! F0D2!=4330

Please, if you can help me and give me some tricks to understand this world… is very complicated form me :slight_smile:

Thanks in advance and have a nice day.

Maybe it’s not normal modbus.

Hi @javierhouse, welcome to the wild world of RS485 and modbus.

I just completed a project that @nikito7 linked to above. There is a lot of info in there so read through, take a look at the files I put up on Github today and buckle up for an adventure.

First advice I’ll give is to ditch the modbus stuff in the YAML file and go with the much more simple uart.write commands. Nothing will progress until you start seeing stuff in the log files for the ESP.

You are going to need the protocol documents for your BMS and they will probably need to come from the manufacturer. Once you have those, share them here so we can take a look.