Simple remote (wifi connected) status display for Victron photovoltaic system (with Cerbo GX central system) without cloud access - for environments without internet.
Victron photovoltaic systems with Cerbo GX has display module (GX Touch 50, GX Touch 70) but they are connected to Cerbo by cable. And they are touch-enabled - you can change view, you can change system settings.
I need wifi-connected display with only passive function (no configuration changes), and it run in no-internet environment (no connection to Victron VRM cloud).
It runs basic ESP32-C3 board with cheap 1.8" SPI display. Without soldering - by using dupont F-F cables:
Connection (display pin - ESP32 pin):
- CS - GPIO 7
- RST - GPIO 6
- DC - GPIO 5
- SDA - GPIO 3
- SCL - GPIO 2
- BKL - GPIO 4
- VCC - 3V3
- GND - GND
Box is 3D printed, STL files are in box-display18 folder.
Cerbo GX offers WiFi access point. And Cerbo GX has MQTT broker built in - you just have to switch it on in Settings.
ESP32 can connect to Cerbo's WiFi, then connect to MQTT broker and get all information about your photovoltaic system. Seems easy.
But when you connect to Cerbo's MQTT and subscribe to all topics ("#"), you've got only one topic with ID of Cerbo's system:
You have to read the system ID and publish keeepalive message: empty message to topic R/<system ID>/keepalive
- for example R/c0619ab33b2f/keepalive
After you send the message, MQTT will magically starts filling with data:
But your happiness will last only for one minute, then Cerbo stops publishing more data until you send another keepalive message. So you have to send keepalive message periodically, every 55 seconds.
-
If your Cerbo is not connected to WiFi: switch on WiFi access point in Cerbo GX.
-
In Cerbo's console, go to Settings - Services and switch on MQTT on Lan (SSL). Then another option will appear: MQTT on Lan (plaintext). Switch it on also.
-
Edit config.h section with your photovoltaic system limits:
#define SOLAR_PANELS_POWER_WP (6.0*450.0)
#define INVERTER_POWER_W 2400.0
#define BATTERY_CAPACITY_KWH 3.5
#define INVERTER_OWN_CONSUMPTION 20.0
- Edit config.h section with connection parameters. MQTT broker address is address of Cerbo GX.
// WiFi
#define WIFI_SSID (const char *)"venus-XXXXXXXX-xxx"
#define WIFI_PASSWORD (const char *)"xxxxxxxx"
// MQTT Broker
#define MQTT_BROKER (const char *)"172.24.24.1"
- Board configuration:
- if you have board with serial-to-USB converter:
USB-CDC on boot: disabled
- if you have board with no serial-to-USB converter, with direct USB to ESP32-C3:
USB-CDC on boot: enabled
Flash mode: DIO
CPU speed: 80 MHz
Flash speed: 40 MHz
- Used libraries:
- PubSubClient 2.8
- Tasker 2.0.3
- ArduinoJson 6.21.4
- Adafruit ST7735 and ST7789 Library 1.10.0
- Adafruit GFX Library 1.11.8
- Adafruit BusIO 1.14.4
- Build application, send it into ESP and enjoy.
First bar is battery status.
- Battery icon shows if battery is charged or discharged.
- Percentage is shown as "usable capacity". Battery will cut off at 20 %, so you've got technical reading 20 % - 100 %, which will be displayed as 0 % - 100 % here.
- First data item (-2264 W) is power consumed (negative) or charging (positive).
- Then estimated energy available (2.6 kWh) and estimated time battery will be able to suply current consumption.
Second bar is status of solar panels. 753 W in bar is current power supplied by panels.
- First data row contains: 110 V = panels voltage; 0.5 kWh = today's yield; 1374 W = today maximum power supplied
- Second data row: yield yesterday / two days back / three days back
Third bar is consumption. 2997 W consumed at the moment.
Last line are LEDs on inverter, so:
- Low Battery (correct - there is only one battery, which is unsupported configuration for 3 KW consumption)
- Overload (correct, inverter is rated for constant output of 2400 W)
- inv = "Inverter on"
- Last field is number of messages processed per minute (as debug information - if connection is somewhat broken, there will be 0/m).
Application has been tested on only one photovoltaic system - mine.
It is not generic / universal tool - for example it reads data only for one battery module. If you have more batteries, you will have to change application.
I'm using it on off-grid system, so it doesn't look for grid consumption/production.
https://community.victronenergy.com/questions/155407/mqtt-local-via-mqtt-broker.html