Build Project

Energy Monitoring

Build an Isolated AC Current Monitor Prototype

Build a bounded ESP32 AC current monitor prototype with an SCT-013 clamp, ADC biasing, calibration limits, and strict mains-safety guidance.

AdvancedAges 14+90-120 minUnder 35 USDParent Safe
Project Mission

Build an Isolated AC Current Monitor Prototype

The Story

AC power projects deserve extra caution. This version measures only the isolated current-transformer output on the ESP32 side and avoids breadboard mains wiring. The Golden version keeps the implementation narrow and testable: code constants, wiring, GPIO notes, expected output, limitations, and troubleshooting all describe the same educational prototype.

Explain Like I'm 12

The clamp acts like a sensor around one insulated wire. It creates a small safe signal that the ESP32 can estimate, after the circuit shifts it into the ADC range. The ESP32 reads a signal, checks it against a simple rule, and prints or changes an output so you can see what happened.

Learning Support

  • Recommended ageAges 14+
  • Adult supervisionQualified adult or electrician required for anything involving real mains conductors.
  • Classroom useUse a low-voltage signal source or a pre-wired isolated demonstration lead; do not expose live terminals.
  • Parent promptAsk which side of the circuit is isolated from mains and why that matters.
  • Screen-free activityDraw the separation between mains wiring, current clamp, conditioning network, and ESP32 ADC input.
  • Next challengeAdd an isolated voltage module only in a qualified, enclosed setup; keep beginner work current-only.
  • Skills practiced
    • Isolated sensing
    • ADC biasing
    • RMS estimate
    • Calibration limits
  • Learning outcomes
    • Use an SCT-013 current transformer clamp without opening live wiring.
    • Bias an AC waveform around the ESP32 ADC midpoint.
    • Print current and apparent-power estimates without claiming billing accuracy.
    • Explain isolation, enclosure, and calibration limits.
  • Mini experiments
    • Record zero-current baseline.
    • Change ASSUMED_VOLTAGE and observe only the apparent-power estimate change.
    • Compare a known safe load with a qualified reference meter.

Safety Standards

  • Unplug USB before changing jumper wires. Recheck 3.3 V, 5 V, and GND before reconnecting power.
  • Do not power motors, pumps, LED strips, or servos from the ESP32 3.3 V pin. Use a suitable external supply and common ground.
  • Breadboards are for low-current prototypes. Move high-current or unattended builds to proper terminals, enclosure, strain relief, and fusing.
  • Relay and mains-voltage projects require isolation, correct relay ratings, enclosed wiring, and qualified adult supervision.

What You Will Build

A low-voltage ESP32 current-monitor prototype using an SCT-013-030 clamp, ADC midpoint bias, and EmonLib RMS calculations.

Learning Objectives

  • Use an SCT-013 current transformer clamp without opening live wiring.
  • Bias an AC waveform around the ESP32 ADC midpoint.
  • Print current and apparent-power estimates without claiming billing accuracy.
  • Explain isolation, enclosure, and calibration limits.

Components List

  • ESP32 DevKit boardUSB-programmable ESP32 board used for the low-voltage control side.
  • SCT-013-030 current transformer clampIsolated clamp with built-in burden, used around one insulated conductor only.
  • 10 kOhm resistor pairCreates 1.65 V ADC midpoint bias.
  • 10 uF electrolytic capacitorAC-couples the CT signal into the biased ADC node.
  • 3.5 mm jack socketMatches the SCT-013 plug; keep low-voltage side enclosed.

Bill of Materials

PartQtyEstimated CostNotes
ESP32 DevKit board1VariesUSB-programmable ESP32 board used for the low-voltage control side.
SCT-013-030 current transformer clamp1VariesIsolated clamp with built-in burden, used around one insulated conductor only.
10 kOhm resistor pair1VariesCreates 1.65 V ADC midpoint bias.
10 uF electrolytic capacitor1VariesAC-couples the CT signal into the biased ADC node.
3.5 mm jack socket1VariesMatches the SCT-013 plug; keep low-voltage side enclosed.

Wiring

GPIO34 reads the biased CT waveform. The 10 kOhm divider creates a 1.65 V midpoint; the CT signal couples through a capacitor.

Build an Isolated AC Current Monitor Prototype wiring diagram
  1. 1

    Unplug USB before changing the ADC bias circuit.

  2. 2

    Build the 10 kOhm / 10 kOhm divider between 3.3 V and GND.

  3. 3

    Connect the divider midpoint to GPIO34.

  4. 4

    Couple the SCT-013 tip signal into the midpoint through the 10 uF capacitor, observing capacitor polarity for the biased node.

  5. 5

    Connect the SCT-013 sleeve to ESP32 GND on the low-voltage side.

  6. 6

    Clamp only around one insulated conductor in a qualified setup; never expose live mains on the breadboard.

GPIO Mapping

SignalESP32 PinDirectionNotes
Biased CT waveformGPIO34InputADC1 input-only; signal must stay within 0-3.3 V.
Bias midpoint3.3 V / GNDPower10 kOhm divider creates about mid-rail.

Circuit Explanation

The SCT-013 produces an isolated AC signal proportional to current. The bias network shifts that waveform into the ESP32 ADC range so EmonLib can estimate RMS current.

Engineering Explanation

The sketch estimates current and apparent power only. True power, power factor, and kWh require voltage measurement, phase calibration, isolation, and proper enclosure.

Libraries

  • EmonLibInstall EmonLib by OpenEnergyMonitor.

Code

Copy into Arduino IDE. Install any libraries noted in the component guides first.

esp32-ac-power-monitor.ino
// ESP32 Isolated AC Current Monitor Prototype
// Educational estimate only. Mains wiring must be handled by a qualified adult/electrician.
#include "EmonLib.h"

EnergyMonitor emon;
const int CT_PIN = 34;          // ADC1 input at 1.65 V biased midpoint
const float ICAL = 29.0;        // Starter calibration; tune with a known safe reference
const float ASSUMED_VOLTAGE = 120.0; // Change to your region only for apparent-power estimates

void setup() {
  Serial.begin(115200);
  analogReadResolution(12);
  analogSetPinAttenuation(CT_PIN, ADC_11db);
  emon.current(CT_PIN, ICAL);
  Serial.println("Educational isolated CT current monitor. Not billing-grade.");
}

void loop() {
  double irms = emon.calcIrms(1480);
  double apparentPower = irms * ASSUMED_VOLTAGE;
  Serial.printf("Irms estimate: %.3f A  Apparent power estimate: %.1f VA\n", irms, apparentPower);
  delay(5000);
}

Code Explanation

CT_PIN is GPIO34. EmonLib samples the biased waveform, estimates RMS current, and multiplies by an assumed voltage only for apparent-power practice.

Expected Output

Serial Monitor prints Irms estimate and apparent power estimate every five seconds. Treat both as prototype estimates that need calibration.

Troubleshooting

  • Current reads near zero Confirm the clamp surrounds one conductor only and the jack wiring reaches GPIO34.
  • Readings drift Check the midpoint bias and capacitor orientation.
  • Values disagree with a meter Tune ICAL against a known safe reference; do not claim precision.

Common Mistakes

  • Putting mains voltage on a breadboard.
  • Clamping around both live and neutral, which cancels the magnetic field.
  • Claiming billing-grade accuracy.
  • Letting the ADC input exceed 3.3 V.

Testing Checklist

  • Verify midpoint voltage before connecting the CT.
  • Run with no load and record baseline.
  • Use a known safe load under qualified supervision.
  • Power-cycle and confirm readings remain estimates.

Engineering Tips

  • Keep mains and ESP32 wiring physically separated.
  • Use an enclosure for the low-voltage interface.
  • Document calibration assumptions with every reading.

Upgrade Ideas

  • Add OLED display for estimated current.
  • Add SD logging of estimates.
  • Add isolated voltage sensing only with qualified enclosure design.

Real-World Applications

  • Current transformer lesson
  • Energy-estimation prototype
  • Electrical-safety discussion

FAQs

Can this measure billing energy?

No. It is not calibrated or certified for billing.

Can I wire mains to the breadboard?

No. Mains work requires qualified handling and proper enclosure.

Why only apparent power?

The starter circuit measures current only and assumes voltage.

Review, Testing, and References

Author: Abdul Mubeen and the ESP32 Engine editorial team. Last updated: 2026-06-27. Reviewed: wiring logic, Arduino code structure, beginner safety, and learning sequence.

Educational level: Advanced. Estimated completion time: 90-120 min. This project is for learning and prototyping; production or unattended hardware needs additional engineering review.

Project Complete!

You completed Build an Isolated AC Current Monitor Prototype as a safe, bounded ESP32 learning build with matching wiring, code, tests, and limitations.

  • Isolated sensing
  • ADC biasing
  • RMS estimate