MPP Solar inverter with ESP32 (RS232)
Poll an MPP Solar / Voltronic PIP inverter with an ESP32 and publish the values as JSON via MQTT, for example to emoncms or Node-RED.
First published 2021, reworked and extended in 2026. The code compiles and its protocol functions are tested on a PC, but it has not been run against a real inverter.
Parts
- ESP32 DevKitC
- RS232-to-TTL module (MAX3232, works at 3.3 V)
- RS232 cable for the inverter's RJ45 port
Wiring
Power the module from 3V3, not 5V. The 2021 drawing below shows 5 V. The module then drives its output with 5 V, and the ESP32 pins are not 5 V tolerant.
| Module | ESP32 |
|---|---|
| VCC | 3V3 |
| GND | GND |
| RXD | GPIO 16 |
| TXD | GPIO 17 |
Modules label RXD/TXD differently. If you get no reply, swap the two wires.
Code
- Download MppReader.ino and
mpp_protocol.h into a folder named
MppReader. - Install the library PubSubClient in the Arduino IDE.
- Enter your WiFi and MQTT settings at the top of the sketch and upload it.
- Open the serial monitor at 115200 baud.
Every 10 seconds the topic inverter/status receives a message like this (shortened):
{"grid_v":0,"out_v":230,"out_w":119,"batt_v":57.5,"batt_pct":100,"pv_v":103.8}
Protocol
2400 baud, 8 data bits, no parity, 1 stop bit. A command is sent as
<command><CRC><CR>. The CRC is CRC-16/XMODEM; a CRC byte that equals
(, CR or LF is increased by one. Replies start with (.
| Command | Returns |
|---|---|
QPIGS | Live values: grid, output, battery, PV, temperature |
QPIRI | Rated values and settings |
QMOD | Mode: P power on, S standby, L line, B battery, F fault, H power saving |
QPIWS | Warnings |
Commands starting with P or M change settings. This sketch only reads.