IOT SMART ELECTRICITY ENERGY METER
Project Report submitted by
NIHAL(4NM22IS405)
NIKHIL R CHANDAN(4NM22IS406)
RANJAN SHETTIGAR(4NM22IS408)
Under the Guidance of
DR. JASON ELROY MARTIS
Associate professor
Department of Information Science and Engineering
In partial fulfillment of the requirements for the award of
the Degree of
Bachelor of Engineering in Information Science and Engineering
from
Visvesvaraya Technological University, Belagavi
Department of Information Science and Engineering
NMAM Institute of Technology, Nitte - 574110
(An Autonomous Institution affiliated to VTU, Belagavi)
MAY 2023
DEPARTMENT OF INFORMATION SCIENCE AND ENGINEERING
CERTIFICATE
Certified that the project work entitled
“Iot Smart electricity energy meter”
is a bonafide work carried out by
Nihal(4nm22is405)
Nikhil r chandan(4nm22is406)
Ranjan shettigar(4nm22is408)
in partial fulfilment of the requirements for the award of
Bachelor of Engineering Degree in Information Science and Engineering
prescribed by Visvesvaraya Technological University, Belagavi
during the year 2022-2023.
It is certified that all corrections/suggestions indicated for Internal Assessment have
been incorporated in the report deposited in the departmental library.
The project report has been approved as it satisfies the academic requirements in respect
of the project work prescribed for the Bachelor of Engineering Degree.
___________________ ___________________ ___________________
Signature of the Guide Signature of the HOD Signature of the Principal
Semester End Viva Voce Examination
Name of the Examiners Signature with Date
1. __________________________ __________________________
2. __________________________ __________________________
ABSTRACT
The rapid advancement of the Internet of Things (IoT) has opened up new
possibilities for innovation in various fields, including the energy sector. In this
article, we will explore the concept of an IoT-enabled Smart Electricity Energy
Meter, which aims to revolutionize traditional energy monitoring systems. This
cutting-edge smart meter incorporates state-of-the-art sensor technologies,
communication protocols, and data analytics to provide real-time and detailed
insights into electricity usage patterns. By utilizing wireless connectivity, these
meters allow for seamless communication between devices, enabling remote
monitoring and control. This article will delve into the key features and advantages
of IoT smart electricity meters, such as improved accuracy, enhanced energy
efficiency, and support for demand-side management strategies. Additionally, we
will discuss the potential impact of these smart meters on overall energy
consumption sustainability, highlighting their role in empowering consumers to
make informed decisions and reduce their carbon footprint. The integration of IoT
in electricity meters marks a significant step towards creating a smarter and more
resilient energy infrastructure for the future.
Table of Contents
Abstract ........................................................................................................................................... a
1. Introduction..................................................................................................................................... 1
2. Components and modules .............................................................................................................. 2
2.1. ESP32 Wi-Fi Board ................................................................................................................. 2
2.2. SCT-013-030 Non-invasive AC Current Sensor ...................................................................... 3
2.3. ZMPT101B AC Single Phase Voltage Sensor ........................................................................... 4
2.4. 20x4 I2C LCD Display .............................................................................................................. 4
2.5. Other Components ................................................................................................................. 5
3. Circuit description & working principle.......................................................................................... 6
3.1 Circuit Diagram ........................................................................................................................ 6
3.2 Working principle .................................................................................................................... 6
3.3 Setting Up Blynk 2.0 Web and Mobile Dashboard .................................................................. 8
4. Algorithm ........................................................................................................................................ 8
5. Implementation .............................................................................................................................. 9
6. Result ............................................................................................................................................ 14
7. Conclusion..................................................................................................................................... 15
8. References .................................................................................................................................... 15
1.INTRODUCTION
In today's world of increasing energy needs and the urgent requirement for
sustainable resource management, the combination of Internet of Things (IoT)
technology with traditional energy monitoring systems has led to the emergence
of exciting new solutions. A noteworthy advancement in this field is the "IoT Smart
Electricity Energy Meter." This intelligent metering system utilizes a complex set
of components to surpass the constraints of conventional monitoring methods,
providing unparalleled understanding of electricity usage patterns, enhancing
efficiency, and encouraging the adoption of sustainable energy practices.
The ESP32 Wi-Fi Module, a highly capable microcontroller equipped with WiFi
and Bluetooth features, lies at the core of this impressive technological
advancement. When combined with the ZMPT101B AC Voltage Sensor Module
and the SCT-013-030 Non-invasive AC Current Sensor, this setup becomes
proficient in accurately measuring voltage and current in real-time within an
electrical circuit. By incorporating a 20x4 I2C LCD Display, users are provided
with a tangible interface to easily comprehend and visualize relevant information
related to electricity consumption. This integration greatly enhances accessibility
to the intricacies of electricity usage.
The combination of these elements enables the IoT Smart Electricity Energy
Meter to not just observe, but also cleverly analyse information. By doing so, it
can calculate power consumption in real-time and empower users to make
educated choices regarding their energy usage. This system goes beyond the
constraints of its immediate physical surroundings thanks to wireless
communication facilitated by the ESP32. This connectivity allows for effortless
transmission of data to external servers or cloud platforms. Not only does it
enable remote monitoring, but it also lays the foundation for thorough data
analysis, contributing to a comprehensive comprehension of energy consumption
patterns.
1
As we explore the complexities of this energy metering system driven by the
Internet of Things (IoT), it becomes evident that it is not just a device for
measurement. It signifies a significant change towards intelligent energy
management, equipping users with the means to enhance consumption, lessen
environmental consequences, and embrace a more sustainable energy future. In
this investigation, we uncover the fundamental principles and uses of the IoT
Smart Electricity Energy Meter, shedding light on its role within the wider scope
of smart technologies and the evolving realm of energy efficiency.
2.COMPONENTS AND MODULES
In this section, various components and modules being used for IoT based smart
electricity energy meter project development is discussed.
2.1 ESP32 Wi-Fi Board
The ESP32 is a versatile and powerful microcontroller that has gained significant
popularity in the world of embedded systems and IoT. Developed by Espressif
Systems, it combines a dual-core processor, built-in Wi-Fi and Bluetooth
connectivity, and a wide array of I/O pins, making it a favourite among electronics
enthusiasts and professionals alike. The ESP32's robust capabilities enable it to
handle a wide range of applications, from simple sensor monitoring to complex
IoT projects. Its adaptability and ease of use, coupled Fire & Movement Detection
System 2 with a strong open-source community, have cemented the ESP32 as a
top choice for developing innovative solutions in various domains, including home
automation, remote monitoring, and industrial automation. Whether you're a
hobbyist or a seasoned engineer, the ESP32 is a go-to platform for turning
creative ideas into practical and connected real-world applications.
Figure 1: ESP32 Wi-Fi board
2.2 SCT-013-030 Non-invasive AC Current Sensor
The SCT-013 is a non-invasive split-core type clamp meter sensor designed to
measure AC current up to 100 amperes. This type of current sensor is commonly
known as a current transformer (CT) and is used for measuring alternating current
in a building. The SCT-013 is convenient to use, as it can be easily attached to
either the live or neutral wire without any electrical work involving high voltage.
Figure 2: SCT-013 Current Sensor
3
2.3 ZMPT101B AC Single Phase Voltage Sensor
The ZMPT101B AC Single Phase Voltage Sensor Module is a high-precision
device built on the ZMPT101B voltage transformer. This makes it an ideal choice
for measuring accurate AC voltage with an Arduino or ESP32.
The module is capable of measuring AC voltage within a range of 250V and offers
adjustable analog output. It is easy to use, featuring a multi-turn trim
potentiometer for adjusting and calibrating the ADC output.
Figure 3: ZMPT101B AC Single Phase Voltage Sensor
2.4 20x4 I2C LCD Display
A 20x4 I2C LCD Display features a 20-character by 4-line configuration, utilizing
the I2C communication protocol. This compact module simplifies wiring,
enhances visibility with backlighting, and serves as a versatile user interface for
microcontroller-based projects, offering clear and concise information
presentation in a space-efficient design.
4
Figure 4: 20x4 I2C LCD Display
2.5 Other Components
2.5.1 Resistor 10K
A 10K ohm resistor is a common electronic component used to limit current or
divide voltage in circuits. With a resistance of 10,000 ohms, it finds applications
in various electronic devices and projects, serving as a crucial element in
ensuring proper signal conditioning and stability within the circuit.
2.5.2 Resistor 100ohm
The 100-ohm resistor is a fundamental electronic component that regulates
current flow in circuits. With its specific resistance value, it is commonly used for
current limiting, voltage division, or as a protective element. Its role is crucial in
maintaining the stability and integrity of electrical systems.
2.5.3 Capacitor 10uF
The 10uF capacitor is an electronic component with a capacitance of 10
microfarads. Used in circuitry, it aids in smoothing voltage fluctuations, filtering
signals, and stabilizing power supplies. Its application is crucial for ensuring a
steady and reliable flow of electrical energy in various electronic devices and
systems.
5
3. CIRCUIT DESCRIPTION & WORKING PRINCIPLE
3.1 Circuit Diagram
Figure 5: circuit diagram
The circuit diagram for the IoT-based Electricity Energy Meter using ESP32 is
shown below. The design was created using the Fritzing software and the
connection diagram is simple. The VCC & GND pins of both the SCT-013 Current
Sensor and ZMPT101B Voltage Sensor are connected to the Vin & GND of
ESP32, which is a 5V supply. The output analog pin of the ZMPT101B Voltage
Sensor is connected to the GPIO35 of ESP32 and the output analog pin of the
SCT-013 Current Sensor is connected to the GPIO34 of ESP32. Additionally, two
10K resistors and a single 100-ohm resistor, along with a 10uF capacitor, are
required to complete the circuit.
3.2 Working principle
The IoT Smart Electricity Energy Meter, utilizing the listed components, operates
on the principle of real-time monitoring and data transmission for efficient energy
management. The ESP32 Wi-Fi module serves as the central controller,
6
orchestrating the integration of the ZMPT101B AC Voltage Sensor and SCT-013-
030 Non-invasive AC Current Sensor. The voltage sensor measures the
alternating current (AC) voltage, providing a proportional analog output.
Simultaneously, the current sensor, which operates non-invasively, captures the
AC current flowing through a conductor without direct contact. The ESP32
processes these sensor inputs, calculates power consumption, and displays the
information on the 20x4 I2C LCD Display. The 10K and 100-ohm resistors, along
with the 10uF capacitor, contribute to signal conditioning and filtering, ensuring
accurate readings. The ESP32, equipped with Wi-Fi capabilities, facilitates
seamless communication, enabling users to remotely monitor energy
consumption patterns and make informed decisions for optimizing power usage.
This interconnected system exemplifies the synergy of IoT technologies in
creating a smart meter that not only measures electricity usage accurately but
also empowers users to enhance energy efficiency and contribute to sustainable
consumption practices.
Figure 6: hardware setup
7
3.3 Setting Up Blynk 2.0 Web and Mobile Dashboard
Blynk is an application that runs over Android and IOS devices to control any IoT
based application using Smartphones. It allows you to create your Graphical user
interface for IoT application. Here we will display the IoT Energy Meter Data on
Blynk Web Dashboard and also in mobile Application.
Visit blynk.io and sign up using the email ID.
First Create a New Template. Assign the name, Hardware & Connection Type.
From the Web Dashboard, Create 4 widgets Gauge. He 4 widgets are here to
display the value of Vrms, Irms, Power & KWh. Do the settings as per the image
below.
Finally, the Web Dashboard looks something like this and is ready to receive the
Smart Energy Meter Data from ESP32. Apart from the Web Dashboard, you can
also set up your Mobile App Dashboard. You can download and install the Blynk
Application from Google Play Store. IOS users can download from the App Store.
Once the installation is completed, open the app & sign-up using your Email id and
Password. Then set up the app similar like Web Dashboard.
4. ALGORITHM
• Initialize the ESP32 and set up WiFi connectivity.
• Initialize the I2C communication for the LCD display.
• Set up pins for ZMPT101B AC Voltage Sensor, SCT-013-030 Current
Sensor, and other
• Calibrate the ZMPT101B AC Voltage Sensor to obtain accurate voltage
readings.
• Calibrate the SCT-013-030 Current Sensor to obtain accurate current
readings.
• Enter a continuous loop for data acquisition and monitoring.
• Read the analog voltage output from the ZMPT101B AC Voltage Sensor.
• Read the analog voltage output from the SCT-013-030 Current Sensor.
8
• Use the obtained voltage and current readings to calculate real power
using the formula: Power (W) = Voltage (V) * Current (A).
• Display real-time power consumption data on the 20x4 I2C LCD display.
• Display additional information such as voltage, current, and any relevant
metrics.
• Optionally, transmit the data to a remote server or cloud platform using the
ESP32's WiFi capabilities.
• Optionally, log the power consumption data to a local storage device or
cloud database for historical analysis.
• Implement user interaction features, such as buttons or a touchscreen, to
allow users to view historical data, set thresholds, or configure the device.
• Implement power-saving mechanisms to ensure efficient use of energy
and extend the device's battery life if applicable.
• Implement error handling mechanisms to address sensor reading errors or
communication issues.
• Implement a sleep mode to further conserve power during idle periods.
• Repeat the data acquisition loop to continuously monitor and update the
power consumption information.
5. IMPLEMENTATION
5.1 Code
/* Code for Arduino */
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.println(analogRead(A0));
delay(100);
}
9
/* Code for Esp32 */
#define BLYNK_TEMPLATE_ID "******"
#define BLYNK_TEMPLATE_NAME "IoT Energy Meter"
#define BLYNK_PRINT Serial
#include "EmonLib.h"
#include <EEPROM.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);
// Constants for calibration
const float vCalibration = 41.5;
const float currCalibration = 0.15;
// Blynk and WiFi credentials
const char auth[] = "********************************";
const char ssid[] = "******";
const char pass[] = "*****";
// EnergyMonitor instance
EnergyMonitor emon;
// Timer for regular updates
BlynkTimer timer;
// Variables for energy calculation
float kWh = 0.0;
10
unsigned long lastMillis = millis();
// EEPROM addresses for each variable
const int addrVrms = 0;
const int addrIrms = 4;
const int addrPower = 8;
const int addrKWh = 12;
// Function prototypes
void sendEnergyDataToBlynk();
void readEnergyDataFromEEPROM();
void saveEnergyDataToEEPROM();
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
// Initialize the LCD
lcd.init();
lcd.backlight();
// Initialize EEPROM with the size of the data to be stored
EEPROM.begin(32); // Allocate 32 bytes for float values (4 bytes each) and some
extra space
// Read the stored energy data from EEPROM
readEnergyDataFromEEPROM();
// Setup voltage and current inputs
emon.voltage(35, vCalibration, 1.7); // Voltage: input pin, calibration, phase_shift
11
emon.current(34, currCalibration); // Current: input pin, calibration
// Setup a timer for sending data every 5 seconds
timer.setInterval(5000L, sendEnergyDataToBlynk);
// A small delay for system to stabilize
delay(1000);
}
void loop()
{
Blynk.run();
timer.run();
}
void sendEnergyDataToBlynk()
{
emon.calcVI(20, 2000); // Calculate all. No.of half wavelengths (crossings), time-
out
// Calculate energy consumed in kWh
unsigned long currentMillis = millis();
kWh += emon.apparentPower * (currentMillis - lastMillis) / 3600000000.0;
lastMillis = currentMillis;
// Print data to Serial for debugging
Serial.printf("Vrms: %.2fV\tIrms: %.4fA\tPower: %.4fW\tkWh: %.5fkWh\n",
emon.Vrms, emon.Irms, emon.apparentPower, kWh);
// Save the latest values to EEPROM
saveEnergyDataToEEPROM();
12
// Send data to Blynk
Blynk.virtualWrite(V0, emon.Vrms);
Blynk.virtualWrite(V1, emon.Irms);
Blynk.virtualWrite(V2, emon.apparentPower);
Blynk.virtualWrite(V3, kWh);
// Update the LCD with the new values
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Vrms: ");
lcd.print(emon.Vrms, 2);
lcd.print(" V");
lcd.setCursor(0, 1);
lcd.print("Irms: ");
lcd.print(emon.Irms, 4);
lcd.print(" A");
lcd.setCursor(0, 2);
lcd.print("Power: ");
lcd.print(emon.apparentPower, 4);
lcd.print(" W");
lcd.setCursor(0, 3);
lcd.print("kWh: ");
lcd.print(kWh, 5);
lcd.print(" kWh");
}
void readEnergyDataFromEEPROM()
{
// Read the stored kWh value from EEPROM
13
EEPROM.get(addrKWh, kWh);
// Check if the read value is a valid float. If not, initialize it to zero
if (isnan(kWh))
{
kWh = 0.0;
saveEnergyDataToEEPROM(); // Save initialized value to EEPROM
}}
void saveEnergyDataToEEPROM()
{
// Write the current kWh value to EEPROM
EEPROM.put(addrKWh, kWh);
// Commit changes to EEPROM
EEPROM.commit();
}
6. RESULT
14
7. CONCLUSION
In conclusion, the utilization of ESP32 and Blynk 2.0 to create an IoT Based Smart
Electricity Energy Meter will bring forth a groundbreaking transformation in the
monitoring and measurement of electricity usage. By implementing this IoT-based
solution, the need for manual meter readings is eliminated, resulting in saved time
and cost.
By employing high-quality current and voltage sensors, precise measurements of
voltage, current, power, and total energy consumption can be acquired. The data
can be accessed from any location through the Blynk 2.0 dashboard. Moreover, in
the event of power outages, the energy meter data is securely stored in the
EEPROM of the ESP32, ensuring uninterrupted readings.
8. REFERENCES
1. IoT Based Smart Energy Meter-(IJERECE)
https://www.technoarete.org/common_abstract/pdf/IJERECE/v8/i9/Ext_60895.pdf
2.https://www.youtube.com/watch?v=24DPTA_l8hg
15