0% found this document useful (0 votes)
54 views

Smart Energy Meter Project Report

The document presents a final year project report on the development of a Smart Energy Meter that integrates IoT and AI for consumption prediction, aimed at improving energy management in Kenya. It addresses challenges such as electricity theft and inefficient consumption by providing real-time monitoring, automated billing, and remote control of appliances through a mobile application. The project emphasizes the significance of smart meters in promoting energy accountability and optimizing electricity usage for consumers and utility companies.

Uploaded by

onyangos205
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

Smart Energy Meter Project Report

The document presents a final year project report on the development of a Smart Energy Meter that integrates IoT and AI for consumption prediction, aimed at improving energy management in Kenya. It addresses challenges such as electricity theft and inefficient consumption by providing real-time monitoring, automated billing, and remote control of appliances through a mobile application. The project emphasizes the significance of smart meters in promoting energy accountability and optimizing electricity usage for consumers and utility companies.

Uploaded by

onyangos205
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 33

MASENO UNIVERSITY

SCHOOL OF COMPUTING AND INFORMATICS

Bsc COMPUTER TECHNOLOGY

CCT 405: FINAL YEAR PROJECT REPORT

SMART ENERGY METER WITH IOT AND AI-DRIVEN CONSUMPTION PREDICTION

TEAM MEMBERS REGISTRATION NUMBERS


ONYANGO SIDNEY OTIENO CCT/00065/021
DAVID SAKWA CCT/00017/021
HENRY KARIUKI GACHANJA CCT/00151/019

Declaration

1
We, the undersigned, hereby declare that this project report titled "Smart Energy Meter with
IoT and AI-Driven Consumption Prediction" is our original work and has not been submitted to
any other institution for academic or professional purposes.
We confirm that all sources of information used in this work have been appropriately
acknowledged, and any borrowed ideas, figures, or research findings have been cited
accordingly. This project is developed for academic purposes, and any implementation beyond
this scope will adhere to relevant ethical and regulatory guidelines.

Name Registration Number Signature Date


Onyango Sidney O. CCT/00065/021
David Sakwa CCT/00017/021

Supervisor’s Name: Dr. McOyowo S.


Signature: ______________________
Date: _________________________

ACKNOWLEDGEMENTS

2
Special thanks to our supervisor, Dr. Sylvester McOyowo for his expert idea and encouragement
throughout this innovative course.
My appreciation also goes to all lecturers in the department of Computer Science. Your help
has really been beneficial to us all may continue inspiring those that will also pursue this field of
study.
We say a big thank you to our parents for their support, both financially and otherwise
throughout this study. We appreciate all your efforts.

ABSTRACT

3
An energy meter is a device used to monitor the electricity utilization/consumption. Meters
usually involve real-time or near real-time sensors data to calculate current, voltage and power.
The main objective of this work was to design a single-phase smart energy meter using
instantaneous power calculation. The device can be utilized to measure the amount of electric
power consumed by electrical appliances. One of the goal is to monitor the consumption of
electric energy using both current and voltage signal from power system. Voltage and current
signal are sampled and analyzed by using Arduino. The device is embedded with WiFi control
switching operation, i.e- to turn on/off the appliances at any time remotely via a software
developed in Android Platform named with PMU. An Arduino code is developed to measure the
various circuit parameters including current voltage, power factor (PF), real power consumption
and reactive power. The system is also embedded with sensitivity measurement module and
the values are displayed regularly. To control the various appliances, a mobile application is
developed and integrated with the system. WiFi enabled energy metering system can be
utilized to control the appliances remotely.

4
TABLE OF CONTENTS
DECLARATION………………………………………………………………………………………………………………………….
ACKNOWLEDGEMENTS ………………………………………………………………………………………………………….. ii
ABSTRACT……………………………………………………………………………………………………………………………….. iii
LIST OF FIGURES……………………………………………………………………………………………………………………… iv
CHAPTER ONE: INTRODUCTION……………………………………………………………………………………………….. 1
1.1 Background of Research……………………………………………………………………………………………………… 2
1.2 Problem Statement………………………………………………………………………………………………………………
1.3 Research Objectives…………………………………………………………………………………………………………..
1.4 Research Questions……………………………………………………………………………………………………………..
1.5 Significance of the study………………………………………………………………………………………………………
1.6 Scope of Work……………………………………………………………………………………………………………………..
CHAPTER TWO: LITERATURE REVIEW…………………………………………………………………………………………
2.1 Background Overview…………………………………………………………………………………………………………
2.2 Automatic Meter Reading……………………………………………………………………………………………………
2.3 Current Measurement………………………………………………………………………………………………………….
2.3.1: Analog to Digital Conversion…………………………………………………………………….
2.3.2: Sampling and Holding……………………………………..
2.3.3: Quantizing and Encoding……………………………………………….
2.4 Node Mcu…………………………….
CHAPTER THREE: METHODOLOGY………………………………………………………………
3.1: Materials
3.2: Block Diagram:
3.3: Detailed Design
3.3.1: Proteus Circuit Simulation
3.4: The Mobile Application:
3.4.1: Overview Of The Mobile Application
3.5. Application Programming Interface
3.6: Database

5
Appendixes
References

CHAPTER ONE
INTRODUCTION

6
1.1 Background of Research
In recent years, domestic and industrial users have shifted from traditional meters to smart
meters. As global energy demand increases, efficient energy usage has become a critical
concern for both consumers and governments. In developing countries like Kenya, households
and small businesses often struggle to monitor and manage their electricity consumption
effectively, leading to high energy bills and wastage. Electromechanical meters were a
dominant part of electricity measurement before 1970 . However, it had been identified that
the requirement of a meter which could communicate and measure the electrical energy along
with other electrical parameters was essential. Therefore, solid state electronic meters were
introduced to measure the overall electrical parameters. Between 1970 and 2000, automatic
meter reading was added to electronic meters and it was a great achievement since it could
send the data in near time. However, it could only provide one-way communication. This
limitation was overcome by the introduction of smart meters which can provide two-way
communication. Smart meters can measure all the electrical parameters like electronic meters
and communicate data in a meaningful way. The consumer is updated with details such as
energy consumption, the number of electricity units remaining and other required information.
Before the invention of smart meters, we had the electromechanical meters. Electromechanical
energy meter is the most traditional and widely used energy meter for over a century. It can
measure only the active energy which is typically displayed on a mechanical counter.
Traditional energy meters only provide a cumulative reading, making it difficult for consumers
to track real-time usage and identify energy-heavy appliances. With rising electricity costs and
increasing awareness of environmental sustainability, a smart energy meter system that
provides real-time data can help users monitor their energy consumption patterns, reduce
waste, and cut down on costs.
The use of microcontrollers in electricity metering is gaining ground when it comes to electricity
distribution.

1.2 PROBLEM STATEMENT


Kenya and most parts of Africa faces significant challenges in energy management, including
electricity theft, inefficient consumption, high billing discrepancies, and limited access to real-
7
time energy data. Traditional meters rely on manual readings, leading to errors, delayed billing,
and potential corruption in meter reading processes. Additionally, high energy costs and
unpredictable power outages make it difficult for consumers to plan and optimize their
electricity usage.
A Smart Energy Meter can address these challenges by providing real-time energy monitoring,
automated billing, and remote access via mobile or web applications. The system will enable
consumers to track their electricity usage, set consumption limits, and receive alerts on
abnormal usage or potential faults. For utility companies, it will help detect power theft, reduce
operational costs, and enhance billing accuracy.
By integrating IoT, GSM, or Wi-Fi-based communication, this project will contribute to
sustainable energy management in Kenya, supporting the push for efficient electricity
distribution, cost reduction, and a smarter national grid. This project proposes the development
of a Smart Energy Meter that integrates IoT and AI-driven consumption prediction to:
1. Provide real-time energy tracking via a mobile/web app.
2. Enable prepaid metering with mobile money integration (M-Pesa, Airtel Money).
3. Use AI to analyze consumption patterns and alert users about high usage.
4. Allow remote control of appliances to optimize energy efficiency.
By implementing this solution, the project aims to enhance energy accountability, empower
consumers with real-time usage insights, and support Kenya’s efforts in smart energy
management.

1.3 RESEARCH OBJECTIVES

8
This project proposes the development of a Smart Energy Meter that integrates Internet of
Things, prepaid metering, and AI-driven consumption prediction to:
1. Provide real-time energy tracking via a mobile/web app.
2. Use AI to analyze consumption patterns and alert users about high usage.
3. Detect and report electricity theft through automated tamper detection.
4. Allow remote control of appliances to optimize energy efficiency.
By implementing this solution, the project aims to enhance energy accountability, empower
consumers with real-time usage insights, and support Kenya’s efforts in smart energy
management.

1.4 RESEARCH QUESTIONS

1. Energy Management and Consumption:


How can real-time energy consumption data influence consumer behavior and energy-saving
practices in Kenyan households?
What are the most effective methods for predicting electricity consumption patterns using AI
and machine learning?
How can the integration of prepaid metering systems help reduce electricity theft and improve
payment collection efficiency in Kenya?
2. Technology and IoT Integration:
What are the most reliable and cost-effective communication protocols (e.g., Wi-Fi, GSM) for
remote monitoring and control of energy meters in rural and urban settings in Kenya?
How can IoT-based energy meters provide real-time feedback to both consumers and utility
companies to optimize electricity distribution?
3. User Experience and Interface:
What features do Kenyan consumers prioritize when using a mobile/web application for energy
monitoring and remote control of home appliances?
5. Cost and Affordability:

9
What is the cost-effectiveness of implementing smart energy meters in Kenyan homes
compared to traditional metering systems?
How can the cost of implementing a Smart Energy Meter solution be minimized for wide-scale
adoption, especially for low-income households?
6. Sustainability and Scalability:
How scalable is the Smart Energy Meter solution in different regions of Kenya, including rural
areas with limited access to the internet or mobile networks?
What are the environmental and economic benefits of using smart energy meters in the
context of Kenya’s push towards sustainable energy management?
7. Policy and Regulatory Impact:
What are the challenges and opportunities for integrating smart energy meters into Kenya’s
current electricity grid and regulatory framework?
How can the government and utility companies encourage the adoption of smart energy meters
among consumers and service providers?

1.5 SIGNIFICANCE OF THE STUDY


There are many problems in metering and billing processes like the going of meter reader to
cach customer meter to manually take the meter reading, the probability of the non-existence
of the customers at their houses during that time, the lack of integrity and credibility of some of
the meter readers etc.
These myriad of problems leads to the need for a solution; a solution that removes the hassles
of energy measurement and management. This is where an electricity smart meter comes in.
A smart meter is an integrated system equipped with a communication network, linking
sensors, domestic appliances, and other electronic and electrical devices, that can be remotely
monitored, accessed or controlled and which provides services that respond to the needs of the
users. The existence of a communication network is central to the concept of smart metering
systems as it is a key feature which distinguishes smart meters from other meters merely
equipped with standalone features.

Advantages of smart meters


i) Smart Meters provide customers with near real-time information on energy use.

10
ii) Smart meters also help enable better management of energy use, save money, and reduce
emissions.
iii) Bring an end to estimated billing-consumers are only billed for their actual energy use,
helping them to better manage their budget.
iv) Smart meters help with energy consumption measurement and enables us to monitor our
billings.

1.7 SCOPE OF WORK

This project is designed to measure changes in electricity consumption readings over time, this
helps with the calculation of energy usage (KWh). However, voltage is kept at a constant 220v.
This is because the NodeMCU has only one analog pin and as such cannot easily be connected
to both a current and voltage sensor.
This project also allows users to monitor their energy consumption via the accompanying
mobile application. Users can set reminders which include but is not limited to "reminders
notifying users to switch off the light before going to bed". Users are also sent E-mail messages
which notifies them when their average power consumption exceeds the limit that has been set
by them in the mobile application to help ensure power conservation and budgeting of
electricity billing. The load connected to the smart meter is also put off once excess power
consumption is sensed. This is however limited as users do not have the flexibility to remotely
switch on or put off their appliances remotely.

11
CHAPTER TWO
LITERATURE REVIEW

2.1: BACKGROUND OVERVIEW


On the development of this project, a few reviews were carried out. These reviews were carried
out to give a better insight and understanding regarding the development and working of the
system. Different sources like journals, books, internet sources and previous projects provide
concrete references and understanding for the study. This project is focused on the design and
implementation of an energy smart meter. The reviews carried out pinpoints smart metering,
Internet of Things, micro controllers as well as sampling techniques.

2.2: AUTOMATIC METER READING


Currently, numerous systems of Automatic Meter Reading (AMR) are implemented using
Bluetooth, General Packet Radio Access (GPRS) and Global System for Mobile communication.
Utilizing GSM technology remote sharing of information of energy consumption to consumers is
possible. But there can be chances of missing SMS thus result in decreasing the reliability and
efficiency of the system. GPRS is difficult to implement for long distance two-way
communication between utility and consumers.
Here, we begin by looking at a couple of projects and papers on electricity smart meters,
Milanpreet Kaur et al in their paper titled "Implementation of Smart Metering based on
Internet of Things" describes the monitoring of energy consumption with Arduino Uno board
and Ethernet using loT (Internet of Things) concept. This proposed design eliminates human
inclusion in the conservation of electricity. The consumer can receive the information about
consumption of energy by using IP address on their devices. The web client code is uploaded for
checking the client information such as location, content, connection, and disconnection to the
web server. This proposed system gives reliable and accurate information regarding electrical
energy management system (EMS) through Internet of things (IoT). Here, it is observed that an
Arduino Uno microcontroller is used.
Also, AMR is enabled by using ZigBee and GSM module in which ZigBee is interfaced with
energy meter to collect data and GSM is used for transmitting message/SMS to the utility. Here,
the user does not have the liberty to easily view historical power consumption data, and
information that could have been sent across can be lost due to network failure.
The data visualization is carried out in a webpage and the data packet loss is investigated in the
remote monitoring of the parameters [9]. Here the authors proposed system that allows
alertness to be set for consumption levels above and below "user set trigger levels" and to
forecast future energy use.
12
To measure bidirectional flow of energy to enable customers participate in energy management
and to perform occupancy detection algorithm to automatically on/off the appliances when not
in use. To categorize the loads into levels and perform load shedding in peak hours and hence
loads to effective energy management and to allow the system operator to control the
appliances remotely by accessing through IOT in case of peak load shaving and power quality
issues. This work did not however go beyond the proposal phase and failed to examine in-depth
how blocks could be put together to build a truly smart electricity meter.

2.3: CURRENT MEASUREMENT:


Measurement of analog signals (in this case current) is essential in a system such as this. Several
papers have made use of different approaches in the measurement of current signals from AC
and/or DC sources.
The current sensing technology used plays a vital role in the accuracy and sensitivity of the
current measurement. Here, the current sensor made use of has the ability to measure both AC
and DC current and measure current of up to 30 Amps.

2.3.1: ANALOG TO DIGITAL CONVERSION:


An analog to digital converter (ADC) as its name indicates is an electronic device which converts
continuous time-varying analogue signals into discrete-time digital signals so that they can
easily be read by the digital devices. It has many applications in electronics projects, ADC
converts the physical quantities of a real-world phenomenon into a digital language which is
used in control systems, data computing, data transmission, and information processing. The
figure below shows the input/output relationship of an ADC

Figure 2: Input and output definitions of an Analog to Digital converter


Usually, transducers are also used to convert the input analog variables in the form of currents
or voltages. Basically, the digital numbers used here are binary Le "O' and "1". The "0" indicates
the 'off state and '1 represents the 'on' state. Hence all the analog values are converted into
digital binary values by an ADC. For example, if we must install an alarm in our house or at

13
some facility, whose function is to set off in case of fire or overheating. Our whole alarm system
will be electronic but the temperature sensor will give analog values at the output after sensing
the temperature. Therefore, convert the varying values of temperature in digital or discrete
values, we have to use an analog to digital converter.
A/D Conversion Process and How ADC works?
Mainly there are two steps for the analog to digital conversion:
1. SH: Sampling and holding.
2. Q/E: Quantizing and Encoding

The ADC process is shown in figure below:

2.3.2: SAMPLING AND HOLDING


An analog signal continuously changes with time, in order to measure the signal we have to
keep it steady for a short duration so that it can be sampled. We could measure the signal
repeatedly and very fast, and then find out the right time scale, or we could measure the signal
at different timings and then average it. Or preferably we can hold the signal for a specific
duration and then digitize the signal and sample the value. This is done by a sample and hold
circuit. For, at least the time required for digitization, it keeps the value stable. Figure shows the
circuit for sampling and holding of a signal.

Sampling and Holding Circuit

14
We keep the switch normally open, and when we want to find a measurement, we close the
switch momentarily.

2.3.3: QUANTIZING AND ENCDING


On the output of (SH), a certain is voltage level present. We assign The nearest value, in
correspondence with the amplitude of samp scarchod. And this value cannot be just any value,
it should be from values. It depends on the range of the quantizer and the range in given in a
power of 2.
After identifying the closest value, a numerical value is assigned to it and it is encoded in the
form of a binary number. The binary encoded numbers generated by quantizer are represented
by 'n' bits. The resolution of an ADC can also be denoted by 'n' bit.
Sampling, Holding and Quantizing
The values achieved after the quantization and encoding process cannot be said to be
thoroughly accurate. These only the approximations of the real-world values. The accuracy of
the quantizer highly depends on the resolution of the quantizer, greater the resolution.
accurate the values will be. The ADC resolution is limited by a number of constraints, out of
which, time is a major issue. If the set of possible values, from which the closest value is to be
searched, is greater, then it will surely take more time. But to accelerate this process, more
techniques have been developed.

2.4: NODE MCU:


The Node MCU microcontroller plays a paramount role when it comes to communication
between devices over the internet. In a paper by D. V. N. Ananth et al titled "Smart Electricity
Billing Using Node-MCU" , They designed a project where the user receives his or her billing
periodically and is automatically cutoff in a case where the credit that is available is finished.

15
This project however improves on this by not only alerting consumers when their available
number of unit is about to finish but also helping them to automatically top-up their credit unit
In another paper by Win Adiyansyah Indra et al titled "GSM-Based Smart Energy Meter with
Arduino Uno" [11]. Users were able to monitor their current power consumption with the help
of SMS alerts. This was made possible by the use if an Arduino Microcontroller and a GSM
module. However, this is not efficient and makes it difficult for users to still be able to monitor
their power consumption should they leave the country or visit an area where their local
service operator does not operate
Here, the smart meter being designed comes along with a mobile application that allows the
user to monitor her power consumption real time from anywhere in the world. This is also cost
effective and updates in real time when compared against an SMS based system.

16
CHAPTER THREE
METHODOLOGY

3.1 MATERIALS

List of materials for the project;


1. Microcontroller/Development Board:
Arduino Uno or ESP32/ESP8266: Great for handling control tasks and communication. ESP32
and ESP8266 are particularly useful for adding Wi-Fi functionality, enabling IoT features.
2. Energy Metering Components:
Current Sensor (ACS712, ZMPT101B): These sensors are crucial for measuring electrical current
and voltage, which is necessary for real-time tracking of energy consumption.
Energy Meter IC (HLW8012, PZEM-004T): These integrated circuits combine the necessary
components to measure energy usage, simplifying the process.
3. Communication Module:
Wi-Fi Module (ESP8266/ESP32): Enables internet connectivity to send data to a cloud service or
mobile app. For this case we’ll prefer ESP8266 since its more affordable.
GSM Module (SIM800L, SIM900): If you want SMS-based alerts or communication, GSM
modules are an affordable solution for low-bandwidth communication.
4. Mobile/Web Application:
Mobile App Development Tools: Platforms like MIT App Inventor, Flutter allow you to create
cross-platform apps for monitoring and controlling energy consumption.
5. Power Supply:
Power Supply (5V adapter): To power the microcontroller and sensors.
Battery/Solar Panel (optional): If you're building a portable or off-grid system, these will ensure
independent power.
6. User Interface and Alerts:
LCD/Display: For showing real-time energy data directly on the device.
Buzzer/LEDs: To give users alerts, such as abnormal consumption.

17
7. Software:
Arduino IDE
Flutter
Golang
AI Tools (e.g., Scikit-learn): With Python, you can integrate machine learning models to predict
energy consumption patterns.
8. Additional Accessories:
Smartphone (mobile application)
Jumper Wires, Switches, Breadboard, Resistors, and Capacitors: Basic prototyping materials for
building circuits.
Relay Module: For remotely controlling home appliances based on energy consumption
thresholds.

3.2 BLOCK DIAGRAM

LCD Display:
The Liquid Crystal library allows you to control LCD displays that are compatible with the Hitachi
HD-4-4780 driver. There are many of them out there, and you can usually tell them by the 16-
pin interface

18
The LCDs have a parallel interface, meaning that the microcontroller has to manipulate several
interface pins at once to control the display. The interface consists of the following
A register select (RS) pin that controls where in the LCD's memory you're writing data to You
can select either the data register, which holds what goes on the screen, or an instruction
register, which is where the LCD's controller looks for instructions on what to do next.
A Read/Write (R/W) pin that selects reading mode or writing mode
An Enable pin that enables writing to the registers
8 data pins (00-07). The states of these pins (high or low) are the bits that you're writing t a
register when you write, or the values you're reading when you read.
There's also a display contrast pin (Vo), power supply pins (+5V and Gnd) and LED Backlight
(Bklt+ and BKlt-) pins that you can use to power the LCD, control the display contrast, and turn
on and off the LED backlight, respectively.
The process of controlling the display involves putting the data that form the image of what you
want to display into the data registers, then putting instructions in the instruction register. The
Liquid Crystal Library simplifies this for you so you don't need to know the low-level instructions

Signal flow:
Once the system is powered on, the ESP8266 NodeMCU creates a connection with the router
(here, my mobile device serves as the router).
The current sensor receives current signal from the load and sends this to the NodeMCU for
sampling.

ESP 8266 (Node MCU)

19
NodeMCU is an open-source Lua based firmware and development board specially targeted for
IoT based Applications. It includes firmware that runs on the ESP8266 Wi-Fi SoC from Espressif
Systems, and hardware which is based on the ESP-12 module
NodeMCU(ESP8266) Development Board Pinout Configuration

ESP8266 Specifications & Features


1. Microcontroller: Tensilica 32-bit RISC CPU Xtensa LX106
2. Operating Voltage: 3.3V
3. Input Voltage: 7-12V
4. Digital I/O Pins (DIO): 16
5. Analog Input Pins (ADC): 1
7. SPIs :1
8. 12Cs; 1
9. Flash Memory: 4 MB
10. SRAM 64 KB
11. Click Speed: 80 MHz.
12. USB-TTL based on CP2102 is included onboard, Enabling Plug & Play
13. PCB Antenna
Current Sensor

20
The ACS712 in a fully integrated, hall effect-based linear current sensor with 2.1kVRMS voltage
isolation and an integrated low-resistance current conductor. Technical terms aside, it is simply
put forth as a current sensor that uses its conductor to calculate and measure the amount of
current applied
The features of ACS712 include:
 80kHz bandwith
 66 to 185 mV/A output sensitivity
 Low-noise analog signal path
 Device bandwith is set via the new FILTER pin
 Stable output offset voltage.
 Near zero magnetic hysteresis
Here's how the ACN712 works:
Current flows through the onboard hall sensor count in its IC
The hall effect sensor detects the incoming current through its magnetic field generation
Once detected, the hall effect sensor generates a voltage proportional to its magnetic field
that's then used to measure the amount of current
ACS712 Current Sensor Applications
The ACS712 IC being able to detect both AC/DC current, it can be used in a wider range of
applications apart from electrical appliances. Be it Arduino other microcontroller usages, or
industrial, commercial, and communications applications
They include:
 Motor speed control in motor control circuits
 Electrical load detection and management
 Switched-mode power supplies (SMPS)
 Protection for over-current

21
Buzzer:
A buzzer is a small yet efficient component to add sound features to our project/system. It is
very small and compact 2-pin structure hence can be easily used on breadboard, Perf Board and
even on PCBs which makes this a widely used component in most electronic applications.
There are two types are buzzers that are commonly available. The one shown here is a simple
buzzer which when powered will make a Continuous Beep...sound, the other type is called a
readymade buzzer which will look bulkier than this and will produce a Beeр. Веер. Beep. Sound
due to the internal oscillating circuit present inside it. But, the one shown here is most widely
used because it can be customised with help of other circuits to fit easily in our application.
This buzzer can be used by simply powering it using a DC power supply ranging from 4V to 9V. A
simple 9V battery can also be used, but it is recommended to use a regulated +5V or +6V DC
supply. The buzzer is normally associated with a switching circuit to turn ON or turn OFF the
buzzer at required time and require interval.
Applications of Buzzer
 Alarming Circuits, where the user has to be alarmed about something
 Communication equipments
 Automobile electronics
 Portable equipment's, due to its compact size

3.3: DETAILED DESIGN

22
3.3.1: Proteus Circuit Simulation

To validate the Smart Energy Meter design, a Proteus simulation was conducted. The simulation
tested the circuit's behavior, including current and voltage measurement, microcontroller
response, and data transmission via Wi-Fi/GSM.

The circuit includes:


ESP8266/Arduino Uno for processing
ACS712 Current Sensor for current measurement
ZMPT101B Voltage Sensor for voltage monitoring
LCD Display for real-time data visualization
Relay Module for remote control of appliances

23
Below is the Proteus simulation of the proposed design:

The simulation successfully demonstrated real-time measurement and IoT data transmission,
confirming that the hardware design functions as expected.

3.4: THE MOBILE APPLICATION:

Software is now an integral part of the world. Almost everything runs on software and the
world is becoming more interconnected than ever with the popularization of loT(Internet of
Things) and increased capability for these devices to connect to the Internet. We have
leveraged some of these technologies to build our project.
The Smartvac project is split into two parts. One part is the Arduino hardware that collects
information on the energy used by the appliance. But most of the processing and data.
aggregation happens at the software end. This offloads most of the complex processing burden
from Arduino so that it doesn't require a larger, more expensive processor or memory. The
software consists of an application, an application programming interface and a database. All of
them are hosted and available on the internet.

24
3.4.1: OVERVIEW OF THE MOBILE APPLICATION
The three different parts can operate independently but are connected to create a good
experience. The app, written in the Flutter language, is the part that the user interfaces with. It
is designed to be visually appealing and easy to use. It displays the energy usage and payment
information in a simple format for the user to see. It serves as the front-end of the product.
The Application Programming Interface(API) is the part that the Arduino sends its data to. The
API is the bridge of communication between the front-end, the Arduino hardware and the
database. It is written in Golang
The database stores all the data-users, energy and payment information. It is secured and
access to it is limited as most of the data it holds is sensitive. Long term storage of the data.
enables users to view their usage over various periods of time.

3.5: APPLICATION PROGRAMMING INTERFACE?

An Application Programming Interface is a set of programming code that enables data


transmission between one software product and another. It also contains the terms of this data
exchange.

25
Figure7 : Hone Application Programming Interface works

Application programming interfaces consist of two components:


 Technical specification describing the data exchange options between solutions
with the specification done in the form of a request for processing and data
delivery protocols
 The software interface is written to the specification that represents it

The software that needs to access information (i.e., X hotel room rates for certain dates) or
functionality (i.e., a route from point A to point B on a map based on a user's location) from
another software, calls its Application Programing Interface while specifying the requirements
of how data/functionality must be provided. The other software returns data functionality
requested by the former application.
And the interface by which these two applications communicate is what the Application
Programming Interface specifies. The Red Hat specialists note that Application Programming
Interfaces are sometimes considered contracts, where documentation is an agreement
between the parties: "If a party first sends a remote request structured a particular way, this is
how the second party's software will respond." The Application Programming Interface (APT)
documentation is a manual for developers that includes all necessary information on how to
work with the Application Programming Interface and use the services it provides.
When used in the context of web development, an API is typically defined as a set of
specifications, such as Hypertext Transfer Protocol (HTTP) request messages, along with a
definition of the structure of response messages, usually in an Extensible Markup Language
(XML) or JavaScript Object Notation (JSON) format. An example might be a shipping company
API that can be added to an eCommerce-focused website to facilitate ordering shipping services
and automatically include current shipping rates, without the site developer having to enter the
shipper's rate table into a web database. While "web API" historically has been virtually
synonymous with web service, the recent trend (so-called Web 2.0) has been moving away

26
from Simple Object Access Protocol (SOAP) based web services and service oriented
architecture (SOA) towards more direct representational state transfer (REST) style web
resources and resource-oriented architecture (ROA)

Overview of the Smartvac API

The Smartvac API collects data from various current sensors in JSON format and stores it in a
database. It can do calculations to convert the current/voltage data into a format more
understandable by users. Ideally, the data being received should have an identification number
to associate the data with different users. It also exposes endpoints so that the data can be
pulled by various dashboards to enable users to view usage data over time in the form of
graphs.

Stack/Languages used:

Language: Golang
Golang was the language of choice because Go is a great language for creating simple yet
efficient web servers and web services. It provides a built-in HTTP package that contains utilities
for quickly creating a web or file server.
The API is to be consumed by an app and possibly other platforms.

Endpoints
-[POST]/signup Onboard users into the app
-[POST]-sign in-Login users
-[POST] data-Receive data from various endpoints
-[GET]/data? Query Dashboards hit this endpoint for data
-[POST]/user-Store user data
-[GET]/user/id-Get user data
-[PUT]/user/id-Update user data
-[POST]/pay/:id-Make payment for a particular user

27
-[GET]/history/id-get history of payment for a particular user

Steps to develop the API


The users need to be authenticated before they can access the app and other users should not
have access to other people's data
The admin user has access to everything and oversees the data.
First, a new Go project and module is created and a framework for making http servers in
Golang called Gin is added. The first http route that leads to the Welcome endpoint is created.
An init function is created to connect to database once the application programming interface
starts up. The database connection details are sensitive information and are gotten from
environment variables, so that even someone that has access to the code cannot connect to
the database. This increases the security of the database.
An ORM(Object Relational Mapping) called gorm is used to convert between incompatible Go
types and the schema in the database table. The ORM makes it easier to insert, retrieve, update
and delete data from the database. Once the database and the routes are set up, the next stage
is to define the various route.
While it would take up too much space to visit each of the routes and the method of
implementation, it is worthy to note that the sign in and sign up use one-way hashing to
encrypt passwords before it is stored in the database.
In the end, the web server is hosted on the free tier of Heroku and the free tier of Heroku
postgres is used. The correct configuration variables are set and the app can be accessed from
anywhere on the internet.

3.6: DATABASE

Formally, a "database" refers to a set of related data and the way it is organized. Access to this
data is usually provided by a "database management system" (DBMS) consisting of an
integrated set of computer software that allows users to interact with one or more databases
and provides access to all of the data contained in the database (although restrictions may exist
that limit access to particular data). The DBMS provides various functions that allow entry,
storage and retrieval of large quantities of information and provides ways to manage how that
information is organized.

28
Because of the close relationship between them, the term "database" is often used casually to
refer to both a database and the DBMS used to manipulate it.
Outside the world of professional information technology, the term database is often used to
refer to any collection of related data (such as a spreadsheet or a card index) as size and usage
requirements typically necessitate the use of a database management system.
Existing DBMSs provide various functions that allow management which can be classified into
four main functional groups:
Data definition-Creation, modification and removal of definitions that define the organization
of the data.
Update-Insertion, modification, and deletion of the actual data.
Retrieval-Providing information in a form directly usable or for further processing by other
applications. The retrieved data may be made available in a form basically the same as it is
stored in the database or in a new form obtained by altering or combining existing data from
the database.
Administration- Registering and monitoring users, enforcing data security, monitoring
performance, maintaining data integrity, dealing with concurrency control, and recovering
information that has been corrupted by some event such as an unexpected system failure.
Both a database and its DBMS conform to the principles of a particular database model.
"Database system" refers collectively to the database model, database management system,
and database.

Postgres, Tables and Schema


The relational database is used for storing data. The choice was PostgresSQL PostgreSQL, also
known as Postgres, advertises itself as "the most advanced open-source relational database in
the world". It was built to be feature-rich, extendable and standards-compliant. In the past,
Postgres performance was more balanced reads were generally slower than MySQL, but it
could write large amounts of data more efficiently, and it handled concurrency better.
The database consists of three tables user, payment and readings. The tables and their schema
are listed below:

Appendix

29
Appendix A: List of Components
The table below outlines the key components required for the development of the Smart
Energy Meter, along with their specifications and purpose.

Component Specification Purpose


Microcontroller Arduino Uno, ESP8266/ESP32 Control System operations
Current Sensor ACS712/ZMPT101B Measures electrical current
in the system
Voltage Sensor ZMPT101B Measures voltage levels for
accurate power calculations
Energy Meter IC PZEM-004T/HLW8012 Calculates power
consumption in real-time
Wi-Fi Module ESP8266/ ESP32 Enables IoT connectivity for
real time data transmission
Power Supply 5V Adapter/Battery Powers the microcontroller
and senses
LCD 16x2 LCD Displays real-time energy
data on the device
Buzzer/LED LED indicators Provides alerts for abnormal
consumption
Jumper wires, Standard values For connectivity
Breadboard, Resistors,
Capacitors

Appendix B: Software Tools and Technologies

The table below lists the software tools used for developing the Smart Energy Meter system.

Software Tool Purpose


Arduino IDE Programming the Microcontroller
Flutter Developing mobile application for monitoring
energy use
HTML etc Web dashboard
Firebase Storing and Analysing realtime data
Python AI-driven consumption prediction

30
Appendix C: System Architecture

System Architecture
1. Data Collection: Sensors measure voltage and current.
2. Processing: Microcontroller calculates energy usage and detects anomalies.
3. Data Transmission: Wi-Fi/GSM module sends data to a cloud database.
4. User Interface: Mobile app or web dashboard displays real-time usage and allows appliance
control.
5. AI Analysis: Predicts future consumption patterns based on historical data.

Appendix D: Budget Estimation

A rough estimate of the costs involved in acquiring the required components.

Item Estimated Cost (Ksh)


Microcontroller ESP32 1000
Current Sensor ACS712 500
Voltage Sensor ZMPT101B 500
Energy meter IC PZEM-004T 1500
Wi-Fi module ESP8266 1000
GSM Module SIM800L 1000
LCD Display 16x2 900
Relay Module 500
Power Adapter 1300
Jumper Wires, breadboard 1500
Estimated Cost 9000

Appendix E: Project Timeline

31
A timeline for completing the Smart Energy Meter project.

Phase Tasks Estimated Timeframe


Phase 1 Research and component selection 2 weeks
Phase 2 System design and circuit assembly 3 weeks
Phase 3 Microcontroller programming 2 weeks
Phase 4 IoT integration 3 weeks
Phase 5 Mobile App development 4 weeks
Phase 6 AI model training and optimization 4 weeks
Phase 7 Testing and Debugging 3 weeks
Phase 8 Documentation and final presentation 2 weeks

REFERENCES
Below are references that were used to guide the development of the Smart Energy Meter
project, including sources for hardware components, IoT integration, and AI-driven energy
analysis.

Books and Research Papers


1. Alahakoon, D., & Yu, X. (2016). Smart electricity meter data intelligence for future energy
systems: A survey. IEEE Transactions on Industrial Informatics, 12(1), 425-436.
2. Depuru, S. S. S. R., Wang, L., & Devabhaktuni, V. (2011). Smart meters for power grid:
Challenges, issues, advantages, and status. Renewable and Sustainable Energy Reviews, 15(6),
2736-2742.
3. Gungor, V. C., et al. (2011). Smart grid technologies: Communication technologies and
standards. IEEE Transactions on Industrial Informatics, 7(4), 529-539.
Web Articles and Blogs
4. Arduino (2024). Getting Started with ESP32 & ESP8266. Retrieved from
https://www.arduino.cc/
5. Raspberry Pi Foundation (2024). Using Raspberry Pi for IoT Projects. Retrieved from
https://www.raspberrypi.org/

32
6. IEEE Xplore (2024). Smart Metering and Energy Management Systems. Retrieved from
https://ieeexplore.ieee.org/
Datasheets and Manufacturer Documentation
7. Espressif Systems (2023). ESP32 Technical Reference Manual. Available at
https://www.espressif.com/en/products/socs/esp32
8. Microchip (2023). ACS712 Current Sensor Datasheet. Retrieved from
https://www.microchip.com/
9. HLW8012 Energy Meter IC Datasheet. Retrieved from https://www.hi-link.com.cn/
Online Learning Platforms
10. Coursera. (2024). IoT and Smart Grid Technologies. Available at https://www.coursera.org/
11. Udemy. (2024). Building IoT Applications with ESP8266/ESP32. Available at
https://www.udemy.com/

Government and Industry Reports


12. Kenya Power & Lighting Company (KPLC). (2023). Smart Metering Implementation in Kenya.
Available at https://www.kplc.co.ke/
13. International Energy Agency (IEA). (2023). Digitalization & Energy Efficiency. Retrieved from
https://www.iea.org/

33

You might also like