Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Β 
Β 

Latest commit

Β 

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Smart Energy Meter using Arduino UNO & ESP32

Multi-Cloud IoT Energy Monitoring System

Real-time electrical parameter monitoring with custom firmware-based power calculations, OLED visualization, overload protection, and cloud connectivity.

Arduino ESP32 AWS IoT Firebase ThingSpeak Blynk


Hardware Prototype


Project Overview

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.


Key Features

  • 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

System Architecture

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.


Circuit Diagram


Hardware Components

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

Electrical Parameters Measured

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

Working Principle

  1. Voltage is measured using the ZMPT101B sensor.
  2. Current is measured using the ACS712 sensor.
  3. Arduino UNO samples both waveforms multiple times during every AC cycle.
  4. Firmware calculates all electrical parameters without using a dedicated metering IC.
  5. Results are displayed on the OLED display.
  6. Processed values are transmitted over UART to the ESP32.
  7. ESP32 uploads the data to multiple cloud services over Wi-Fi.

OLED User Interface

The OLED provides five different display pages.

  • Live Voltage, Current & Power
  • Complete Power Analysis
  • Energy Consumption & Electricity Bill
  • System Health & Status
  • Overload Event History

🚨 Safety Features

  • 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

Cloud Integration

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

πŸ“š Required Libraries

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.


Arduino UNO Dependencies

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)

ESP32 Dependencies

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

βš™ ESP32 Board Package

Install the latest ESP32 by Espressif Systems from the Arduino Boards Manager.

Arduino IDE
    ↓
Boards Manager
    ↓
ESP32 by Espressif Systems

πŸ”§ Project Configuration

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"

πŸ’» Key Library Initialization

OLED Display

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>

Adafruit_SH1106G display(128,64,&Wire,-1);

Wi-Fi

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED)
{
    delay(500);
}

AWS IoT MQTT

WiFiClientSecure net;
PubSubClient client(net);

Firebase

FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig config;

ThingSpeak

ThingSpeak.begin(client);

πŸ“‚ Repository Structure

Smart-Energy-Meter
β”‚
β”œβ”€β”€ Arduino_UNO.ino
β”œβ”€β”€ ESP32.ino
β”œβ”€β”€ ESP32_AWS_only.ino
β”œβ”€β”€ README.md
β”‚
└── images
    β”œβ”€β”€ hardware_photo.jpeg
    β”œβ”€β”€ Architecture_Diagram.png
    └── Ckt_Diagram.png

Software & Technologies

  • 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

Future Improvements

  • Mobile application
  • OTA firmware updates
  • AI-based energy prediction
  • Smart home integration

⭐ If you found this project interesting, consider giving it a Star!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages