← 4Wobi

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

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.

ModuleESP32
VCC3V3
GNDGND
RXDGPIO 16
TXDGPIO 17

Modules label RXD/TXD differently. If you get no reply, swap the two wires.

Original wiring drawing: DB9 adapter, RS232 module, ESP32 and RJ45 cable
Original wiring for my inverter (use 3V3 instead of 5V). The RJ45 pinout differs between models, so check the manual of yours.

Code

  1. Download MppReader.ino and mpp_protocol.h into a folder named MppReader.
  2. Install the library PubSubClient in the Arduino IDE.
  3. Enter your WiFi and MQTT settings at the top of the sketch and upload it.
  4. 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 (.

CommandReturns
QPIGSLive values: grid, output, battery, PV, temperature
QPIRIRated values and settings
QMODMode: P power on, S standby, L line, B battery, F fault, H power saving
QPIWSWarnings

Commands starting with P or M change settings. This sketch only reads.

Links