How to Build a Smart Energy Monitor
Share
A smart energy monitor turns a vague electricity bill into a live picture of what your home actually draws, which makes it easy to spot the appliances quietly running up costs. This guide builds a non-invasive monitor end to end. Because mains measurement involves a few specific parts, Compoden's AI build assistant can match the clamp sensor, board, and burden circuit to this project and ship them with sample code.
What you'll build
A non-invasive energy monitor that clamps around a single live wire and reads current without cutting into the wiring. An ESP32 calculates power and energy used, then shows live watts and a running total on a dashboard you can open on any phone. Over time it builds a history so you can compare days and find heavy loads.
Parts you need (rough BOM)
- ESP32 development board
- SCT-013 split-core current transformer (clamp sensor)
- Burden resistor and a bias circuit (two resistors and a capacitor)
- Optional: ZMPT101B voltage sensor for true power, not just current
- 0.96-inch OLED display (optional local readout)
- Breadboard, jumper wires, and a 5V supply
- An enclosure to keep the electronics away from mains
The clamp is non-invasive and safe to fit around an insulated wire, but adding a voltage sensor means touching mains, so treat that step with caution or have an electrician help.
How it works
The split-core clamp acts as a current transformer: the current flowing through your live wire induces a proportional small current in the clamp. A burden resistor turns that into a voltage the ESP32 can read on its ADC, with a bias circuit centring the signal so the ADC can capture the full AC wave. The firmware samples that wave, computes RMS current, multiplies by your mains voltage, and accumulates energy in kilowatt-hours.
Wiring overview
Connect the clamp across the burden resistor, and feed that point into an ESP32 ADC pin. Build the bias divider from two equal resistors between 3.3V and ground, with a capacitor to steady it, and tie the divider's midpoint to the clamp circuit so the AC signal rides on a DC offset. If you add the ZMPT101B voltage sensor, it connects to a second ADC pin. Keep grounds common and the mains-facing parts isolated.
Build steps
- Build the bias and burden circuit on a breadboard and check the midpoint sits near half the ADC range.
- Clip the clamp around one live wire of a known appliance such as a kettle.
- Read raw ADC samples and confirm the value swings when the appliance turns on.
- Add code to compute RMS current from the samples.
- Calibrate against a known load until the reading matches expected watts.
- Add energy accumulation so kilowatt-hours build up over time.
- Connect the ESP32 to Wi-Fi and publish to a dashboard.
- House the electronics safely and mount the clamp in your distribution box.
Code outline
- Sample the ADC many times across several mains cycles.
- Subtract the DC bias and compute the root-mean-square of the samples.
- Apply a calibration factor to convert to real amps.
- Multiply by mains voltage to get watts (use the voltage sensor for accuracy).
- Integrate power over time to accumulate kilowatt-hours.
- Publish watts and total energy to the dashboard and update the display.
Troubleshooting
If readings are noisy or never settle, your bias point is probably off-centre; recheck the divider so the idle ADC value sits mid-range. If current reads zero, confirm the clamp is around a single conductor, not the whole cable, since a clamp around both live and neutral cancels out. Wildly wrong watts usually mean the calibration factor is off, so tune it against a known appliance. Add more samples if the value flickers.
Going further
Add the voltage sensor for true power and power factor, monitor several circuits with multiple clamps, or set alerts when usage spikes. You can estimate the cost per appliance using your tariff, log long-term trends, or trigger automation when a specific load turns on.
Build it with Compoden's AI
Tell Compoden's AI build assistant you want an energy monitor and it matches a kit with the clamp sensor, burden and bias components, the ESP32, and an optional voltage sensor, then ships sample code that already computes RMS current. You avoid the tricky bias-circuit mistakes that derail most first attempts. Browse sensors and boards at /collections/all.
Want to see exactly where your power goes? Describe your setup to Compoden's AI and build a monitor that puts your usage on a live dashboard.
FAQ
Is the clamp sensor safe to fit? Yes. A split-core clamp goes around the outside of an insulated wire and never touches a conductor, so it is non-invasive. Only the optional voltage sensor involves a mains connection.
Why does my monitor read zero current? The clamp must go around a single conductor. If it surrounds both the live and neutral together, the fields cancel and you read nothing.
How accurate is a DIY energy monitor? With careful calibration and a voltage sensor for true power, it is accurate enough to compare appliances and track trends, though it is not a billing-grade meter.