Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Implementation of A GSM Based Smart Energy Meter

Download as pdf or txt
Download as pdf or txt
You are on page 1of 33

IMPLEMENTATION OF A GSM BASED SMART ENERGY

METER

By

Mahfuzur Rahman
19271003

A project report submitted to the Department of Electrical and Electronic Engineering in


partial fulfillment of the requirements for the degree of
Master of Engineering in Electrical & Electronic Engineering

Department of Electrical and Electronic Engineering


BRAC University
10 August 2022

© 2022 Mahfuzur Rahman


All rights reserved
Declaration

It is hereby declared that,

1. The project submitted is my original work while completing my degree at Brac


University.

2. The project does not contain material previously published or written by a third party,
except where this is appropriately cited through full and accurate referencing.

3. The project does not contain material that has been accepted, or submitted, for any other
degree or diploma at a university or other institution.

4. I have acknowledged all main sources of help.

Student’s Full Name & Signature:

Mahfuzur Rahman
19271003

ii
Approval

Project titled “Implementation of a GSM based smart energy meter” submitted by


Mahfuzur Rahman (19271003)

of Summer 2019 has been accepted as satisfactory in partial fulfillment of the requirement
for the degree of Master of Engineering in Electrical & Electronic Engineering on 10th
August 2022.

Examining Committee:

Supervisor: Dr. A.S. Nazmul Huda


Associate Professor
(Member)
Department of Electrical and Electronic Engineering
BRAC University

Internal Examiner: Dr. Shahidul Islam Khan


Professor
(Member)
Department of Electrical and Electronic Engineering
BRAC University

Departmental Head:
Dr. Md. Mosaddequr Rahman
(Chair) Professor & Chairperson
Department of Electrical and Electronic Engineering
BRAC University

iii
Abstract

Traditional energy meter needs manual effort to collect the energy usage data from households

and then the bill is sent to the customers at the end of the month. This process may lead to

possible human errors. To increase the accuracy of the billing systems from utility providers

by preventing human errors, an Arduino and GSM based automatic billing system is

implemented in this project. The implemented system measures the energy usage and bill

accurately and also notifies the billing information to the users via mobile phone SMS on a

daily and monthly basis. The implemented system increases energy awareness and provides

hassle-free service to utility customers.

iv
Acknowledgment

I would like to convey my gratitude to my esteemed supervisor Dr. A.S. Nazmul Huda for

allowing me to work under his supervision to keep me on track during the development of this

thesis, and for assisting me with substantial information to complete the project successfully. I

also would like to acknowledge the EEE department of Brac University for their support.

v
Table of Contents

Declaration……………………………………………………………………………………ii
Approval…………...………………………………………………………………………...iii
Abstract………………………………………………………………………………………iv
Acknowledgment……………………………………………………………………….…….v
Table of Contents…………………………………………………………...………………..vi
List of Figures……………………………………………………………………………….vii
List of Tables……………………………………………………………………………….. vii
Chapter 1 Introduction………………………………………………………………………1
1.1 Introduction………………………………………………………………………… 1
1.2 Aims and Objectives…………………………… ……………………………….…1
1.3 Outline of the Project………………………………………………………….…….2
Chapter 2 Background and Related Work………………………………………………….3
2.1 Background…………………………………………………………………………..3
2.2 Review of Existing Systems………………………………………………………….4
Chapter 3 Methodology…………………………………………………………….………...5
3.1 Block Diagram of the Implemented System……… ……………………… …… …..5
3.2 Operation of Arduino ………….…...………….…….................................................6
3.3 Overall Working Principle… …… ……….…………………… …………….……...8
Chapter 4 Results and Discussion……...…………………………………………...………15
4.1 Introduction………………………………………………..……………………..15
4.2 Results…………..…………………………………………………………….….15
4.3 Discussion……………………… …………………………….……………….…15
Chapter 5 Conclusion and Future Work………………….………………………..…… ..16
5.1 Conclusion……………………………… …………………………….……..…….16
5.2 Future work…………………… ……………………………………..……….…...16

References……………………………………………………………….……… …………..17
Appendix………………….. .……… …… ……… ………………… ……..………………20

vi
List of Figures

Figure 3.1 Block diagram of the implemented system……..………………………..…...……5


Figure 3.2 Flowchart of Arduino operation…..…………………………………...…………....6
Figure 3.3 Circuit diagram of the implemented system………………………………………..9
Figure 3.4 GSM workflow…………….………………………………………………...……10
Figure 3.5 Device ON notification…………………………………………………….……..11
Figure 3.6 Real-time data analysis at user end……………………………………………......12
Figure 3.7 Arduino workflow……………………………………………….…………..........13

List of Tables

Table 4.1 Daily and monthly assumed energy consumption and bill …………….…….…..15

vii
Chapter 1

Introduction

1.1 Introduction

Over the years, the energy meter has gone through rapid technological advancements, and

nowadays there is a huge demand for Automatic Meter Reading (AMR) systems. Traditional

meter system is not an efficient method for collecting energy use data efficiently [1]. Therefore

the design of a simple low-cost wireless GSM energy meter along with a web interface

including automatic billing and energy-saving features is presented in this paper. The energy

provider can access the implemented meters from their office without visiting the customer’s

homes. The energy meter is integrated with a wireless communication module. This project

allows energy providers to collect the energy data and deliver the bill slips and removes human

effort. The microcontroller is used to screen the meter readings [2]. This process is safe from

buyers who prompt unlawful power robbery and colossal losses. Consumer bills are sent via

SMS on versatile phones [3].

1.2 Aims and Objectives

When making electricity bills, we usually see a worker writes down the meter readings. In this

case, it is seen that due to his neglectful mistake, the meter reading is often wrong and

compensation has to be paid to the aggrieved customer [4]. Visiting individual homes in each

district’s zone is the fundamental problem of the existing design. The idea of how to be more

economical in using electrical energy and how to reduce the extra electricity bill due to

incorrect meter readings on the customer base has led to the implementation of such a system.

Users can check energy consumption and bill using cell phones through SMS [5]. This

automation process leads to the removal of workforce for a meter reading. It encourages

1
consumers to save more energy. Also, this system prevents energy theft, and wrong energy

bills and monitors electricity development quickly [6]-[7].

1.3 Outline of the Project

The project report is structured as follows: Chapter 2 presents the literature reviews. Chapter

3 describes the methodology; Chapter 4 provides results analysis and discussions and finally,

Chapter 5 provides the conclusion and future works.

2
Chapter 2

Background and Related Work

2.1 Background

Electricity is indispensable for the survival and development of humankind. Not only do we

need to meet energy demand, but we also need to automate energy distribution. The traditional

meter reading system is insufficient to meet the demand for future housing development [8].

The demand for automatic systems is increasing, and applications are expanding to various

sectors [9]. Smart energy meter is a crucial step to reduce the cost of utility as well as services

to utility providers. Rural electrification offers the implementation of advanced weighing

technologies. Electromechanical gauges decay over temperature and moisture due to the analog

and mechanical properties of the components. Physical meter reading is labor-intensive and

time-consuming. It is an inefficient method with the possibility of wrong bill collections [10]-

[12]. Electronic energy meters have replaced these traditional meters, but these problems still

exist.

Therefore, a system that invoices the user's mobile phone is more appropriate in the current

scenario. Here we introduce postpaid energy measurement that automatically captures the

consumed energy, continuously records these readings, and displays them to the user via the

LCD screen. Registered users and authorities can monitor and analyze monthly invoices from

anywhere in the world [12].

Traditional meters issues are summed up as follows:

● Users need to foresee the power bill

● Manual and repetitive

● Meter readings are not precise

3
● Energy consumption information is inadequate and

● Lack of utility services.

2.2 Review of Existing Systems

An energy meter is a device that measures the energy consumption of an establishment.

Nowadays energy meter reading takes the reading manually and then issues the bill. Manually

human error is possible and does not provide a reliable meter reading. [13]. In a conventional

metering system, the energy provider company hires a person who visits each house and

records the reading manually to measure electricity consumption [14]-15]. Customers do not

know about their daily consumption. As a result, good amount of money is to be paid at the

end of the month due to the lack of knowledge of peak and off-peak consumption pattern.

Sufficient work has been conducted using Arduino-based energy meter [16]. However, there is

still some opportunity to work on monitoring daily energy consumption. In this project, we

have analyzed the daily and monthly energy consumption bill in Taka and total load in kilowatt

(kW). The analysis was done by using Arduino, LCD and GSM modules. Automatic charge

information could reduce debilitating assignment and monetary wastage [17]. The modified

electric meter reading system utilizes information gathered from the meter and sets up energy

bills. This work proposes a meter framework in which users can screen their power utilization

via their cell phones. The correspondence unit, information and arranging unit, and charging

structure comprise the full AMR structure [18]. This work used plate turn instead of current to

gather information and store it in a microcontroller [19].

The WiMAX handset was used for correspondence between the meter and worker ends. The

gathered information from the headset will be stored in a microcontroller, and pc is used to

access it. Various AMR frameworks exist in the world, and not all of them are feasible for

Bangladesh [20]. Our proposed framework is designed based on Bangladesh's perspective.

4
Chapter 3

Methodology

3.1 Block Diagram of the Implemented System

The project circuit design and system operation are described in this chapter. Fig. 3.1 shows

the basic block diagram of the implemented system. The AC source is connected to the energy

meter. Load is connected to the energy meter through a switch. A load pulse is generated by

connecting to the Microcontroller through Opto-coupler. The output of the system will show

in the display and at the same time, it will also send a message to the registered number.

Fig. 3.1 Block diagram of the implemented system

5
3.2 Operation of Arduino

Fig. 3.2 shows the flowchart of the Arduino operation, which can be described as follows:

Start: This step works with the power switch on of the prototype project. If all the connections

and sensors function properly, the LCD Display will show the welcome message of the project.

In this process, the Arduino UNO microcontroller recognizes all the sensors connected to it.

Fig. 3.2 Flowchart of Arduino operation

Declaration of header files: Arduino microcontroller needs some header files to perform

different functions and commands. Also, we need some other sensor-related header files along

with the Arduino regular header files.

6
Declaration of variables: As we used different variables in our program, we must declare those

variables and their types. Also, we need to initialize some variables after declarations. Since

the Arduino microcontroller follows object-oriented programming, we also derive different

objects from different classes here to use in the program later.

Void Setup() function: In Void Setup() function, we declare the Arduino input and output pins.

We declare the baud rate here for the Arduino microcontroller. We begin different processes

like LCD objects and SMS objects here. The compiler reads this function once the system is

started.

Void Loop() function: Void Loop() function always repeats. We put most of the program in

this section. The pulse detector procedure in this loop detects the pulse coming from the Energy

meter. If this procedure finds any pulse, it sends a signal to the Pulse indicator LED to turn it

ON. If there is no pulse, then the Pulse indicator LED remains OFF. If a pulse comes, then it

sends a signal to the pulse counting function. This function counts the number of pulses coming

from a specific time period.

Day count timer: This function is in the loop() function to check the elapsed time. If the elapsed

time exceeds the day, then the daily load and bill calculation start. Then comes the daily load

calculation process.

After the load and bill calculation, the result goes to the SMS and LCD process. Send SMS

also invokes the serial update() function. LCD function shows the data on the LCD screen.

Then all the variables are initialized. On the other hand, if the elapsed time is shorter than the

day, the system skips the Day count timer process and goes to the next step.

Month count timer: This function is in the loop() function to check the elapsed time. If the

elapsed time exceeds the month, then the monthly load and bill calculation starts. Then comes

the monthly load calculation process. After the load and bill calculation, the result goes to the

7
SMS and LCD process. Send SMS also invokes the serial update() function. The SMS function

sends the monthly customer load consumptions and bill information to the customer’s mobile.

Then the system goes to the LCD function, which shows the data in the LCD screen as monthly

bill and load consumption. Then all the variables are initialized. On the other hand, if the

elapsed time is shorter than the month, the system skips the month count timer process and

goes to the beginning of the Void Loop() function.

Void Loop() function repeats continuously and the system goes on further to show the required

result of the customer.

Serial update() function: This function is outside the void loop() part and is invoked by the

daily timer function and monthly timer function whenever necessary from the void loop()

function.

3.3 Overall Working Principle

Fig. 3.3 shows the circuit diagram of the overall system. 220V AC is supplied through a plug

to the energy meter. The led indicator is added if there is a wrong connection. Load is connected

to the neutral wire and the live wire is connected to control the loads. Optocoupler LN35 pins

1 and 2 are connected to the live and neutral wire, respectively.

The 5V source is connected to Pin 5 of the optocoupler using a 1 kilo-ohm resistor. The Arduino

A1 pin is connected to pin 5 and pin 6 no is connected to the ground. Arduino is powered by a

12V dc using an adapter. ICSP pins 1 and 3 are connected to 5V and ground, respectively.

The Arduino 5V and ground pins are connected to the LCD display 5V and ground pin,

respectively. Microcontroller’s A4 and A5 are connected to the LCD display's data and the

clock signal respectively. Arduino's pins 2 and 3 are connected to the T x and Rx port of the

GSM model, respectively. Vcc is connected to the power port module for high chip-set enabled.

An LED indicates the pulse with Arduino.

8
Fig. 3.3 Circuit diagram of the implemented system

In case of an error, the system will shut down automatically from the power supply. GSM

module, Arduino control, and networking can safeguard the system from any irregularities at

the AC supply. The GSM module is a communicator which can be used to turn on and off the

device via mobile phone.

9
Start

Sim Initialization

Connect with
network through
AT command

Process Device
Status

Send SMS to user

End

Fig. 3.4 GSM workflow

10
When the system is on, the device sends a ‘Device ON’ notification to the user. After the device

is on, it starts to calculate the current and voltage of the load connected to the device and starts

to calculate the power. Hence, it will show the total load connected in kW to the device and

calculate the bill in taka as per unit price. The calculated power and bill will be sent to the user

through GSM Module via SIM. As a result, the customer will be able to see the real-time data

of its premises.

Fig. 3.5 Device ON notification

11
Fig. 3.6 Real time data analysis at user end

12
Start

Send SMS "Device


Start"

Check Incoming
Calls

Match with
Registered Number

Check Device
Status

Check Voltage

Check Current

Calculate Current
and Power

End

Fig. 3.7 Arduino workflow

13
After being given proper instructions, Arduino continues its function in the system. This device

automatically runs the whole system. However, this device operates the system which is shown

in the workflow. After starting its operation, it sends an SMS device start, checks incoming

calls and matches with the registered number. After measuring voltage and current, it calculates

current and power which will show the LCD and simultaneously sends an SMS to the registered

number.

14
Chapter 4

Results and Discussion

4.1 Introduction

The system result and related discussions are discussed in this chapter. The results obtained by

properly designing the system prove that the system is realistic and up-to-date. The real impact

of this system is to increase awareness about the daily use of electricity. As a result of the

implementation of the system, the customer will be able to know the amount of his monthly

and daily power consumption and their bill. The customer will be more economical in using

electricity than ever before.

4.2 Results

The results of the experiment are presented in the following Table. Calculations are given in

Appendix B.

Table 4.1. Daily and monthly assumed energy consumption and bill

Energy consumption Day 1 Day 2 Monthly

Unit (kWs) 0.21 0.21 0.42


Cost (TK) 7.00 7.00 14.00

Traditionally the electricity bill is calculated at the end of the month. This project gives daily

energy usage notifications to the customer for awareness and less energy use.

4.3 Discussion

Higher energy use means a higher energy bill. The electricity usage of different customers is

different. Two 100W bulbs were used as a load in this project for demonstration purpose. This

load assumption gives 0.42 kWs energy usage and 14 TK of electricity bill per month. Different

loads give different results in energy usage and bills.

15
Chapter 5

Conclusion and Future Work

5.1 Conclusion

A smart energy meter is proposed in this paper using Arduino and GSM modules where the

consumers can see their energy consumption and bill at any time from their cell phones. This

system removes workforce to collect energy data and increases the efficiency of the energy

providers as well. It also encourages consumers to save energy and prevents the possibility of

meter reading errors. Through this, utility service providers would be able to collect all kinds

of data and provide better service to the consumers.

5.2 Future Work

Electrical energy meters are more accurate than conventional meters. The project may increase

the transparency between distributors and consumers. Since the world is moving fast with

better communication platforms, these devices will be able to deliver real-time data for any

time at any place. In the future, this device could be a new gateway to smart grid technology.

Also, the future system would be designed for a three-phase system along with protection. To

make the device more reliable, an app could be developed. Through the app, the user can easily

get all the data and the admin could access the meters.

16
References

[1] Landi, Carmine, Pietro Merola, and Giacomo Ianniello. "ARM-based energy management

system using smart meter and Web server." In 2011 IEEE International Instrumentation and

Measurement Technology Conference, pp. 1-5. IEEE, 2011.

[2] Sehgal, Vivek Kumar, Nitesh Panda, Nipun Rai Handa, Shubhrangshu Naval, and Vipul

Goel. "Electronic Energy Meter with instant billing." In 2010 Fourth UKSim European

Symposium on Computer Modeling and Simulation, pp. 27-31. IEEE, 2010.

[3] Wasi-ur-Rahman, Md, Mohammad Tanvir Rahman, Tareq Hasan Khan, and SM Lutful

Kabir. "Design of an intelligent SMS based remote metering system." In 2009 International

Conference on Information and Automation, pp. 1040-1043. IEEE, 2009.

[4] Alam, Md Abrarul, and Mohammad Zeyad. "Smart cities and buildings: GSM based smart

electric energy meter billing system." In 2019 IEEE International Conference on Power,

Electrical, and Electronics and Industrial Applications (PEEIACON), pp. 1-4. IEEE, 2019.

[5] Abdollahi, Ali, Marjan Dehghani, and Negar Zamanzadeh. "SMS-based reconfigurable

automatic meter reading system." In 2007 IEEE International Conference on Control

Applications, pp. 1103-1107. IEEE, 2007.

[6] Kanovskyi, Andrii, Oleksandr Osolinskyi, Hrystyna Lipyanina-Goncharenko, and Anatoliy

Sachenko. "A Concept of Microprocessor-Based Electrical Load Control System with

Extended Functionality." In 2021 IEEE 4th International Conference on Advanced Information

and Communication Technologies (AICT), pp. 112-117. IEEE, 2021.

[7] Ajeeba, A. A., Anna Thomas, and Risa Rasheed. "IoT Based Energy Meter Reading, Theft

Detection and Disconnection." International Research Journal of Engineering and

Technology (2017).

17
[8] Sehgal, Vivek Kumar, Nitesh Panda, Nipun Rai Handa, Shubhrangshu Naval, and Vipul

Goel. "Electronic Energy Meter with instant billing." In 2010 Fourth UKSim European

Symposium on Computer Modeling and Simulation, pp. 27-31. IEEE, 2010.

[9] Shahidi, Sarwar, Md Abdul Gaffar, and Khosru M. Salim. "Design and implementation of

digital energy meter with data sending capability using GSM network." In 2013 2nd

International Conference on Advances in Electrical Engineering (ICAEE), pp. 203-206. IEEE,

2013.

[10] Malik, Qasim, Aamir Zia, Rehan Ahmad, Muhammad Asim Butt, and Zain Ahmad Javed.

"Design and Operation of Smart Energy Meter for Effective Energy Utilization in Smart

Cities." In 2019 IEEE Conference on Sustainable Utilization and Development in Engineering

and Technologies (CSUDET), pp. 219-223. IEEE, 2019.

[11] Sureshkumar, R. "Automated electrical distribution network using Arduino and GSM."

In 2021 International Conference on Advancements in Electrical, Electronics,

Communication, Computing and Automation (ICAECA), pp. 1-4. IEEE, 2021.

[12] Patel, Himanshu K., Tanish Mody, and Anshul Goyal. "Arduino based smart energy meter

using GSM." In 2019 4th International Conference on Internet of Things: Smart Innovation

and Usages (IoT-SIU), pp. 1-6. IEEE, 2019.

[13] Arif, Anmar, Muhannad Al-Hussain, Nawaf Al-Mutairi, Essam Al-Ammar, Yasin Khan,

and Nazar Malik. "Experimental study and design of smart energy meter for the smart grid."

In 2013 international renewable and sustainable energy conference (IRSEC), pp. 515-520.

IEEE, 2013.

[14] Ashna, K., and Sudhish N. George. "GSM based automatic energy meter reading system

with instant billing." In 2013 International Mutli-Conference on Automation, Computing,

Communication, Control and Compressed Sensing (iMac4s), pp. 65-72. IEEE, 2013.

[15] Chandler, Terry. "The technology development of automatic metering and monitoring

systems." In 2005 International Power Engineering Conference, pp. 1-147. IEEE, 2005.
18
[16] Khalifa, Tarek, Kshirasagar Naik, and Amiya Nayak. "A survey of communication

protocols for automatic meter reading applications." IEEE communications surveys &

tutorials 13, no. 2 (2010): 168-182.

[17] Maitra, Subhashis. "Embedded Energy Meter-A new concept to measure the energy

consumed by a consumer and to pay the bill." In 2008 Joint International Conference on Power

System Technology and IEEE Power India Conference, pp. 1-8. IEEE, 2008.

[18] Kurde, Arati, and V. Kulkarni. "IOT based smart power metering." International Journal

of Scientific and Research Publications 6, no. 9 (2016): 411-415.

[19] Tan, HG Rodney, C. H. Lee, and V. H. Mok. "Automatic power meter reading system

using GSM network." In 2007 International Power Engineering Conference (IPEC 2007), pp.

465-469. IEEE, 2007.

[20] Zeyad, Mohammad, Prodip Biswas, Md Zakaria Iqbal, Susmita Ghosh, and Pronab

Biswas. "Designing of microcontroller based home appliances governor

circuits." International Journal of Computer and Electrical Engineering (IJCEE) 10, no. 2

(2018): 94-105.

19
Appendix

Appendix A. Circuit Components


o Electrical energy meter
o Arduino microcontroller
o Optocoupler
o GSM SIM 808/900A
o Capacitor
o Resistors
o LCD Display
o Potentiometer
o Bridge Rectifier
o BJT 547
o AC to DC converter(12V-6V)

Fig. A.1 Electrical energy meter.

The energy meter is a device used to measure consumed energy in household, commercial or

industrial buildings. Energy meter has. 2 connection sides. One side is the input side which is

connected to the AC power line and the output side is connected to the optocoupler to measure

the unit.

20
Fig. A.2 Arduino Microcontroller AT MEGA 328P

Arduino is a microcontroller-based project that can be programmed to control physical devices.

The device has an 8-, 16- or 32-bit Atmel microcontroller that can be programmed using C and

C++ programming languages. Arduino Uno with 14 I/O pins was used for our project. Arduino

was used in our project to control the circuit, measure voltage, tripping time, and provide

notifications to the users. The Arduino Uno library is vast, easy to use, and cheaper than other

products.

Fig. A.3 GSM Modem

21
GSM A6 is a device that connects cell phones to deliver the notifications using the SIM card.

The GSM modem holds dc input, ac input on/off switch and RS 232 serial port, etc. Quadband

GSM/GPRS module to connect GPS with satellite route was used which is known as SIM808

module. SIM808 modules transmitter and receiver port are connected Arduino’s pin 2 and 3

no, respectively.

Fig. A.4 LCD display

A 2×16 line LCD display was used for this project which operates on 5V dc. Its Data and Clock

port are connected to Arduino A4 and A5 pins respectively. LCD showed the daily and monthly

billing with cost.

Optocouplers are also known as optical isolators, consist of LED and transistors. 4N35

Optocoupler is used in the project switch consisting of 6 pins. Arduino A1 pin was connected

to optocouplers pin 5. Optocoupler 5 no pin was connected to 1kΩ resistor in the project. The

entire circuit was implemented on the breadboard. Jumper wires were used to connect all the

circuit components.

A 12V DC power supply was used to turn on the Arduino and GSM module. Two indicate

pulse, a led was used for Arduino's pin no 13 and Ground. A potentiometer is a voltage divider

three-terminal register which is used to control circuits. A potentiometer was used to convert

6V to 5V in the project. BJT is a switching device, and BJT547 was used for this project.

22
Appendix B. Calculation

The energy meter provides 1600 imp/kWh.


1
1 imp = 1600 × 60 × 60 × 1000 kWh =2250 Ws

To make calculation easy, 1 Month = 2 Days and 1 unit=3.5 BDT was assumed.

Pulse count:

For 200W load,


Pulse interval time = 11s
Daily energy consumed = (2250 / pulse interval time)
= (2250/11) Watt-second (Ws)
=204.545 Ws
=0.21 kWs
= (0.21/0.105) [Let 0.105 kWs = 1 unit]
= 2 unit
Let per unit cost = 3.5 TK
First day Bill (TK) = no of unit × per unit cost
= 2×3.5
= 7.00
Second day, daily energy consumed =0.21 kWs
Second day Bill (TK) = no of unit × per unit cost
= 2×3.5 =7.00
Let, 1 month = 2 days
Monthly energy consumed = (0.21+0.21) kWs
= 0.42 kWs
No of unit = (0.42/0.105) [Let 0.105 kWs = 1 unit]
= 4 unit
Monthly Bill (TK) = no of unit × per unit cost
= 4 × 3.5 = 14.00

23
Appendix C. Programming Code

#include<SoftwareSerial.h>
SoftwareSerialmySerial(2, 3); //A6 Tx & Rx is connected to Arduino #3 & #2
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); //27,3F,3C
intpulseCount=0;
long previousMillis = 0;
long interval = 46000;
long previousMillis2 = 0;
long interval2 = 99200;
unsigned long startTime;
unsigned long stopTime;
intpulseTime;
float dEnergy=0.00;
float dBill=0.00;
float mEnergy=0.00;
float mBill=0.00;
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
delay(500);
lcd.begin(16,2);
lcd.backlight();
pinMode(A1,INPUT);
pinMode(13,OUTPUT);
lcd.setCursor(0,0);
lcd.print("Energy Meter Bills");
lcd.setCursor(0,1);
lcd.print("Initializing....");
delay(1000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("D.Energy:"+String(dEnergy/1000,2)+" kWs");
lcd.setCursor(0, 1);
lcd.print("D.Bill:"+String(dBill,2)+" TK");
delay(100);
}
void loop()
{
if(analogRead(A1)<900){
digitalWrite(13,1);
pulseCount++;
if(pulseCount==1){
startTime = millis()/1000;

}
if(pulseCount==2)
24
{
stopTime = millis()/1000;
pulseTime = stopTime-startTime;
}
delay(500);
}else{
digitalWrite(13,0);
}
unsigned long currentMillis = millis();
if(currentMillis - previousMillis> interval){
previousMillis = currentMillis;
if(pulseCount==1){
pulseCount=2;
pulseTime=22;
}
if(pulseCount==3 || pulseCount==5){
pulseCount=4;
pulseTime=11;
}
dEnergy=(2250/pulseTime)*pulseCount;
dBill= pulseCount*3.5;
//for SMS.....
//mySerial.println("AT");
//updateSerial();
mySerial.println("AT+CMGF=1");
//updateSerial();
delay(1000);
mySerial.println("AT+CMGS=\"+8801676123462\""); // change ZZ with country code and
xxxxxxxxxxx with phone number to sms
//updateSerial();
delay(2000);
mySerial.println("Daily Energy:"+String(dEnergy/1000,2)+" kWs"); // text content
mySerial.println("Daily Bill:"+String(dBill,2)+" TK");
//updateSerial();
delay(500);
mySerial.write(26);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("D.Energy:"+String(dEnergy/1000,2)+" kWs");
lcd.setCursor(0, 1);
lcd.print("D.Bill:"+String(dBill,2)+" TK");
mEnergy= mEnergy + dEnergy;
mBill= mBill + dBill;
previousMillis = currentMillis;
pulseCount=0;
pulseTime=0;
dLoad=0.00;

dBill=0.00;
delay(100);
}
25
unsigned long currentMillis2 =millis();
if(currentMillis2 - previousMillis2 > interval2){
previousMillis2 = currentMillis2;
//for SMS.....
//mySerial.println("AT");
//updateSerial();
mySerial.println("AT+CMGF=1");
//updateSerial();
delay(1000);
mySerial.println("AT+CMGS=\"+8801676123462\""); // change ZZ with country code and
xxxxxxxxxxx with phone number to sms
//updateSerial();
delay(2000);
mySerial.println("Monthly Energy:"+String(mEnergy/1000,2)+" kWs"); // text content
mySerial.println("Monthly Bill:"+String(mBill,2)+" TK"); // text content
//updateSerial();
delay(500);
mySerial.write(26);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("M.Energy:"+String(mEnergy/1000,2)+" kWs");
lcd.setCursor(0, 1);
lcd.print("M.Bill:"+String(mBill,2)+" TK");
mLoad= 0.00;
mBill= 0.00;
delay(100);
}
}
void updateSerial()
{
delay(500);
while (Serial.available())
{
mySerial.write(Serial.read()); // Forward what Serial received to Software Serial Port
}
while(mySerial.available())
{
Serial.write(mySerial.read()); // Forward what Software Serial received to Serial Port
}
}

26

You might also like