← All projects
ESP32-S3 AC Power Monitor
Mains-powered board streaming live AC energy parameters to the cloud with four relay channels for load control.
- ESP32-S3
- Modbus RTU
- MQTT
- Firebase
- Altium Designer

Problem
Energy dashboards and sub-metering need accurate AC measurement plus the ability to switch loads, from a single board that runs directly off mains.
System overview
A compact IoT board pairing the ESP32-S3 with a PZEM-004T energy meter. Voltage, current, active power, energy, power factor and frequency are read over UART/Modbus RTU and published over Wi-Fi to Firebase, an MQTT broker or another IoT backend. Four optocoupled relay channels switch connected loads from the dashboard or from threshold rules on the MCU. An isolated HLK-PM01 AC-DC module powers the board from mains.
Responsibilities
- Schematic and PCB layout including mains-side clearances
- Firmware for Modbus RTU acquisition and cloud publishing
- Threshold rule engine and relay control logic
Hardware architecture
- ESP32-S3, dual-core 240 MHz Xtensa LX7
- PZEM-004T energy meter, ±0.5% measurement accuracy
- 4× optocoupled relay channels, 10 A contacts
- HLK-PM01 isolated AC-DC module, 100–240 V AC input
- USB-C for flashing and debugging
Firmware architecture
- UART / Modbus RTU polling of the PZEM-004T
- Publishing to Firebase, MQTT or a custom IoT backend over Wi-Fi
- Automated threshold rules for relay switching
Communication interfaces
- UART / Modbus RTU
- Wi-Fi
- MQTT
- USB-C
Engineering challenges
- Mains-side isolation and creepage on a compact two-sided board
- Keeping measurement stable while four relay channels switch inductive loads


