You are on page 1of 88

Construction of Energy (KWH) Meter with GSM and IoT

Abstract:
The aim of the project is to minimize the queue at the energy meter billing counters and to
restrict the usage of energy meter automatically, if the bill is not paid. The project also aims at
proposing a system that will reduce the loss of power and revenue due to power thefts and other
illegal activities. The work system adopts a totally new concept of “Prepaid Energy Meter”. The
GSM technology is used so that the consumer would receive messages about the consumption of
power (in watts) and if it reaches the minimum amount, it would automatically alert the
consumer to recharge. GSM-based Energy Recharge Interface which contains a prepaid card
equivalent to a mobile SIM card. The prepaid card communicates with the power utility using
GSM communication network. Once the prepaid card is out of balance, the consumer load is
disconnected from the utility supply by the latching Relay (contactor). The power utility can
recharge the prepaid card remotely through GSM/SMS mode base on customer requests. The
results obtained shows good system performance. A prior billing is bound to do away with the
problems of unpaid bills and human error in meter readings, thereby ensuring justified revenue
for the utility. In our nation, electricity use is continuously growing day by day. A representative
from the electricity office visited our home, took a manual reading, and then calculated or
estimated the amount of the consumer's bill to send it to them. It will be challenging for them to
manage and compute the bill because each house worker must go to each area to take the reading
and then return if the consumer is not present. It is impossible to receive an exact bill or prevent
consumers from receiving more money than their consumption unit when doing all these chores
since they occasionally make mistakes when taking readings or calculating the bill, misplace the
bill, or both. Only IoT can help to solve all the problems; it is used to provide accurate metre
readings over the internet without the need for human intervention, used to reduce power
consumption and use only the necessary amount, and used to protect the system from theft if
someone attempts to misuse the electricity or if the user did not pay the given bill for whatever
they consumed at a given time. Relay hosts will then automatically cut the supply from the
remote area. In this work, NodeMCU and IoT are used to transform a conventional metre reading
into a smart metre reading. Given that they can view their daily energy consumption, consumers
can adjust their power usage as necessary.
System requirements:
Hardware requirements:

 NodeMCfintU ESP8266
 GSM Module
 16x2 LCD
 Analogue Electricity Energy Meter
 Resistors
 POT
 Connecting wires
 Bulb and holder
 SIM card
 Power supply
 Mobile Phone

Software requirements:

 NodeMCU ESP8266 IDE


 Blynk application
 Embedded C
Block diagram:
Chapter-1
1.Working Process:
In this project we are building a automated system by using NodeMCU ESP8266 and GSM
module. You can recharge the electricity balance through this system, just by sending a SMS. It
can also disconnect the home power supply connection, if there is low or zero balance in the
system. And this system will reads the energy meter readings and automatically send some
updates to user’s mobile phone like low balance alert, cut off alert, resume alert and recharge
alert. Here we have interfaced electricity energy meter with NodeMCU ESP8266using the
pulse LED (Calibration or Cal) of electricity Energy meter. We only need to connect tis CAL
LED to NodeMCU. When we power up the system then it reads previous values of rupees stored
in EEPROM and restores them into the variables then checks the available balance with the
predefined value and take action according to them, like if available balance is greater than 15
rupees then NodeMCU ESP8266turns On the electricity of home or office by using relay. And if
balance is less than 15 rupees then NodeMCU ESP8266sends a SMS to user phone regarding
low balance alert and requesting to recharge soon. And if balance is less than 5 rupees then
Arudino turns Off the electricity connection of home and sends a SMS to user’s phone for ‘Light
Cut’ alert and requesting to recharge soon. GSM module has been used to send and receive
messages, you can check about GSM module and AT commands here. Now when we need to
recharge our system, we can recharge it simply by sending a SMS to the system, through our
Cellphone. Like if we want to recharge by 45 bucks then we will send #45*, here # and * are
prefix and suffix to the recharge amount. System receives this message and extract recharge
amount and update the balance of system. And system again turns On the electricity of the house
or office. This flow of working can be understood through the video at the end.

1.1.Circuit Description:
Circuit connections for this Wireless Electricity Meter Reading Project, are shown in the
diagram; we have used a NodeMCU ESP8266UNO for processing all the things used in project.
A liquid crystal display is used for displaying the status of Units and remaining balance. Data
pins of LCD namely RS, EN, D4, D5, D6, D7 are connected to NodeMCU ESP8266digital pin
number 7, 6, 5, 4, 3, 2. And Rx and Tx pins of GSM module are directly connected to the Tx and
Rx pins of NodeMCU ESP8266respectively. And GSM module is powered by using a 12 volt
adaptor. A relay is used for switching electricity connection which is connected at pin 12 of
NodeMCU ESP8266though ULN2003 relay driver.

The above image illustrates the block diagram of IoT based energy monitoring system and the
circuit we are going to develop will be based on the above blocks.

 The brain of the project is an ESP8266 NodeMCU; it has built-in internet access capability and
supports several peripheral communication protocols.
 A load is connected to a voltage and current sensor module and the load has an external power
supply which is separate from 5V supply that is applied for functioning of the measuring circuit.
 An I2C LCD adapter module is used for driving a 16 x 2 display which shows real-time voltage,
current and power measurements.
 The NodeMCU is connected to internet and sends the measured data to a server called Blynk
where the data is stored for future analysis.
 The real time data can be accessed on a PC / laptop / smartphone using any browser.

When power is supplied to the energy meter's input terminals from the main (substation or power
station). Two input terminals and two output terminals are often seen on an energy metre.By
connecting the input terminals of the energy metre and the input terminals of the ac converter in
series, input from the energy metre is provided to the ac converter (220v to 12v). With this
converter, 230V AC is changed into 12V DC. The converter's output is this 12V DC supply. The
voltage regulator receives this output as input. The regulator's output is provided to the Node
MCU as Vin's input. The load receives the energy meter's output. By shorting the lamp terminal,
one of the output terminals is linked to the lamp load. The current sensor connects the second
terminal to the switches. There are two terminals on the current sensor. The analogue output
terminal of the Node MCU is linked to one terminal, while the other is grounded. We supply the
energy metre at that time. Through the output terminal, which first passes through the current
sensor, it transfers to the load. The Node MCU receives the current sensed by this current sensor
by way of the wire. We linked to the Blynk app interfaces using Node MCU. It is an IOT
platform used to manage Node MCU. Create a new project with the name "IOT based smart
energy metre" in the Blynk app. Finally, we insert a notification bar in a Blynk app so that when
the load is reached and the threshold value, it sends a notification alert to the Mobile through the
WiFi module of Node MCU. The page will now display how much load we consume and the
cost of power consumed by the load over the course of a month.
1.2.Calculation of Pulses and Units:
Before proceeding for the calculations, first we have to keep in mind the pulse rate of energy
meter. There are two pulse rates of energy meter first is 1600 imp/kwh and second is 3200
imp/kwh. So here we are using 3200 imp/kwh pulse rate energy meter.
So first we need to calculate the Pulses for 100watt, means how many times Pulse LED will
blink in a minute, for the load of 100 watts.
Pulse= (Pluse_rate*watt*time)/ (1000*3600)
So pulses for 100 watt bulb in 60 seconds, with energy meter of 3200 imp/kwh pulse rate can be
calculated as below:
Pulses=3200*100*60/1000*3600
Pulses = ~5.33 pulse per minute
Now we need to calculate Power factor of a single pulse, means how much electricity will be
consumed in one pulse:
PF= watt/(hour*Pulse)
PF=100/60*5.33
PF=0.3125 watt in a single pulse
Units= PF*Total pulse/1000
Total pulses in an hour is around 5.33*60=320
Units = 0.3125*320/1000
Units = 0.1 per hour
If a 100 watt bulb is lighting for a day then it will consume
Units =0.1*24
Units = 2.4 Units
And suppose unit rate is at your region is 5 rupees per unit then
You have to pay for 2.4 Units Rs:
Rupees= 2.4*5 = 12 rupees
Programing explanation:
First of all we include required library and Define pins & variables that are required in our
project. This can be seen in first few lines of our program code below.
After it we initialize the LCD, serial communication, GSM and display some message message.
After this in loop function we read serial received data if any. And reads pulse from energy meter
and show units and balance on LCD.
GSM Based Prepaid Electricity Energy Meter using Arduino. Prepaid Electricity Energy Meter
is one of the best concepts for the current electricity payment system. In this system, you can
recharge the device and update the balance as we do on our mobile phones.
By sending a simple SMS, you can recharge the electricity balance through this system. It can
also disconnect the home power supply connection if there is a low or zero balance in the system.
And this system will read the energy meter readings and automatically send some updates to the
user’s mobile phone like low balance alert, cut off alert, resume alert and recharge alert. The
Anti-Theft Alert can also be detected when someone tries stealing the meter by opening the lid.
Chapter-2
2.INTRODUCTION:
The conventional method of electricity billing involves a person from the distribution unit
reading the number of units of electricity consumed in the energy meter, conveying this
information to the distribution unit and then preparing the bill according to the units consumed
for a fixed amount of time. This can prove quite tedious as it involves various tasks like reading,
then preparing the bill. Still accuracy cannot be guaranteed as there can be errors in human
reading. Even though digital meters are being replacing conventional electromechanical meters
and provide much accurate readings, still the problem of deliberately making a false reading can
exist (political reasons). Despite this, the task of billing for every consumer is a time consuming
job for the distribution grid. Also the consumer can deliberately consume more amount of power
than required and still refrain from paying the bill and nothing can be done to severe the electric
power supply. To eliminate all these problems, the most convenient method is making the whole
system prepaid similar to a mobile phone recharge or a DTH recharge. Electric energy meters,
the direct billing interface between utilities and consumers for long, have undergone several
advancements in the last decade. The AMR and power quality monitoring systems
The world is shifting towards automatic wireless technologies, which favour not only
minimizing human efforts but also aiding in the autonomous and efficient operation of systems.
When a system can act autonomously and make decisions without being told what to do, this is
referred to as intelligence. An energy or electric metre counts the number of electrical units
consumed by all of the devices that draw power from the main power source. There are two
types of meters on the market to monitor unit consumption: electromechanical and electronic
metres.In rural areas, where adoption of contemporary technology is lower than in cities,
electromechanical metres are frequently utilized [1]. Nowadays, electromechanical metres are
obsolete. Electromechanical metres are replaced by electronic metres. The LCD/LED in this
metre is used to display the reading. On the metre, a calibration led is utilised to display the
expended units. To read the metre and record the reading, labour is needed. The reading on the
metre, which is used to calculate the electricity bill, is rising.
Now-a-days the demand for electricity is increasing at a constant rate in the population and is
being utilized for various purposes viz, agriculture, industries, household purposes, hospitals
etc.,. So, it is becoming more and more complicated to handle the electricity maintenance and
requirements. Therefore there is an immediate requirement to save as much electricity as
possible. As the demand from the newer generations of population for electricity is increasing so
in along with it the technology improvement is needed. The proposed system provides a
technical twist to the normal energy meters using the GSM technology. Also there are other
issues that we have to address such as power theft 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 system basically can be classified on the basis of service ends in two ways:-
1. Consumer end
2. Service end.
The data from the system is displayed on a webpage which can be accessed by the consumer.

Manufacturers are taking advantage of these advances and integrating them into new meters and
instruments. The networking technologies are driven by the demand for interconnection of
computer users’ worldwide (Jackson, 1996). The AMR and power monitoring systems are using
these advances to expand the monitoring systems. The idea of prepaid metering will be very
important for the new research fields of Micro-grid and Smart Grid and is an inevitable step in
making any grid smarter than it is now. The system designed in this paper can be used to develop
more complex system where a smart card can be used for several applications including
prepayment (Koay, 2003).
The same activity is performed by an IOT-based smart electricity metre and billing system
without the need for human labour [2]. A microcontroller board called the Arduino Mega is used
to control IOT-based SEM systems. This board was chosen for its effectiveness and memory. In
terms of memory and GPIO, it is more effective. The acquired data is subsequently uploaded to
the cloud over the internet. Using the internet, it is simple to send data wirelessly across great
distances without any noise interference. The data is incredibly accurate and efficient because
there is no human involvement because it is delivered directly to the cloud, where there are no
range or distance issues [3]. Due to their restricted range, other wireless technologies like Zigbee
and Bluetooth cannot be used efficiently over very long distances. In order to change the existing
issues the electricity board and the user are currently facing, this paper envisions the usage of the
internet and the idea of IOT to keep base stations and users informed of the current consumed
units. The distribution businesses are unable to keep up with the shifting maximum demand of
consumers under the current invoicing scheme. Even though bills are paid on time, the consumer
still has issues with receiving past-due bills for payments that have already been made as well as
with the reliability and quality of the electrical supply [4]. The solution to all of these issues is to
regularly monitor consumer load in order to ensure proper billing, monitor peak demand, and
identify threshold values. The current article "IoT Based Smart Energy Metre" covers the issues
that distribution businesses and customers both face. The focus of the study is the smart energy
metre, which combines hardware and software to provide desired functionality using embedded
system capabilities. In order to introduce the "Smart" notion, the article compares Arduino and
other controllers and discusses how GSM and WiFi modems can be used. The consumer and
service provider can both access the consumed energy reading and associated amount using a
GSM modem [5]. Consumers can also receive text-based notifications via GSM when they are
approaching a threshold value that they have defined. The user can also track his read material
with the aid of a Wi-Fi modem and can change the threshold value via a website. With the use of
this method, the electricity department can read the meter readings monthly without having to
send someone to each home. This can be done by using an Arduino device which tracks and
stores energy metre readings in a permanent (non-volatile) memory location. On request, the
consumer can view the live metre reading on a webpage where this system continuously records
the measurement [6],. When necessary, this device can also be used to cut off the house's power
supply.
2.1.STATEMENT OF PROBLEMS:
At the end of every month in the street of Nigeria, we always see group of persons standing or
carrying ladder in front of our houses from Electricity board whose duties are: i. to read the
manual energy meter, ii. handover the bills (electric) to the owner of that house, iii. To check
whether there are by-passes in the cases where the prepaid energy meters are in use. iv. Cut our
lights in the cases where the house holders defaulted in paying bills or cby passed the prepaid
energy meters v. In some cases where houses have no manual energy meter or the prepaid energy
meter, estimated bills are given which the house holders must pay. vi. In the manual meter cases
wrong reading are always giving to the consumers and they must pay. vii. For this prepaid
energy meter, whenever a customer wants to recharge their energy meter, they would have to go
all the way to the utility company to buy electricity and receive a voucher that is then must be
taken back to the location of the meter and is entered through a keypad or slot the card into the
prepaid meter. This is a very tiresome process for electricity recharge, especially if the location
of the meter is far from the utility company. viii. Lastly, in case the electricity runs out, the
period of time the building where the meter is installed stays offline until it is once more
recharged may be critical depending on the facility itself.

2.2.RESEARCH OBJECTIVES:
The objectives include:
i) To design a power supply unit, Voltage sensing device that automatically
adjusts the power factor of the electricity supply through its calibration.
ii) To design a voltage sensing device that automatically adjusts the power factor
of the electricity supply through its calibration and current sensing device to
measure the accurate current consumed by the load.
iii) To program a device using the NodeMCU ESP8266development board that
will measure current, voltage, and effectively calculate the power consumed
from the load. iv) To Program and configure the Global System for Mobile
communication (GSM) module to effectively send, receive message which is
compatible with all mobile network operators.
iv) To design a circuit that disconnects the load when the unit is exhausted.
v) To evaluate result based on the energy consumption of the measured values.
vi) A system that has the ability to automatically send some updates as alert to the
user’s mobile phone like low balance alert, cut of alert, resume alert and
recharge alert

2.3.SYSTEM STUDY

2.3.1 FEASIBILITY STUDY

The feasibility of the project is analyzed in this phase and business proposal is put forth
with a very general plan for the project and some cost estimates. During system analysis the
feasibility study of the proposed system is to be carried out. This is to ensure that the
proposed system is not a burden to the company. For feasibility analysis, some understanding
of the major requirements for the system is essential.

Three key considerations involved in the feasibility analysis are

 ECONOMICAL FEASIBILITY
 TECHNICAL FEASIBILITY
 SOCIAL FEASIBILITY

2.3.2. ECONOMICAL FEASIBILITY

This study is carried out to check the economic impact that the system will have on the
organization. The amount of fund that the company can pour into the research and development
of the system is limited. The expenditures must be justified. Thus the developed system as well
within the budget and this was achieved because most of the technologies used are freely
available. Only the customized products had to be purchased.

2.3.3. TECHNICAL FEASIBILITY

This study is carried out to check the technical feasibility, that is, the technical
requirements of the system. Any system developed must not have a high demand on the available
technical resources. This will lead to high demands on the available technical resources. This
will lead to high demands being placed on the client. The developed system must have a modest
requirement, as only minimal or null changes are required for implementing this system.

2.3.4. SOCIAL FEASIBILITY


The aspect of study is to check the level of acceptance of the system by the user. This
includes the process of training the user to use the system efficiently. The user must not feel
threatened by the system, instead must accept it as a necessity. The level of acceptance by the
users solely depends on the methods that are employed to educate the user about the system and
to make him familiar with it. His level of confidence must be raised so that he is also able to
make some constructive criticism, which is welcomed, as he is the final user of the system.

2.4. Literature survey


Literature survey is the most important step in Hardware and software development process.
Before developing the tool it is necessary to determine the time factor, economy n company
strength. Once these things r satisfied, ten next steps are to determine which operating system
and language can be used for developing the tool. Once the programmers start building the tool
the programmers need lot of external support. This support can be obtained from senior
programmers, from book or from websites. Before building the system the above consideration r
taken into account for developing the proposed system.
2.5. REVIEW OF RELATED LITERATURE:
Evolution of Prepaid Energy Meters Evolution of Prepaid Energy Meters The use of electronic
token prepayment metering has been widely used in UK for customers with poor record of
payment. Ning et al (2004) in their paper presented the Digital Tele-wattmeter System as an
example of a microcontrollerbased meter. The meter was implemented to transmit data on a
monthly basis to a remote central office through dedicated telephone line and a pair of modems.
Maheswari et al (2009) utilized a DSP-based meter to measure the electricity consumption of
multiple users in a residential area. A Personal Computer (PC) at the control center was used to
send commands to a remote meter, which in turn transmitted data back, using the power Line
Communication (PLC) technique. The major problem with this system is that it cannot detect
tampering by consumers. A paper suggests a design of a system which can be used for data
transmission between the personal computer and smart card. The device will transmit the data in
half duplex mode (Kwan, 2002). In this paper, an Intelligent Prepaid Energy Meter has been
designed, modeled and simulated using Matlab/Simulink tools. Koay et al (2003) in their work
(Koay .B.S, 2003), designed and implemented a Bluetooth energy meter where several meters
are in close proximity, communicated wirelessly with a Master PC. Distance coverage is a major
set-back for this kind of system because the Bluetooth technology works effectively at close
range. In their paper,(Scaradozzi, 2003) Scaradozzi and Conte (2003) viewed home- automation
systems as Multiple Agent Systems (MAS). Hong and Ning (2004) in their paper (Ning.L, 2004),
proposed the use of Automatic Meter Reading (AMR) using wireless networks. Some
commercial AMR products use the internet for data transmission. Stanescu et al (2006) present a
design and implementation of SMS based control for monitoring systems (Stanescu, 2006).
Prepayment poly-phase electricity metering systems have also been developed consisting of local
prepayment and a card reader based energy meter (Ling Zou, 2010)..

Energy Meter is a device that measures the amount of electrical energy consumed by a residence,
business, or an electrically powered device. They are typically calibrated in billing units and the
most common one is the kilowatt hour, which is equal to the amount of energy used by a load of
one kilowatt over a period of one hour, or 3,600,000 joules. Electricity meters operate by
continuously measuring the instantaneous voltage (volts) and current (amperes) The product of
which gives the instantaneous electrical power (watts) which is then integrated against time to
give energy used. A Prepaid Energy Meter enables power utilities to collect electricity bills from
the consumers prior to its consumption. The prepaid meter is also attributed with prepaid
recharging ability and information exchange with the utilities pertaining to customer’s
consumption details.
Literature has witnessed quite an amount of work in this area (Nwaoko, 2006; Omijeh, 2012).
Simple Prepaid Energy Meter Kit: A simplest type of prepaid energy meter consists of 2
EEPROMs interfaced to a microcontroller. One EEPROM contains the recharged balance
amount. The microcontroller reads this balance and stores it in the other EEPROM along with
the tariff. The energy meter supplies pulses to the microcontroller for every unit of energy
consumed. The microcontroller increases the spent energy unit by one and decreases the balance
amount in the EEPROM by the fixed tariff. As soon as the balance amount in the EEPROM
comes down to zero, the microcontroller sends a signal to the relay driver which in turn switches
off the relay, such that the main supply to the load is switched off. An LCD is also interfaced to
the microcontroller which displays the amount of energy consumed.
Zhang et al (1998) utilized a DSP-based meter to measure the electricity consumption of multiple
users in a residential area. A Personal Computer (PC) at the control centre was used to send
commands to a remote meter, which in turn transmitted data back, using the power Line
Communication (PLC) technique. The major problem with this system is that it cannot detect
tampering by consumers. A paper suggests a design of a system which can be used for data
transmission between the personal computer and smart card. The device will transmit the data in
half duplex mode (Kwan et al, 2002). In this paper, an Intelligent Prepaid Energy Meter has been
designed, modeled and simulated using matlab/simulink tools. Koay et al (2003) in their work,
designed and implemented a Bluetooth energy meter where several meters are in close
proximity, communicated wirelessly with a Master PC. Distance coverage is a major setback for
this kind of system because the Bluetooth technology works effectively at close range. In their
paper, Scaradozzi and Conte (2003) viewed home- automation systems as Multiple Agent
Systems (MAS). Home automation system was proposed where by home appliances and devices
are controlled and maintained for home management. It is only a home management system and
does not measure the amount of energy consumed by users. Hong and Ning (2005) in their paper,
proposed the use of Automatic Meter Reading (AMR) using wireless networks. Some
commercial AMR products use the internet for data transmission.

Stanescu et al(2006) present a design and implementation of SMS -based control for monitoring
systems. The paper has three modules involving sensing unit for monitoring the complex
applications. The SMS is used for status reporting such as power failure. Issues on billing system
for electricity board usage were not considered.Prepaid meters can also make use of state of art
technologies like WiMAX owing to the idea of centralized accounting, monitoring and charging.
It brings telecommunication to the core of its activities to support more Smart Grid applications
such as Demand Response and Plug-in electric vehicles (Khan et al, 2007). Prepayment
polyphase electricity metering systems have also been developed consisting of local prepayment
and a card reader based energy meter (Ling et al, 2010).

Malik et al (2009) in their paper, mainly focused on the controlling of home appliances remotely
and providing security when the user is away from the place using an SMS- based wireless
Home Appliance Control. In their lighting system using Global System for Mobile
communication [GSM] and General Packet Radio Service [GPRS]. The whole setup provides the
remote operator to turn off the lights when not required, regulate the voltage supplied to the
streetlights and prepare daily reports on glowing hours Sharma and Shoeb (2011), in their paper
suggested a method where we utilize telecommunication systems for automated transmission of
data to facilitate bill generation at the server end and also to the customer via SMS, Email. Amit.
and Mohnish (2011). Suggested in their paper, a prepaid energy meter behaving like a prepaid
mobile phone. The meter contains a prepaid card analogous to mobile SIM card. The prepaid
card communicates with the power utility using mobile communication infrastructure. Once the
prepaid card is out of balance, the consumer load is disconnected from the utility supply by the
contactor. The power utility can recharge the prepaid card remotely through mobile
communication based on customer requests.

2.6.DESIGN METHODOLOGY :
The design methodology we are going to use for the research work is Embedded system
development methodology. Our lives are surrounded by an overwhelming number and variety of
information equipment. Many of them provide their required functionalities by means of the so-
called embedded system. In the core of this embedded system is the embedded software. In order
to develop the embedded software efficiently and ensure that the developed software is of high
quality, there is a need to execute the appropriate tasks in the appropriate sequence in the course
of development. This trend has led the development of embedded software to expand in scale in
order to meet the ever-growing functional needs. In earlier days, the developers of embedded
software did not have to be that conscious about development process to build the software
required to be embedded in the final product, since their scope of development was relatively
limited. But due to the recent expansion in scale of software development, numerous problems
attributable to embedded software or embedded system have come to surface. As a result, more
and more attention is given now to improve the development process to address these emerging
problems. This Research is useful for billing purposes in Electricity board. Instead of going to
every house and taking the readings or using a token, by just sending an SMS the readings of the
house can be received and the electric bill can be recharged. The microcontroller and the GSM
unit are interfaced with the energy meter of each house. Every house has a separate number,
which is given by the corresponding authority. The GSM unit is fixed in the energy meter. The
amount of consumption is stored in the microcontroller’s memory and available to the authority
as SMS. Using this software, SMS can be sent through the GSM Modem to that particular
number which is assigned by these authorities and wait for the response. On other end, the
modem will receive the data in the form of a command and informs the controller to do the
readings. After the readings the controller will send data to the modem. The modem, in turn
sends data to the other end. In the office the GSM unit will receive the data and the total
consumption information. The number assigned by the authorities is unique. Using GSM, the
response can be obtained very fast, due to which time is saved. After consumption of the entire
balance on the meter, the power will be cut-off, and the consumer must send an SMS to recharge.
This will reduce illegal power using without paying money, and also able to solve by - pass of
voltage. The system gives the information of meter reading, power cut, total unit used, unit left,
power disconnect, and tampering on request or regularly at a particular interval through SMS.
Information is sent and received by the energy providing company such as PHCN (Power
Holding Company of Nigeria) using the Global System for Mobile Communication (GSM)
Network. A quad band GSM modems with a registered SIM (subscriber identification module)
card with unique numbers is used. The communication process employed here is achieved by
installing sets of AT (Attention) command strings in the GSM modems through HyperTerminal
software which comes with Microsoft operating system. With the aid of the installed AT
command strings, instructions and data are sent and received by the GSM modems respectively.
Data received from the consumer unit are used to update the customer’s database at the office of
the power providing company. The EEPROM of the microcontroller is updated each time a
customer pays his/her bills via SMS recharge by simply sending a secret pin from his mobile
number to the developed system. Other information such as total energy consumed, total amount
paid on consumption, User’s interface consist of LCD (Liquid Crystal Display) which displays
energy consumed, the (unit recharged) amount of bill paid and the amount left to be used.
Information such as unit recharged, success of recharge, power disconnect/reconnect by the
supply company, and when the unit left is critically low to avoid loss of power supply is
communicated through the customer’s mobile phone to the customer via SMS. With this new
system, customers are confident that they are not being exploited, power pilfering is eliminated,
rogue customers are shut off, prevention of bypass and the huge revenue loss which was inherent
in the traditional metering system is completely avoided. For the programming and development
of the controller part of the project at the energy meter end was made possible by the use of
NodeMCU ESP8266development board. It is inexpensive, simple, cross platform and has other
extensible properties. The microcontroller on the board has a flash memory of 32kB, making the
processing speed fast enough for the single IC to cater to not just one but multiple
microcontrollers in a residential building. The software section will contain the NodeMCU
ESP8266C variant and java for serial communication and the interface

2.7. Existing system:


• In existing system to monitor voltage, current sensors information manpower is required.
• Reduction in sharing information and customer services. Time consuming and costly to
produce reports, Lack of security, Higher Cost, Duplication of data entry.

2.8. Proposed system:


This proposed simple and economic digital prepaid energy meter controlled by GSM based
communication can cover rural area as well as urban areas. At the end of the research will be
able to achieve what we stated in the objectives. This is an effort about improving the present
conventional electromechanical meters through the fusion of analog and digital circuits which
have aim of collecting bills for consumption of power thus improved the revenue collection for
scheduled supply. This is beneficial for Nigeria as a developing country which having huge
population for improving the economic through power utility. The power board is accustomed to
the manual process and follows it even if there are many concerns involved. The client's
difficulty is to get yet corrected from the energy supply board due to human errors after receiving
staff charge. All things considered, the client must go to the location, wait in queue, and have it
fixed. The problem is the outcome of human intervention. In this new era, a programmed reading
metre reading framework was created to prevent human errors in the construction process.
The consumer can manage their energy use using the suggested strategy by periodically
becoming aware of their energy use. In addition to providing two paths of communication
between the utility and the customer, the strategy also offers a number of additional features,
such as the ability for the utility to cut off the customer's access to electricity if they fail to pay
their bill until they do. With the suggested method, the client can manage their energy use by
periodically being aware of it. The plan not only provides two-way communication between the
utility and the customer, but it also offers additional features, such as the ability for the utility to
cut off the customer's access to power until the bill is paid and then re-connect it. Everything in
the world in which we live depends on electricity. We may put it simply by saying that electricity
rules the planet. As a result, power consumption has become a crucial factor in every industry.
When we look at the electricity bill, we occasionally wonder if it will surpass our monthly
budget. The only way to get out of this scenario is with an effective monitoring and regulating
system. One such technique is the suggested system. Simply put, the goal of the proposed system
is to develop a user-friendly system for tracking energy consumption in real time. Some
electronic gadgets collect data, which NodeMCU is used to send to the server.
Chapter-3
3. Hardware description:
3.1. Node MCU ESP8266 :

Fig:2. ESP8266
NodeMCU was created shortly after the ESP8266 came out. On December 30, 2013, Espressif
Systems began production of the ESP8266. The ESP8266 is a Wi-Fi SoC integrated with a
Tensilica Xtensa LX106 core,[citation needed] widely used in IoT applications. NodeMCU
started on 13 Oct 2014, when Hong committed the first file of nodemcu-firmware to
GitHub. Two months later, the project expanded to include an open-hardware platform when
developer Huang R committed the gerber file of an ESP8266 board, named devkit v0.9.Later that
month, Tuan PM ported MQTT client library from Contiki to the ESP8266 SoC platform, and
committed to NodeMCU project, then NodeMCU was able to support the MQTT IoT protocol,
using Lua to access the MQTT broker. Another important update was made on 30 Jan 2015,
when Devsaurus ported the u8glib to NodeMCU project, enabling NodeMCU to easily drive
LCD, Screen, OLED, even VGA displays.
In summer 2015 the creators abandoned the firmware project and a group of independent but
dedicated contributors took over. By summer 2016 the NodeMCU included more than 40
different modules. Due to resource constraints users need to select the modules relevant for their
project and build a firmware tailored to their needs.
As Arduino.cc began developing new MCU boards based on non-AVR processors like the
ARM/SAM MCU and used in the NodeMCU ESP8266Due, they needed to modify the
NodeMCU ESP8266IDE so that it would be relatively easy to change the IDE to support
alternate tool chains to allow NodeMCU ESP8266C/C++ to be compiled down to these new
processors. They did this with the introduction of the Board Manager and the SAM Core. A
"core" is the collection of software components required by the Board Manager and the
NodeMCU ESP8266IDE to compile an NodeMCU ESP8266C/C++ source file down to the
target MCU's machine language. Some creative ESP8266 enthusiasts have developed an
NodeMCU ESP8266core for the ESP8266 WiFi SoC that is available at the GitHub ESP8266
Core webpage. This is what is popularly called the "ESP8266 Core for the NodeMCU
ESP8266IDE" and it has become one of the leading software development platforms for the
various ESP8266 based modules and development boards, including NodeMCUs.
The Button
The Button is a Wi-Fi connected push button designed by Peter R Jennings.The Button is
designed for single-purpose, internet-enabled functions. When the button is pressed, a connection
is made to a web server which will perform the desired task. Applications include a doorbell or
panic button.
3.2.NodeUSB:
NodeUSB is an open IoT platform about the size of a standard USB stick. It was designed to
leverage NodeMCU (Lua) for easy programming and has the extra feature of USB capability. It
is ideal for Plug-n-Play solutions, allowing easy prototyping for developers.
ijWatch: ijWatch is an open-hardware and open-source Wi-Fi smartwatch, using
an OLED screen and running NodeMCU firmware.[13]The author believes it may be the first
smartwatch. (As in, the watch itself is fully functional without the pairing of another bluetooth
device such as a smartphone.).
Pins of NodeMCU: NodeMCU provides access to the GPIO (General Purpose Input/Output) and
for developing purposes below pin mapping table should be referenced.
Fig.3. Pins of NodeMCU

IO index ESP8266 pin IO index ESP8266 pin

0 [*] GPIO16 7 GPIO13

1 GPIO5 8 GPIO15

2 GPIO4 9 GPIO3

3 GPIO0 10 GPIO1

4 GPIO2 11 GPIO9

5 GPIO14 12 GPIO10

6 GPIO12
Electronic equipment and signal and power transmission lines can be subjected to voltage surges
induced by lightning, electrostatic discharge, radio frequency transmissions, switching pulses
(spikes) and perturbations in power supply. Remote lightning strikes can induce surges up to 10
kV, one thousand times more than the voltage limits of many electronic components. A circuit
can also incorporate high voltages by design, in which case it needs safe, reliable means of
interfacing its high-voltage components with low-voltage ones. The main function of an opto-
isolator is to block such high voltages and voltage transients, so that a surge in one part of the
system will not disrupt or destroy the other parts.
We are employing PC817 as the photo coupler in our project. It is connected to the two pins of
ARM Processor (Vcc and PV3, PC4 or PC5) at its pin number 1 and 2. The output of ARM is
sent to the relay PCB. The voltage input at pin 4 is coming from the SMPS. When the Vcc has
+5 V and Rel 1 (for first relay) has +5 V as well, no current flows in the LED connected between
these two points of the opto coupler. Thus, there will be no connection between pin 3 and 4 of
the opto coupler. Thus the 5 V voltages would be received at pin 4 i.e. R1. On the other hand, if
the Rel 1 receives 0 V, there will be a potential difference created between pin 1 and 2. Thus
current will flow and the LED will glow, thereby leading to the making of connection at the
secondary. This will give pin 4, ground potential and thus R1 won‘t receive the 5 V voltages
from the SMPS. In other words, the relay card will get current when the voltage at the Rel1 is 5V
only, and there will be no current in the relay PCB if the Rel1 pin is at ground voltage.This is a
small and easy to use 2 channel relay board that operates on 5V. This relay board lets you control
two 240V power appliance directly from 5V ARM Processors or low voltage circuits. Perfect for
switching 240V appliances - lights, fans, etc, and even high power motors at lower voltages.

3.3.Digital Energy meter:


The energy meter is nothing but a device or instrument which used to measure the amount of
electrical energy consumed by the consumer or the load. This load can be domestic, commercial
or industrial. SI unit of electrical power is watt. So, this meter also known as watt-hour (Wh)
meter. If an electric load consumed one kilowatt power in one hour, it considered as one kWh
consumption or one unit of energy consumed. These meters installed at every place where utility
is supplying electrical energy. The energy meter always connected in series with the load. The
load will be single-phase or three-phase and according to the type of load, energy meter
classified as a single-phase meter or three-phase meter. For single-phase or lower load, energy
meter can directly connect with the load but in case of higher load (industrial-3-Φ), step down
current transformer used to reduce current.
Basically, these meters are measuring an instantaneous voltage and current, and calculate
instantaneous power by multiplying the voltage and current. To find final energy utilization, the
instantaneous power integrated over a period of time.
According to the working principle, energy meter classified into three types;
 Electromagnetic induction type energy meter
 Electronic energy meter
 Smart energy meter
Smart energy meter
The smart energy meter is the next generation of an electric meter. The smart meters are installed
in developed countries.
Advantages of the smart energy meter:
 It can detect an outage
 It can limit the demand
 Record consumer consumption
 Remote disconnection and reconnection
 It can monitor the quality of supply
 Advanced Communication system
The smart kWh meter has the ability to measure the power in both directions; utility to load and
load to the utility. For example, the smart meter is installed at home and a solar rooftop is also
installed. Let us assume that, in the present condition, the generation of solar is higher than a
load, in this condition power will transfer from load (home) to utility and if generation is less
than the demand, in this condition, power will transfer from utility to load. In this case, the meter
can measure the power in both directions.
The smart meter has an advanced communication system for data transfer. It can transfer data to
the utility like energy consumption, voltage, and current value, power factor, etc. The power
theft is not possible in case of a smart meter. The consumer can directly pay money through the
meter and not need to visit the consumer for a meter reading. It can connect to your smartphone
also. So, you can get details of all parameters from your phone.
Advantages of IoT based energy monitoring system:
 Real time energy monitoring from anywhere in the world. Since the project is connected to
internet and as long as you have access to internet, you can read the data in real time anywhere.
 Real-time energy consumption data feedback to the power plant to efficiently generate power. In
real life power plants need to adjust the production of power as per consumer’s demand in real-
time. If electric power companies produce less power than the demand, blackouts will occur and
if they produce more power than the demand, voltage on the grid will rise to dangerous levels
and protection systems will kick-in and blackout will occur (also here). With real time data the
power companies can manage the power generation efficiently with zero to minimal blackouts.
 No need for manual labor for collecting monthly power consumption data on individual houses
or industries and power generation companies can bill the customers directly.
 Individual consumers can keep track of their energy consumption and may able to cut down
power consumption to save on the bills.
Disadvantages:

 Privacy and data concerns. New technologies not only helpful for the society but also brings new
opportunities for tech frauds, scammers and hackers. The data they harvest illegally can be used
against you for their financial gain.
 Maintaining the software and hardware will cost the companies.
 Initial replacement cost of replacing old energy meters with new one will be incurred by the
consumers and also power companies.

3.4. NodeMCU ESP8266Nano power supply:

The NodeMCU ESP8266Nano can be powered via the Mini-B USB connection, 6-20V
unregulated external power supply (pin 30), or 5V regulated external power supply (pin 27).
The power source is automatically selected to the highest voltage source.
The Nano has one 3.3V and two 5V power pins of which one is the VIN pin. With the VIN pin
you can supply the NodeMCU ESP8266Nano with a voltage between 7V-12V to run the
microcontroller on battery for example. All three power pins provide a maximum currency of 50
mA. You can close the circuit with two ground pins.

Power sensor:
power sensors are designed to provide fast, accurate average power measurements from as low
as 10 MHz up to 50 GHz. The USB power sensors contain a power meter, enabling them to
make analog-to-digital conversions and pass the data directly to a PC.
3.5. GSM MODULE SIM 900L

Sim800L Module is low cost, low form factor GSM module based on Simcoms SIM800L
chipset. Sim800L module supports quad-band GSM and GPRS network.
This breakout board is perfect for application where size and cost is a constraint. Sim800l gsm
module also supports quad band which means that it can work anywhere in the world. This low
cost module is perfect for launching your next IoT project. Using this module you can almost
make your own cellphone.
Using this module you can:-

 Send Text Messages (SMS)


 Make or receive Phone calls
 Connect to Internet via GPRS
 TCP/IP
The main drawback of this module is works on 3.7 to 4.2 volts so you cannot power it directly
through NodeMCU ESP8266or Raspberry Pi. Moreover the sim800L GSM and GPRS module
requires upto 2 ampere current so accordingly design your power supply. You can use a 3.7 volt
lipo battery to directly power the GSM module.

You can communicate with SIM800l module via UART port, supports command including
3GPP TS 27.007, 27.005 and SIM COM enhanced AT Commands.

Features of SIM800L GSM Module:-

 Quad-band 850/900/1800/1900MHz - connect onto any global GSM network with any
2G SIM (in the USA, T-Mobile is suggested).
 Make and receive voice calls using a headset or an external 8Ω speaker and electret
microphone.
 PWM/Buzzer vibration motor control
 AT command interface with "auto baud" detection
 Send and receive SMS messages.
 Send and receive GPRS data (TCP/IP, HTTP, etc.).
 Scan and receive FM radio broadcasts.
 Lead out buzzer and vibration motor control port.
 AT command interface with "auto baud" detection.
 Onboard IPEX socket that can be connected to external antenna.
 Breakouts for external 8W speaker and electret mic if you don't want to use a headphone
 Level shifting circuitry so you can run it with 2.8V to 5V logic.
 Vibrational motor (buzzer) driver so you can have noiseless notifications
 uFL or SMA connections for external antenna
 Indicator LEDs for power and network connectivity
 Standard SIM slides into the back

3.6 LIQUID CRYSTAL DISPLAY (LCD):


Figure Liquid Crystal Display
· Vcc, at pin 16 controls the background contrast.
· Vcc, at pin 2 controls the display contrast.
· Pin 7 - 14 gets input data.
· Pin 1 and pin 3 controls the brightness of the display.
· Pin 5, gets a read/write signal.
· Pin 6, enable signal.
· Pin 4, data register select.

LCD Pins
Table Pin Assignment
Interfacing Example - 16 Character x 2 Line LCD
Description:
This is the first interfacing example for the Parallel Port. We will start with something simple.
This example doesn't use the Bi-directional feature found on newer ports, thus it should work
with most, if no all Parallel Ports. It however doesn't show the use of the Status Port as an input.
So what are we interfacing? A 16 Character x 2 Line LCD Module to the Parallel Port. These
LCD Modules are very common these days, and are quite simple to work with, as all the logic
required running them is on board.
Schematic:
Circuit Description:
Above is the quite simple schematic. The LCD panel's Enable and Register Select is connected to
the Control Port. The Control Port is an open collector / open drain output. While most Parallel
Ports have internal pull-up resistors, there are a few which don't. Therefore by incorporating the
two 10K external pull up resistors, the circuit is more portable for a wider range of computers,
some of which may have no internal pull up resistors. We make no effort to place the Data bus
into reverse direction. Therefore we hard wire the R/W line of the LCD panel, into write mode.
This will cause no bus conflicts on the data lines. As a result we cannot read back the LCD's
internal Busy Flag which tells us if the LCD has accepted and finished processing the last
instruction. This problem is overcome by inserting known delays into our program.
The 10k Potentiometer controls the contrast of the LCD panel. Nothing fancy here. As with all
the examples, I've left the power supply out. You can use a bench power supply set to 5v or use a
onboard +5 regulator. Remember a few de-coupling capacitors, especially if you have trouble
with the circuit working properly. The 2 line x 16 character LCD modules are
available from a wide range of manufacturers and should all be compatible with the HD44780.
The one I used to test this circuit was a Power trip PC- 1602F and an old Philips LTN211F-10
which was extracted from a Poker Machine! The diagram to the right shows the pin numbers for
these devices. When viewed from the front, the left pin is pin 14 and the right pin is pin
The LCD panel requires a few instructions to be sent, to order to turn on the display and initialize
it. This is what the first for loop does. These instructions must be sent to the LCD's Instruction
Register which is controlled by the Register Select (Pin 4). When pin 4 is low the instruction
register is selected, thus when high the data register must be selected. We connect this to the
Parallel Port's Select Printer line which happens to be hardware inverted. Therefore if we write a
'1' to bit 3 of the Control Register the Select Printer line goes low. We want to first send
instructions to the LCD module. Therefore the Register Select line must be low. As it is
hardware inverted, we will want to set bit 3 of the Control Register to '1'. However we don't want
to upset any other bits on the Control Port. We achieve this by reading the Control Port and
Oaring 0x80 to it. E.g. out port (CONTROL, in port b (CONTROL) | 0x08);
this will only set bit 3. After we place a data byte on the data lines, we must then signal to the
LCD module to read the data. This is done using the Enable line. Data is clocked into the LCD
module on the high to low transition. The Strobe is hardware inverted, thus by setting bit 0 of the
Control Register we get a high to low transition on the Strobe line. We then wait for a delay, and
return the line to a high state ready for the next byte. After we initialize the LCD Module, we
want to send text to it. Characters are sent to the LCD's Data Port, thus we want to clear bit 3.
Once again we must only change the one bit, thus we use out port b (CONTROL, in port
b(CONTROL) & 0xF7);. Then we set up another for loop to read a byte
from the string and send it to the LCD panel. This is repeated for the length of the string. The
delays should be suitable for most machines. If the LCD panel is not initializing properly, you
can try increasing the delays. Likewise if the panel is skipping characters, e.g. Test, 2. On the
other hand, if the LCD module is repeating characters e.g. testing then you may have a faulting
Enable connection. Check your Enable to Strobe connection.

3.7. LIGHT EMITTING DIODE (LED):


LED's are special diodes that emit light when connected in a circuit. They are frequently used as
"pilot" lights in electronic appliances to indicate whether the circuit is closed or not. A clear (or
often colored) epoxy case enclosed the heart of an LED, the semi-conductor chip.

Figure : LED View

Figure LED Symbol


LED’s must be connected the correct way round, the diagram may be labeled a or + for anode
and k or - for cathode. The negative side of an LED lead is indicated in two ways:

Figure : LED Internal View


1) By the flat side of the bulb.
2) By the shorter of the two wires extending from the LED.
If you can see inside the LED the cathode is the larger electrode (but this is not an official
identification method). The negative lead should be connected to the negative terminal of a
battery. LED's operate at relative low voltages between about 1 and 4 volts, and draw currents
between about 10 and 40 mille amperes. Voltages and currents substantially about these values
can melt a LED chip. The most important part of light emitting diode (LED) is the semi-
conductor chip located in the center of the bulb as shown below. The chip has two regions
separated by a junction. The p region is dominated by positive electric charges, and the n region
is dominated by negative electric charges. The junction acts as a barrier to the flow of electrons
between the p and n regions. Only when sufficient voltage is applied to the semi-conductor chip,
can the current flow and the electron cross the junction into the p region? In the absence of the
large enough electric potential difference (voltage) across
the LED leads, the junction presents an electric potential barrier to the flow of electrons.
A light-emitting diode (LED) is a semiconductor light source. LEDs are used as indicator lamps
in many devices and are increasingly used for other lighting. Appearing as practical electronic
components in 1962, early LEDs emitted low intensity red light, but modern versions are
available across the visible, ultraviolet, and infrared wavelengths, with very high brightness.
Fig. Light Emitting Diode
When a light-emitting diode is switched on, electrons are able to recombine with holes within the
device, releasing energy in the form of photons. This effect is called electroluminescence and the
color of the light (corresponding to the energy of the photon) is determined by the energy band
gap of the semiconductor. An LED is often small in area (less than 1 mm2), and integrated
optical components may be used to shape its radiation pattern. LEDs present many advantages
over incandescent light sources including lower energy consumption, longer lifetime, improved
physical robustness, smaller size, and faster switching. However, LEDs powerful enough for
room lighting are relatively expensive and require more precise current and heat management
than compact fluorescent lamp sources of comparable output.
Printed Circuit Board(PCB):
The earliest PCB's (printed circuit boards) were made from materials like Bakelite, Masonite,
layered cardboard and even thin wooden planks. Holes were drilled into the material and then
flat brass "wires" were riveted or bolted onto the board. Connections to components were usually
made by pressing the end of the brass trace onto a hollow rivet and the component's leads were
simply pressed into the open end of the rivet. Occasionally small nuts and bolts were used in
place of the rivets. These types of PCBs were used in early tube style radios and gramophones in
the 1920's.

3.8. Jumper Wires


A jump wire (also known as jumper, jumper wire, jumper cable, DuPont wire, or DuPont cable –
named for one manufacturer of them) is an electrical wire, or group of them in a cable, with a
connector or pin at each end (or sometimes without them – simply "tinned"), which is normally
used to interconnect the components of a breadboard or other prototype or test circuit, internally
or with other equipment or components, without soldering.
Types:
 Male to Male
 Female to Male
 Female to Female
3.9. Power Supply:
input power supply for the project 5v,1Amp

3.10. PCB:

A printed circuit board (PCB) mechanically supports and electrically


connects electrical or electronic components using conductive tracks, pads and other
features etched from one or more sheet layers of copper laminated onto and/or between sheet
layers of a non-conductive substrate. Components are generally soldered onto the PCB to both
electrically connect and mechanically fasten them to it.

Printed circuit boards are used in all but the simplest electronic products. They are also used in
some electrical products, such as passive switch boxes.

Alternatives to PCBs include wire wrap and point-to-point construction, both once popular but
now rarely used. PCBs require additional design effort to lay out the circuit, but manufacturing
and assembly can be automated. Electronic computer-aided design software is available to do
much of the work of layout. Mass-producing circuits with PCBs is cheaper and faster than with
other wiring methods, as components are mounted and wired in one operation. Large numbers of
PCBs can be fabricated at the same time, and the layout only has to be done once. PCBs can also
be made manually in small quantities, with reduced benefits.

PCBs can be single-sided (one copper layer), double-sided (two copper layers on both sides of
one substrate layer), or multi-layer (outer and inner layers of copper, alternating with layers of
substrate). Multi-layer PCBs allow for much higher component density, because circuit traces on
the inner layers would otherwise take up surface space between components. The rise in
popularity of multilayer PCBs with more than two, and especially with more than four, copper
planes was concurrent with the adoption of surface mount technology. However, multilayer
PCBs make repair, analysis, and field modification of circuits much more difficult and usually
impractical.

A basic PCB consists of a flat sheet of insulating material and a layer of copper foil, laminated to
the substrate. Chemical etching divides the copper into separate conducting lines called tracks
or circuit traces, pads for connections, vias to pass connections between layers of copper, and
features such as solid conductive areas for electromagnetic shielding or other purposes. The
tracks function as wires fixed in place, and are insulated from each other by air and the board
substrate material. The surface of a PCB may have a coating that protects the copper
from corrosion and reduces the chances of solder shorts between traces or undesired electrical
contact with stray bare wires. For its function in helping to prevent solder shorts, the coating is
called solder resist or solder mask.

A printed circuit board can have multiple copper layers. A two-layer board has copper on both
sides; multi layer boards sandwich additional copper layers between layers of insulating material.
Conductors on different layers are connected with vias, which are copper-plated holes that
function as electrical tunnels through the insulating substrate. Through-hole component leads
sometimes also effectively function as vias. After two-layer PCBs, the next step up is usually
four-layer. Often two layers are dedicated as power supply and ground planes, and the other two
are used for signal wiring between components.

"Through hole" components are mounted by their wire leads passing through the board and
soldered to traces on the other side. "Surface mount" components are attached by their leads to
copper traces on the same side of the board. A board may use both methods for mounting
components. PCBs with only through-hole mounted components are now uncommon. Surface
mounting is used for transistors, diodes, IC chips, resistors and capacitors. Through-hole
mounting may be used for some large components such as electrolytic capacitors and connectors.

The pattern to be etched into each copper layer of a PCB is called the "artwork". The etching is
usually done using photoresist which is coated onto the PCB, then exposed to light projected in
the pattern of the artwork. The resist material protects the copper from dissolution into the
etching solution. The etched board is then cleaned. A PCB design can be mass-reproduced in a
way similar to the way photographs can be mass-duplicated from film negatives using
a photographic printer.

In multi-layer boards, the layers of material are laminated together in an alternating sandwich:
copper, substrate, copper, substrate, copper, etc.; each plane of copper is etched, and any internal
vias (that will not extend to both outer surfaces of the finished multilayer board) are plated-
through, before the layers are laminated together. Only the outer layers need be coated; the inner
copper layers are protected by the adjacent substrate layers.

FR-4 glass epoxy is the most common insulating substrate. Another substrate material is cotton
paper impregnated with phenolic resin, often tan or brown.

When a PCB has no components installed, it is less ambiguously called a printed wiring
board (PWB) or etched wiring board. However, the term "printed wiring board" has fallen into
disuse. A PCB populated with electronic components is called a printed circuit
assembly (PCA), printed circuit board assembly or PCB assembly (PCBA). In informal usage,
the term "printed circuit board" most commonly means "printed circuit assembly" (with
components). The IPC preferred term for assembled boards is circuit card assembly (CCA),
[4] and for assembled backplanes it is backplane assemblies. "Card" is another widely used
informal term for a "printed circuit assembly". For example, expansion card.

A PCB may be "silkscreen" printed with a legend identifying the components, test points, or
identifying text. Originally, an actual silkscreen printing process was used for this purpose, but
today other, finer quality printing methods are usually used instead. Normally the screen printing
is not significant to the function of the PCBA.
A minimal PCB for a single component, used for prototyping, is called a breakout board. The
purpose of a breakout board is to "break out" the leads of a component on separate terminals so
that manual connections to them can be made easily. Breakout boards are especially used for
surface-mount components or any components with fine lead pitch.

Advanced PCBs may contain components embedded in the substrate.


Characteristics:

The first PCBs used through-hole technology, mounting electronic components by leads inserted
through holes on one side of the board and soldered onto copper traces on the other side. Boards
may be single-sided, with an unplated component side, or more compact double-sided boards,
with components soldered on both sides. Horizontal installation of through-hole parts with two
axial leads (such as resistors, capacitors, and diodes) is done by bending the leads 90 degrees in
the same direction, inserting the part in the board (often bending leads located on the back of the
board in opposite directions to improve the part's mechanical strength), soldering the leads, and
trimming off the ends. Leads may be soldered either manually or by a wave soldering machine.

Through-hole manufacture adds to board cost by requiring many holes to be drilled accurately,
and it limits the available routing area for signal traces on layers immediately below the top layer
on multi-layer boards, since the holes must pass through all layers to the opposite side. Once
surface-mounting came into use, small-sized SMD components were used where possible, with
through-hole mounting only of components unsuitably large for surface-mounting due to power
requirements or mechanical limitations, or subject to mechanical stress which might damage the
PCB (e.g. by lifting the copper off the board surface).
3.11. Resistor:
Resistance R is the amount of opposition to the flow of electrical current. The higher the
resistance, the more difficult it is for current to flow. The lower the resistance, the easier it is for
current to flow. Resistance is measured in units called ohms, named after German scientist and
mathematician Georg Simon Ohm.

Types of Resistors:
There are many thousands of different Types of Resistors and are produced in a variety of
forms because their particular characteristics and accuracy suit certain areas of application,
such as High Stability, High Voltage, High Current etc., or are used as general purpose
resistors where their characteristics are less of a problem.
All modern fixed value resistors can be classified into four broad groups,
Carbon Composition Resistor - Made of carbon dust or graphite paste, low wattage values.
Film or Cermet Resistor - Made from conductive metal oxide paste, very low wattage
values. Wire-wound Resistor - Metallic bodies for heat sink mounting, very high wattage
ratings.
Semiconductor Resistor - High frequency/precision surface mount thin film technology.
Resistance Color Code: In order to identify the nominal resistance and the tolerance of a resistor,
manufacturers typically use a color band system known as the resistor color code. The electronic
color code is used to indicate the values or ratings of electronic components, usually for
resistors.
The power rating is not indicated in the resistor color code and must be determined by
experience using the physical size of the resistor as a guide.
For resistors with 5% or 10% tolerance, the color code consists of 4 color bands. For
resistors with 1% or 2% tolerance, the color code consists of 5 bands.
Tight tolerance resistors may have three bands for significant figures rather than two, or an
additional band indicating temperature coefficient, in units of ppm/K.
Application:
Resistors are used with transducers to make sensor subsystems. Transducers are electronic
components which convert energy from one form into another, where one of the forms of energy
is electrical. Microphones and switches are input transducers. Output transducers include
loudspeakers, filament lamps and LEDs.
In other circuits, resistors are used to direct current flow to particular parts of the circuit, or may
be used to determine the voltage gain of an amplifier. Resistors are used with capacitors to
introduce time delays.
Most electronic circuits require resistors to make them work properly and it is obviously
important to find out something about the different types of resistor available, and to be able to
choose the correct resistor value, in , , or M , for a particular application.

Fig:- Color Coding of Resistor


1. On most resistors, you'll see there are three rainbow-colored bands, then a space, then a
fourth band colored brown, red, gold, or silver.
2. Turn the resistor so the three rainbow bands are on the left.
3. The first two of the rainbow bands tell you the first two digits of the resistance. Suppose
you have a resistor like the one shown here, with colored bands that are brown, black,
and red and a fourth golden band. You can see from the color chart below that brown
means 1 and black means 0, so the resistance is going to start with "10". The third band is
a decimal multiplier: it tells you how many powers of ten to multiply the first two
numbers by (or how many zeros to add on the end, if you prefer to think of it that way).
Red means 2, so we multiply the 10 we've got already by 10 × 10 = 100 and get 1000.
Our resistor is 1000 ohms.
4. The final band is called the tolerance and it tells you how accurate the resistance value
you've just figured out is likely to be. If you have a final band colored gold, it means the
resistance is accurate to within plus or minus 5 percent. So while the officially stated
resistance is 1000 ohms, in practice, the real resistance is likely to be anywhere between
950 and 1050 ohms.
If there are five bands instead of four, the first three bands give the value of the resistance, the
fourth band is the decimal multiplier, and the final band is the tolerance. Five-band resistors
quoted with three digits and a multiplier, like this, are necessarily more accurate than four-band
resistors, so they have a lower tolerance value.
3.12. LM 7805:
DESCRIPTION:
The LM7804 series of three terminal positive regulators are available in the TO-220/D-PAK
package and with several fixed output voltages, making them useful in a wide range of
applications. Each type employs internal current limiting, thermal shut down and safe operating
area protection, making it essentially indestructible. If adequate heat sinking is provided, they
can deliver over 1A output current. Although designed primarily as fixed voltage regulators,
these devices can be used with external components to obtain adjustable voltages and currents.
Figure 2.4 General view of Regulator
FEATURES:
• Output Current up to 1A
• Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V
• Thermal Overload Protection
• Short Circuit Protection
• Output Transistor Safe Operating Area Protection

WORKING:
Voltage regulator limits the voltage that passes through it. Each regulator has a voltage rating;
For example, the 7805 IC (these regulators are often considered to be ICs) is a 5-volt voltage
regulator. What that means is that no matter how many volts you put into it, it will output only 5
volts. This means that you can connect a 9-volt battery, a 12-volt power supply, or virtually
anything else that's over 5 volts, and have the 7805 give you a nice supply of 5 volts out. There
are also 7812 (12-volt) and 7815 (15-volt) three pin regulators in common use.
The pin-out for a three pin voltage regulator is as follows:
1.Voltage-in
2.Ground
3.Voltage out
For example, with a 9-volt battery, you'd connect the positive end to pin 1 and the negative (or
ground) end to pin 2. A 7805 would then give you +5 volts on pin 3.Voltage regulators are
simple and useful. There are only two important drawbacks to them: First, the input voltage must
be higher than the output voltage. For example, you cannot give a 7805 only 2 or 3 volts and
expect it to give you 5 volts in return. Generally, the input voltage must be at least 2 volts higher
than the desired output voltage, so a 7805 would require about 7 volts to
work properly. The other problem: The excess voltage is dissipated as heat. At low voltages
(such as using a 9-volt battery with a 7805), this is not a problem. At higher voltages, however, it
becomes a very real problem and you must have some way of controlling the temperature so you
don't melt your regulator. This is why most voltage regulators have a metal plate with a hole in
it; That plate is intended for attaching a heat sink to-Do not confuse three-pin voltage regulators
with a device known as a TRIAC (short for triode AC switch). It is easy to associate them with
each other, since they look similar (both have three pins) and they both regulate power.
However, the 78XX types of regulators are used for regulating DC current, while TRIACs are
used for AC current.
Chapter-4

\
4. Software Description
NodeMCU ESP8266IDE:
NodeMCU ESP8266is an open-source prototyping platform based on easy-to-use hardware and
software. NodeMCU ESP8266boards are able to read inputs - light on a sensor, a finger on a
button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED,
publishing something online. You can tell your board what to do by sending a set of instructions
to the microcontroller on the board. To do so you use the NodeMCU ESP8266programming
language (based on Wiring), and the NodeMCU ESP8266Software (IDE), based on Processing.
Over the years NodeMCU ESP8266has been the brain of thousands of projects, from everyday
objects to complex scientific instruments. A worldwide community of makers - students,
hobbyists, artists, programmers, and professionals - has gathered around this open-source
platform, their contributions have added up to an incredible amount of accessible knowledge that
can be of great help to novices and experts alike.
In the programming part, to facilitate communication between NodeMCU ESP8266and LCD
module, we make use of a built in library in NodeMCU ESP8266<LiquidCrystal.h> – which is
written for LCD modules making use of the Hitachi HD44780 chipset (or a compatible chipset).
This library can handle both 4 bit mode and 8 bit mode wiring of LCD. In 4 bit mode, data is
sent using 4 data pins and 3 control pins. In our project, R/W pin is always grounded so we
require only 6 pins in 4 bit mode, thus saving no of pins. During interfacing the library is first
initialized and then define pins using the command LiquidCrystal lcd(RS, E, D4, D5, D6, D7),
pins are assigned in this order. In program we can see this command as LiquidCrystal lcd(13,12,
11, 10, 9, 8), here RS pin to 13, Enable pin to 12, D4 pin to 11, D5 pin to 10, D6 pin to 9 and D7
pin to 8 respectively.
The NodeMCU ESP8266reads the sensor output through the analog input pins using analogRead
function. For example “analogRead(moisture_sensorPin);” converts the voltage (in the range 0 to
5V) at the A0 pin into a number (in the range 0 to 1023) This way the voltage at A0 is compared
to a fixed number (avg_moisture) for identifying the current status of the soil .=
The status of the float switch is compared to identify the current water level and according to
these both sensor status the controller will switch the motor to ON or OFF condition. If values
from the float switches is high and if the reading from the moisture sensor is low, then controller
will shows a full level tank status and a low level moisture status on LCD and switches the
motor to ON condition. This is done by giving a signal to the base of the BC547 transistor which
is connected to the 4th pin of the NodeMCU ESP8266Nano. The controller will also switch the
moisture status LED and the tank status LED OFF by writing a digital 0 to the 2nd and 3rd pin of
arduino. The motor will be in ON condition until the moisture content goes above reference
value or if the float switch status become low.

Software program
The program is written in NodeMCU ESP8266programming language. The code is well
commented and is easy to understand. Compile the autowatering.ino code and upload it to the
microcontroller, using NodeMCU ESP8266IDE version 1.

4.1. Hardware installation:

The USB standard requires a 1.5 kΩ pullup resistor on D+, but this board is known to have a
wrong value (R10 on the board). It ships with either a 10 kΩ resistor or a 4.7 kΩ resistor, but it
should be replaced with a 1.5 kΩ resistor, or put an appropriate resistor value (e.g 1.8 kΩ) in
between PA12 and 3.3V. It is also true that some PCs are tolerant of incorrect value so, before
you change the resistance, you can try if it works in your case.
TEST PLAN:
Check the power supply connections
· Insert smart card in to the smart card reader · Check LEDs
· Check Microcontroller minimum requirements
· Welcome message will be printed on LCD
· Consumed units and available units are displayed on LCD
· A message will be displayed if there is no smart card
Window – Files.
Now use from the menu Project – Select Device for Target and select a CPU for your project.
The Select Device dialog box shows the μVision2 device database. Just select the
microcontroller you use. We are using for our examples the Philips 80C51RD+ CPU. This
selection sets necessary tool options for the 80C51RD+ device and simplifies in this way the tool
Configuration

Building Projects and Creating a HEX Files


Typical, the tool settings under Options – Target are all you need to start a new application. You
may translate all source files and line the application with a click on the Build Target toolbar
icon. When you build an application with syntax errors, μVision2 will display errors and warning
messages in the Output Window – Build page. A double click on a message line opens the source
file on the correct location in a μVision2 editor window. Once you have
successfully generated your application you can start debugging. After you have tested your
application, it is required to create an Intel HEX file to download the software into an EPROM
programmer or simulator. μVision2 creates HEX files with each build process when Create HEX
file under Options for Target – Output is enabled. You may start your PROM
programming utility after the make process when you specify the program under the option Run
User Program #1.
CPU Simulation:
μVision2 simulates up to 16 Mbytes of memory from which areas can be mapped for read, write,
or code execution access. The μVision2 simulator traps and reports illegal memory accesses. In
addition to memory mapping, the simulator also provides support for the integrated peripherals
of the various 8051 derivatives. The on-chip peripherals of the CPU you have selected are
configured from the Device

Database selection:
You have made when you create your project target. Refer to page 58 for more information
about selecting a device. You may select and display the on-chip peripheral components using
the Debug menu. You can also change the aspects of each peripheral using the controls in the
dialog boxes.
Start Debugging:
You start the debug mode of μVision2 with the Debug – Start/Stop Debug Session command.
Depending on the Options for Target – Debug configuration, μVision2 will load the application
program and run the startup code μVision2 saves the editor screen layout and restores the screen
layout of the last debug session. If the program execution stops, μVision2 opens an editor
window with the source text or shows CPU instructions in the disassembly window. The next
executable statement is marked with a yellow arrow. During debugging, most editor features are
still available. For example, you can use the find command or correct program errors. Program
source text of your application is shown in the same windows. The
μVision2 debug mode differs from the edit mode in the following aspects: The “Debug Menu
and Debug Commands” described on page 28 are available. The additional debug windows are
discussed in the following. The project structure or tool parameters cannot be modified. All build
commands are disabled.
Disassembly Window:
The Disassembly window shows your target program as mixed source and assembly program or
just assembly code. A trace history of previously executed instructions may be displayed with
Debug – View Trace Records. To enable the trace history, set Debug – Enable/Disable Trace
Recording. If you select the Disassembly Window as the active window all program step
commands work on CPU instruction level rather than program source lines. You can select a text
line and set or modify code breakpoints using toolbar buttons or the context menu commands.

4.2.Implementation of the Software:


For the software part we use an algorithm and is given below
i) The controller continuously scans the ports which receive inputs from maximum demand
section and optical section.
ii) If the optical pickup receives a pulse then the counter increments and display the unit
consumed in LCD. Then count is compared to display the warning for recharging.
iii) When the total unit finishes, after that the tripping relay is activated to disconnect the power.
iv) If the maximum demand section gives a pulse then it activates the tripping mechanism.
Continuously the controller rechecks the maximum demand section and regains the power when
load is reduced

Code:
#include<EEPROM.h>

#include <LiquidCrystal.h>

LiquidCrystal lcd(7,6,5,4,3,2);

int led=13;

#define pulsein 8

#define relay 12

unsigned int pusle_count=0;


float units=0;

unsigned int rupees=0;

float watt_factor=0.3125;

unsigned int temp=0,i=0,x=0,k=0;

char str[70],flag1=0,flag2=0;

String bal="";

void setup()

lcd.begin(16,2);

Serial.begin(9600);

pinMode(led, OUTPUT);

pinMode(pulsein, INPUT);

pinMode(relay, OUTPUT);

digitalWrite(pulsein, HIGH);
lcd.setCursor(0,0);

lcd.print("Automatic Energy");

lcd.setCursor(0,1);

lcd.print(" Meter ");

delay(2000);

lcd.clear();

lcd.print("Circuit Digest");

delay(2000);

lcd.clear();

lcd.print("GSM Initilizing...");

gsm_init();

lcd.clear();

lcd.print("System Ready");

Serial.println("AT+CNMI=2,2,0,0,0");

init_sms();

send_data("System Ready");
send_sms();

delay(1000);

digitalWrite(led, LOW);

lcd.clear();

// EEPROM.write(1,0);

// rupees=EEPROM.read(1);

void loop()

serialEvent();

rupees=EEPROM.read(1);

units=rupees/5.0;

lcd.setCursor(0,0);

lcd.print("Units:");

lcd.print(units);
lcd.print(" ");

lcd.setCursor(0,1);

if(rupees<15)

lcd.print("LOW Balance:");

else

lcd.print("Balance:");

lcd.print(rupees);

lcd.print(" ");

read_pulse();

check_status();

if(temp==1)

decode_message();

send_confirmation_sms();

}
}

void serialEvent()

while(Serial.available())

char ch=(char)Serial.read();

str[i++]=ch;

if(ch == '*')

temp=1;

lcd.clear();

lcd.print("Message Received");

delay(500);

break;

}
}

void init_sms()

Serial.println("AT+CMGF=1");

delay(200);

Serial.println("AT+CMGS=\"+918287114222\"");

delay(200);

void send_data(String message)

Serial.println(message);

delay(200);

void send_sms()
{

Serial.write(26);

void read_pulse()

if(!digitalRead(pulsein))

digitalWrite(led, HIGH);

//count++;

//units=watt_factor*count/1000;

if(units<1){}

else

units--;

rupees=units*5;

EEPROM.write(1,rupees);
while(!digitalRead(pulsein));

digitalWrite(led,LOW);

// delay(2000);

void check_status()

if(rupees>15)

digitalWrite(relay, HIGH);

flag1=0;

flag2=0;

if(rupees<15 && flag1==0)

{
lcd.setCursor(0,1);

lcd.print("LOW Balance ");

init_sms();

send_data("Energy Meter Balance Alert:");

send_data("Low Balance\n");

Serial.println(rupees);

delay(200);

send_data("Please recharge your energy meter soon.\n Thank you");

send_sms();

message_sent();

flag1=1;

if(rupees<5 && flag2==0)

digitalWrite(relay, LOW);
lcd.clear();

lcd.print("Light Cut Due to");

lcd.setCursor(0,1);

lcd.print("Low Balance");

delay(2000);

lcd.clear();

lcd.print("Please Recharge ");

lcd.setCursor(0,1);

lcd.print("UR Energy Meter ");

init_sms();

send_data("Energy Meter Balance Alert:\nLight cut due to low Balance\nPlease


recharge your energy meter soon.\n Thank you");

send_sms();

message_sent();

flag2=1;

}
}

void decode_message()

x=0,k=0,temp=0;

while(x<i)

while(str[x]=='#')

x++;

bal="";

while(str[x]!='*')

bal+=str[x++];

}
x++;

bal+='\0';

void send_confirmation_sms()

int recharge_amount=bal.toInt();

rupees+=recharge_amount;

EEPROM.write(1, rupees);

lcd.clear();

lcd.print("Energy Meter ");

lcd.setCursor(0,1);

lcd.print("Recharged:");

lcd.print(recharge_amount);

init_sms();
send_data("Energy Meter Balance Alert:\nYour energy meter has been recharged
Rs:");

send_data(bal);

send_data("Total Balance:");

Serial.println(rupees);

delay(200);

send_data("Eelctricity Has Been Connected\nThank you");

send_sms();

temp=0;

i=0;

x=0;

k=0;

delay(1000);

message_sent();

}
void message_sent()

lcd.clear();

lcd.print("Message Sent.");

delay(1000);

void gsm_init()

lcd.clear();

lcd.print("Finding Module..");

boolean at_flag=1;

while(at_flag)

Serial.println("AT");

while(Serial.available()>0)
{

if(Serial.find("OK"))

at_flag=0;

delay(1000);

lcd.clear();

lcd.print("Module Connected..");

delay(1000);

lcd.clear();

lcd.print("Disabling ECHO");

boolean echo_flag=1;

while(echo_flag)

Serial.println("ATE0");
while(Serial.available()>0)

if(Serial.find("OK"))

echo_flag=0;

delay(1000);

lcd.clear();

lcd.print("Echo OFF");

delay(1000);

lcd.clear();

lcd.print("Finding Network..");

boolean net_flag=1;

while(net_flag)

{
Serial.println("AT+CPIN?");

while(Serial.available()>0)

if(Serial.find("+CPIN: READY"))

net_flag=0;

delay(1000);

lcd.clear();

lcd.print("Network Found..");

delay(1000);

lcd.clear();

}
Chapter-5

5. Screen Shots:

6. TESTING OF PROJECT
With the knowledge of operation of the system was tested step by step to the transistor output
and the load was connected across the collector terminal of the transistor.
ASSEMBLING
The whole system was packed in a plastic casing and provision was made for the IR to sense
light from the outside.

6.1. Software installation:


A bootloader needs to be flashed using USB to Serial or ST-Link (SWD). See Flashing the
bootloader.
Note that after first flashing the bootloader you may have to place the board into "perpetual
bootloader" mode before you can upload a sketch; place a resistor between pin PC14 and 3.3V,
and then reset the board. You should now be able to flash a blank sketch, remove the resistor,
and restart the board, after which uploading new sketches should work as expected. If you find
that the IDE successfully resets your board, but dfu-util complains about no DFU-devices being
present you may have to edit the maple-upload script in tools-folder. Find the line where it calls
upload-reset, and increase the value given to it.
3.7. Software installation:
A bootloader needs to be flashed using USB to Serial or ST-Link (SWD). See Flashing the
bootloader.
Note that after first flashing the bootloader you may have to place the board into "perpetual
bootloader" mode before you can upload a sketch; place a resistor between pin PC14 and 3.3V,
and then reset the board. You should now be able to flash a blank sketch, remove the resistor,
and restart the board, after which uploading new sketches should work as expected. If you find
that the IDE successfully resets your board, but dfu-util complains about no DFU-devices being
present you may have to edit the maple-upload script in tools-folder. Find the line where it calls
upload-reset, and increase the value given to it.

3.8. Software program


The program is written in NodeMCU ESP8266programming language. The code is well
commented and is easy to understand. Compile the autowatering.ino code and upload it to the
microcontroller, using NodeMCU ESP8266IDE version 1.
Blynk app:
Blynk was designed for the Internet of Things. It can control hardware remotely, it can display
sensor data, it can store data, vizualize it and do many other cool things.
There are three major components in the platform:
 Blynk App - allows to you create amazing interfaces for your projects using various widgets
we provide.
 Blynk Server - responsible for all the communications between the smartphone and hardware.
You can use our Blynk Cloud or run your private Blynk server locally. It’s open-source, could
easily handle thousands of devices and can even be launched on a Raspberry Pi.
 Blynk Libraries - for all the popular hardware platforms - enable communication with the
server and process all the incoming and outcoming commands.
 Now imagine: every time you press a Button in the Blynk app, the message travels to space the
Blynk Cloud, where it magically finds its way to your hardware. It works the same in the
opposite direction and everything happens in a blynk of an eye.

Features

 Similar API & UI for all supported hardware & devices


 Connection to the cloud using:
o WiFi
o Bluetooth and BLE
o Ethernet
o USB (Serial)
o GSM

 Set of easy-to-use Widgets


 Direct pin manipulation with no code writing
 Easy to integrate and add new functionality using virtual pins
 History data monitoring via SuperChart widget
 Device-to-Device communication using Bridge Widget
 Sending emails, tweets, push notifications, etc.
 new features are constantly added.
1. Hardware.
An Arduino, Raspberry Pi, or a similar development kit.
Blynk works over the Internet. This means that the hardware you choose should be able to
connect to the internet. Some of the boards, like NodeMCU ESP8266Uno will need an Ethernet
or Wi-Fi Shield to communicate, others are already Internet-enabled: like the ESP8266,
Raspberri Pi with WiFi dongle, Particle Photon or SparkFun Blynk Board. But even if you don’t
have a shield, you can connect it over USB to your laptop or desktop (it’s a bit more complicated
for newbies, but we got you covered). What’s cool, is that the list of hardware that works with
Blynk is huge and will keep on growing.
2. A Smartphone.
The Blynk App is a well designed interface builder. It works on both iOS and Android
Getting Started With The Blynk App
1. Create a Blynk Account
After you download the Blynk App, you’ll need to create a New Blynk account. This account is
separate from the accounts used for the Blynk Forums, in case you already have one. We
recommend using a real email address because it will simplify things later.
An account is needed to save your projects and have access to them from multiple devices from
anywhere. It’s also a security measure. we can always set up your own Private Blynk Server and
have full control.
2. Create a New Project
After you’ve successfully logged into your account, start by creating a new project.

3. Choose Your Hardware


Select the hardware model you will use. Check out the list of supported hardware!

4. Auth Token
Auth Token is a unique identifier which is needed to connect your hardware to your
smartphone. Every new project you create will have its own Auth Token. You’ll get Auth Token
automatically on your email after project creation. You can also copy it manually. Click on
devices section and selected required device :
And you’ll see token :

NOTE: Don’t share your Auth Token with anyone, unless you want someone to have access to
your hardware.
It’s very convenient to send it over e-mail. Press the e-mail button and the token will be sent to
the e-mail address you used for registration. You can also tap on the Token line and it will be
copied to the clipboard.
Now press the “Create” button.
5. Add a Widget
Your project canvas is empty, let’s add a button to control our LED.
Tap anywhere on the canvas to open the widget box. All the available widgets are located here.
Now pick a button.
Widget Box

Drag-n-Drop - Tap and hold the Widget to drag it to the new position.
Widget Settings - Each Widget has it’s own settings. Tap on the widget to get to them.

The most important parameter to set is PIN . The list of pins reflects physical pins defined by
your hardware. If your LED is connected to Digital Pin 8 - then select D8 (D - stands
for Digital).
6. Run The Project
When you are done with the Settings - press the PLAY button. This will switch you from EDIT
mode to PLAY mode where you can interact with the hardware. While in PLAY mode, you
won’t be able to drag or set up new widgets, press STOP and get back to EDIT mode.
You will get a message saying “NodeMCU ESP8266UNO is offline”. We’ll deal with that in the
next section.

Let’s take a look at the example sketch for an NodeMCU ESP8266UNO + Ethernet shield
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
char auth[] = "YourAuthToken";

void setup()
{
Serial.begin(9600); // See the connection status in Serial Monitor
Blynk.begin(auth); // Here your NodeMCU ESP8266connects to the Blynk Cloud.
}

void loop()
{
Blynk.run(); // All the Blynk Magic happens here...
}
Auth Token
In this example sketch, find this line:
char auth[] = "YourAuthToken";
This is the Auth Token that you emailed yourself. Please check your email and copy it, then
paste it inside the quotation marks.
It should look similar to this:
char auth[] = "f45626c103a94983b469637978b0c78a";
Upload the sketch to the board and open Serial Terminal. Wait until you see something like this:
Blynk v.X.X.X
Your IP is 192.168.0.11
Connecting...
Blynk connected!
Congrats! You are all set! Now your hardware is connected to the Blynk Cloud!
Blynking

Go back to the Blynk App, push the button and turn the LED on and off! It should be Blynking.
Check out other example sketches.
Feel free to experiment and combine different examples together to create your own amazing
projects.
For example, to attach an LED to a PWM-enabled Pin on your Arduino, set the slider widget to
control the brightness of an LED. Just use the same steps described above.

6.2. Testing:
System Testing
The purpose of testing is to discover errors. Testing is the process of trying to discover
every conceivable fault or weakness in a work product. It provides a way to check the
functionality of components, sub assemblies, assemblies and/or a finished product It is the
process of exercising software with the intent of ensuring that the Software system meets its
requirements and user expectations and does not fail in an unacceptable manner. There are
various types of test. Each test type addresses a specific testing requirement.
Types of Tests:
Unit testing
Unit testing involves the design of test cases that validate that the internal program logic is
functioning properly, and that program inputs produce valid outputs. All decision branches and
internal code flow should be validated. It is the testing of individual software units of the
application .it is done after the completion of an individual unit before integration. This is a
structural testing, that relies on knowledge of its construction and is invasive. Unit tests perform
basic tests at component level and test a specific business process, application, and/or system
configuration. Unit tests ensure that each unique path of a business process performs accurately
to the documented specifications and contains clearly defined inputs and expected results.
Integration testing
Integration tests are designed to test integrated software components to determine if they
actually run as one program. Testing is event driven and is more concerned with the basic
outcome of screens or fields. Integration tests demonstrate that although the components were
individually satisfaction, as shown by successfully unit testing, the combination of components is
correct and consistent. Integration testing is specifically aimed at exposing the problems that
arise from the combination of components.
Functional test
Functional tests provide systematic demonstrations that functions tested are available as
specified by the business and technical requirements, system documentation, and user manuals.
Functional testing is centered on the following items:
Valid Input : identified classes of valid input must be accepted.
Invalid Input : identified classes of invalid input must be rejected.
Functions : identified functions must be exercised.
Output : identified classes of application outputs must be exercised.
Systems/Procedures: interfacing systems or procedures must be invoked.
Organization and preparation of functional tests is focused on requirements, key functions, or
special test cases. In addition, systematic coverage pertaining to identify Business process flows;
data fields, predefined processes, and successive processes must be considered for testing.
Before functional testing is complete, additional tests are identified and the effective value of
current tests is determined.
System Test
System testing ensures that the entire integrated software system meets requirements. It tests a
configuration to ensure known and predictable results. An example of system testing is the
configuration oriented system integration test. System testing is based on process descriptions
and flows, emphasizing pre-driven process links and integration points.
White Box Testing
White Box Testing is a testing in which in which the software tester has knowledge of the
inner workings, structure and language of the software, or at least its purpose. It is purpose. It is
used to test areas that cannot be reached from a black box level.
Black Box Testing
Black Box Testing is testing the software without any knowledge of the inner workings,
structure or language of the module being tested. Black box tests, as most other kinds of tests,
must be written from a definitive source document, such as specification or requirements
document, such as specification or requirements document. It is a testing in which the software
under test is treated, as a black box .you cannot “see” into it. The test provides inputs and
responds to outputs without considering how the software works.
Unit Testing:
Unit testing is usually conducted as part of a combined code and unit test phase of the
software lifecycle, although it is not uncommon for coding and unit testing to be conducted as
two distinct phases.
Test strategy and approach
Field testing will be performed manually and functional tests will be written in detail.
Test objectives
 All field entries must work properly.
 Pages must be activated from the identified link.
 The entry screen, messages and responses must not be delayed.
Features to be tested
 Verify that the entries are of the correct format
 No duplicate entries should be allowed
 All links should take the user to the correct page.
Integration Testing
Software integration testing is the incremental integration testing of two or more
integrated software components on a single platform to produce failures caused by interface
defects.
The task of the integration test is to check that components or software applications, e.g.
components in a software system or – one step up – software applications at the company level –
interact without error.
Test Results: All the test cases mentioned above passed successfully. No defects encountered.
Acceptance Testing
User Acceptance Testing is a critical phase of any project and requires significant
participation by the end user. It also ensures that the system meets the functional requirements.
Test Results: All the test cases mentioned above passed successfully. No defects encountered.
Acceptance Testing
User Acceptance Testing is a critical phase of any project and requires significant
participation by the end user. It also ensures that the system meets the functional requirements.
Test Results: All the test cases mentioned above passed successfully. No defects encountered.

7.CONCLUSION:
This proposed simple and economic digital prepaid energy meter controlled by GSM based
communication can cover rural area as well as urban areas. This is an effort about improving the
present conventional electromechanical meters through the fusion of analog and digital circuits
which have aim of collecting bills for consumption of power thus improved the revenue
collection for scheduled supply. This is beneficial for Nigeria like developing country which
having huge population for improving economic through power utility. The primary motivation
for the construction of an IOT-based E-meter is to lower household power usage. It saves money
and human power by avoiding human interference. Both automatically and manually, it
functions. Without requiring human participation, this metre sends billing immediately to a
mobile device before the due date. First, we need to turn on the mains, which detects how much
electricity the load is using. Analogue output is provided by this. The monitoring hardware
system is connected to the internet using the Node MCU. The cloud, or Thing Speak cloud,
graphically displays the amount of electricity used by the load. It periodically displays how much
electricity is being used by the linked load or loads. An novel IOT application called energy
monitoring was created to enable remote cloud-based home appliance control from any location
in the world. In the project under consideration, a current sensor is employed to gauge the current
and show it online via IoT. The system uses the public cloud BLYNK to update the information
on the internet every 1 to 2 seconds. Wi-Fi is used in the current system to access energy load
consumption, which will aid users in reducing unnecessary electricity use. IoT technology that
enables online bill payment and energy use monitoring. Additionally, a system that sends an
SMS to a user when their electricity usage exceeds a certain threshold can be installed. When
theft is discovered at the consumer end, we can create systems that can SMS the concerned metre
reading man of that region. Additionally, we can forecast future energy consumptions utilising
cloud analytics.

7.1.Advantages:
a) Up front payment for electricity: Energy is paid for before it is consumed
b) No unpaid bill: Because energy is prepaid the problem of collection of arrears and
unpaid bills will be no more.
c) No meter readings
d) Lower overheads
e) No incorrect bills
7.2. Objective of the project
 To avoid more consumption of electricity.
 Reduction of man-power.
 Increase the accuracy of the meter reading.

8. Future Work:
The development of GSM based energy meter demonstrates the concept and implementation of
new power metering system. GSM based AMR have low infrastructure cost, low operating costs,
more data security and less man power required. It not only solve the problem of manual meter
reading but also provide additional feature such as power disconnect, power connect , power cut
alert and tempering alert customer can also pay bill via online login on authenticated web. Data
base server can stored the current month data and also all previous month data for future use. So
it saves a lot amount of time and energy. Furthermore this can whole contribute towards smarter
grid system

9. REFERENCES:
[1]. Amit, J. and Mohnish, B. (2011). A Prepaid Meter using mobile communication Hong.
International Journal of Engineering, Science and Technology 3(3), 2011, pp. 160-166
[2]. Ning, L. (2004). Design and Implementation of Remote Intelligent Management System for
City Energy Resources base on Wireless Network. Study of Computer Application 12:237-239.
International Journal of Engineering, Science and Technology, 3(3), 2011, pp. 160-166.
[3]. Koay .B.S, Cheah.S.S, Sng .Y.H,Chong. P.H.J, Shun.P,Tong.Y.C (2003) . Design and
implementation of a Blue tooth energy meter. proceedings of the Joint 4th International
Conference on Information, Communication and Signal, Processing and the 4th Pacific Rim
Conference on Multimedia .3: 1474-1477
[4]. Kwan, B.H., Moghavvemi, M. (2002), “PIC Based Smart Card Prepayment System.”
Student Conference on Research and Development, pp. 440- 443.
[5]. Ling Zou, Sihong Chu and Biao Guo. (2010). “The Design of Prepayment Polyphase Smart
Electricity Meter System, International Conference on Intelligent Computing and Integrated
Systems (ICISS), pp. 430-432, 22-24, Dec 2010.
[6]. Maheswari, C; Jejanthi, R (2009). Implementation of Energy Management Structure for
street Lighting System. A Journal of Modern Applied Science 5:6-10
[7]. Malik S.H .l, Aihab. K, and Erum .S (2009). SMS Based Wireless Home Appliance Control
System (HACS) for Automating Appliances and Security. Issue in informing Science and
Information Technology 6:887-894.
[8]. Joy, N. K. (2006). Electrical Energy Accounting Methods. Lagos Nigeria: Impressed
Publishers, 1-8.
[9]. Omijeh, B. O. (2012). Design and Evaluation of GSM-based Intelligent Prepaid Energy
Metering System for Nigeria, Ph.D Thesis. . Ekpoma: Ambrose Alli University,
[10]. Scaradozzi, D and Conte, G. (2003). Viewing home automat ion systems as multiple agents
systems. Robo CUP 2003, Padova, Italy. Retrieved from
http://www.robosiri.it/ROBOCUP_2003/ROBOCUPSITOSIRI/articles/pdf/Cont e.pdf
[11]Kwan, B. M. (2002). PIC Based Smart Card Prepayment System. Student Conference on
Research [6] and Development.
[12] Ling Zou, S. C. (2010). The Design of Prepayment Polyphase Smart Electricity Meter
System. [8] International Conference on Intelligent Computing and Integrated Systems (ICISS).
[13] Maheswari, C., & Jejanthi, R. (2009). Implementation of Energy Management Structure for
street [10]Lighting System. Journal of Modern Applied Science.
[14]Md. Mejbaul Haque, M. K. (2011). Microcontroller Based Single Phase Digital Prepaid
Energy meter. [12]Ning.L, H. L. (2004). Design and Implementation of Remote Intelligent
Management System for City
[15]Energy Resources base on Wireless Network. [14]P. Harish M.Tech, S. S. (2012). GSM
Based Automatic Wireless Energy Meter Reading System.
[16]International Journal of Engineering Research & Technology (ERT).
[17] “Billing metering using sampled value”, basic idea given by J. Widmer, Landis IEEE 2014.
[18] A prepaid meter using model communication by Amit Jain, MohnishBagree, International
Joural of Engineering, Science and Technology Vol. 3, No. 3, 2011, pp. 160-166.
[19] Design and Implementation of smart energy meter ny V.Preethi, G. Harish, 2016
International Conference on Inventive Computation Technologies (ICICT).
[20] “GSM Enabled Smart Energy Meter and Automation of Home Appliances”, presented by
Himshekhar Das, L.C.Saikia, PP978-1-4678-6503-1, 2015 IEEE.
[21] “Virtual smart metering in automation and simulation of energy efficient lighting system”,
done by Cheng Pang, Valierry Vyatkin, YInbai Deng, Majidi Sorouri, IEEE 2013.
[22] Sehgal VK, Panda N, Handa NR, Naval S & Goel V, “Electronic Energy Meter with instant
billing”, Fourth UKSim European Symposium on Computer Modeling and Simulation (EMS),
(2010), pp.27-31.
[23] Yaacoub E & Abu-Dayya A, “Automatic meter reading in the smart grid using contention
based random access over the free cellular spectrum”, computer networks, (2014).
[24] Ashna K & George SN, “GSM based automatic energy meter reading system with instant
billing”, Proceeding of international multi conference on automation, computing,
communication, control and compressed sensing (Imac4S),Vol.65,No.72, (2013), pp.22-23.
[25] Malik NS, kupzog F & Sonntag M, “An approach to secure mobile agents in automatic
meter r eading”, IEEE International Conference on Cyber worlds, computer society, (2010),
pp.187-193.
[26] Praveen MP, “KSEB to introduce SMS-based fault maintenance system”, The hindu news,
(2011

You might also like