Hybrid inverter monitor (RS485 / Modbus)

Reads load, grid status, battery and solar data from Deye, Growatt or Voltronic-type inverters through their communication port.

Power & batteries Board: ESP32 DevKit V1 (WROOM-32) Level: ●●● ⏱ 3–5 h

⛔ High risk

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.

Speak the inverter’s language

Hybrid inverters expose a communication port, but the port that you need is not always the one you find first. On Deye there is a Modbus RS485 port that is separate from the BMS port. Growatt uses RS485 or a Wi-Fi stick. Voltronic and similar models talk a serial protocol at 2400 baud with text commands such as QPIGS.

Work in this order

  • First connect a USB-RS485 adapter to a PC and read the registers with a Modbus tool. Register maps differ between firmware versions, and it is far easier to debug there than on the ESP32.
  • Then move the same requests to the ESP32 with a 3.3 V transceiver.
  • Poll every 5 to 10 seconds. A busy master can slow down the inverter’s own communication.
  • Keep it read-only. Writing a wrong register can change the charge limits.

A galvanic isolation between the inverter and the ESP32 avoids ground loops. A small buck converter can power the node from the same battery bus.

Components

  • ESP32 DevKit V1 (30 pin, WROOM-32)
  • TTL to RS485 module (MAX3485 / MAX485, 3.3V)
  • DC-DC buck converter (MP1584 / LM2596)
  • Plastic project enclosure

Wiring

Module Module pin ESP32 pin Note
MAX3485 RO / DI UART GPIO16 (RX) / GPIO17 (TX) RO to RX, DI to TX
MAX3485 DE+RE direction GPIO4 omit if the module has auto-direction
MAX3485 A / B RS485 inverter RS485 port A / B check the pinout in your inverter manual
Power for the ESP32 5V buck converter from a SEPARATE low-voltage supply do not power from the inverter battery without fuse and isolation

Code

# Generic Modbus RTU template. The register addresses below are PLACEHOLDERS (0x0000...).
# Take the real addresses, scaling and data types from the Modbus map of YOUR inverter model.
esphome:
  name: inverter-monitor

esp32:
  board: esp32dev
  framework:
    type: arduino

logger:
api:
  encryption:
    key: !secret api_key
ota:
  - platform: esphome
    password: !secret ota_password
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

uart:
  id: mod_uart
  tx_pin: GPIO17
  rx_pin: GPIO16
  baud_rate: 9600
  stop_bits: 1

modbus:
  id: modbus1
  uart_id: mod_uart
  flow_control_pin: GPIO4

modbus_controller:
  - id: inverter
    address: 1                # Modbus slave address of the inverter
    modbus_id: modbus1
    update_interval: 10s

sensor:
  - platform: modbus_controller
    modbus_controller_id: inverter
    name: "Battery voltage"
    address: 0x0000           # TODO: from your register map
    register_type: holding
    value_type: U_WORD
    unit_of_measurement: "V"
    accuracy_decimals: 1
    filters:
      - multiply: 0.1         # TODO: scaling from the register map
  - platform: modbus_controller
    modbus_controller_id: inverter
    name: "Battery state of charge"
    address: 0x0001           # TODO
    register_type: holding
    value_type: U_WORD
    unit_of_measurement: "%"
  - platform: modbus_controller
    modbus_controller_id: inverter
    name: "Load power"
    address: 0x0002           # TODO
    register_type: holding
    value_type: U_WORD
    unit_of_measurement: "W"
  - platform: modbus_controller
    modbus_controller_id: inverter
    name: "Grid power"
    address: 0x0003           # TODO
    register_type: holding
    value_type: S_WORD
    unit_of_measurement: "W"

Build tips

  • Download the Modbus register map for your exact inverter model; addresses and scaling differ between brands.
  • Test with a USB-RS485 adapter and a Modbus tool first; wrong baud rate or A/B swap are the usual faults.

What you need

Buy the parts kit · Estimated total: $10.00

ESP32 DevKit V1 (30 pin, WROOM-32) × 1
$4.00
Buy at AliExpress Buy at Amazon.com
TTL to RS485 module (MAX3485 / MAX485, 3.3V) × 1
$1.50
Buy at AliExpress Buy at Amazon.com
DC-DC buck converter (MP1584 / LM2596) × 1
$1.50
Buy at AliExpress Buy at Amazon.com
Plastic project enclosure × 1
$3.00
Buy at AliExpress Buy at Amazon.com
🇺🇦 Ukraine🌍 Other countries

Ukraine: we buy and sell these parts ourselves, order them on this site.

Some links are affiliate links: we may earn a commission at no extra cost to you.

Related ideas

⛔ High risk

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.

Hybrid inverter monitor over RS485

Reads power, battery state and grid status from a hybrid inverter over its RS485 Modbus port and publishes them locally, with no vendor cloud in between.

  • Board ESP32-C3 SuperMini
  • Level ●●● Advanced
  • Build time 3–4 h
Pick parts / kit
⛔ 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 voltage monitor

Measures 220 V mains through an isolated ZMPT101B module and warns about sags, surges and blackouts in Telegram or Home Assistant.

  • Board ESP32 DevKit V1 (WROOM-32)
  • Level ●●○ Intermediate
  • Build time 2–3 h
Pick parts / kit
⛔ 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.

Smart energy meter

Reads voltage, current, power and kWh with PZEM-004T and publishes them to a web page, MQTT or Home Assistant.

  • Board ESP32 DevKit V1 (WROOM-32)
  • Level ●●○ Intermediate
  • Build time 2–4 h
Pick parts / kit

← All module ideas →

Comments

No comments yet. Share your experience or ask a question.

Comments are moderated.