ESP32 Smart Energy Meter with Blynk 2.0

By Tanmoy Kundu

Updated On:

ESP32 Smart Energy Meter with Blynk

Smart energy monitoring is becoming increasingly important as electricity costs rise and homes become more connected. Instead of waiting for a monthly bill to understand power consumption, modern systems allow users to track voltage, current, power usage, and total energy consumption (kWh) in real time. This level of visibility helps identify high-consumption appliances, reduce wastage, and manage electricity expenses more efficiently.

Traditional energy meters, however, are limited in functionality. They typically display only total energy consumption and offer no real-time insights, remote access, or detailed analytics. Users cannot monitor live power usage, calculate running costs instantly, or receive alerts. Additionally, conventional meters lack IoT connectivity, making remote tracking and smart automation impossible.

To overcome these limitations, this ESP32-based Smart Energy Meter provides a complete IoT-enabled solution. Using an ESP32  microcontroller, voltage and current sensors, and Blynk integration, the system measures real-time electrical parameters, calculates power and kWh, stores data in EEPROM, and even estimates electricity cost. With WiFi connectivity and auto calibration features, it transforms a simple DIY project into a powerful smart energy monitoring system.

Why Build a Smart Energy Meter?

Building an ESP32 Smart Energy Meter is more than just a DIY electronics project — it is a practical solution for understanding and controlling electricity consumption in real time. With rising energy costs and increasing demand for smart homes, having a WiFi-enabled electricity monitoring system gives you both awareness and control over your power usage.

Benefits of Real-Time Monitoring

Traditional energy meters only show total units consumed, but they don’t tell you what is happening right now. A smart energy meter provides:

  • Live voltage, current, and power readings
  • Instant detection of high power consumption
  • Identification of faulty or power-hungry appliances
  • Better load management during peak hours

With real-time data, you can immediately see how turning on an appliance affects your power usage. This helps prevent overloads and reduces unnecessary energy waste.

Electricity Bill Tracking

One of the biggest advantages of an IoT-based energy meter is automatic electricity cost calculation. Instead of waiting for your monthly bill, you can:

  • Track total kWh consumption anytime
  • Calculate cost based on your local tariff rate
  • Monitor daily energy expenses
  • Set usage targets to stay within budget

This level of transparency helps households and small businesses control electricity expenses more effectively.

IoT Advantages

By integrating the system with a platform like Blynk, your WiFi electricity monitor becomes accessible from anywhere. IoT connectivity enables:

  • Remote monitoring through smartphone
  • Cloud-based data visualization
  • Real-time alerts and notifications
  • Daily automatic energy reports

This means you don’t have to be physically present to check your power usage. Whether you are at work or traveling, your energy data is always available.

Circuit Diagram

Smart Energy Meter

Components Required

Source Code

Software Features

The ESP32 Smart Energy Meter is not just a basic monitoring device — it includes several intelligent software features that improve accuracy, stability, and user experience. Below are the core software functionalities that make this system reliable for real-world IoT energy monitoring applications.

Auto Calibration System

Calibration is essential for accurate voltage and current measurement. This system includes a built-in auto calibration feature that allows the meter to self-adjust based on known reference values.

Instead of manually tuning calibration constants, the ESP32 measures real-time voltage and current, compares them with predefined actual values, and automatically adjusts the calibration factors. These updated calibration values are then stored permanently in EEPROM.

Benefits of auto calibration:

  • Improves long-term measurement accuracy
  • Eliminates manual trial-and-error calibration
  • Can be triggered using a long button press
  • Can also be triggered remotely from the Blynk dashboard

This ensures the ESP32 Smart Energy Meter maintains consistent performance even if sensors drift over time.

Startup Stabilization Filter

One common problem in many DIY energy meter projects is unstable or garbage readings during startup. This happens because sensors require a short stabilization time after power-up.

To solve this, the system includes a startup warm-up filter. During the first few measurement cycles:

  • Readings are ignored
  • Smoothing buffers are reset
  • Energy calculation is paused

Only after stable samples are detected does the meter begin normal operation.

This prevents:

  • False high power readings
  • Incorrect kWh calculation at boot
  • Sudden spikes in Blynk dashboard data

As a result, the system delivers clean and reliable data from the moment it becomes active.

Smoothing Algorithm

Electrical signals naturally fluctuate due to noise, load variation, and AC waveform distortion. To reduce this noise, the system uses an Exponential Moving Average (EMA) smoothing algorithm.

Instead of displaying raw voltage, current, and power values, the ESP32 processes the readings using a smoothing factor (alpha). This creates:

  • Stable voltage display
  • Smooth current readings
  • Reduced power fluctuations
  • More professional dashboard appearance

The smoothing algorithm improves the overall quality of IoT energy monitoring without slowing down responsiveness.

Long Press Button Functions

A single push button is used to control multiple system features through press duration detection.

The button supports three levels of control:

  • Short Press (<3 seconds): Switch LCD display pages
  • Medium Press (3–6 seconds): Reset total energy and cost
  • Long Press (>6 seconds): Trigger auto calibration

This smart button logic reduces hardware complexity while increasing functionality.

It allows the DIY energy meter project to remain compact while still offering advanced control options.

EEPROM Memory Handling

Power loss should never erase energy consumption data. To ensure persistence, the system uses the ESP32’s EEPROM memory.

The following values are stored permanently:

  • Voltage calibration factor
  • Current calibration factor
  • Total kWh consumed
  • Total electricity cost

Every time energy is updated, it is saved in EEPROM. When the system restarts:

  • Previous energy data is restored
  • Calibration settings remain intact
  • Billing continues accurately from the last value

This makes the ESP32 Smart Energy Meter suitable for long-term electricity monitoring applications.

Blynk IoT Integration

One of the most powerful features of this ESP32 Smart Energy Meter is its seamless integration with the Blynk IoT platform. With WiFi connectivity, the system transforms into a fully functional IoT energy monitoring solution that allows you to track electricity usage anytime, from anywhere.

Let’s break down how the integration works.

Dashboard Setup

To begin, create a new template inside the Blynk IoT web dashboard and configure the required datastreams. After generating your Template IDTemplate Name, and Auth Token, add them to your ESP32 code.

On the web dashboard, add the following widgets:

Smart Energy Meter
  • Gauge Widget → Voltage
  • Gauge Widget → Current
  • Gauge Widget → Power
  • Value Display → Energy (kWh)
  • Value Display → Electricity Cost

Arrange them neatly so users can quickly view real-time electrical parameters in a clean interface.

Virtual Pins Explanation

The system uses Blynk virtual pins to send and receive data between the ESP32 and the cloud.

  • V0 → Voltage (Vrms)
  • V1 → Current (Irms)
  • V2 → Real Power (Watts)
  • V3 → Total Energy (kWh)
  • V4 → Electricity Cost
  • V10 → Manual Calibration Trigger
Smart Energy Meter

Virtual pins act as communication channels. The ESP32 continuously pushes measured data to these pins, and the app displays them instantly.

Real-Time Monitoring

Once connected to WiFi, the ESP32 sends updated readings every second. Users can monitor:

  • Live AC voltage
  • Current consumption
  • Real-time power usage
  • Total accumulated energy
  • Running electricity cost

Because it is cloud-based, you can check your home’s power usage remotely, whether you’re at work, traveling, or in another room.

This makes the system a true WiFi electricity monitor rather than just a local display meter.

Daily 12 AM Automatic Energy Report

The system is programmed to send a daily energy usage summary automatically at 12:00 AM.

Each day, Blynk generates a notification containing:

  • Total Energy Consumed (kWh)
  • Total Electricity Cost (₹ or your local currency)

This feature helps users track daily power consumption habits and manage electricity bills more effectively.

Instead of manually checking readings, the report arrives automatically — turning the project into a smart electricity bill tracker.

Manual Calibration Trigger from App

Accuracy is critical in any DIY energy meter project. That’s why this system includes a remote calibration feature.

Using a button widget assigned to Virtual Pin V10, users can trigger auto calibration directly from the Blynk app.

When pressed:

  1. The ESP32 measures actual voltage and current.
  2. It compares readings with known reference values.
  3. It adjusts calibration constants automatically.
  4. New values are saved in EEPROM for long-term accuracy.

This eliminates the need to reprogram the board physically whenever recalibration is required.

Full System Testing and Results

To ensure the ESP32 Smart Energy Meter performs reliably in real-world conditions, the system was thoroughly tested under multiple scenarios. These tests focused on measurement accuracy, startup stability, and long-term performance consistency. Below are the detailed results.

No-Load Testing

No-load testing is critical for verifying sensor noise handling and system stability. In this test, the AC mains supply was connected, but no electrical load was attached to the system.

Expected behavior:

  • Voltage should display normal mains value (around 220–240V depending on region).
  • Current should remain close to 0A.
  • Power consumption should remain near 0W.

Observed results:

  • Voltage readings remained stable.
  • Current readings were extremely close to zero.
  • Power displayed near-zero values.
  • No random spikes or garbage readings appeared after startup.

Thanks to the built-in startup stabilization filter and smoothing algorithm, the meter avoided false power readings that are common in many DIY energy meter projects. This confirms proper sensor calibration and noise filtering.

Load Testing

For load testing, various electrical appliances were connected one by one, such as:

  • Incandescent bulb
  • LED bulb
  • Electric iron
  • Fan
  • Resistive load

Testing process:

  1. Connect a known load.
  2. Observe voltage, current, and power values.
  3. Compare readings with a standard commercial digital energy meter.

Results:

  • Real-time voltage and current values updated smoothly.
  • Power readings responded instantly to load changes.
  • Energy (kWh) accumulated accurately over time.
  • Cost calculation updated automatically based on the defined tariff rate.

The WiFi IoT dashboard also reflected changes instantly, confirming stable data transmission to the cloud.

Accuracy Comparison

To validate performance, readings were compared with a calibrated commercial energy meter.

Comparison Parameters:

  • RMS Voltage
  • Current
  • Real Power
  • Energy Consumption (kWh)

After auto calibration using known reference voltage and current values:

  • Voltage accuracy was within ±1–2%.
  • Current measurement error remained minimal.
  • Power calculation closely matched the reference meter.
  • Long-duration energy tracking showed negligible deviation.

The EEPROM-based calibration storage ensures that accuracy remains consistent even after power cycles.

Stability After Warm-Up

One of the biggest improvements in this version is the startup warm-up stabilization system.

In many DIY systems, the first few seconds after power-on produce unstable or garbage readings due to sensor settling time. This project eliminates that issue using:

  • Multiple warm-up sampling cycles
  • Temporary data blocking before activation
  • Smoothing filter initialization
  • Controlled energy calculation start time

Observed behavior:

  • LCD displays “Stabilizing…” during startup.
  • Energy calculation begins only after system stabilization.
  • No sudden spikes in kWh or power at boot.
  • Stable readings maintained during continuous operation.

Even after several hours of operation, readings remained consistent and noise-free, confirming reliable long-term performance.

Advantages of This Version

Stable Readings

One of the biggest improvements in this ESP32 Smart Energy Meter is its enhanced stability. Thanks to the built-in smoothing algorithm and filtered signal processing, voltage, current, and power readings remain consistent and noise-free. Even during minor power fluctuations, the system avoids sudden spikes or unstable values, ensuring accurate long-term energy monitoring.

No Garbage Startup Values

Many DIY energy meter projects show random or incorrect readings during startup. This version eliminates that issue with a warm-up stabilization filter. The system ignores initial unstable samples and only begins calculations once the readings are stable. As a result, you get clean, reliable measurements right from the moment the meter becomes active.

Remote Monitoring

With integrated Blynk IoT support, this ESP32 Smart Energy Meter allows real-time monitoring from anywhere using a smartphone. Users can view live voltage, current, power, total energy (kWh), and electricity cost directly from the app. It also sends automatic daily updates, making it a complete WiFi-enabled electricity monitoring solution.

Customizable Electricity Rate

The system includes a configurable per-unit electricity rate, allowing users to calculate real-time billing based on their local tariff. This feature makes the project practical for real-world home energy tracking, rental properties, or educational demonstrations where cost analysis is important.

Applications

The ESP32 Smart Energy Meter is a versatile solution that fits perfectly into multiple real-world and educational scenarios. Its real-time monitoring, IoT connectivity, and cost calculation features make it suitable for both beginners and advanced users.

1. Home Energy Monitoring

This system works as a powerful home energy monitoring device, allowing users to:

  • Track real-time voltage, current, and power consumption
  • Monitor total kWh usage
  • Calculate electricity cost automatically
  • Detect unusual power spikes
  • Reduce unnecessary electricity wastage

With WiFi connectivity and Blynk integration, homeowners can check their energy usage remotely from anywhere. It’s an ideal low-cost alternative to commercial smart meters.

2. Smart Homes

For modern smart home setups, this ESP32-based WiFi electricity monitor can act as a core energy tracking unit. It can be integrated with:

  • Home automation systems
  • Smart relays
  • Energy-saving logic
  • Load scheduling systems

The real-time data can be used to automate devices based on consumption patterns, helping improve efficiency and reduce electricity bills.

3. IoT Projects

This project is perfect for developers building IoT energy monitoring systems. Since it uses ESP32 and Blynk:

  • Data can be viewed remotely
  • Calibration can be triggered from the cloud
  • Notifications can be automated
  • Energy logs can be expanded to cloud storage

It serves as a strong foundation for advanced IoT-based power analytics systems.

4. Educational Demonstrations

The DIY energy meter project is highly valuable for:

  • Engineering students
  • Polytechnic labs
  • Embedded systems learning
  • IoT workshops

Students can understand real-world concepts like:

  • AC signal measurement
  • RMS calculation
  • Power factor basics
  • Energy (kWh) computation
  • EEPROM data storage
  • Cloud IoT integration

It combines hardware, software, and networking in one complete learning platform.

5. Lab Experiments

In electrical and electronics laboratories, this system can be used for:

  • Load testing experiments
  • Power consumption analysis
  • Efficiency comparison studies
  • Sensor calibration practice
  • Embedded firmware testing

Because it includes auto calibration and startup stabilization, it provides consistent and reliable results for repeated experiments.

Future Improvements

The ESP32 Smart Energy Meter is already a powerful IoT energy monitoring system, but there is always room for enhancement. Below are some future upgrades that can make the system even more advanced and commercially ready.

1. Mobile App UI Enhancement

While the current Blynk dashboard provides real-time monitoring, the user experience can be further improved by:

  • Designing a more interactive and modern dashboard layout
  • Adding graphical charts for live power trends
  • Creating separate tabs for daily, weekly, and monthly data
  • Improving alert visualization for overload conditions
  • Adding dark/light theme options

2. Cloud Database Logging

Currently, the system stores kWh and cost data in EEPROM for local retention. Future upgrades can include:

  • Cloud database integration (Firebase, Thingspeak, or custom server)
  • Real-time data logging
  • Historical data backup
  • Multi-device monitoring from a single dashboard
  • Remote firmware updates

3. Monthly Analytics

To provide deeper insights, the system can be expanded to include:

  • Automatic monthly energy summaries
  • Bill prediction based on usage trends
  • Daily average consumption analysis
  • Peak usage hour detection
  • Exportable reports (PDF or CSV)

4. Relay Control Automation

A major upgrade would be adding relay-based load control. This would allow the ESP32 Smart Energy Meter to:

  • Automatically disconnect load during overload
  • Turn off devices after exceeding a preset energy limit
  • Enable scheduled appliance control
  • Integrate with smart home automation systems
  • Support remote ON/OFF control via mobile app

Conclusion

The ESP32 Smart Energy Meter is a reliable and feature-rich IoT energy monitoring system that accurately measures voltage, current, power, kWh, and electricity cost in real time. With auto calibration, startup stabilization, EEPROM storage, and Blynk remote monitoring, it delivers stable performance and smart energy tracking in one compact solution.

Whether for home energy monitoring, IoT development, or educational use, this project offers both practical value and strong technical learning. With future upgrades like cloud logging and relay automation, it can easily evolve into a complete smart energy management system.

Tanmoy Kundu

I'm the founder of Circuit Diagrams, holds a B.Sc in Electronics and a Master's in Computer Applications (MCA). With a strong foundation in both hardware and software, I combines my passion for electronics and programming to create practical, real-world DIY projects. Driven by the goal of simplifying embedded systems and IoT development, I designs, tests, and documents each project to ensure it's accessible for students, beginners, and makers of all levels. My mission is to turn complex concepts into easy-to-follow solutions through detailed tutorials, eBooks, and custom circuit designs.

Leave a Comment

Item added to cart.
0 items - 0.00