Skip to content

LoRaWAN Node for Growatt PV-Inverter Modbus Data Interface

License

Notifications You must be signed in to change notification settings

matthias-bs/growatt2lorawan

Repository files navigation

CI GitHub release License: MIT

growatt2lorawan

LoRaWAN Node for Growatt Photovoltaic Inverter Modbus Data Interface

This project can be used if you want to monitor your PV Inverter in case it is out of reach of your WiFi access point (and a WiFi repeater would not help/is not wanted) and you are not able to cover the distance with an RS485 cable. Otherwise, the original Growatt ShineWiFi-S (serial) / ShineWiFi-X (USB), the customized otti/Growatt_ShineWiFi-S or nygma2004/growatt2mqtt can be used.

growatt2lorawan Architecture

👷 Work in Progress! 👷

This is a "remix" of

and

Hardware Requirements

  • ESP32 (optionally with LiPo battery charger and battery)
  • SX1276 (or compatible) LoRaWAN Radio Transceiver
  • LoRaWAN Antenna
  • optional: RS485 Transceiver - 3.3V compatible, half-duplex capable (e.g Waveshare 4777 module)
  • optional: USB-to-TTL converter for Debugging (e.g. AZ Delivery HW-598)

Inverter Modbus Interface Options

  1. USB Interface

    The inverter's USB port operates like a USB serial port (UART) interface at 115200 bits/s. If the length of a standard USB cable is sufficient to connect the ESP32 to the inverter (and there are no compatibility issues with the ESP32 board's USB serial interface), this is the easiest variant, because no extra hardware is needed.

    As pointed out in otti/Growatt_ShineWiFi-S, only CH340-based USB-Serial converters are compatible - converters with CP21XX and FTDI chips do not work!

  2. COM Interface

    The inverter's COM port provides an RS485 interface at 9600 bits/s. An RS485 tranceiver is required to connect it to the ESP32.

Modbus Interface Select Input

The desired interface is selected by pulling the GPIO pin INTERFACE_SEL (defined in settings.h) to 3.3V or GND, respectively:

Level Modbus Interface Selection
low (GND) USB Interface
high (3.3V/open) RS485 Interface

Power Supply

The ESP32 development board can be powered from the inverter's USB port which only provides power if the inverter is active.

No sun - no power - no transmission! 😎

But: Some ESP32 boards have an integrated LiPo battery charger. You could power the board from a battery while there is no PV power (at least for a few hours).

Library Dependencies

Pinning Configuration

See src/settings.h

GPIO define Description
INTERFACE_SEL Modbus Interface Selection (USB/RS485)

Modbus via RS485 Interface Only:

GPIO define Waveshare 4777 pin
MAX485_DE RSE
MAX485_RE_NEG n.c.
MAX485_RX RO
MAX485_TX DI

Debug Interface in case of using Modbus via USB Interface (optional):

USB-to-TTL converter, e.g. AZ Delivery HW-598

GPIO define USB to TTL Converter
DEBUG_TX RXD
DEBUG_RX TXD / n.c.

MQTT Integration and IoT MQTT Panel Example

Arduino App: IoT MQTT Panel

Screenshot_20230314-130325_IoT_MQTT_Panel_Pro-1

Set up IoT MQTT Panel from configuration file

You can either edit the provided JSON configuration file before importing it or import it as-is and make the required changes in IoT MQTT Panel. Don't forget to add the broker's certificate if using Secure MQTT! (in the App: Connections -> Edit Connections: Certificate path.)

Editing IoT_MQTT_Panel_Growatt2LoRaWAN.json

Change USERNAME and PASSWORD as needed:

[...]
"username":"USERNAME","password":"PASSWORD"
[...]