Skip to content
Back to Portfolio
IoT/EmbeddedSelf-study, 2025

AC Energy Monitor & Solid-State Protection Relay

RoleHardware Prototyping & Firmware Architecture
StatusCompleted
Last Updated2026-03-20
ESP32ZMPT101BACS712Solid-State RelayFreeRTOSEmbedded C++Optocoupler PC817I2C LCD

Live Build

Working System & Interface Capture

Tektronix digital oscilloscope screen displaying a noisy yellow 50.02 Hz AC waveform on channel 1 overlaid with a smooth RC-filtered cyan sine wave on channel 2 at 500 mV per division
Physical Hardware Bench Setup · Verified Test EnvironmentAC Energy Monitor & Solid-State Protection Relay

Topology

System Schematic & Architecture

ESP32 Telemetry Hardware Architecture · Bench Prototype (v1 Built)
Verified Bench BuildMQTT RTT: 68ms
01. SENSING STAGEANALOG + GPIOACS712-05B + DHT22

Hall-effect AC current with RC low-pass filter (R=1kΩ, C=100nF, fc=1.59kHz) + AM2302 temp/RH

02. MCU & SCHEDULERDUAL-CORE LX6ESP32 DevKit (240MHz)

Core 0: 3.2 kS/s ADC True RMS sampling with 12-pt LUT. Core 1: Wi-Fi state machine & MQTT

03. TELEMETRY & DISPLAYI2C / 802.11nSSD1306 OLED + Wi-Fi MQTT

100kHz I2C bus with 2.2kΩ pull-ups for live Vpp/RMS screen · JSON publish over TLS

Bench Supply: 5V DC via CP2102 / ME6211 3.3V LDO · Measured Standby: 18.2 µAActive Build: ESP32 + ACS712-05B + DHT22 (v1 Bench Prototype) · Next Rev: KiCad PCB with I2C INA226

Telemetry & Bench

Additional Working Interface & Simulator Captures

AC Energy Monitor & Solid-State Protection Relay Bench Assembly
AC Energy Monitor & Solid-State Protection Relay Bench AssemblyVerified
Oscilloscope Waveform: Simultaneous Voltage and Filtered Current Acquisition
Oscilloscope Waveform: Simultaneous Voltage and Filtered Current AcquisitionVerified

Overview

Engineered a digital AC power instrumentation and fast fault-isolation prototype. Combines a precision micro-transformer for AC voltage waveforms, a Hall-effect sensor for current draw, and an opto-isolated solid-state relay to protect bench equipment against short-circuit overcurrent in under 15ms.

The Problem

Standard bench power strips lack fast, cycle-accurate electronic cutoffs for high-current surges and inductive feedback, risking damage to sensitive microcontroller power supplies during testing.

The Solution

Constructed a dual-sensor telemetry and interrupter circuit using a ZMPT101B active voltage transformer module and an ACS712-05B current module. Firmware runs on ESP32 Core 0 computing true active power (W), apparent power (VA), and power factor, triggering a DC-controlled AC solid-state relay (SSR) via PC817 optoisolator whenever instantaneous current breaches user-configured thresholds.

Key Features

Simultaneous true RMS voltage (180V–260V AC) and current (0.05A–5.0A) sampling at 3.2 kS/s
Opto-isolated galvanic barrier separating 230V mains power from the low-voltage ESP32 3.3V logic rail
Zero-crossing phase angle tracking to calculate real-time Power Factor (cos φ)
Under 15ms hardware-level solid-state relay trip isolation during inductive surge transients
Dual-line 16x2 I2C alphanumeric display with visual fault-code latching

Engineering Obstacles

Challenges Overcome

ZMPT101B op-amp introducing ~12° phase shift between line voltage and output waveform, distorting power factor calculations. Corrected via software phase-lead calibration coefficient.

Inductive kickback from switching industrial fan loads causing micro-resets. Eliminated by adding an RC snubber network (100Ω + 0.1µF) directly across SSR output terminals.

Verification & Impact

Results & Verification

Voltage measurement accuracy within ±1.6% across 190V–245V AC utility fluctuations.

Overcurrent trip isolation completed within 12.4ms of fault injection, well within the single-cycle (20ms) safety target.

Reliable continuous operation over 72-hour burn-in test powering variable test loads.

Roadmap & Future Extensions

Future Planned Iterations

01.Design KiCad 4-layer PCB with creepage and clearance slotting meeting IEC 61010-1 insulation standards
02.Integrate Modbus RTU / RS485 transceiver for industrial DIN-rail deployment