ESP32 Energy Monitor with Home Assistant: Build a Complete DIY Smart Electricity Meter 2026

Key Takeaway: Build a complete DIY energy monitoring system for under ₹700 using an ESP32 and an SCT-013 current clamp, then integrate it with Home Assistant via ESPHome. The system measures real-time power consumption (watts), tracks daily energy usage (kWh), and feeds directly into Home Assistant’s Energy Dashboard. Total component cost: ESP32 (₹380) + SCT-013-030 clamp (₹250) + burden resistor + wires (₹70). This is a completely local, non-invasive, and privacy-preserving alternative to commercial energy monitors.

ESP32 Energy Monitor System with Home Assistant

1. System Overview

Understanding your home’s energy consumption is the first step toward managing electricity costs and reducing waste. While commercial smart energy monitors exist, they are expensive, often require cloud subscriptions, and may not provide the data granularity you need. A DIY ESP32-based energy monitor solves all these problems: it costs under ₹700 in components, is completely local (no cloud dependency), integrates directly with Home Assistant for visualization and automation, and can be expanded to monitor multiple circuits individually.

The system uses a non-invasive SCT-013 current transformer (CT) clamp that clips around the live wire of the circuit you want to monitor. No direct electrical connection to mains voltage is required, making it safe for DIY installation. The ESP32 reads the analog signal from the CT clamp, ESPHome firmware processes it into current, power, and energy values, and Home Assistant displays everything on a dashboard and tracks daily/monthly usage.

2. Hardware Selection Guide

There are several approaches to ESP32 energy monitoring, each with different strengths:

Sensor Type Range Interface Cost Best For
SCT-013-030 CT Clamp 0-30A AC Analog (ADC) ₹250 Whole house, non-invasive
INA219/INA226 Shunt-based 0-3.2A DC I2C ₹200 DC circuits, solar/battery
HLW8032/BL0942 Energy IC 0-100A AC UART ₹300 Individual appliances
Pulse LED Reader Optical Meter-specific GPIO ₹150 Reading utility meter directly

For most users, the SCT-013-030 is the best starting point. It is non-invasive, safe (no direct mains connection required), and provides sufficient accuracy (±1%) for home energy monitoring. The 30A rating covers most household circuits, and it works with standard ESP32 ADC inputs.

3. SCT-013 Current Clamp — The Safe Choice

The SCT-013-030 is a split-core current transformer that clamps around a wire to measure the magnetic field generated by current flow. It outputs an analog voltage signal proportional to the current. Key advantages: completely non-invasive (you never touch the conductor), no risk of electric shock, and easy to install and remove without interrupting the circuit.

Wiring the SCT-013 to ESP32

The SCT-013-030 typically comes with a 3.5mm audio jack. For connection to the ESP32, cut the jack and connect: the white wire to GPIO34 (ADC pin), the black wire to GND, and the shield (if present) also to GND or left unconnected. Add a 33-ohm burden resistor across the signal and ground wires if your SCT-013 does not have one built in (the -030 model typically includes it).

Wiring summary: SCT-013 output → GPIO34 (ADC) + GND. Optional: 10µF capacitor between ADC and GND for noise filtering.

4. ESPHome Configuration (YAML)

ESPHome is the firmware that makes this project simple. Install the ESPHome add-on in Home Assistant (Settings > Add-ons > ESPHome), create a new device, and paste the following configuration. This YAML reads the SCT-013 analog signal and converts it to current, power, and energy readings.

esphome:
  name: esp32-energy-monitor
  friendly_name: ESP32 Energy Monitor

esp32:
  board: esp32dev
  framework:
    type: arduino

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

# Enable Home Assistant API
api:
ota:
logger:

sensor:
  # Read raw analog value from SCT-013
  - platform: adc
    pin: GPIO34
    id: sct013_raw
    update_interval: 1s
    filters:
      - lambda: return (x / 4095.0) * 3.3;
      - calibrate_linear:
          # Calibrate for SCT-013-030 with 33 ohm burden at 3.3V VCC
          # 0A -> VCC/2 = 1.65V
          # 30A -> ~2.88V, -30A -> ~0.42V
          - 0.42 -> -30.0
          - 1.65 -> 0.0
          - 2.88 -> 30.0

  # Calculate RMS current
  - platform: template
    name: "House Current"
    id: house_current
    unit_of_measurement: "A"
    accuracy_decimals: 2
    icon: "mdi:current-ac"
    lambda: |-
      static float filtered = 0.0;
      filtered = filtered * 0.9 + id(sct013_raw).state * 0.1;
      return abs(filtered);
    update_interval: 1s

  # Calculate power (assumes 230V, resistive load)
  - platform: template
    name: "House Power"
    id: house_power
    unit_of_measurement: "W"
    accuracy_decimals: 1
    icon: "mdi:flash"
    lambda: return id(house_current).state * 230.0;
    update_interval: 1s

  # Track daily energy consumption
  - platform: total_daily_energy
    name: "House Daily Energy"
    power_id: house_power
    unit_of_measurement: "kWh"
    accuracy_decimals: 3
    icon: "mdi:chart-line"
    filters:
      - multiply: 0.001

5. Calibration and Accuracy Tips

Calibration is the most important step for accurate readings. The calibrate_linear section in the ESPHome YAML maps the voltage range to current values. For the SCT-013-030 with a 33-ohm burden resistor and 3.3V VCC: 0A produces 1.65V (half VCC), 30A produces approximately 2.88V, and -30A produces approximately 0.42V.

Calibration procedure:

  1. Connect a known resistive load (like a 1000W heater or a 100W incandescent bulb) to the circuit you are monitoring.
  2. Clamp the SCT-013 around the live wire.
  3. Compare the ESPHome reading with a reference device (like a commercial smart plug with energy monitoring).
  4. Adjust the calibration linear mapping values until the readings match.
  5. A 1000W heater at 230V should draw approximately 4.35A.

Accuracy tips: The ESP32’s ADC is noisy. The low-pass filter in the lambda function (filtered_value = filtered_value * 0.9 + raw * 0.1) helps smooth readings. Adding a 0.1µF ceramic capacitor between the ADC pin and GND further reduces noise. For better accuracy, use an external ADC like the ADS1115 over I2C.

6. Home Assistant Integration

Once your ESP32 device is configured and flashed, it should automatically appear in Home Assistant via the ESPHome integration (Settings > Devices & Services). You will see three new sensors:

  • sensor.house_current — Real-time current in amps
  • sensor.house_power — Real-time power consumption in watts
  • sensor.house_daily_energy — Daily accumulated energy in kWh

Adding to the Energy Dashboard: Go to Settings > Energy. Click “Add” under Electricity Grid, select the “House Daily Energy” sensor, and choose “kWh” as the unit. Home Assistant will automatically track daily, monthly, and yearly consumption. You can also add the “House Power” sensor for real-time power display on the dashboard.

The energy sensor uses device_class: energy with state_class: total_increasing, which meets Home Assistant’s requirements for the Energy dashboard. The total_daily_energy platform resets at midnight, providing daily breakdowns automatically.

7. Advanced: Multiple Circuits and Utility Meter Pulse Reading

Monitoring Multiple Circuits

Use an ESP32 with multiple ADC pins (GPIO32-GPIO39) and multiple SCT-013 clamps to monitor individual circuits like kitchen, AC, water heater, and workshop separately. Each clamp connects to a different ADC pin, and you create separate sensor configurations in ESPHome for each one. This gives you circuit-level granularity to identify the biggest energy consumers in your home.

Utility Meter Pulse Reading

Instead of a CT clamp, you can read your existing utility meter’s flashing LED using an optical sensor and an ESP32. This is a completely non-invasive approach that uses the meter’s own pulse output — typically 1000-10000 pulses per kWh. The ESPHome pulse_meter component measures the time between pulses and converts it to power (W) and total energy (kWh).

Key configuration: use platform: pulse_meter with internal_filter: 20ms (to debounce false pulses) and set the multiplier based on your meter’s impulse constant (e.g., for 1000 imp/kWh, multiply by 60 to get watts). This approach is exceptionally accurate because it uses the utility’s own calibrated meter.

8. Troubleshooting

Problem Cause Solution
Sensor reads zero or constant value Wiring issue or clamp direction Ensure clamp is around only one wire (not both); check connections
Readings are jumpy or noisy ESP32 ADC noise or electrical interference Add 0.1µF cap between ADC and GND; increase low-pass filter factor
Power reading is inaccurate Calibration values need adjustment Recalibrate using a known load; check burden resistor value
Device doesn’t connect to HA WiFi or ESPHome API issue Check WiFi credentials; ensure ESPHome add-on is running

Frequently Asked Questions

Is the SCT-013 safe to use?

Yes, the SCT-013 is one of the safest options because it is non-invasive. It clamps around the wire without requiring any direct electrical connection to the mains voltage. You do not need to strip wires or touch live conductors.

Can I monitor my whole house with one clamp?

Yes. Place the SCT-013 clamp around the main live wire coming into your electrical panel to monitor total household consumption. For circuit-level monitoring, use multiple clamps on individual circuit breakers.

Do I need to modify my electrical panel?

No. The SCT-013 clamp simply clips around the wire. However, if you are not comfortable working near an electrical panel, hire a qualified electrician to install the clamps.

What is the total cost of this project?

ESP32 development board: ₹380. SCT-013-030 current clamp: ₹250. Wires, resistor, capacitor: ₹70. Total: approximately ₹700. If you already have Home Assistant running on a Raspberry Pi, there is no additional cost for the hub.

How accurate is this compared to a commercial energy monitor?

With proper calibration, the SCT-013-based system achieves ±1-3% accuracy for resistive loads. For reactive loads (motors, AC compressors), accuracy decreases because the system assumes a power factor of 1. For true power measurement on mixed loads, consider adding voltage sensing or using an HLW8032-based module.

Can I use an ESP8266 instead of ESP32?

You can, but the ESP32 has a better ADC (12-bit vs 10-bit) and more GPIO pins, providing more stable readings. For the pulse meter approach (reading the utility meter LED), an ESP8266 works fine.

Is there a cloud dependency?

No. The entire system is local — ESPHome communicates with Home Assistant over your local network without any cloud services. Your energy data never leaves your home.

Sources

Disclosure: This post contains affiliate links. We may earn a small commission when you purchase through these links at no extra cost to you. As an Amazon Associate, we earn from qualifying purchases of electronic components and development boards. Component prices are approximate and based on Indian market rates.

You are currently viewing ESP32 Energy Monitor with Home Assistant: Build a Complete DIY Smart Electricity Meter 2026

Leave a Reply