Skip to content

jochemkroon/GrowattModbusTCP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Growatt Modbus TCP Gateway

ESP8266 firmware that converts Modbus RTU (from Growatt inverter) to Modbus TCP for home automation integration.

Overview

This firmware turns a ShineWiFi-X stick into a Modbus TCP gateway, enabling home automation systems like Homey, Home Assistant, or OpenHAB to read real-time data from Growatt solar inverters.

Key Features:

  • πŸ”Œ Modbus RTU Master (reads from Growatt inverter via USB/Serial)
  • 🌐 Modbus TCP Server (serves data over WiFi network)
  • ⚑ Low latency - optimized for ESP8266 performance
  • πŸ“Š Protocol 1.20 support (TL-X series inverters)
  • πŸ”§ Serial setup menu (button + USB terminal for WiFi and Modbus settings)

Hardware Requirements

  • ShineWiFi-X stick (ESP8266 ESP-07S based)
    • 1MB flash, 80MHz CPU
    • USB-to-Serial (CH340) interface
  • Growatt Inverter with Modbus support
    • Tested with: 600TL-X (115200 baud, protocol v1.20)
    • Should work with: TL-X, TL3-X, MIC series

Supported Data Points

The gateway reads and publishes the following registers via Modbus TCP:

Real-time Data (Registers 0-48)

  • Inverter status
  • DC input power, voltage, current (PV1, PV2)
  • AC output power (total + per phase)
  • Grid voltage, current, frequency
  • Temperature

Energy Counters (Registers 53-60)

  • Energy produced today (kWh)
  • Total energy produced (kWh)

Installation

Prerequisites

Build & Upload

  1. Clone the repository

    git clone https://github.com/jochemkroon/GrowattModbusTCP.git
    cd GrowattModbusTCP
  2. Configure WiFi credentials

    WiFi and Modbus settings are configured via the serial setup menu (no code edit required).

  3. Build and upload

    # Using PlatformIO CLI
    pio run -e ModbusTCP-Gateway --target upload
    
    # Or use VSCode PlatformIO extension
    # Click "Upload" in the PlatformIO toolbar
  4. Connect to inverter

    • Disconnect ShineWiFi-X from computer
    • Plug into Growatt inverter USB port
    • The stick will connect to WiFi and start serving Modbus TCP

WiFi Setup (Button + Serial Menu)

Use this flow to configure WiFi and network settings:

  1. Connect the ShineWiFi-X stick to USB.
  2. Open a serial monitor at 115200 baud.
  3. Reset/power-cycle the stick.
  4. During boot, when you see Checking button..., hold the hardware button for 5 seconds.
  5. Wait for CONFIG MODE ACTIVATED! and the menu.
  6. Use menu options:
    • 1 set WiFi SSID
    • 2 set WiFi password
    • 3 toggle static IP on/off
    • 4, 5, 6 set IP, gateway, subnet
    • 7, 8, 9 set Modbus ID, baud, TCP port
    • S save and restart
    • R restore defaults and restart
    • X exit without saving

After restart, the gateway boots with the saved settings.

Configuration

Modbus RTU Settings

Default configuration in code:

#define DEFAULT_MODBUS_RTU_SLAVE_ID    1
#define DEFAULT_MODBUS_RTU_BAUD        115200

Modbus TCP Settings

#define DEFAULT_MODBUS_TCP_PORT        502

Update Interval

#define READ_INTERVAL 30  // seconds

Usage

Connecting from Homey

  1. Install "SolarEdge + Growatt TCP modbus" app
  2. Add device with these settings:
    • IP Address: 192.168.1.100 (your static IP)
    • Port: 502
    • Modbus ID: 1
    • Poll Interval: 30-60 seconds

Key Register Addresses (Protocol 1.20)

Register Data Point Type Multiplier Unit
0 Inverter Status 16-bit 1 -
1-2 DC Power Total 32-bit 0.1 W
3 PV1 Voltage 16-bit 0.1 V
5-6 PV1 Power 32-bit 0.1 W
35-36 AC Power Total 32-bit 0.1 W
37 Grid Frequency 16-bit 0.01 Hz
38 AC Voltage L1 16-bit 0.1 V
40-41 AC Power L1 32-bit 0.1 W
53-54 Energy Today 32-bit 0.1 kWh
55-56 Energy Total 32-bit 0.1 kWh

LED Indicators

  • Green (GPIO0): Inverter communication OK
  • Red (GPIO2): Communication error
  • Blue (GPIO16): WiFi activity

Technical Details

Memory Usage

  • RAM: ~30KB (36.8% of 80KB)
  • Flash: ~320KB (33.4% of 958KB)

Network

  • Static IP recommended for reliability
  • Modbus TCP uses standard port 502
  • WiFi reconnect on connection loss

Protocol

Based on Growatt Modbus Protocol v1.20 for TL-X series inverters.

Troubleshooting

No WiFi connection

  • Enter setup mode via button + serial menu and verify SSID/password
  • If static IP is enabled, verify IP/gateway/subnet values
  • Use R in the serial menu to restore defaults and reconfigure

No data from inverter

  • Verify inverter Modbus settings (slave ID, baud rate)
  • Check USB connection (try different cable)
  • Monitor serial output during boot

Homey shows 0W

  • Verify Homey is configured for register 35-36 (AC Power)
  • Check if inverter is actively producing (daylight, grid connected)
  • Test with manual Modbus TCP client tool

Development

Project Structure

Growatt_ShineWiFi-X-master/
β”œβ”€β”€ SRC/
β”‚   └── GrowattModbusTCP.ino    # Main firmware
β”œβ”€β”€ platformio.ini               # PlatformIO config
└── README.md

Libraries Used

License

MIT License.

Credits

  • Based on Growatt_ShineWiFi-X hardware documentation
  • Growatt Modbus protocol definitions (v1.20, v1.24, v3.05)

Support

For issues specific to this Modbus TCP gateway, please open an issue on GitHub.

For general Growatt inverter questions, consult the official Growatt documentation.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages