Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesSome links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
The safe way to build an ESP32 home energy monitor is to keep the ESP32 on the low-voltage side of the system. Measure current with split-core current transformers (CTs), power the controller from an isolated supply, and use isolated voltage sensing or a dedicated energy-meter IC only when you need true active-power measurements.
This is a monitoring project, not a billing meter. Installing CTs near a service panel can still expose you to dangerous voltages, and work inside a panel may require a qualified electrician under local rules.
As an Amazon Associate I earn from qualifying purchases.
Start with the safety boundary
Never connect household mains directly to an ESP32 GPIO. Do not use a non-isolated mains voltage divider, a capacitive-dropper power supply, or an exposed mains-referenced circuit. The ESP32 should receive only a properly conditioned, low-voltage signal from a CT, isolated voltage transformer, external ADC, or energy-meter IC.
A CT is non-invasive because it normally does not make metallic contact with the conductor. That does not make installation risk-free. The clamp is fitted near energized wiring, and its leads, circuit board, power supply, enclosure, and connectors still need suitable insulation, spacing, strain relief, protection, and secure mounting. OpenEnergyMonitor recommends de-energizing before CT installation. Home Assistant likewise warns that panel work should be done by someone familiar with electrical wiring or a licensed professional where required.
Popular on Amazon
- 2.4GHz Dual Mode WiFi + Bluetooth Development Board
- Support LWIP protocol, Freertos
- SupportThree Modes: AP, STA, and AP+STA
- Ultra-Low power consumption, Compatible with Arduino IDE
- ESP32 is a safe, reliable, and scalable to a variety of applications
Never do these things
- Connect a mains conductor directly to an ESP32 pin.
- Connect a non-isolated voltage divider from mains to the ESP32.
- Power the board from an unapproved capacitive-dropper circuit.
- Open or modify a CT secondary while it is clamped around a live conductor unless the CT is specifically designed for that condition.
- Insert a bare current transformer in series with mains.
- Assume a low-voltage connector makes an entire commercial meter PCB safe to touch.
- Attach a USB computer to a mains-powered board unless the isolation and procedure are explicitly suitable.
Use a flame-retardant enclosure, suitable cable glands, protected low-voltage terminals, correct fusing where applicable, and physical separation between sensor wiring and mains conductors. Do not describe an uncertified hobby build as UL-listed, code-compliant, or billing-grade.
What the monitor actually measures
Choosing the measurement architecture starts with defining the result you need:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
| Quantity | Meaning | Can a CT alone provide it? |
|---|---|---|
| Current (A) | RMS current flowing through the monitored conductor | Yes, after suitable signal conditioning |
| Apparent power (VA) | Voltage multiplied by RMS current | Only as an estimate if voltage is assumed |
| Active power (W) | Power actually consumed or exported | Not reliably; voltage waveform and phase are needed |
| Reactive power (VAR) | Energy exchanged with reactive loads | No |
| Power factor | Active power divided by apparent power | No |
| Energy (Wh/kWh) | Power integrated over time | Only as good as the power measurement |
For a current-only monitor, an estimate such as apparent power ≈ RMS current × assumed line voltage is useful for trends. It is not the same as measured active power. Motors, LED drivers, switching supplies, solar inverters, and other nonlinear loads can have power factors substantially below one.
Choose the architecture before choosing the board
Option 1: CT-only apparent-power monitor
This is the simplest DIY path:
Mains conductor → split-core CT → burden/protection → ADC → ESP32 → Home Assistant
It uses an ESP32, one CT per monitored conductor, a suitable burden resistor when the CT requires one, a midpoint-bias circuit, input protection, and an isolated low-voltage supply.
It is inexpensive and useful for trends, appliance comparisons, and automation. Its limitations are important: it relies on an assumed voltage, does not measure power factor, handles export poorly, and does not automatically track voltage fluctuations.
Option 2: CT plus isolated AC voltage sensing
Add a properly rated, certified AC/AC voltage transformer or other isolated voltage-sensing module. Sampling voltage and current together allows the system to calculate active power, power factor, and import/export direction more accurately.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →This adds calibration, phase-shift compensation, signal conditioning, and another safety-critical component. The voltage adapter must be correctly rated and safely installed. OpenEnergyMonitor documents the relationship between CTs, AC voltage adapters, phase, and calibration.
Option 3: Dedicated energy-meter IC or pre-certified meter
An ATM90E32, ADE-family metering IC, or a commercial device such as Shelly EM or Shelly 3EM is often a better engineering choice when true energy measurement matters. These products or boards generally provide more appropriate sampling and metrology than repeatedly optimizing the ESP32’s built-in ADC.
Check the actual isolation, enclosure, ratings, and regional compliance of the specific product. A mains-connected metering board is not automatically safe because it contains an ESP32 or exposes a low-voltage programming header.
Also popular on Amazon
- Dual-Core Performance Up to 240 MHz: Run sensor processing, wireless communication, automation logic and connected-device tasks on a 32-bit dual-core ESP32 platform designed for responsive embedded and IoT projects
- Built-in Wi-Fi and Bluetooth 4.2: Connect to 2.4 GHz Wi-Fi networks or use Bluetooth Classic and BLE for wireless sensors, smart devices, remote controls, home automation and other connected projects
- Flexible Power-Saving Modes: ESP32 power-management features support dynamic clock scaling and low-power operating modes, helping developers reduce energy use in compatible sensing, monitoring and connected-device applications, suitable for battery-powered Internet of Things (IoT) devices.
- USB-C Programming with CP2102: Connect through USB-C for power, sketch uploads and serial monitoring, while GPIO, UART, SPI and I2C interfaces support sensors, displays, motor drivers and other modules (USB-C cable not included)
- Over-the-Air Update Support: Configure OTA functionality through a compatible ESP-32 software framework to update deployed firmware over Wi-Fi without reconnecting the board by USB for every revision
| Requirement | DIY CT-only | CT plus voltage sensing | Dedicated meter or certified product |
|---|---|---|---|
| Lowest cost | Strong | Moderate | Variable |
| Customization | Excellent | Excellent | Varies |
| True active power | Weak | Good when correctly sampled | Usually good |
| Calibration effort | High | High | Low to moderate |
| Safety confidence | Depends on the build | Depends heavily on the build | Usually highest when professionally installed |
| Billing suitability | No | No by default | Only where explicitly certified |
CT placement and household wiring
A split-core CT must normally surround one current-carrying conductor. If it surrounds both line and neutral in the same cable, their magnetic fields largely cancel and the reading may be close to zero.
Correct: [ CT ] around Line only
Incorrect: [ CT ] around Line + Neutral together
Record the CT’s primary-current rating, output type, burden-resistor requirement, conductor-size limit, frequency range, accuracy class, insulation rating, connector, and lead length. A current-output CT, such as a 5 A secondary transformer, is not interchangeable with a voltage-output CT without the correct burden and protection.
Size the CT for the circuit. An oversized unit can have poor low-current resolution; an undersized unit can saturate or exceed its rating. Confirm the manufacturer’s limits rather than copying a calibration multiplier from another project.
North American split-phase warning
In a typical North American 120/240 V service, a whole-home monitor generally needs one CT on each service leg. A 240 V load uses both legs. A single CT may be appropriate for a particular single-leg circuit, but it cannot automatically represent every load in a split-phase panel.
European single-phase installations, three-phase systems, and homes with solar, batteries, or generators require a different channel and voltage-reference plan. “One CT is enough” is not a general rule.
Recommended Free Tools
Hardware design
ESP32 and ADC selection
Use the ESP32 primarily as a communications processor, logger, and controller—not automatically as a precision metering instrument. On the original ESP32, prefer ADC1 pins when Wi-Fi is enabled. ESPHome identifies ADC1 as GPIO32–GPIO39 and warns that ADC2 cannot be used while Wi-Fi is configured. See the ESPHome ADC documentation.
The original ESP32 ADC has nominal 12-bit raw resolution, but resolution is not the same as accuracy. Espressif documents a nominal 1.1 V reference that can vary approximately from 1.0 to 1.2 V, along with attenuation and calibration requirements. See the ESP-IDF ADC documentation and ADC calibration driver documentation.
An external ADC such as an ADS1115 can improve analog consistency and simplify a multi-channel layout, but more bits do not automatically produce a more accurate meter. For serious active-power measurement, a dedicated metering IC may be more appropriate.
CT signal conditioning
CT output is bipolar AC, while the ADC input normally accepts only a nonnegative voltage. A typical signal path is:
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Also popular on Amazon
- Powerful ESP-32 Board: Unlock the world of Internet of Things (IoT) and advanced electronics with the heart of this kit: the ESP-32 board. It features a powerful dual-core processor, integrated Wi-Fi and Bluetooth 4.2, making it perfect for building connected, smart devices that communicate with your phone or the cloud. It's fully compatible with the Arduino IDE for easy programming.
- Super Starter Kit: This kit contains over 35 different modules and electronic components, including sensors, displays, motors, and input devices. From LEDs and buttons to an OLED screen, servo motor, and keypad, you have everything needed to explore a vast range of projects in one box.
- Step by Step Online Tutorial: Jump right in with our detailed, beginner-friendly tutorial. Access 30+ projects with complete code, clear circuit diagrams, and step-by-step instructions. Learn the fundamentals of electronics, coding, and how to utilize the ESP-32's unique capabilities without any prior experience.
- Hands-on Learning for All Skill Levels: Perfect for students, makers, engineers, and hobbyists. Start with basic circuits and coding, then progress to intermediate and advanced IoT applications. Build practical projects like weather stations, smart home controllers, remote-controlled devices, and interactive gadgets. The skills you learn are the foundation for real-world innovation.
- Quality & Great Support: Elegoo is committed to quality. We provide a clear, detailed tutorial guide, refined code, and a well-organized component kit. All modules are carefully selected for reliability and ease of use. Our dedicated technical support team and active online community are ready to help you succeed in your learning journey.
- Convert the CT output using the correct burden resistor.
- Bias the waveform around a midpoint, often near half the ADC supply.
- Add appropriate input resistance, filtering, and overvoltage protection.
- Verify the entire waveform stays within the ADC’s permitted range.
- Sample, subtract the bias in firmware, and calculate RMS over complete AC cycles.
Do not connect a CT directly to an ADC pin without specifying the CT type, burden, expected waveform amplitude, bias circuit, protection, and ADC limits.
Power and enclosure
Use a reputable isolated USB power supply or certified isolated AC/DC module. Keep the low-voltage electronics in a secure enclosure with strain relief and no exposed terminals that can be touched while the panel is energized. If any mains-referenced circuitry exists, creepage, clearance, fusing, insulation, and enclosure requirements become design-critical rather than optional.
ESPHome implementation
ESPHome provides a ct_clamp platform that converts an analog sensor into measured single-phase AC current. A basic pattern is:
sensor:
- platform: adc
pin: GPIO34
id: ct_adc
attenuation: auto
update_interval: 1s
- platform: ct_clamp
sensor: ct_adc
name: "Measured Current"
update_interval: 1s
The exact calibration parameters depend on the CT ratio, burden resistor, bias circuit, ADC variant, protection network, and firmware scaling. There is no universal CT multiplier. Use the ESPHome CT clamp documentation for the current configuration options.
For a current-only estimate, you could expose apparent power like this:
sensor:
- platform: template
name: "Estimated Apparent Power"
unit_of_measurement: "VA"
device_class: apparent_power
state_class: measurement
lambda: |-
return id(measured_current).state * 120.0;
update_interval: 1s
The value 120.0 is an assumed voltage, not a measurement. Label the result as estimated apparent power. In a North American whole-home system, account for both service legs or measure voltage rather than applying one assumption to all loads.
Energy totals and Home Assistant
Energy accumulation is meaningful only if the source power sensor is in watts and the sign convention is deliberate. Configure appropriate device class and state class metadata, understand restart behavior, and decide how negative export values should be handled. A cumulative sensor should not unexpectedly reset after a reboot.
ESPHome’s Shelly 3EM example demonstrates a total-energy pattern using a watts-to-kilowatts conversion and total_increasing. Treat it as an example, not a universal configuration.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchAfter installation, Home Assistant should show an ESPHome device, a current sensor for each configured CT, and optional power and energy sensors. Home Assistant can graph and integrate the data, but it does not make an inaccurately calibrated sensor accurate.
Also popular on Amazon
- 2.4GHz Dual Mode WiFi + Bluetooth Development Board
- Support LWIP protocol, Freertos;ESP32 is a safe, reliable, and scalable to a variety of applications
- SupportThree Modes: AP, STA, and AP+STA
- Ultra-Low power consumption, Compatible with Arduino IDE
- 1PCS 30Pin ESP32 Development Board 2.4GHz WiFi Dual Cores Microcontroller Integrated with Antenna RF Low Noise Amplifiers Filters
Installation strategy
- Decide whether the work requires a licensed electrician or inspection under local rules.
- Identify the exact conductors and service configuration before selecting the number of CTs.
- De-energize equipment before fitting CTs whenever the installation procedure permits it.
- Clamp around one current-carrying conductor only and close the split core completely.
- Keep CT leads away from unnecessary interference and secure them against strain.
- Mount the low-voltage electronics in a suitable enclosure outside or within the panel only where the enclosure and installation method are appropriate.
- Restore power only after checking insulation, terminals, routing, and enclosure security.
Do not assume that “low voltage” at one connector means every part of the installation is safe. The safety of the finished system is a property of the CT, signal conditioning, supply, PCB layout, enclosure, wiring, installation, and operating procedure together.
Calibration and validation
1. Check zero current
With no meaningful load, record the RMS reading and noise floor. A small deadband can prevent noise from becoming false energy consumption, but do not use a large deadband to conceal a wiring or calibration error.
2. Use a stable resistive load
A heater or incandescent lamp is a better first test than a phone charger or variable-speed motor. For a nominal 1,200 W resistive load at 120 V:
expected current ≈ rated power ÷ measured line voltage
≈ 1,200 W ÷ 120 V
≈ 10 A
Use the actual line voltage when comparing results. Appliance ratings and supply voltage are not exact.
3. Compare with a reference
Compare the same conductor and load state with a reputable true-RMS clamp meter, a known-good plug-in power meter, a certified energy meter, or a supported utility-meter pulse or optical interface. Correct the calibration magnitude only after confirming the CT type, burden, bias, ADC scaling, and load.
If the sign is wrong, reverse the CT orientation or invert the software sign. Do not alter the calibration magnitude to hide reversed direction.
4. Validate over time
Compare accumulated kWh against the utility meter over several hours or a day. The utility meter remains the billing reference. Differences can result from voltage assumptions, power factor, phase imbalance, CT placement, calibration, integration, and solar or battery flow direction. OpenEnergyMonitor cautions that monitoring approximations may not be suitable for billing.
Free tools Windows power users keep installed
One-click scans. No signup required.
Troubleshooting by symptom
The reading is zero or nearly zero
- Confirm that the CT surrounds only one conductor.
- Check the CT connector and pinout.
- Confirm whether the CT requires a burden resistor.
- Check the midpoint bias and ground reference.
- Verify the configured ADC pin.
- Test with a known load.
The reading is negative
Reverse the CT orientation or invert the sign in software. Negative values may also be intentional for solar or battery export. Define whether positive means import or export, and preserve that meaning throughout Home Assistant.
The waveform clips at higher loads
ADC clipping, a wrong attenuation setting, an undersized burden, or CT saturation can flatten the reading. Verify the CT rating, burden, expected amplitude, and conditioned waveform with suitable test equipment before reconnecting the system.
Also popular on Amazon
- 2.4GHz Dual Mode WiFi + Bluetooth Development Board
- Ultra-Low power consumption, works perfectly with the Arduino IDE
- Support LWIP protocol, Freertos
- SupportThree Modes: AP, STA, and AP+STA
- ESP32 is a safe, reliable, and scalable to a variety of applications
ESPHome documents that the original ESP32’s default ADC range is approximately 0–1.1 V and that attenuation is needed for higher input voltages; usable ranges vary between chips. See the ESPHome ADC documentation.
Wi-Fi breaks analog readings
On the original ESP32, ADC2 is unavailable while Wi-Fi is configured. Move the input to ADC1 or use an external ADC.
Current looks right but power is wrong
Likely causes include an incorrect voltage assumption, power factor below one, phase mismatch between voltage and current, reversed CT direction, short sampling windows, or confusion between apparent and active power. A true active-power design must sample voltage and current with known timing and phase relationships.
The energy total resets or loses data
Review ESPHome persistence and Home Assistant recorder behavior, define restart behavior, synchronize time with NTP, and decide whether local buffering is needed during Wi-Fi outages. Provide OTA recovery and a physical safe-mode procedure before installing the unit where access is difficult.
Commercial alternatives
DIY is appropriate when customization, local data, and learning matter more than turnkey installation. A commercial meter is usually the better choice when the panel is unfamiliar, the system includes solar or batteries, the data will drive major financial decisions, or the installation must have documented support and safety information.
Shelly EM Gen3
The Shelly EM Gen3 80A is a compact two-CT alternative with local connectivity, Home Assistant integration, and local data storage. Shelly’s product information states that it supports up to two CTs and local logs for up to 10 days at one-minute intervals. Verify current regional availability, ratings, and installation requirements before purchase.
Recommended Free Tools
It is a poor fit when many circuit channels, open hardware, unusual CT connectors, or a different certified installation method is required. Do not reflash it casually: ESPHome warns that the programming pins on the Shelly EM Gen3 are not isolated and that the board is live when connected to mains.
Shelly 3EM
The Shelly 3EM provides three measurement channels and bidirectional energy monitoring for more complex installations. Its suitability depends on the service configuration, CT placement, supply requirements, enclosure, and local rules. A storefront price is volatile and should not be treated as a permanent quotation.
OpenEnergyMonitor
The OpenEnergyMonitor ecosystem is worth considering for readers who want purpose-built open monitoring hardware and detailed documentation on CTs, voltage adapters, calibration, and multi-phase systems. It is less suitable for someone seeking a completely turnkey, no-calibration product.
When not to build it yourself
Choose a commercial meter and qualified installation when you are not comfortable opening a panel, the panel is crowded or damaged, the service includes solar, storage, a generator, or multiple feeds, the result must be certified, or you cannot make the electronics physically secure and enclosed.
The best DIY design is the one that leaves household mains isolated from the ESP32, makes its measurement limits explicit, and can be installed and validated without compromising personal safety.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

