Professional Documents
Culture Documents
Submitted by
PRASATH M 611720205013
SAKTHIVEL P 611720205017
of
BACHELOR OF TECHNOLOGY
in
INFORMATION TECHNOLOGY
MAY 2023
i
BONAFIDE CERTIFICATE
Certified that the product is “IOT BASED SMART ENERGY METERING AND POWER THEFT
(611720205013), SAKTHIVEL P(611720205017), who carried out the project work under my
SIGNATURE: SIGNATURE:
Dr.K.SASIKALA.,Ph.D., Mrs.S.M.C.SUBASHINI., M.E.,
..................................... ......................................
Internal Examiner External Examiner
ii
ACKNOWLEDGEMENT
We would like to express our deep sense of gratitude and heart felt thanks to
LATE Thiru.R.P.SARATHY, Founder, Narasu’s Sarathy Institute of Technology.
We extend our thanks to staff who cooperated with us in every deed of this
project. We also thank our friends and parents for their continuous encouragement and the
untiring support rendered to us in all deeds and walks of this project.
iii
ABSTRACT
human. According to their inspection, the electric bills are prepared. The
using IOT concept. The proposed system eliminates the human involvement in
Electricity maintenance. The client needs to pay the bill for usage of electricity
on schedule, in case they couldn't pay the bill, the electricity provider can be
turn off autonomously from the distant server. The client can monitor the
energy consumption of units from the LCD display. If any electricity theft
occurred, the electricity provider can turn off the Client’s energy Meter. All
nodes are connected for transferring the data through wireless communication.
Every Individual users data can be sent to the head node. The head node can
directly send the data to service provider using NodeMCU. Using mesh
network, internet usage can be reduced. By utilizing the Blynk web platform,
the electricity provider can effectively monitor the power consumption of each
iv
CHAPTER TITLE PAGE
NO. NO.
ABSTRACT iv
LIST OF FIGURES vii
LIST OF ABBRIVATION viii
1 INTRODUCTION 1
1.1 PROLOGUE 1
1.2 HIGHLIGHTS OF THE WORK 2
1.3 SCOPE AND OBJECTIVES 3
2 LITERATURE SURVEY 5
3 EXISTING SYSTEM 8
3.1 INTRODUCTION 8
3.2 BLOCK DIAGRAM 8
3.3 EXPLANATION 8
3.4 DRAWBACKS 9
4 PROPOSED SYSTEM 10
4.1 INTRODUCTION 10
4.2 BLOCK DIAGRAM 11
4.3 EXPLANATION 12
5 POWER SUPPLY 13
5.1 DEFINITION 13
5.2 POWER SUPPLY UNIT 13
5.2.1 Transformer 14
5.2.2 Rectifier 14
5.2.3 Filters 14
v
6 HARDWARE DESCRIPTION 16
6.1 NODEMCU (ESP8266) 16
6.2 LIQUID CRYSTAL DISPLAY (LCD) 18
6.3 INTER-INTEGRATED CIRCUIT (I2C) 19
6.4 CURRENT TRANSFORMER 20
6.5 VOLTAGE TRANSFORMER 20
6.6 RELAY DRIVER 21
6.6.1 Relay 21
6.6.2 Components Needed 21
6.6.3 DC Relay Driver Circuit 22
7 SOFTWARE DESCRIPTION 24
7.1 ARDUINO IDE 24
7.1.1 Code Editor 24
7.1.2 Library Manager 25
7.1.3 Board Manager 26
7.1.4 Upload and Compilation 27
7.1.5 Serial Monitor 28
7.2 BLYNK 29
7.2.1 Web-Based Interface 30
7.2.2 Drag-and-Drop Interface Builder 30
7.2.3 Real-Time Data Visualization 31
7.2.4 Device Control 31
8 CODE 32
8.1 CLIENT 32
8.2 SERVER 38
9 EXPERIMENTAL SETUP AND RESULT 49
9.1 HARDWARE SCREENSHOT 49
9.2 RESULT SCREENSHOT AND DISCUSSION 50
10 CONCLUSION & FUTURE WORK 51
10.1 CONCLUSION 51
REFERENCES 52
vi
LIST OF FIGURES
6.1 NodeMCU 16
6.6 Relay 21
vii
LIST OF ABBREVIATION
viii
CHAPTER 1
INTRODUCTION
1.1 PROLOGUE
Electrical metering instrument technology has come a long way from what it was
more than 100 years ago. From the original bulky meters with heavy magnets & coils there
have been many innovations that have resulted in size & weight reduction in addition to
improvement in features & specifications. So, it is new concept in world of Electricity
measurement. This concept is not only beneficial for electricity measurement but also has the
capability to prevent misuse of electricity. Now a days, the energy consumption &
distribution has become a big subject for discussion because of huge difference in energy
consumption & energy production. At present most of the houses in INDIA has the
traditional mechanical watt hour meter & the billing system is not automated. So, a new
system was discussed known as smart energy electronic meter which uses cloud in it. Cloud
communication refers to technology that enables machines to be networked so data can be
freely exchanged among these assets. It is a form of data communication that involves one or
more entities that do not necessarily require human interaction or intervention in the process
of communication. It can be in two ways one of them is Uplink to collect product and usage
information and another is Downlink to send instructions or software updates, or to remotely
monitor equipment. In our system we are using PIC Controller for getting the Energy
consumption data of remote distance. Here we are using GSM model to transfer the data from
the user meter to corresponding cloud-based server using IOT (Internet of Things). IOT
service to make the global system connectivity to portrait the electricity-oriented records to
all its respective users via online. The PIC Controller commands the GSM module to transfer
data using IOT on the cloud.
In the present billing system, the distribution companies are unable to keep track of
the changing maximum demand of consumers. The consumer is facing problems like
receiving due bills for bills that have already been paid as well as poor reliability of
electricity supply and quality even if bills are paid regularly. The remedy for all these
problems is to keep track of the consumers load on timely basis, which will be held to assure
accurate billing, track maximum demand and to detect threshold value. These are all the
features to be taken into account for designing an efficient energy billing system.
1
The present project Smart Energy Meter addresses the problems faced by both the
consumers and the distribution companies. The paper mainly deals with smart energy meter,
which utilizes the features of embedded systems i.e. combination of hardware and software in
order to implement desired functionality. The paper discusses comparison of PIC Controller
and other controllers, and the application of GSM and Wi-Fi modems to introduce „Smart‟
concept. With the use of GSM modem the consumer as well as service provider will get the
used energy reading with the respective amount, Consumers will even get notification in the
form text through GSM when they are about to reach their threshold value, that they have set.
Also, with the help of Wi-Fi modem the consumer can monitor his consumed reading and can
set the threshold value through webpage. Now-a-days the demand for electricity is increasing
at a constant rate throughout the population and is being utilized for various purposes wiz,
agriculture, industries, household purposes, hospitals etc. So, it is becoming more and more
complicated to handle the electricity maintenance and requirements. There for there is an
immediate requisite to save as much electricity as possible. As the demand from the newer
generations of population for electricity is increasing so in accordance with it the technology
improvement is needed. The proposed system provides a technical twist to the normal energy
meters using the IoT technology. Also, there are other issues that we have to address such as
power theft and meter tampering which in turn generate economic loss to the nation.
Monitoring, Optimized power usage and reduction of power wastage are the major objectives
that lie ahead for a better system.
The present system vastly depends on human involvement for billing. Billing requires
a human individual to visit each and every customer‟s energy meter and generate the bill by
taking the unit readings from the energy meter. This is a time-consuming process. To address
all the mentioned constraints, we developed a system on the basis of IoT technology.
This system enables the electricity department to read the meter readings monthly
without a person visiting each house. This can be achieved by the use of Microcontroller that
continuously monitor and records the energy meter reading in its permanent (non-volatile)
memory location. This system continuously records the reading and the live meter reading
can be displayed on webpage to the consumer on request. This system also can be used to
disconnect the power supply of the house when needed.
2
In this manner, the framework can beat the issues of human mistake and power
misfortune as far as controlling and the board. Also, it can likewise illuminate the manual
control and a unit recording activity without human blunder. To accomplish this refined
framework, the correspondence, and systems administration are the significant job to follow
all sort of availability among the individual gadgets. The test is to fabricate the system
framework with hearty, at a similar time low power utilization just as reasonable. The
fundamental target of our proposed framework is to actualize also, grow minimal effort Wi-
Fi-based single stage advanced vitality meter with IoT s ideas.
The objective behind the introduction of „smart‟ energy meters is first and foremostly
to gain insight into small-scale users‟ gas and electricity consumption
⚫ Providing real-time data useful for balancing electric loads and reducing power
outages (blackouts)
The lobbyists for the introduction of the „smart‟ meter systematically make it seem as if it
is all about increasing consumer insight.
3
However, the importance of such detailed insight into energy consumption isn‟t so
much that consumers can gain detailed information using this electronic equipment into what
their household appliances and the „smart‟ meter itself consume. The most important thing is
the data which enables suppliers to provide energy as cheaply as possible on the basis of the
behavior and behavioral profiles of their customers. „Knowing‟ customer behavior, being
able to predict the latter and having a tool which allows the monitoring of their behavior
enables the peak loads of energy required to be able to serve these customers to be reduced.
As there are plenty of ideas and innovation that one could implement, there are also
many innovative ideas that can be processed further or extended further in our project. Since
here we are concentrating on the provider side, i.e. at the ELECTRICITY BOARD. One can
also include the features related to the customer side, ie making the fixed usage manual, thus
by making the recharge of a particular amount, customer will be allowed to use the supply
depending upon the plan selected as similar to the PREPAID sim card systems, which would
enhance the experience of the economic consumer with modern digital utility meter. One can
also include the feature of INSTANT BILL, at any instant of the time. By this feature
consumer can know his/her bill at any interval of the month, so that an economical consumer
can vary his/her consumption. Also, a timer control can be provided, which would automatic
cut down the system supply, if the payment of bill is not done in the specified time limit.
4
CHAPTER 2
LITERATURE SURVEY
Description: In this paper we design and implement a wireless sensor network and protocol
for smart energy meter applications. The system consists of a digital energy meter, a ZigBee
coordinator and a management program. A ZigBee module from Atmel was adopted as a
communication unit. The designed system is capable of automatically reading the unit and
sending a terminal and a cover alarm to the management program. The system can support up
to 100 energy meters, 10-hop network depth and automatically detect a new energy meter.
The experimental results show that the system proposed in this paper is feasible to
implemented in practical applications for automatic meter reading
The electricity system is one of the most important infrastructures in the modern society
because it is the electrical power source of the electrical machines, e.g. motors and
generators, used in the factory and also for the electrical appliances and lighting in
households. Recently, an automation system has been applied to many basic infrastructures
such as electricity, gas, and water systems in order to facilitate the routine work such as a
manual control and a unit recording operation. Nowadays, the unit recording has to be done
by human before the end of each month. Since the unit recording was done by human, the
human error becomes the major problem of system. Recently, the smart meter concept has
been popularly adopted by many leading electricity companies in USA and EUROPE in order
to overcome the problem of human error in the unit recording as well as provide the
automatic procedure to report the energy meter impairment and the tampering activity of
misbehaved subscribers by using the advance wireless and wired communication
technologies
5
Title: DESIGN AND IMPLEMENTATION OF AN IOT ACCESS POINT FOR SMART
HOME.
In recent years, the Internet of Things (IoT) has attracted much attention because of the
provided functionalities that can advance humanity in terms of intelligence, automation,
convenience, etc. The IoT can change objects that are precisely unidentifiable into
identifiable, recognized, interconnected intelligent objects based on the standard
communication protocols, called Smart Objects. The IoT consists of a number of smart
objects that are embedded with wired/wireless communication interfaces to communicate and
interact with each other without human intervention. The basic concept of IoT is that various
smart objects can be automatically linked into a network for interacting with humans through
perception and networking technologies. Smart objects in the IoT have the ability to send
information through the Internet to provide the interaction among multiple things and people.
For example, a smart power meter can get information with regard to energy usage from
various electrical devices. Afterward, the smart power meter sends information wirelessly to
the access point and the information is further forwarded to user devices through the Internet.
6
Title: AUTOMATED WIRELESS METER READING SYSTEM FOR MONITORING &
CONTROLLING POWER CONSUMPTION.
Description: The authors O. Homa Kesav, B. Abdul Rahim presented a paper titled
“AUTOMATED WIRELESS METER READING SYSTEM FOR MONITORING &
CONTROLLING POWER CONSUMPTION. In this paper the design presents new method
for avoiding high construction & maintenance cost in the existing system. The system is
designed in such a way that if the consumer is unable to pay the bill the power connection
maybe disconnected automatically from remote server. The ARM 7 based hardware system
consist of a processor core board & the peripheral board. The embedded C language is used
as programming language in this system.
Title: IOT BASED SMART ENERGY METER MONITORING & THEFT DETECTION
USING ATMEGA.
Description: The authors S. V. Anushree T. Shanthi presented a paper titled “IOT BASED
SMART ENERGY METER MONITORRING & THEFT DETECTION USING ATMEGA”.
The main objective of the system is detection of theft of electricity increases the cost paid by
customers & can have serious safety consequences. Identify the theft by sending alert SMS to
owner send meter reading & rate every month to the owner. this system has an additional set
up of IOT which portraits the global connection environment to the user & allow them to
view the status of meter reading from anywhere at any time theft of electricity as a material
impact on customers in terms of cost & safety.
7
CHAPTER 3
EXISTING SYSTEM
3.1 INTRODUCTION
An electrical meter or energy meter is a device that measures the amount of electric
energy consumed by a residence, a business, or an electrically powered device. Electric
utilities use electric meters installed at customers' premises for billing purposes. They are
typically calibrated in billing units, the most common one being the kilowatt hour (kWh).
They are usually read once each billing period. When energy savings during certain periods
are desired, some meters may measure demand, the maximum use of power in some interval.
"Time of day" metering allows electric rates to be changed during a day, to record usage
during peak high-cost periods and off-peak, lower-cost, periods. Also, in some area‟s meters
have relays for demand response load shedding during peak load periods.
3.3 EXPLANATION
The energy meter has the aluminum disc whose rotation determines the power
consumption of the load. The disc is placed between the air gap of the series and shunt
electromagnet. The shunt magnet has the pressure coil, and the series magnet has the current
coil. The pressure coil creates the magnetic field because of the supply voltage, and the
current coil produces it because of the current. The field induces by the voltage coil is lagging
by 90º on the magnetic field of the current coil because of which eddy current induced in the
disc. The interaction of the eddy current and the magnetic field causes torque, which exerts a
8
force on the disc. Thus, the disc starts rotating. The force on the disc is proportional to the
current and voltage of the coil. The permanent magnet controls Their rotation. The permanent
magnet opposes the movement of the disc and equalizes it on the power consumption. The
cyclometer counts the rotation of the disc.
3.4 DRAWBACKS
• Possibility to change the reading, when talking photos of energy meter by using
software tools.
• More number of meter reading employees are extra expenses to the Government for
hiring them and their expenses on travelling too.
9
CHAPTER 4
PROPOSED SYSTEM
4.1 INTRODUCTION
This project proposes smart, integrated power consumption monitoring system has
been implemented with the use of open standard technology, commercial project &
household items which actively monitors the voltage & current ratio in remote system.
Here an IOT based smart energy metering system which will replace traditional meter
reading method. They can monitor the meter readings regularly without the person visiting
each house. Microcontroller based power consumption monitoring system that senses
parameters & shows on an LCD display. The meter readings are automatically sent on Cloud
generated using IOT.
According to that reading we have to pay the bills. The main drawback of existing
system is that person has to go area by area and he has to read the meter of every house and
handover the bills. Many times, errors like extra bill amount or notification from electric
board even though the bills are paid are common errors.
To overcome this drawback, we have come up with an idea which will eliminate the
third party between the consumer and service provider, even the errors will be overcome. In
this project the idea of smart energy meter using IoT and PIC Controller have been
introduced. We proposed controlling the load smartly.
10
4.2 BLOCK DIAGRAM
11
4.3 EXPLANATION
The new smart energy meter transfers specific readings at regular intervals to the
electricity provider, ensuring accurate measurements. Additionally, this eliminates the need
for manual labor and reduce labor fees. All the data can be stored in the Blynk web cloud.
The LCD display on the electricity meter can show the daily usage of electricity in
unit measurement. This allows clients to stay informed and receive accurate updates
regarding their daily electricity consumption.
If a client fails to pay the electricity bill within the specified time, the electricity
provider has the capability to remotely disconnect the power connection of that specific
client. Once the payment is made, the provider can then reconnect the power connection for
the client. This eliminates the need for sending an employee to physically disconnect or
reconnect the power.
By utilizing the Blynk web platform, the electricity provider gains the ability to
monitor the power consumption of each individual client and remotely control their power
connection. Through the Blynk web interface, the provider can trigger the on and off
functions, which in turn activate or deactivate power supply in client's smart energy meter via
the relay mechanism.
12
CHAPTER 5
POWER SUPPLY
5.1 DEFINITION:
All digital circuits work only with low DC voltage. A power supply unit is required to
provide the appropriate voltage supply. This unit consists of transformer, rectifier, filter and a
regulator. AC voltage typically of 230Vrms is connected to a transformer which steps that
AC voltage down to the desired AC voltage level. A diode rectifier then provides a full wave
rectified voltage that is initially filtered by a simple capacitor filter to produce a DC voltage.
This resulting DC voltage usually has some ripple or AC voltage variations. Regulator circuit
can use this DC input to provide DC voltage that not only has much less ripple voltage but
also remains in the same DC value, even when the DC voltage varies, or the load connected
to the output DC voltage changes. The required DC supply is obtained from the available AC
supply after rectification, filtration and regulation. Block diagram of power supply unit is
shown in below diagram.
VOLTAGE
DC
REGULATOR
SUPPLY
The main components used in the power supply unit are Transformer, Rectifier, Filter
and Regulator. The 230V AC supply is converted into 9V AC supply through the
transformer. The output of the transformer has the same frequency as in the input AC power.
This AC power is converted into DC power through diodes.
13
Here the bridge diode is used to convert AC supply to the DC power supply. This
converted DC power supply has the ripple content and for normal operation of the circuit, the
ripple content of the DC power supply should be as low as possible. Because the ripple
content of the power supply will reduce the life of the circuit. So, to reduce the ripple content
of the DC power supply, the large value of capacitance filter is used. This filtered output will
not be the regulated voltage. For this purpose, IC7805 regulator IC is used in the circuit.
5.2.1 TRANSFORMER
5.2.2 RECTIFIER
5.2.3 FILTERS
Capacitors are used as filters in the power supply unit. The action of the system
depends upon the fact, that the capacitors stores energy during the conduction period and
delivers this energy to the load during the inverse or non-conducting period. In this way, time
during which the current passes through the load is prolonged and ripple is considerably
reduced.
The LM78XX is three terminal regulator available with several fixed output voltages
making them useful in a wide range of applications. IC7805 is a fixed voltage regulator used
in this circuit. Here, we can discuss about IC 7805. The voltage regulator IC 7805 is
actually a member of 78xx series of voltage regulator ICs. It is a fixed linear voltage
regulator.
14
Fig.No. 5.2 LM7805 Pinout Diagram
The xx present in 78xx represents the value of the fixed output voltage that the
particular IC provides. For 7805 IC, it is +5V DC regulated power supply. This regulator IC
also adds a provision for a heat sink. The input voltage to this voltage regulator can be up to
35V, and this IC can give a constant 5V for any value of input less than or equal to 35V
which is the threshold limit.
15
CHAPTER 6
HARDWARE DESCRIPTION
6.1 NODEMCU
NodeMCU utilizes the ESP8266 microcontroller, which is based on the Xtensa LX106
architecture and runs at a clock speed of 80 MHz It has a 32-bit RISC CPU and offers
GPIO (General Purpose Input/Output) pins for interacting with external components.
One of the main advantages of NodeMCU is its built-in Wi-Fi module. It supports both
infrastructure (connecting to an existing Wi-Fi network) and access point (creating its own
Wi-Fi network) modes. This allows your project to connect to the internet and interact
with web services, cloud platforms, and other connected devices.
NodeMCU can be programmed using the Lua scripting language. Lua is a lightweight
and easy-to-learn language that is well-suited for IoT applications. Additionally,
NodeMCU also supports programming with the Arduino IDE, which allows you to write
code in C/C++.
16
NodeMCU can be powered using a USB cable or an external power supply. It operates
at a voltage of 3.3V, so it is important to use compatible components and ensure proper
voltage level shifting when interfacing with 5V devices.
NodeMCU provides a number of GPIO pins that can be used to connect and control
external sensors, actuators, and other components. These pins support digital input/output,
analog input, and PWM (Pulse Width Modulation) output. Additionally, NodeMCU also
supports I2C and SPI communication protocols for interfacing with sensors and other
devices.
SPECIFICATION:
Developer : ESP8266 Opensource Community
Type : Single-board microcontroller
CPU : ESP8266
Memory : 128kBytes
Storage : 4MBytes
Power By : USB
Power Voltage : 3v ,5v
17
6.2 LIQUID CRYSTAL DISPLAY (LCD)
An LCD consists of two glass panels, with the liquid crystal material sand witched in
between them. The inner surface of the glass plates is coated with transparent electrodes
which define the character, symbols or patterns to be displayed polymeric layers are present
in between the electrodes and the liquid crystal, which makes the liquid crystal molecules to
maintain a defined orientation angle.
One each polarizes are pasted outside the two glass panels. These polarizes would
rotate the light rays passing through them to a definite angle, in a particular direction. When
the LCD is in the off state, light rays are rotated by the two polarizes and the liquid crystal,
such that the light rays come out of the LCD without any orientation, and hence the LCD
appears transparent.
When sufficient voltage is applied to the electrodes, the liquid crystal molecules
would be aligned in a specific direction. The light rays passing through the LCD would be
rotated by polarizes, which would result in activating / highlighting the desired characters.
The LCD‟s are lightweight with only a few millimeters thickness. Since the LCD‟s consume
less power, they are compatible with low power electronic circuits, and can be powered for
long durations.
18
6.3 INTER-INTEGRATED CIRCUIT (I2C)
19
6.4 CURRENT TRANSFORMER
Current transformer is put in series with the line in which the current is to be
measured. They are used to step down the current to such a level so that it can easily be
measured by using an ammeter. Generally, they are expressed as primary: secondary current
ratio for e.g.: A 100:5 amp CT will have primary current of 100 Amp‟s and secondary current
of 5 Amp‟s. Standard secondary rating of CT‟s is either 5 or 1 Amp‟s Common application of
CT available in market is “clamp meter”.
This large MMF will produce large flux in the core and will saturate the core. Again,
due to large flux in the core the flux linkage of secondary winding will be large which in turn
will produce a large voltage across the secondary terminals of the CT. This large voltage
across the secondary terminals will be very dangerous and will lead to the insulation failure
and there is a good chance that the person who is opening the CT secondary while primary is
energized will die due to shock.
20
6.6 RELAY DRIVER
6.6.1 RELAY
A relay driver circuit is a circuit which can drive, or operate, a relay so that it can
function appropriately in a circuit.
The driven relay can then operate as a switch in the circuit which can open or close,
according to the needs of the circuit and its operation.
In this project, we will build a relay driver for both DC and AC relays. Since DC and
AC voltages operate differently, to build relay drivers for them requires slightly different
setup. We will also go over a generic relay driver which can operate from either AC or DC
voltage and operate both AC and DC relays. All the circuits are relatively simple to
understand.
• DC Relay
• Zener Diode
• DC Voltage Source
Again, the DC relay must receive its rated voltage value in order to operate.
The DC power source can be either batteries, wall wart power, or a DC power supply- any
DC power source. The zener diode is placed reverse biased in parallel to the relay.
21
6.6.3 DC RELAY DRIVER CIRCUIT
We will first go over how to build a relay driver circuit for relays which operate from
DC power. To drive a DC relay, all we need is sufficient DC voltage which the relay is rated
for and a zener diode.
All relays come with a voltage rating. This is called on a relay's datasheet its rated coil
voltage. This is the voltage needed in order for the relay to be able to operate and be able to
open or close its switch in a circuit. In order for a relay to function, it must receive this
voltage at its coil terminals. Thus, if a relay has a rated voltage of 9VDC, it must receive 9
volts of DC voltage to operate. So, the most important thing a DC relay needs is its rated DC
voltage. If you don't know this, look up what relay you have and look up its datasheet and
check for this specification.
And the reason why a diode is needed is usually because it functions to eliminate
voltage spikes from a relay circuit as the relay opens and closes. The coil of a relay acts an
inductor. Remember that inductors are basically coils of wires wrapped around a conductive
core. This is what relay coils are as well. Therefore, they act as inductors. Inductors are
electronic components that resist changes in current. Inductors do not like sudden changes in
current. If the flow of current through a coil is suddenly interrupted, for example, a switch
opening, the coil will respond by producing a sudden, very large voltage across its leads,
causing a large surge of current through it. From a physics or physical perspective, this
phenomenon is a result of a collapsing magnetic field within the coil as the current is
terminated abruptly. Mathematically, this can be understood by noticing how a large change
in current (dI/dt) affects the voltage across a coil (V=LdI/dt). Since we are opening the
switch, in this case, the current literally goes from full mode to 0 instantaneously. This
creates a large voltage spike. Surges in current that result from inductive effects can create
very high voltage spikes (as high as 1000V) that can have nasty effects on neighboring
devices with in the circuits, such as switches and transistors getting zapped. Not only are
these voltage spikes damaging to other electronic components in a circuit but they are also
damaging to the relay's switch contacts. The contacts will suffer from these spikes as well.
So how do we prevent these voltage spikes? How can we suppress them so that they
don't cause this damage? The answer for DC relay circuits is to use a diode. A diode is placed
reverse biased in parallel with the relay. The diode acts as a transient suppressor. A transient
22
is a spike. A transient suppressor suppresses these spikes. Placing a diode in reverse bias
across a relay's coil eliminates voltage spikes by going into conduction before a large voltage
can form across the coil. In other words, a diode will conduct current in reverse bias once the
voltage reaches a certain threshold and shunt the current to ground. Once the diode begins
conducting, it no longer holds voltage. So that the relay in parallel will not receive the excess
voltage. So, the diode functions to shunt excess power to ground once it reaches a certain
threshold. Diodes are devices that do not conduct in reverse. However, if the voltage reaches
a certain level, called the breakdown voltage, it will conduct. This is a good thing, when we
need the diode to act as a transient suppressor, because it forces all excess power to ground,
as to not affect any other parts of the circuit.
` The diode must be rated to handle currents equivalent to the maximum current that
would have been flowing through the coil before the supply current was interrupted.
The relay which we use in this case is rated for 9V. Therefore, a 9-volt DC voltage
source feeds the resistor. To suppress transients that may be caused by the relay opening and
closing, we place a zener diode reverse biased in parallel with the relay. This will shunt all
excess power to ground once it reaches a certain threshold. This is all that is needed to
operate the relay. With sufficient power, the relay will now be closed, driving the loads that
are connected to its output.
23
CHAPTER 7
SOFTWARE DESCRIPTION
7.1 ARDUINO IDE
Arduino IDE offers a simple and intuitive code editor where you can write your
Arduino sketches. The code editor provides features like syntax highlighting, auto-
indentation, and code completion, making it easier to write and read code.
Arduino IDE uses a specific structure for Arduino code known as a "sketch." A sketch
consists of two mandatory functions: setup() and Loop(). The setup() function is called once
when the board is powered on or reset and is used for initializing variables and setting up the
initial configuration. The setup() function is executed repeatedly after the setup() function
and contains the main code logic that will run continuously.
24
7.1.2 Library Manager
Arduino IDE comes with a library manager that allows you to easily include external
libraries in your projects. Libraries contain pre-written code that extends the functionality of
Arduino boards, providing additional features and simplifying complex tasks. The library
manager provides a convenient way to search, install, and update libraries directly from the
IDE.
25
7.1.3 Board Manager
Arduino IDE supports a wide range of Arduino boards, including popular ones like
Arduino Uno, Arduino Mega, and Arduino Nano. The board manager allows you to select the
appropriate board and configure its settings, such as the microcontroller type, clock speed,
and communication parameters. This flexibility enables you to develop projects for different
Arduino board variants.
26
7.1.4 Upload and Compilation
Arduino IDE simplifies the process of uploading your code to the Arduino board.
With a single click, you can compile your code and upload it to the board via a USB
connection. The IDE handles the compilation process, converting your code into machine-
readable instructions that can be executed by the microcontroller
The Compile option in Arduino IDE is used to verify the syntax of the code and to
generate the binary executable file (.hex) that will be uploaded to the Arduino board. The
compiler checks the code for errors, warnings, and syntax issues, ensuring that the code is
valid and can be executed on the board. The compiled code can be found in the temporary
folder of the Arduino IDE.
Once the code has been compiled, the Upload option is used to transfer the compiled
code to the Arduino board. The board must be connected to the computer through a USB
cable or other serial interface. When the Upload option is selected, the Arduino IDE sends the
compiled code to the board's microcontroller, where it is stored in flash memory. The code is
then executed by the microcontroller, running the program as specified in the code.
27
7.1.5 SERIAL MONITOR
The Serial Monitor is a built-in feature of Arduino IDE that allows for two-way
communication between an Arduino board and a computer through the serial port. It serves as
a valuable tool for debugging, monitoring sensor data, and exchanging information during the
development and testing phases of Arduino projects.
The Serial Monitor enables serial communication between the Arduino board and the
computer. It provides a way to send and receive data in real-time, allowing for interactive
communication and data exchange.
The Serial Monitor displays data received from the Arduino board in a user-friendly
format. It can show numerical values, text strings, or even special characters sent by the
Arduino. This feature is particularly useful for monitoring sensor readings, debugging output,
or displaying system status information.
28
The Serial Monitor allows you to configure the baud rate, which determines the rate at
which data is transmitted and received. The baud rate needs to be set consistently between the
Arduino board and the Serial Monitor to ensure proper communication.
In addition to displaying data, the Serial Monitor also provides a text input field. This
allows you to send commands or data from the computer to the Arduino board. For example,
you can send instructions to control actuators, change settings, or trigger specific actions in
your Arduino project.
The Serial Monitor is an invaluable tool for debugging and troubleshooting Arduino
projects. By printing out debugging messages and variable values in the Serial Monitor, you
can track program flow, identify issues, and verify that your code is executing as expected.
This can greatly simplify the process of finding and fixing errors in your code.
The Serial Monitor is an essential tool for Arduino developers, providing a convenient
way to monitor, debug, and interact with Arduino projects through the serial port. Its real-
time data display, text input, and debugging capabilities greatly simplify the development
process and enable effective troubleshooting.
Remember to include any specific examples or experiences you had while using the
Serial Monitor in your project, such as the use of debug messages, monitoring sensor data, or
utilizing the Serial Plotter for visual analysis.
7.2 BLYNK
Blynk Web is a powerful platform for creating web-based user interfaces and
dashboards for IoT (Internet of Things) projects. It provides a simple and intuitive way to
monitor and control connected devices remotely through a web browser.
Blynk Web offers a user-friendly and versatile platform for creating web-based
interfaces and dashboards for IoT projects. Its drag-and-drop interface builder, real-time data
visualization, device control capabilities, and advanced functionality make it an ideal choice
for creating user-friendly and interactive web interfaces for your IoT-based smart energy
metering and power theft control project.
29
7.2.1 Web-based Interface
Blynk Web allows users to access their IoT projects through a web browser,
eliminating the need for installing dedicated mobile apps. This web-based interface provides
a consistent and convenient user experience across different devices, including desktop
computers, laptops, and mobile devices.
Blynk Web provides a drag-and-drop interface builder that enables users to create
custom dashboards and user interfaces for their IoT projects. The builder allows you to add
various widgets, such as buttons, sliders, graphs, gauges, and text displays, to visualize and
control the connected devices.
30
7.2.3 Real-time Data Visualization
Blynk Web enables real-time data visualization by allowing you to connect your IoT
devices and sensors to the platform. It supports data streaming and updates the interface in
real-time, providing users with live data readings and visualizations, such as charts and
graphs, for monitoring and analysis purposes.
Blynk Web offers interactive controls, such as buttons, sliders, and switches, that can
be linked to your IoT devices. These controls allow users to remotely control and manipulate
connected devices, such as turning on/off lights, adjusting motor speed, or changing settings
on IoT-enabled appliances.
31
CHAPTER 8
CODE
8.1 CLIENT
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
int error;
String a,re,re1,re2,re3,re4,re5,re6,data;
int u=0,d=0;
void setup() {
Serial.begin(9600);
Wire.begin();
Wire.beginTransmission(0x27);
pinMode(D5, INPUT_PULLUP);
pinMode(D2, INPUT_PULLUP);
pinMode(D1, OUTPUT);
pinMode(D6, OUTPUT);
pinMode(D4, OUTPUT);
digitalWrite(D4, HIGH);
digitalWrite(D6, HIGH);
lcd.setBacklight(255);
32
if(digitalRead(D5)==0)
void loop()
lcd.begin(16, 2);
cu=cu/100;
float p=cu*230;
if(p>10)
u++;
d++;
if(d>29)
u=0;
d=0;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("c= ");
lcd.print(cu);
lcd.print(" p= ");
lcd.print(p);
lcd.setCursor(0,1);
33
lcd.print("u= ");
lcd.print(u);
lcd.print(" D= ");
lcd.print(d);
delay(1000);
digitalWrite(D3, HIGH);
while (Serial.available()) {
inputString += inChar;
// if the incoming character is a newline, set a flag so the main loop can
if (inChar == '\n') {
stringComplete = true;
if (stringComplete) {
//Serial.println(inputString);
//Serial.println("string");
a=inputString;
inputString = "";
stringComplete = false;
//Serial.println(a);
//Serial.println("end");
34
for (int i = 0; i < a.length(); i++) {
value1=a.substring(0, i);
re=a.substring(i+1);
break;
value2=re.substring(0, i);
re1=re.substring(i+1);
break;
value3=re1.substring(0, i);
re2=re1.substring(i+1);
break;
value4=re2.substring(0, i);
re3=re2.substring(i+1);
break;
35
}
value5=re3.substring(0, i);
re4=re3.substring(i+1);
break;
value6=re4.substring(0, i);
re5=re4.substring(i+1);
break;
value7=re5.substring(0, i);
re6=re5.substring(i+1);
break;
if(value1=="K")
digitalWrite(D4, LOW);
digitalWrite(D6, LOW); }
36
if(value1=="L")
delay(500);
Serial.print(cu);
Serial.print(",");
Serial.print(p);
Serial.print(",");
Serial.print(u);
Serial.print(",");
Serial.println("1");
Serial.print(",");
Serial.print("0");
value1="0";
a="0";
if(value1=="J")
digitalWrite(D4, HIGH);
digitalWrite(D6, HIGH);
int temp_adc_val;
float temp_val;
temp_val = (temp_adc_val);
delay(1000);
37
void serialEvent() {
while (Serial.available()) {
inputString += inChar;
// if the incoming character is a newline, set a flag so the main loop can
if (inChar == '\n') {
stringComplete = true;
8.2 SERVER
#include <WiFiClient.h>;
#include <ThingSpeak.h>;
#include<EEPROM.h>
#include <ESP8266WiFi.h>;
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>
LiquidCrystal_PCF8574 lcd(0x27);
38
int r=8;
int error;
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
String a,re,re1,re2,re3,re4,re5,re6,data;
WiFiClient client;
BLYNK_WRITE(V5) {
39
int data= (param.asInt());
if(data==8)
lcd.clear();
lcd.print("n1 request");
delay(1000);
r=8;
if(data==9)
lcd.clear();
lcd.print("n2 request");
delay(1000);
r=9;
if(data==1)
lcd.clear();
lcd.print("D1 ON");
delay(1000);
Serial.println("J,1,0");
delay(1000);
Serial.println("J,1,0");
if(data==2)
digitalWrite(D4, LOW);
40
lcd.clear();
lcd.print("D1 OFF");
delay(1000);
Serial.println("K,1,0");
delay(1000);
Serial.println("K,1,0");
if(data==3)
digitalWrite(D0, HIGH);
lcd.clear();
lcd.print("D2 ON");
delay(1000);
Serial.println("Q,1,0");
delay(1000);
Serial.println("Q,1,0");
if(data==4)
digitalWrite(D0, LOW);
lcd.clear();
lcd.print("D2 OFF");
delay(1000);
Serial.println("R,1,0");
delay(1000);
Serial.println("R,1,0");
}}
41
void setup() {
Serial.begin(9600);
pinMode(D5, INPUT_PULLUP);
pinMode(D4, OUTPUT);
digitalWrite(D4, LOW);
pinMode(D0, OUTPUT);
digitalWrite(D0, LOW);
Serial.print("welcome");
delay(3000);
Wire.begin();
Wire.beginTransmission(0x27);
error = Wire.endTransmission();
Serial.print("Error: ");
Serial.print(error);
if (error == 0) {
show = 0;
} else {
delay(20);
lcd.home();
lcd.setBacklight(255);
lcd.clear();
lcd.print("WELCOME");
lcd.setCursor(0, 1);
42
lcd.print(" ");
delay(2000);
EEPROM.begin(512);
Serial.println(myWriteAPIKey);
Serial.println(auth);
int i=0;
while(i<16)
myWriteAPIKey[i] =EEPROM.read(i);
i++;
Serial.println(EEPROM.read(i));
i=0;
while(i<32)
auth[i] =EEPROM.read(i+20);
i++;
Serial.println(EEPROM.read(i));
Serial.println("things Key");
Serial.println(myWriteAPIKey);
Serial.println("blynk key");
Serial.println(auth);
if (WiFi.status() != WL_CONNECTED)
Serial.println(ssid);
43
lcd.clear();
lcd.print("con..project");
WiFi.begin(ssid, pass);
Serial.print(".");
delay(5000);
Serial.println("\nConnected.");
lcd.clear();
lcd.print("wifi connected");
delay(1000);
ThingSpeak.begin(client);
inputString.reserve(200);
if(digitalRead(D5)==0)
void loop()
if(digitalRead(D5)==0)
Blynk.run();
Blynk.virtualWrite(V1, value1);
Blynk.virtualWrite(V2, value2);
44
Blynk.virtualWrite(V3, value3);
Blynk.virtualWrite(V4, value4);
//Blynk.virtualWrite(V4, value5);
lcd.clear();
lcd.print("c ");
lcd.print(value1);
lcd.print(" p ");
lcd.print(value2);
lcd.setCursor(0, 1);
lcd.print("u ");
lcd.print(value3);
lcd.print(" n ");
lcd.print(value4[0]);
delay(500);
if(r==8)
Serial.println("S,1,0");
if(r==9)
Serial.println("L,1,0");
while (Serial.available()) {
inputString += inChar;
// if the incoming character is a newline, set a flag so the main loop can
if (inChar == '\n') {
45
stringComplete = true;
if (stringComplete) {
//Serial.println(inputString);
//Serial.println("string");
a=inputString;
inputString = "";
stringComplete = false;
//while(Serial.available())
//Serial.println("data");
//Serial.println(a);
//Serial.println("end");
if(a[0]=='@')
Serial.println("copy");
for(int x=0;x<16;x++)
EEPROM.write(x,a[x+1]);
Serial.println(a[x+1]);
EEPROM.commit();
a[0]='_';
46
}
if(a[0]=='!')
Serial.println("copy");
for(int x=20;x<52;x++)
EEPROM.write(x,a[x-19]);
Serial.println(a[x-19]);
EEPROM.commit();
a[0]='_';
value1=a.substring(0, i);
re=a.substring(i+1);
break;
value2=re.substring(0, i);
re1=re.substring(i+1);
break;
47
for (int i = 0; i < re1.length(); i++) {
value3=re1.substring(0, i);
re2=re1.substring(i+1);
break;
value4=re2.substring(0, i);
re3=re2.substring(i+1);
break;
value5=re3.substring(0, i);
re4=re3.substring(i+1);
break;
value6=re4.substring(0, i);
re5=re4.substring(i+1);
break;
}}
48
CHAPTER 9
The experimental setup for the smart energy meter will depend on the IOT based
wireless medium. ESP8266 micro controller is the main functioning element of the energy
meter system. The IOT is the medium to set the demand limit for the consumer load usage.
The 5V and 12V regulated supply is designed by the step-down transformer along with the
rectifier unit. The current transformer will measure the load usage current and the potential
transformer will measure the voltage rating by considering this the power will be calculated,
based on the calculation taken from the load usage.
49
9.2 RESULT SCREENSHOT AND DISCUSSION
The current power status is compared with the threshold value that is assigned by the
IOT medium, if the value exceeds from the threshold value the relay unit will trips the power
unit. The entire parameters will be monitored with the LCD display along with the IOT
thinkspeak web page.
50
CHAPTER 10
CONCLUSION & FUTURE WORK
10.1 CONCLUSION
The project is based on IoT technology and aims to replace outdated energy meters
with advanced smart energy meters capable of automatic power reading.
Through this project, the electricity provider can eliminate the need for physical
measurement of individual power usage by employees. Additionally, the provider can
remotely disconnect and reconnect power connections in cases where clients fail to pay
their bills promptly.
Clients can conveniently monitor their daily electricity consumption through the
LCD display on the energy meter. This empowers clients to minimize their power usage
if the total consumption is excessively high, thereby helping them keep their electricity
bills low-cost.
Develop a mobile application that enables users to access and control their energy
consumption remotely. Users can monitor their energy usage, set energy-saving goals,
receive real-time notifications and control connected devices through the application.
This enhances convenience and promotes energy-conscious behavior.
51
REFERENCES
1. Abdollahi .A, Dehghani .M and Zamanzadeh .N, (2007), “SMS- sbased
reconfigurable automatic meter reading system,” IEEE International Conference on
Control Applications, Vol. 32, No. 4, pp. 1103-1107.
2. Amit Jain and Mohnish Bagree, (2011), “A prepaid meter using mobile
communication”, International Journal of Engineering, Science and Technology Vol.
3, No. 3, pp. 160-166.
3. Andrea Zanella, Nicola Bui, Angelo Castellani, Lorenzo Vangelista and Michele
Zorzi, (2014), “Internet of Things for Smart Cities”, IEEE Internet of Things Journal,
Vol. 1, No. 1, pp. 22-32.
5. Devjani Banerjee and Kulkarni .N .R, (2013), “Three Phase Parameter Data Logging
and Fault Detection Using GSM Technology”, International Journal of Scientific and
Research Publications, Vol. 3, No. 2, pp. 126-131.
6. Gao .J, Xiao .Y, Liu .J, Liang .W, and Chen .C.P, (2012), “A survey of
communication / networking in smart grids,” Future Generation Computer Systems,
Vol. 28, No. 2, pp. 391-404.
7. Guilin Zheng and Zhifu Zhang, (2011), “Intelligent wireless electric power
management and control system based on Zigbee technology”, International
Conference on Transportation, Mechanical and Electrical Engineering (TMEE), Vol.
2, No. 1, pp. 1120-1124.
8. Hao .Q and Song .Z, (2005), “The Status and Development of the Intelligent
Automatic Meter Reading System”, proc of China Science and Technology
Information, Vol. 3, No. 19, pp.72-76.
9. Homa Kesav.O and Abdul Rahim .B, (2012), ”Automated Wireless Meter Reading
System for Monitoring and Controlling Power Consumption”, International Journal of
Recent Technology and Engineering, Vol. 1, No. 2, pp. 70-74.
52
10. Mejbaul Haque, Kamal Hossain, Mortuza Ali and Rafiqul Islam Sheikh, (2011),
"Microcontroller Based Single Phase Digital Prepaid Energy Meter for Improved
Metering and Billing system", International of Power Electronics and Drive System
(IJPEDS), Vol.1, No.2, pp.139-147.
11. Nabil Mohammad, Anomadarshi Barua, and Muhammad Abdullah Arafat, (2013),
“A smart prepaid energy metering system to control electricity theft”, International
Conference on Power, Energy and Control (ICPEC), Vol.562, No.565, pp.6-8.
12. Najmus Saqib malik, Friedrich kupzog and Michael Sonntag, (2010), “An approach
to secure mobile agents in automatic meter reading”, IEEE International Conference
on Cyber worlds computer society, Vol. 3, No. 1, pp. 187-193.
13. Poonam Borle, Ankitha Saswadhar, Deepali Hiwarkar and Rupali S Kali, (2013),
“Automatic Meter Reading for Electricity”, International Journal of Advanced
Research in Electrical, Electronics and Instrumentation Engineering, Vol. 2, No. 3,
pp. 982-987.
14. Shi-Wei Lee, Cheng_Shong Wu, Meng-Shi Chiou and Kou-Tan Wu, (2012), “Design
of Automatic Meter Reading System”, 22nd International Conference on Industrial
Electronics, Control and Instrumentation., Vol. 4, No. 3, pp. 66-72.
15. Sujatha .M .S, Vijay Kumar .M, (2011), “On-line monitoring and analysis of faults in
transmission and distribution lines using GSM technique”, Journal of Theoretical and
Applied Information Technology, Vol. 33, No.2, pp. 70-78.
53