Advanced IoT Project

Build a Smart Energy Monitor

A smart energy monitor measures electrical parameters in real time, allowing homeowners, businesses and engineers to understand how much electricity is being consumed. It can display voltage, current, power, energy usage and power factor while sending the information to a smartphone or computer over Wi-Fi. This project demonstrates how to build a smart energy monitor using an ESP32 and an energy metering module such as the PZEM-004T.

Smart Energy Monitor

Project Overview

The energy meter continuously measures the electrical parameters of the connected load.

The ESP32 reads the measurements through a serial interface and displays the results on an OLED display or web dashboard.

Energy consumption can be logged for long-term analysis, helping identify high-power appliances and opportunities to reduce electricity usage.

Project Difficulty

ItemValue
Difficulty⭐⭐⭐⭐ Advanced
Build Time5–10 Hours
Supply Voltage5 V DC (Controller)
Measured Voltage80–260 V AC (Typical)
ControllerESP32

Electrical Parameters Measured

Parameter Description
Voltage (V) AC supply voltage.
Current (A) Load current.
Power (W) Instantaneous active power.
Energy (kWh) Total energy consumed.
Frequency (Hz) Mains frequency.
Power Factor Efficiency of AC power usage.

Main Sections

Section Function
ESP32 Processes measurements and provides Wi-Fi connectivity.
Energy Meter Module Measures voltage, current, power and energy.
Current Transformer or Shunt Measures load current.
OLED Display (Optional) Displays measurements locally.
Wi-Fi Interface Uploads data to dashboards or cloud services.
MicroSD Module (Optional) Stores historical measurements.

Typical Components

QuantityComponent
1ESP32 Development Board
1PZEM-004T, ATM90E32 or Similar Energy Meter
1Current Transformer (If Required)
1OLED Display (Optional)
1MicroSD Module (Optional)
15 V Power Supply
1Push Button (Reset/Menu)
1Insulated Enclosure

How the System Works

The energy metering module samples the AC voltage and current of the connected load.

Internal calculations determine the active power, accumulated energy, frequency and power factor.

The ESP32 retrieves these values at regular intervals and displays them on an OLED screen or publishes them via Wi-Fi to a web interface, MQTT broker or home automation system.

Historical data can be stored for daily, weekly or monthly energy analysis.

Typical Features

Feature Description
Real-Time Measurements Displays live electrical values.
Energy Logging Stores long-term consumption data.
Wi-Fi Dashboard Remote monitoring from anywhere.
Overload Alarm Warns when current exceeds a preset limit.
Daily Statistics Shows daily and monthly usage.
MQTT Support Integrates with Home Assistant and other IoT platforms.

Applications

  • Home energy monitoring.
  • Solar power systems.
  • Workshops.
  • Industrial equipment.
  • Server rooms.
  • Energy efficiency studies.
  • Smart buildings.
  • Electrical laboratories.

Testing

  1. Verify all mains and low-voltage wiring.
  2. Power the ESP32 and energy meter.
  3. Connect a known electrical load.
  4. Compare voltage and current readings with a calibrated meter.
  5. Verify power calculations.
  6. Confirm energy accumulation over time.
  7. Test Wi-Fi communication.
  8. Check overload alarm functionality.

Troubleshooting

Problem Possible Cause
No measurements Incorrect wiring or communication failure.
Incorrect readings Calibration error or incorrect CT installation.
Wi-Fi not connecting Network configuration issue.
Display blank OLED wiring or power problem.
Data not updating Serial communication fault or software issue.

Project Improvements

  • Support three-phase power measurement.
  • Create a web dashboard with historical graphs.
  • Send email or Telegram alerts for overload conditions.
  • Integrate with Home Assistant using MQTT.
  • Store measurements in an SQL database.
  • Add OTA firmware updates.
  • Generate daily and monthly energy reports.
  • Support multiple monitored circuits.

Skills Learned

  • AC power measurement.
  • Energy metering.
  • Serial communication.
  • ESP32 programming.
  • Wi-Fi networking.
  • IoT dashboard development.

Safety Notes

  • Extreme care is required when working with mains voltage.
  • Disconnect power before wiring or modifying the circuit.
  • Use insulated enclosures and correctly rated wiring.
  • Install suitable fuses or circuit breakers.
  • Verify all measurements with calibrated equipment before relying on the results.

Key Points

  • A smart energy monitor provides real-time electrical measurements.
  • It helps identify inefficient appliances and reduce electricity consumption.
  • ESP32 enables wireless monitoring and cloud connectivity.
  • Historical data supports energy management and preventive maintenance.
  • Energy monitoring is an important part of modern smart homes and industrial automation systems.

Next Project

Continue by building a Solar Power Monitoring System, capable of measuring solar panel voltage, current, charging power, battery status and energy production through an interactive web dashboard.

Next Project → Solar Power Monitoring System