Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Home Automation & Smart Devices

Building a Smart Inverter Monitor with ESP32 and Modbus

Building a Smart Inverter Monitor with ESP32 and Modbus

March 11, 2026 /Posted byJayesh Jain / 0

Building a smart inverter monitor with ESP32 and Modbus addresses one of the most important smart home needs in India — visibility into your backup power system. Power cuts are a reality across most Indian states, and knowing your inverter battery status, charge level, and estimated backup time without walking to a physical display is genuinely valuable. This project connects an ESP32 to your inverter via Modbus RS485, pulling real-time data into Home Assistant for monitoring, alerts, and smart load management during outages.

Table of Contents

  • Which Indian Inverters Support Modbus?
  • Required Components
  • RS485 Modbus Wiring
  • Reading Inverter Registers
  • ESP32 Modbus Code
  • Home Assistant Dashboard
  • Load Management Automations
  • Frequently Asked Questions

Which Indian Inverters Support Modbus?

Modbus RTU over RS485 is the most common communication protocol for solar inverters and some UPS systems. Popular Indian inverter brands with Modbus support:

  • Luminous: Higher-end solar PCU models have RS485 Modbus ports
  • Microtek: Solar hybrid inverters with RS485 communication
  • Su-Kam: Solar inverters with Modbus RTU
  • Genus: Smart solar inverters with communication port
  • Growatt: Popular solar inverters with full Modbus register documentation
  • Deye/Solis: Chinese solar inverters imported by many Indian installers, excellent Modbus support

Standard battery UPS inverters (Luminous, Microtek home inverters) typically do NOT have Modbus. For those, use a voltage monitoring approach with the PZEM module or a simple battery voltage divider to the ESP32 ADC.

Recommended: 12V Modbus RTU 4-Channel Relay Module — Add automated load shedding during outages. This relay module connects to the same Modbus RS485 bus as your inverter monitor, allowing Home Assistant to cut non-essential loads when battery drops below 50%.

Required Components

  • ESP32 DevKit V1
  • MAX485 or SP3485 RS485 transceiver module (Rs 30-50 each)
  • 2-wire twisted pair cable (for RS485 bus)
  • 120-ohm termination resistors
  • 5V power supply
  • Your inverter’s communication cable/port adapter

Total cost: Rs 300-500 plus your ESP32 and power supply.

RS485 Modbus Wiring

RS485 uses a differential signal on two wires (A and B). Most inverters provide either RJ11, RJ45, or screw terminal RS485 ports.

MAX485 Module to ESP32:
RO  (Receive) -> GPIO 16 (RX2)
RE+DE (Direction) -> GPIO 4
DI  (Transmit) -> GPIO 17 (TX2)
VCC -> 5V (or 3.3V depending on module)
GND -> GND

MAX485 to Inverter RS485 Port:
A (MAX485) -> A (Inverter)
B (MAX485) -> B (Inverter)

Termination: Add 120-ohm resistor
between A and B at the inverter end
if cable is longer than 10m

Reading Inverter Registers

Every inverter model has a specific Modbus register map in its communication manual. Common registers for solar inverters (Growatt example):

Register Parameter Scale
0x0001 Inverter Status Bitmap
0x0004 Grid Voltage (V) x0.1
0x0006 Grid Power (W) x1
0x001A Battery Voltage (V) x0.1
0x001B Battery SoC (%) x1
0x001E Solar Power (W) x1
0x0056 Load Power (W) x1

ESP32 Modbus Code

#include <ModbusMaster.h>
#include <WiFi.h>
#include <PubSubClient.h>

#define MAX485_DE_RE 4
#define INVERTER_ID 1

ModbusMaster node;
WiFiClient wifiClient;
PubSubClient mqtt(wifiClient);

void preTransmission() { digitalWrite(MAX485_DE_RE, HIGH); }
void postTransmission() { digitalWrite(MAX485_DE_RE, LOW); }

struct InverterData {
  float gridVoltage;
  float batteryVoltage;
  int batterySoC;
  int solarPower;
  int loadPower;
  int gridPower;
  bool onGrid;
};

InverterData readInverter() {
  InverterData data;
  uint8_t result;
  
  // Read input registers starting at 0x0001
  result = node.readInputRegisters(0x0001, 20);
  
  if (result == node.ku8MBSuccess) {
    data.onGrid = (node.getResponseBuffer(0) == 1);
    data.gridVoltage = node.getResponseBuffer(3) * 0.1;
    data.gridPower = node.getResponseBuffer(5);
    
    result = node.readInputRegisters(0x001A, 10);
    if (result == node.ku8MBSuccess) {
      data.batteryVoltage = node.getResponseBuffer(0) * 0.1;
      data.batterySoC = node.getResponseBuffer(1);
      data.solarPower = node.getResponseBuffer(4);
    }
    
    result = node.readInputRegisters(0x0056, 2);
    if (result == node.ku8MBSuccess) {
      data.loadPower = node.getResponseBuffer(0);
    }
  }
  return data;
}

void publishToMQTT(InverterData& data) {
  mqtt.publish("inverter/battery_soc", String(data.batterySoC).c_str());
  mqtt.publish("inverter/battery_voltage", String(data.batteryVoltage).c_str());
  mqtt.publish("inverter/solar_power", String(data.solarPower).c_str());
  mqtt.publish("inverter/load_power", String(data.loadPower).c_str());
  mqtt.publish("inverter/grid_voltage", String(data.gridVoltage).c_str());
  mqtt.publish("inverter/on_grid", data.onGrid ? "on" : "off");
}

void setup() {
  pinMode(MAX485_DE_RE, OUTPUT);
  digitalWrite(MAX485_DE_RE, LOW);
  
  Serial2.begin(9600, SERIAL_8N1, 16, 17); // RX, TX
  node.begin(INVERTER_ID, Serial2);
  node.preTransmission(preTransmission);
  node.postTransmission(postTransmission);
  
  WiFi.begin("YOUR_SSID", "YOUR_PASS");
  while (WiFi.status() != WL_CONNECTED) delay(500);
  mqtt.setServer("192.168.30.100", 1883);
  mqtt.connect("inverter-monitor");
}

void loop() {
  mqtt.loop();
  static unsigned long lastRead = 0;
  if (millis() - lastRead > 10000) {
    InverterData data = readInverter();
    publishToMQTT(data);
    lastRead = millis();
  }
}

Home Assistant Dashboard

# configuration.yaml MQTT sensors
mqtt:
  sensor:
    - name: "Battery SoC"
      state_topic: "inverter/battery_soc"
      unit_of_measurement: "%"
      device_class: battery
    - name: "Solar Power"
      state_topic: "inverter/solar_power"
      unit_of_measurement: W
      device_class: power
    - name: "Load Power"
      state_topic: "inverter/load_power"
      unit_of_measurement: W
      device_class: power
  binary_sensor:
    - name: "Grid Status"
      state_topic: "inverter/on_grid"
      payload_on: "on"
      payload_off: "off"
      device_class: power

Load Management Automations

The real power of inverter monitoring is automatic load management during outages:

alias: Power Cut Load Management
trigger:
  - platform: state
    entity_id: binary_sensor.grid_status
    to: "off"
action:
  # Turn off high-load non-essentials
  - service: switch.turn_off
    entity_id:
      - switch.washing_machine
      - switch.bedroom_2_ac
      - switch.computer_socket
  # Notify family
  - service: notify.family_group
    data:
      message: >-
        Power cut! Battery at {{ states('sensor.battery_soc') }}%.
        Estimated backup: {{ (states('sensor.battery_soc') | int * 1.2) | round }} minutes.

alias: Low Battery Alert
trigger:
  - platform: numeric_state
    entity_id: sensor.battery_soc
    below: 30
action:
  - service: notify.mobile_app
    data:
      message: "Inverter battery at {{ states('sensor.battery_soc') }}%. Reduce loads!"
Recommended: 5V Modbus RTU 8-Channel Relay Module — Share the RS485 Modbus bus between your inverter monitor and this relay module. When battery SoC drops below 30%, Home Assistant triggers this module to cut 8 non-essential circuits automatically.
Recommended: Waveshare 30-Ch Ethernet Relay with Modbus TCP — For large installations with many loads to manage during outages, this Ethernet relay module with Modbus TCP/RTU bridges your Home Assistant network to physical load control with industrial-grade reliability.

Frequently Asked Questions

My home inverter does not have RS485 Modbus. How can I monitor it?

For standard home inverters without Modbus, monitor battery voltage using a voltage divider connected to the ESP32 ADC pin. Battery state-of-charge can be estimated from voltage (12.7V = 100%, 12.0V = 50%, 11.8V = 20% for lead-acid). This is less accurate than Modbus but provides useful monitoring without hardware modification.

What is the baud rate for inverter Modbus communication?

Most inverters use 9600 baud, 8N1 (8 data bits, no parity, 1 stop bit). Some older models use 4800 baud. Check your inverter’s communication manual. The Growatt, Deye, and Solis inverters used widely in India all default to 9600 baud.

Can I monitor multiple inverters with one ESP32?

Yes. RS485 is a multi-drop bus supporting up to 32 devices. Configure each inverter with a unique Modbus device ID (address). The ESP32 polls each inverter sequentially using its specific address. This is common in commercial solar installations with multiple string inverters.

Is this setup compatible with Luminous solar inverters popular in India?

Higher-end Luminous solar PCUs (Cruze, NXG series) have RS485 ports. The Modbus register map varies by model – contact Luminous technical support for the register documentation. The ESP32 Modbus implementation described here works with any Modbus RTU inverter once you have the correct register addresses.

Shop Home Automation at Zbotic –

Tags: ESP32 Modbus, home assistant inverter, inverter monitor, power backup monitor, RS485, solar monitor india
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
OPC UA Protocol: Industrial Io...
blog opc ua protocol industrial iot data exchange explained 598558
blog remote controlled robot troubleshooting motor signal issues 598566
Remote Controlled Robot Troubl...

Related posts

Svg%3E
Read more

MQTT for Home Automation: ESP32 + Mosquitto + Home Assistant

April 1, 2026 0
MQTT is the backbone protocol of professional home automation systems. If you are building a smart home with multiple ESP32... Continue reading
Svg%3E
Read more

Curtain and Blind Automation: Stepper Motor Controller

April 1, 2026 0
Curtain automation is one of the most satisfying smart home upgrades you can build. Imagine your curtains opening automatically at... Continue reading
Svg%3E
Read more

Smart Doorbell with Camera: ESP32-CAM Video Intercom

April 1, 2026 0
A smart doorbell with a camera lets you see who is at your door from your phone, even when you... Continue reading
Svg%3E
Read more

Blynk IoT Platform: Control Arduino and ESP32 from Mobile

April 1, 2026 0
The Blynk IoT platform is the fastest way to control your Arduino and ESP32 projects from your mobile phone. Instead... Continue reading
Svg%3E
Read more

PIR Sensor Automatic Light: Save Electricity with Motion Detection

April 1, 2026 0
PIR sensor automatic lights are the simplest and most effective way to save electricity in Indian homes. By automatically turning... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now