Level: Advanced Board: ESP32 DevKit V1 (WROOM-32) Power & blackouts
⚠ Safety High-current battery: a short circuit can start a fire. Fuse the battery plus close to the battery, and never power the ESP32 straight from the battery bank. Read-only monitoring means you do not touch the power wiring.
What you need Buy the parts kit · Estimated total: $10.00
ESP32 DevKit V1 (30 pin, WROOM-32) × 1
$4.00
TTL to RS485 module (MAX3485 / MAX485, 3.3V) × 1
$1.50
DC-DC buck converter (MP1584 / LM2596) × 1
$1.50
Plastic project enclosure × 1
$3.00
Some links are affiliate links: we may earn a commission at no extra cost to you.
Code inverter-modbus.yaml Copy Download .ino
# 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"Flash a ready firmware from the browser Paste your error into the AI Error Doctor
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. ← ← All projects
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.
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.
⛔ 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.
Measures 220 V mains through an isolated ZMPT101B module and warns about sags, surges and blackouts in Telegram or Home Assistant.
⛔ 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.
Reads voltage, current, power and kWh with PZEM-004T and publishes them to a web page, MQTT or Home Assistant.
Comments
No comments yet. Share your experience or ask a question.