Real-time electrical parameter monitoring with custom firmware-based power calculations, OLED visualization, overload protection, and cloud connectivity.
Conventional electricity meters only display the total energy consumed at the end of the billing cycle, giving users very little insight into how electricity is being used throughout the day.
This project presents a Smart Energy Meter capable of measuring electrical parameters in real time and making them available both locally and remotely through multiple IoT platforms.
Unlike many similar projects that depend on dedicated energy metering ICs, this system performs all electrical calculations directly in the firmware running on the Arduino UNO (ATmega328P). The processed measurements are transmitted to an ESP32, which acts as an IoT gateway and securely uploads the data to multiple cloud platforms.
The separation of measurement and communication ensures that energy monitoring continues uninterrupted even if Wi-Fi connectivity or cloud services become unavailable.
- Real-time RMS Voltage Measurement
- Real-time RMS Current Measurement
- Real Power Calculation
- Apparent Power Calculation
- Reactive Power Calculation
- Power Factor Calculation
- Energy Consumption (kWh)
- Electricity Bill Estimation (βΉ8/unit)
- OLED Graphical Interface
- Animated Waveform Display
- UART Communication between Arduino & ESP32
- Multi-Cloud IoT Connectivity
- EEPROM Event Logging
- Overload Detection (>2000 W)
- Audible & Visual Fault Indication
- Persistent Event Storage after Power Failure
The system is divided into two independent processing units.
- Arduino UNO performs signal acquisition, RMS calculations, power analysis, energy computation, and OLED display management.
- ESP32 handles Wi-Fi connectivity and cloud communication.
This modular architecture improves reliability because measurement continues even if the networking module disconnects.
| Component | Purpose |
|---|---|
| Arduino UNO (ATmega328P) | Measurement & signal processing |
| ESP32 Dev Board | Wi-Fi & cloud communication |
| ZMPT101B Voltage Sensor | AC Voltage sensing |
| ACS712 Current Sensor | AC Current sensing |
| OLED Display | Local graphical display |
| EEPROM | Persistent overload logging |
| LEDs | Status indication |
| Piezo Buzzer | Overload alarm |
| Push Buttons | Navigation / Control |
The firmware continuously measures and calculates:
- RMS Voltage (V)
- RMS Current (A)
- Real Power (W)
- Apparent Power (VA)
- Reactive Power (VAR)
- Power Factor
- Energy Consumption (kWh)
- Estimated Electricity Cost
- System Status
- Voltage is measured using the ZMPT101B sensor.
- Current is measured using the ACS712 sensor.
- Arduino UNO samples both waveforms multiple times during every AC cycle.
- Firmware calculates all electrical parameters without using a dedicated metering IC.
- Results are displayed on the OLED display.
- Processed values are transmitted over UART to the ESP32.
- ESP32 uploads the data to multiple cloud services over Wi-Fi.
The OLED provides five different display pages.
- Live Voltage, Current & Power
- Complete Power Analysis
- Energy Consumption & Electricity Bill
- System Health & Status
- Overload Event History
- Automatic overload detection above 2000 Watts
- Buzzer alarm
- Red warning LED
- OLED warning screen
- EEPROM storage of overload events
- Data retained after power loss
- Normal/Fault status indication
The ESP32 uploads a JSON payload approximately every 2 seconds to multiple cloud platforms simultaneously.
| Platform | Purpose |
|---|---|
| AWS IoT Core | Secure MQTT communication |
| Firebase | Mobile/Web applications |
| Blynk | Live dashboard |
| ThingSpeak | Data visualization & analytics |
The project consists of two independent firmware programs:
- Arduino UNO Firmware (
Arduino_UNO.ino) - ESP32 Firmware (
ESP32.ino/ESP32_AWS_only.ino)
Install the following libraries before compiling the project.
| Library | Purpose |
|---|---|
| Adafruit GFX | Graphics library for OLED |
| Adafruit SH110X | SH1106 OLED display driver |
| Adafruit BusIO | Required by Adafruit libraries |
| EEPROM | Persistent storage of overload events (Built-in) |
| Wire | IΒ²C communication (Built-in) |
| SPI | SPI communication (Built-in) |
| Library | Purpose |
|---|---|
| WiFi | Wi-Fi connectivity |
| WiFiClientSecure | Secure TLS communication |
| HTTPClient | Firebase & REST API communication |
| ArduinoJson | JSON parsing and generation |
| Firebase ESP Client | Firebase Realtime Database |
| PubSubClient | MQTT communication with AWS IoT |
| Blynk | Mobile dashboard |
| ThingSpeak | Cloud analytics platform |
Install the latest ESP32 by Espressif Systems from the Arduino Boards Manager.
Arduino IDE
β
Boards Manager
β
ESP32 by Espressif Systems
Before uploading the firmware, replace the placeholder credentials with your own.
// Wi-Fi Credentials
const char* ssid = "YOUR_WIFI_NAME";
const char* password = "YOUR_WIFI_PASSWORD";
// Firebase
#define FIREBASE_HOST "YOUR_FIREBASE_HOST"
#define FIREBASE_AUTH "YOUR_FIREBASE_AUTH"
// AWS IoT
#define AWS_ENDPOINT "YOUR_AWS_ENDPOINT"
// ThingSpeak
#define THINGSPEAK_API_KEY "YOUR_API_KEY"
// Blynk
#define BLYNK_AUTH_TOKEN "YOUR_BLYNK_TOKEN"#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
Adafruit_SH1106G display(128,64,&Wire,-1);WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
}WiFiClientSecure net;
PubSubClient client(net);FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig config;ThingSpeak.begin(client);Smart-Energy-Meter
β
βββ Arduino_UNO.ino
βββ ESP32.ino
βββ ESP32_AWS_only.ino
βββ README.md
β
βββ images
βββ hardware_photo.jpeg
βββ Architecture_Diagram.png
βββ Ckt_Diagram.png
- Arduino IDE
- Embedded C++
- ESP32 Wi-Fi Libraries
- MQTT Protocol
- HTTP REST APIs
- EEPROM Library
- Adafruit SH110X OLED Library
- AWS IoT Core
- Firebase Realtime Database
- ThingSpeak
- Blynk
- Mobile application
- OTA firmware updates
- AI-based energy prediction
- Smart home integration

