prepaid energy meter using gprs gsm technology

81
1.INTRODUCTION Energy Meter is a device that measures the electrical energy consumption of an electrically powered device or system. Energy meters used in Sri Lanka are mainly electromechanical and they operate by counting the revolutions of a non-magnetic, electrically conductive, metal disc which rotates at a speed proportional to the power consumed by the system which has been connected to the meter and the number of revolutions of the metal disc is proportional to the energy usage.[1] Although the electromechanical energy meters have been quite common in the past years, they are gradually being replaced by digital energy meters due to certain problems associated with them and most of these problems are due to their moving parts. A study conducted by Analog Devices Inc. USA found that the electromechanical energy meters deteriorate due to various environmental factors such as humidity, dust and dirt which significantly affect the operating accuracy of the electromechanical energy meters. And also the accuracy of electromechanical energy meters change as they age as shown in the figure 1.1 1

Upload: sasikala-nawarathne

Post on 26-Jan-2017

218 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Prepaid energy meter using gprs gsm technology

1. INTRODUCTION

Energy Meter is a device that measures the electrical energy consumption of an

electrically powered device or system. Energy meters used in Sri Lanka are mainly

electromechanical and they operate by counting the revolutions of a non-magnetic,

electrically conductive, metal disc which rotates at a speed proportional to the

power consumed by the system which has been connected to the meter and the

number of revolutions of the metal disc is proportional to the energy usage.[1]

Although the electromechanical energy meters have been quite common in the

past years, they are gradually being replaced by digital energy meters due to certain

problems associated with them and most of these problems are due to their moving

parts.

A study conducted by Analog Devices Inc. USA found that the electromechanical

energy meters deteriorate due to various environmental factors such as humidity,

dust and dirt which significantly affect the operating accuracy of the

electromechanical energy meters. And also the accuracy of electromechanical energy

meters change as they age as shown in the figure 1.1

1

Page 2: Prepaid energy meter using gprs gsm technology

Figure 1.1: Change of the accuracy of electromechanical energy meters with age.

Since digital energy meters don’t have moving parts, they are considered better

than electromechanical energy meters. But digital energy meters are failed in

preventing some of the issues within the electricity system. [2]

Some of them are,

A large number of inspectors have to be employed for meter reading and bill

payment related tasks [3]

Incorrect meter readings, billing errors and errors due to estimated bills[3]

Reluctance of consumers for paying electricity bills on time.[3]

Uncontrollable demand growth [3]

Electricity theft [3]

Consumers have to spend time and energy standing in queues to make bill

payments.

As a solution for most of the above problems Sri Lankan power sector has paid their

attention towards the “prepaid energy metering” concept. “Prepaid electricity”

concept has become a new escalating trend in the world. According to a report from

Navigant Consulting (formerly Pike Research), the global installed prepaid meters

are expected to grow from 31.7 million in 2014 to 85.2 million in 2024, with a

compound annual growth rate of 10.4% as shown in the Fig. 2.Europe and parts of

the US have already powered a number of successful prepaid focused suppliers.[4]

2

Page 3: Prepaid energy meter using gprs gsm technology

Figure 1.2: Prepaid electricity customer forecast.

1.1 What Is Prepaid Metering

Simply a prepaid energy meter enables power utilities to collect energy

bills from consumers prior to the usage of power by delivering only as much as what

has been paid for.

The consumer begins with a positive account balance and the utility

company tracks real time electrical usage and deducts the corresponding

consumption charge from the prepaid credits. If the consumer fails to pay or to add

more credits to an account then the service is terminated.

This concept can be considered as a true win-win scenario for both utility and

the consumer.

Repaid electricity programs have long been offered by utilities in numerous

countries, such as the United Kingdom, Ireland, South Africa, New Zealand, India,

Argentina, and many developing nations with various metering technologies and

communication solutions. [5]

1.2 Existing Prepaid Metering Technologies

1.2.1. Smart card based prepaid energy meters

Smart card is a credit card sized plastic card embedded with an integrated circuit (IC)

and usually it consists of a ROM, EEPROM and a CPU.A smart card provides both

the memory capacity and the computational capability. Access to data stored on the

card is under the control of the smart card operating system. In this method consumer

have to have the smart card recharged for the amount he choose and enter the card

into the card reader of the energy meter. Then the meter store the number of units

recharged and start to measures the energy consumption. When purchased units are

used up the meter disconnect the power supply until the next recharge. [6]

3

Page 4: Prepaid energy meter using gprs gsm technology

1.2.2. RFID (Radio-Frequency Identification) based prepaid energy meters

Radio-frequency identification (RFID) is an automatic identification method, relying

on storing and remotely retrieving data using devices called RFID tags or

transponders. The technology requires some extent of cooperation of an RFID reader

and an RFID tag. An RFID tag is an object that can be applied to or incorporated into

a product, animal, or person for the purpose of identification and tracking using radio

waves. Some tags can be read from several meters away and beyond the line of sight

of the reader.

In this method RFID cards which are issued by the electricity suppliers to individual

consumers are used. This RFID card is unique with a code in it and consumers are

free to make flexible recharge. When the consumer wants to use the system he needs

to show the card to the reader, then the unique code inside the card is recognized by

the reader, and starts deducing the amount of the RFID card as per the quantized unit

charge. When the usage completes the consumer has to recharge the RFID card

again.[7]

1.2.3. Prepaid energy meters with GSM technology

In this method consumers are expected to reload their mobile account and send a

SMS to the energy meter using GSM network. Then the meter holds the purchased

energy units corresponding to the recharged value and let the consumer to use

electricity until the purchased units are exhausted. If the available energy units are

exhausted then the electricity supply is cut-off .After the next recharge occurs the

microcontroller pulls the SMS sent by the mobile, decodes it, recognizes the Mobile

no. and then makes the power supply connection again. After successful operation,

controller sends back the acknowledgement to the consumer's mobile through SMS

[8], [9].

4

Page 5: Prepaid energy meter using gprs gsm technology

1.3. Design of A Prepaid Energy Meter With New Features

The main objective of our project was implementing a single phase digital prepaid

energy meter which provides measurement up to 40A load current and 230V line to

neutral voltage. As the first step of the design process of the prepaid energy meter we

had to decide the most convenient payment method for consumers. Therefore we

conducted an online survey with the contribution of one hundred and one participants

and majority (77.5%) preferred making payments through credit cards and mobile

service providers as shown in the figure 1.3.

The survey questionnaire and the summary of responses have been attached in the

appendices A and B.

5

Page 6: Prepaid energy meter using gprs gsm technology

Figure 1.3.The results of the online survey

Depending on the results of the survey, payments through credit cards and mobile

service providers were selected as the most convenient method of payment for the

prepaid energy meter.

Implementation of the energy meter was carried out in two stages.

First stage - Developing the prepaid module

Second stage - Developing the metering device

The working scheme of the integration of the both modules is shown in the

Fig.1.4.Utility power supply is fed to the energy meter and the prepaid module

provides a control signal to the local contactor according to the remaining energy.

Whenever the remaining energy goes below the disconnection threshold it provides a

disconnection signal to the contactor so that the power supply gets disconnected and

consumer receives a sms verifying his supply is disconnected.

When the consumer recharges his account above the reconnection threshold the

prepaid module sends a reconnection signal to the contactor so the supply gets

reconnected and consumer receives a sms verifying his supply is reconnected.

6PREPAID MODULE

POWER UTILITY PREPAYMENT

METERING DEVICE CONSUMER LEVEL SUPPLY CONTACTOR

CONSUMER WWIRELESS COMWMUNICATION

Page 7: Prepaid energy meter using gprs gsm technology

Figure 1.4.Working scheme of the energy meter

1. ENERGY METERING DEVICE

Metering device of this prepaid energy meter is designed according to the

IEC1036 (1996-09) Alternating Current Watt-Hour Meters for Active Energy

(Classes 1 and 2).Main function of the energy metering device is measuring

consumed energy and it is carried out using an AD7755 energy metering IC. This

IC is highly accurate with an error of less than 0.1% in active energy over the

selected current and voltage range and surpasses the accuracy requirements as

quoted in the IEC1036 standard.

7

PREPAID MODULE

POWER UTILITY PREPAYMENT

METERING DEVICE CONSUMER LEVEL SUPPLY CONTACTOR

CONSUMER WWIRELESS COMWMUNICATION

Page 8: Prepaid energy meter using gprs gsm technology

Figure 2.1.Block diagram of the prepaid energy meter

As shown in the figure 2.1 voltage signals come from voltage and current

transducers are applied to the AD7755 metering IC and it provides average real

power information on two low frequency outputs (F1 and F2) and instantaneous

real power information on a high frequency output (CF).One of the Low

frequency outputs are supplied to the microcontroller for energy calculations and

high-frequency output is made available at a LED which is used to speed

up the calibration process and used for real power calculations.

8

Page 9: Prepaid energy meter using gprs gsm technology

Figure 2.2.Metering device of the implemented energy meter

2.1. Current Sensing

For the function of the energy metering IC a voltage output from the current

transducer should be connected to the current channel (V1) of the metering IC. There

are two inputs (V1P, V1N) for the current channel and V1P is the positive input with

respect to V1N.The maximum peak differential signal on Channel 1 should be less

than 470 mV (330 mV rms for a pure sinusoidal signal) for specified operation.

Current-to-voltage conversion needed for the operation of the metering IC of this

energy meter is carried out using a shunt resistor. This shunt resistor is connected in

series with the phase wire of the load supply and the voltage signal needed for the IC

is taken by the voltage across the resistor as shown in the figure 2.3.

9

Page 10: Prepaid energy meter using gprs gsm technology

Figure 2.3.Current detection

2.1.1. Shunt selection

In this meter a 350 µΩ resister which has been manufactured from Manganin was

selected as the shunt resistor.

When selecting the size of the shunt resister there are some important facts that

should be considered. First, the power dissipation in the shunt should be minimized.

The maximum rated current for this design is 40 A, therefore, the maximum power

dissipated in the shunt is (40 A)2 ×350 μΩ = 560 mW. According to IEC1036

maximum power dissipation of the meter including power supply should be less than

2 W. But the higher power dissipation may make it difficult to manage the thermal

issues. Although the shunt is manufactured from Manganin material which is an

alloy with a low temperature coefficient of resistance, high temperatures may cause

significant error at heavy loads. The next consideration is the ability of the meter to

resist attempts to tamper by shorting the phase circuit. With a very low value of

shunt resistance the effects of externally shorting the shunt are very much minimized.

Therefore, the shunt should always be made as small as Possible.

10

Page 11: Prepaid energy meter using gprs gsm technology

If the shunt is made too small it will not be possible to meet the IEC1036 accuracy

requirements at light loads. Therefore a shunt value of 350 μΩ was considered a

good compromise for this design.

2.2 Voltage Sensing

Output from the voltage transducer should be connected to the voltage channel (V2)

of the metering IC. There are two inputs (V2P, V2N) for the voltage channel and

these inputs provide a fully differential input pair. The maximum differential input

voltage is 660 mV for specified operation. The maximum signal level at these pins is

1 V with respect to AGND (AGND pin provide ground reference for the analog

circuitry) and overvoltage of 6 V can also be sustained on these inputs without risk of

permanent damage.

2.3 Operation of The Energy Metering IC

Figure 2.4. Signal processing block diagram

11

Page 12: Prepaid energy meter using gprs gsm technology

As shown in the figure 2.4 voltage signals come from the voltage and current

sensors are digitized using two analog-to-digital converters (ADCs).Then they

are subjected to amplification with user selectable gain of 1, 2, 8 or 16 in the

current channel and it facilitates easy transducer interfacing. The instantaneous

power signal is generated by directly multiplying the digitized current and

voltage signals and the real power component (DC component) is extracted by

sending through a low pass filter.

Let,

V(t)= Vcos(ωt)

I(t)=Icos(ωt)

Then,

Power=V(t) ×I(t)

= Vcos(ωt)×Icos(ωt)

=VI2 + VIcos(2 ωt )

2 ;

VI2 is the real power component

This operation is valid even when the voltage and current signals are non-sinusoidal

and not in phase. Then the IC generates two frequency outputs (low and high) using

extracted real power component. The low frequency output is generated by

accumulating real power component over a long accumulation time period

and therefore the low frequency output is proportional to the average real

power. But the high frequency output is generated accumulating real power

information over a short time period and this frequency output is proportional to

the Instantaneous real power. This high frequency output (CF) is used for meter

calibration purpose.

Sometimes the voltage and current signals comes from transducers may

have offsets and it contributes a DC component after the multiplication

introducing a constant error to the real power calculation as shown by the

calculation below.

12

Page 13: Prepaid energy meter using gprs gsm technology

Vcos(ωt)+VOS × Icos(ωt)+IOS =

VI2 + VOSIOS + VOSIcos (ωt) + IOSVcos (ωt) +

VI2 cos (2ωt)

Where,

VOS -Offset of the voltage signal

IOS -Offset of the current signal

V -rms value of the voltage signal

I -rms value of the current signal

This problem is avoided by connecting a high pass filter (HPF) to the current

channel. By removing the offset from at least one channel, the error DC

component generated in multiplication can be eliminated.

13

Page 14: Prepaid energy meter using gprs gsm technology

2. PREPAID MODULEPrepaid module of the digital prepaid energy meter has been developed as a separate

devise and it can be connected to an existing digital energy meter and convert it into

a prepaid energy meter. Microcontroller of the prepaid module integrates the

functionalities of the metering device and the prepaid module. Communication

between prepaid module and the outer world is carried out by the GPRS/GSM

module.

Figure 3.1.Prepaid Module of the implemented energy meter.

3.1. GPRS/GSM Module

In the implemented prepaid meter, SIM900 GPRS/GSM shield is used as the

communication device among prepaid module, utility server and the consumer. The

14

Page 15: Prepaid energy meter using gprs gsm technology

figure 3.2 shows the GPRS/GSM module used for the implementation of the prepaid

energy meter.

Figure 3.2.GPRS/GSM module

Communication with the GPRS/GSM module and the microcontroller is carried out

using AT commands. AT commands are instructions used to control MODEMs.

Some of the AT commands used to instruct the GPRS/GSM module of the energy

meter through the microcontroller are mentioned in the table 3.1.

Table 3.1. AT commands used to instruct the GPRS/GSM

Command Function

AT+CMGF Select SMS message format

AT+CMGS Send SMS message

AT+HTTPINIT Initialize http service

AT+HTTPPARA Set http parameters value

AT+HTTPREAD Read the http server response

15

Page 16: Prepaid energy meter using gprs gsm technology

3.2 Operation Of The Microcontroller

For the implementation of the energy meter, an Arduino Mega

microcontroller is used. Energy measuring IC generates average real power

information on two low frequency outputs (F1 and F2) and high frequency pin(CF)

as mentioned before and one of the Low frequency outputs and the CF pin are

connected to the microcontroller through interrupt pins. Microcontroller detects

pulses generate by the metering IC using attachInterrupt function. Energy calculation

is carried out through the F1 pin and power calculation and calibration is carried out

through the CF pin. Microcontroller communicates with the GPRS/GSM module

allowing the prepaid energy meter to connect with the utility server through serial

communication.

3.2.1. Serial communication

Serial communication is the process of sending data one bit at a time, sequentially,

over a communication channel. All Arduino boards have at least one serial port and

Arduino Mega has four serial ports.

3.2.2. Active energy calculation

Whenever the microcontroller detects a pulse from the F1 pin consumed

active energy increases by 0.01 kWh. Simultaneously remaining energy units reduces

by 0.01 and monthly consumption increases by 0.01 kWhs.

Meter constant used for energy calculation = 100imp/kWh

kWhs per pulse =1

100 = 0.01kWh/pulse

Then the server and the LCD display for the user is updated.

3.2.3. Active real power calculation

16

Page 17: Prepaid energy meter using gprs gsm technology

Meter constant used for power calculation=3200imp/kWh

Average frequency per kW =32003600=0.8889 Hz

Variable “power counter” counts the number of pulses generated by the FC pin over

15 min time period. Then,

Average frequency at CF pin=Power Counter

Time

. Average real power =Average Frequency

0.8889

3.3. Main Server And Updating Processes

Figure 3.3.Communication process

As shown in the figure 3.3 the main server consists of a database, utility webpage

and a consumer web page. It stores all the information related to the prepaid metering

system using a database. Database is updated once in every fifteen (15) minutes by

all the prepaid meters connected to the server. This server stay connected with the

vending stations and maintains a system to exchange data with these stations.

17

Page 18: Prepaid energy meter using gprs gsm technology

3.3.1. Data base

As shown in the figure 3.4 data base of the energy metering system consist of 6 data

tables. They are,

1. user information table

2. Tariff table

3. Recharge information table

4. User consumption table

5. Recharge table

6. Dismonth table

18

Page 19: Prepaid energy meter using gprs gsm technology

Figure 3.4.Structure of the data base

User information table keeps records of user ID, user name, user password,

and user contact number and tariff category of all the consumers. Every consumer of

19

DATABASE

User Information

User ID User name Password user contact tariff category

Tariff

Domestic Hotel, Industrial, Religion General

Recharge Information

Recharge card number

Recharge amount

User Consumption

Timestamp instantaneous

power monthly

consumption Total

consumption Remaining units

Recharge

Timestamp Recharge

Rupees recharge units tag

Dismonth table

Monthly reset Disconnection

Page 20: Prepaid energy meter using gprs gsm technology

the prepaid metering system is given a unique identity number called user ID and the

phone number relevant to the SIM card which has been inserted in to the GSM

module of the prepaid energy meter is used as this user ID. Passwords which are

used by the consumer s for logging into their accounts are also stored in this table.

And also the tariff category which they belong to is kept in this table.

Tariff table is used to store tariff rates relevant to the different types of tariff

categories. The categories of domestic, hotel, industrial, religion and general have

been stored in the database of the implemented energy meter.

Recharge information table contains pin numbers and recharge amount of all the

recharge cards supplied to the all vender stations. In addition to that recharge

information table keeps a record called tag. Initially the value of the tag for a

recharge card is zero and whenever this card is used by a consumer value of the tag is

made one.

Three data tables (User consumption table, Recharge table, Dismonth table) are

assigned for every ID number or every consumer of the user information table.

User consumption table keeps the records of timestamp, monthly

consumption, total consumption, remaining units and instantaneous power.

Timestamp column shows the time and the date of each record of the user

consumption table. This table is updated once in every 15 minutes according to the

data come from prepaid energy meters.

Recharge table keeps records of timestamp, recharged rupees, recharged units

and tag. Whenever the consumer recharge his/her account this table updates and

make the value of the tag record one. After the prepaid meter made a request for

updating the server, recharged number of units is sent to the prepaid meter back as a

response and then the value of the tag column is made zero.

Dismonth table keeps records of monthly reset and disconnection. Cron file

make the value of the monthly reset record one at 0000h on the last day of every

month.Cron file (Cron tab) are used for scheduling tasks to run on servers. A

program calle daemon initiated by the system runs in the background all the time.

20

Page 21: Prepaid energy meter using gprs gsm technology

This cron daemon is responsible for launching these cron jobs on schedule. After the

prepaid meter made a request for updating the server, a notification is sent to the

prepaid meter back as a response informing the meter about the start of the new

month. Then the value of the monthly reset is made zero. Utility can disconnect the

power supply to the consumer by making the value of the disconnection record zero.

When the consumer utilizes the power supply this value should be kept as one.

3.3.2. Updating the server

As mentioned before prepaid energy meters send an http request to the server once in

every 15 minutes. This request includes the values of the variables of user Id, supply

current, supply voltage, supply power factor, remaining units, total consumption,

monthly consumption and average power in the form of a string. After the server

receives the request it calls for the request handler.php file. Then the request handler

extracts the data from the string and directed them to correct position of the database.

After that the server issue a response which contain recharged amount, monthly reset

value ,disconnection, tariff rate and the tariffcategory in the form of a string. This

string is received by the GPRS/GSM module and the microcontroller extracts and

updates the values of the variables.

3.3.3. Data backup

The EEPROM available in the Arduino microcontroller is used to store the data

recharged amount, remaining units, total consumption, monthly consumption and

variable values required to continue the metering process.In the event of a failure,

previously accumulated data can be retrieved and resumed the process.

3.4. Meter Display

16×4 Liquid Crystal Display module is used for displaying the

Remaining number of units

Amount of last recharge

Total consumption

Monthly consumption

21

Page 22: Prepaid energy meter using gprs gsm technology

Tariff Category

Tariff rate

at the prepaid digital energy meter as shown in the figure 3.5.

Figure 3.5. LCD display of the prepaid energy meter

Figure 3.6 shows the pin positions of the LCD display and function of each pin is

discussed briefly.

22

Page 23: Prepaid energy meter using gprs gsm technology

Figure 3.6.Pin diagram of LCD display

The pin at the right top corner of the LCD display is ground pin and it is

connected to the ground and the second pin is connected to the 5V power supply of

the Arduino board. Third pin is for controlling the brightness of the backlight of the

LCD and it is connected to the middle pin of a10k potentiometer (other two pins of

the potentiometer is connected to the 5V and GND of the arduino). RS pin allows a

user to select the instruction mode or the character mode of the LCD. When the

instruction mode is selected, the data that the LCD receives on the 8 data pins (D0 to

D7) will be interpreted as instruction data. These data can be instructions such as

"clear the display", "moves the cursor", etc. When the character mode is selected, the

data that the LCD receives on the 8 data pins (D0 to D7) will be interpreted as

character data and they will be shown on the LCD screen. This RS pin is connected

to a digital pin of the arduino. The next pin, RW pin (Read/Write) pin enables a user

to write to the LCD so that it displays characters or to read the characters from the

LCD. For “high” signal level it enables read mode and for “low” signal level it

enables write mode. In this meter the RW pin was connected to a digital pin of the

arduino. The next pin is enable pin and it enables the clock of the LCD to be

triggered such that the LCD can execute instructions that are given it. This pin also

connected to a digital pin of the arduino. In this LCD we use 4 bit mode and neglect

the 0,1,2,3 data pins connecting 4,5,6,7 data pins to the arduino. Last two pins are

connected to the 5V power supply and ground of the arduino for supplying LED

backlight to the LCD.

This LCD screen is controlled by using the Liquid Crystal Library of the

Arduino.

3.5. Controlling Power Supply To The Consumer

Within the main user program of the Arduino the variable “remaining_units” is

maintained. The value of the “remaining_units” reducesby 0.01 whenever the energy

metering IC generates a pulse at the frequency output pin.

When the remaining number of units reaches 5 it generates a notification to

the consumer through his/her mobile phone informing to recharge the account. If the

23

Page 24: Prepaid energy meter using gprs gsm technology

account is not recharged and remaining number of units reach 3 it generates a buzzer

alarm and a SMS notification through the mobile phone.Whenever the remaining

number of units reaches 1 it provides the disconnecting signal to the contactor and

contactor disconnect the power supply to the consumer. Then consumer has to make

a reestablishing request to the utility by recharging his/her account.

3.5.1. Solid state relay

Figure 3.7 shows the solid state relay that we used for the digital prepaid energy

meter to control (disconnect and connect) the power supply to the consumer

according to the remaining number of energy units.

Figure 3.7.Solid state relay

Main features of this solid state relay are,

Control voltage is in the range of 3V to 32V DC

Output voltage is in the range of 24V to 380VAC

Rated load current is 40A

24

Page 25: Prepaid energy meter using gprs gsm technology

Figure 3.8.Connection of solid state relay with Arduino

According to the figure 3.8. Solid state relay is connected within the energy meter.

By making the power level at the digital pin of the Arduino low, power supply to the

consumer can be disconnected and by making the power level at the pin high, power

supply to the consumer can be disconnected.

3.5.2.Generating notifications

This power supply system generates SMS notifications for the consumer when,

1. Remaining number of units reaches 5

2. Remaining number of units reaches 3

3. Just after the power supply is disconnected

4. Just after the account is recharged

5. Just after the power supply is reconnected

25

Page 26: Prepaid energy meter using gprs gsm technology

These messages are generated by the Arduino and send through the GSM/GPRS

module. In addition to that microcontroller generate a buzzer notification when

the remaining number of units reaches 3.The figure 3.9 shows an image of the

buzzer used for the implemented prepaid meter.

Figure 3.9.Buzzer

One pin of the buzzer is connected to the ground and the other pin is connected to a

digital pin of the Arduino.

3.6. Recharging The Account

Recharging of the account can be done in three methods. They are,

1. Credits cards

2. Reloads through mobile service provider

3. Scratch cards

When making payments through credit cards consumer has to log in to his/her

account through the prepaid metering web site.

When reloading through mobile service providers vendors should send a

request massage according to the format of @user_id#recharge_ammount@ to the

recharging unit.

3.6.1. Recharging unit

26

Page 27: Prepaid energy meter using gprs gsm technology

This unit mainly consists of a GPRS/GSM module and a Mega arduino

microcontroller. Whenever a recharging message is sent by a vendor station to the

recharging unit it decode the message and update the server with the correct

recharged amount as shown in the flow diagram of the figure 3.10.

Figure 3.10 Flow diagram of the recharging process

27

Input user ID & recharged amount

Waiting for message

Decode message

Update the server

Send a notification message to vendor

Send error message to vendor

If successful

Wrong user IDSend error message to vendor

Page 28: Prepaid energy meter using gprs gsm technology

4. EXISTING METER ATTACHMENT KIT

Metering device and the prepaid module of the energy meter was implemented as

separate modules as mentioned before. This prepaid module can be connected to an

existing digital energy meter using a meter attachment kit and converted it into a

prepaid energy meter. Figure 4.1.shows a circuit diagram of the existing meter

attachment kit.

Figure 4.1.Circuit diagram of the existing meter attachment kit.

Calibration output(CF),low frequency output(F1) and the ground of the existing

digital energy meter are connected to the CF input,F1 input, ground and the 5V

terminals(which come from arduino board) of the prepaid module.

28

Page 29: Prepaid energy meter using gprs gsm technology

5. WEB INFRASTRUCTURE

This prepaid energy metering system has facilitated both consumers and utilities to

manage their functions and requirements online through the web. Anyone who

follow the link address

http://prepaidmeter.projects.mrt.ac.lk/index_consumer.html

can enter to the login screen shown in the figure 5.1.

Figure 5.1.Login screen of the web page

Each consumer in the network has given a separate web account and he/she can login

to this web account by selecting “Login as Consumer” and enter his/her user name

and the password.

4.1. Consumer Website

Consumer website has been developed with the five tabs” Home” tab, “Usage” tab,”

Pay online” tab, “ Features” tab and the “Contact” tab.

Home tab

29

Page 30: Prepaid energy meter using gprs gsm technology

Home tab of the utility website provides a brief introduction to the prepaid energy

metering system in an attractive and brief manner. In addition to that home tab

facilitate checking the remaining number of units very easily. As shown in the figure

5.2 consumer has to click on the yellow color button to check his/her remaining

energy units.

Figure 5.2.Home tab of the consumer web page

Usage tab

By looking at the usage tab consumer can observe his/her energy consumption of last

12 months in monthly basis and the energy consumption of last 30 days. In addition

to that consumers are facilitated to observe the energy consumption and the

recharged amount relevant to any previous month as shown in the figure5.3.

30

Page 31: Prepaid energy meter using gprs gsm technology

Figure 5.3.Usage tab of the consumer web page

Pay online tab

This tab facilitates online payments for prepaid energy. Consumers can pay for their

energy using their credit cards and by entering pin numbers of purchased recharge

cards at this tab location as shown in the figure 5.4. .

Figure 5.4.Pay online tab of the consumer web page

31

Page 32: Prepaid energy meter using gprs gsm technology

Features tab

This tab gives a brief introduction about the features of the prepaid energy metering

system and also instructions for connecting to the prepaid metering network.

Contact tab

Contact tab provides the contact details of the help desk of the utility and accept the

e-mails send by consumers.

4.2. UtilityWebsite

By logging to the utility website, utility can monitor their consumer’s performance

very easily. Utility website consists of the four tabs “Home”, ”Graphs”,

”ConsumerInformation” and “Update”

Home tab

Home tab of the utility website shows several information important to the utility as

shown in the figure 5.5. They are,

1. Monthly recharged energy revenue

2. Annual recharged energy revenue

3. Monthly energy consumption

4. Annual energy consumption

5. Tariff categories and their tariff rates

32

Page 33: Prepaid energy meter using gprs gsm technology

Figure 5.5. Home tab of the utility web page

Graphs tab

Graph tab shows the graph of the monthly energy revenue for last 12 months and

facilitate to observe the energy supply of the month entered by the consumer. And

also utility can observe the load curve in this tab location.

Consumer information tab

In this tab utility can check the details of consumers and monitor the energy

consumption information of each consumer.

Update tab

By entering to the update tab utility can

1. Issue new recharge cards to the system

2. Change tariff rates

3. Change consumer tariff categories

4. Disconnect and reconnect power supply for consumers.

33

Page 34: Prepaid energy meter using gprs gsm technology

Figure 5.6. Update tab of the utility web page.

34

Page 35: Prepaid energy meter using gprs gsm technology

6. ELECTRICITY THEFT DETECTION SYSTEM

Electricity theft detection mechanism uses a normally closed limit switch as

shown in the figure 6.1 and whenever the casing of the energy meter is

opened a pulse is triggered.

Figure 6.1.Circuit diagram of the theft detection mechanism

35

Page 36: Prepaid energy meter using gprs gsm technology

7. POWER SUPPLY UNIT

Power supply required for the operation of the prepaid energy meter is supplied by a

switching power supply module which is shown in the figure 7.1. This module

consists of a 100V-240V AC to DC power adaptor and provide over voltage, over

current and short circuit protection for the system. Some of the additional features of

this module are,

Input Voltage:100V-240V

Input frequency:50/60Hz

Output :DC 12V,2.5A,30W

Figure 7.1. Switching power supply module

A 2500mAh,Li-Polymer chargeable battery is used to provide the power supply for

the arduino board and the contactor in an event of power failure. Figure 7.2. Shows

the circuit diagram of the complete power supply module which include the

switching power supply module and the chargeable battery.

36

Page 37: Prepaid energy meter using gprs gsm technology

Figure 7.2.Power supply circuit of the prepaid energy meter.

At a normal operational condition relay coil is energized allowing power supply

through the SPSM (switching power supply module) and charging the battery. Input

to the switching power supply has been connected to the utility power supply. During

a power failure, relay coil is de-energized allowing power supply through the

charged battery. A 7808 linear voltage regulator IC is used to supply an 8V regulated

voltage and 220µF capacitor is used to maintain a steady voltage supply at switching.

37

Page 38: Prepaid energy meter using gprs gsm technology

8. METER CALIBRATION

Calibration of the meter is carried out using a simple resistor divider network

connected to the voltage channel of the energy metering IC (AD7755) as shown in

the figure 8.1. This network allows the line voltage to be attenuated and adjusted

with a resolution of 10 bits. This is achieved by using the binary weighted resistor

chain R5 to R14. This will allow the meter to be accurately calibrated using a

successive approximation technique.

Figure 8.1.Calibration network

38

Page 39: Prepaid energy meter using gprs gsm technology

The voltage which should be appearing on the divider network can be calculated as

below.

According to the AD7755AAN data sheet the equation that relates the low frequency

output on F1 and F2 to the product of the rms signal levels at current channel (V1)

and the voltage channel (V2) is given by the equation (1)

Frequency= 8.06×V 1× V 2×Gain × F 1−4

Vref ×Vref (1)

Where,

V1 - Differential rms Voltage signal on channel 1

V2 - Differential rms Voltage signal on channel 2

Gain -1, 2,8or16 depending on the gain selected using two logic inputs to the IC

Vref - Reference voltage

F1-4 - One of the four possible frequencies selected by using the logic inputs to

the IC (Identified as S0 and S1 in the data sheet of (AD7755AAN)

Design parameters:

Line voltage = 230 V (nominal)

IMAX = 40 A

Base current (Ib)= 5 A

Counter = 100 imp/kWh

Meter constant = 3200 imp/kWh

Shunt size = 350 µΩ

F1–4 frequency=3.4

Gain=16 (selected using the AD7755 data sheet)

Then,

100 imp/hour = 100/3600 sec = 0.027777 Hz

Meter is calibrated at Ib (5A). Then,

Power dissipation at Ib = 230 V × 5 A = 1.15W

Frequency on F1 and F2 at Ib = 1.15 × 0.027777 Hz

= 0.03194355 Hz

39

Page 40: Prepaid energy meter using gprs gsm technology

Voltage across shunt (V1) at Ib = 5 A × 350 µΩ

= 1.75 mV

Frequency =8.06 ×V 1× V 2 ×Gain × F 1−4

Vref ×Vref

0.03194355 Hz =8.06 ×1.75 mV ×V 2 ×16 ×3.4 Hz

2.5 V ×2.5 V

V2 = 260.19 mV rms

Therefore, in order to calibrate the meter the line voltage needs to be attenuated

down to 260.19 mV by varying resistance across the voltage channel.

Error of the implemented energy meter was measured using the pz4000 power

analyzer. A load of 2300W was supplied for 30 min time period through the power

analyzer and obtained the readings.

Voltage : 228.623V

Current :10.153A

Power factor: 0.99

Power : 2.298 kW

Energy : 1.15kWh

Then the load was connected across the prepaid energy meter and obtained

the consumed energy reading as 1.13kWh.Then,

Error of the energy meter¿energy registered bymeter – true energy

true energy ×100

= 1.13−1.15

1.15 ×100

= 1.739 %< 2%

According to the above calculation this meter can be coded as a type II

energy meter.

40

Page 41: Prepaid energy meter using gprs gsm technology

9. ISSUES RELATED TO IMPLEMENTATION OF PREPAID

METERING SYSTEMS

When a prepaid metering system is installed it replaces the billing system, the

reading of meters and the administration of revenue collection. Implementing a

prepaid meter is a change of mindset, a change in the way the revenue collection is

managed, a change in IT procedures, a change in customer service, a change in

metering and a change in consumer behavior. Therefore all the parties should

understand the benefits and accept the change.

The most important task in implementing the meter is planning the implementation.

Detailed program, schedules, including resource allocation, distribution of

responsibilities and the setting of milestones are very essential.

9.1. Marketing & Training

Most people in the society see anything new with suspicion and therefore marketer’s

task is to offer a package which best suits the consumer’s needs, make people aware

about this new technology or procedure and show them the benefits of the new

approach.

Important points which should be considered in this context are

Installation teams must be trained on meter installation and also they should

be trained to train the customers to operate and maintain the meters.

Training the customer service staff to operate the Help Desk with good

manners , the completion of the registration of new consumers etc.

Training vendors so that they can give the customer good service and create

the image the utility wishes.

Training the SMS manager, supervisors and operators.

The success of any system relies on the acceptance of all the players within the utility

as well as on consumer acceptance.

41

Page 42: Prepaid energy meter using gprs gsm technology

9.2 Maintenance Management

Before the system has been installed, authorities should have a procedure to manage

the system from a maintenance point of view. In this case following issues should be

considered.

Authorities have to decide what procedures will be followed if a meter fails.

If a consumer complains regularly that his/her meter is not working the

maintenance team has to regularly replace the meter and the result will be a

high maintenance cost to the utility.

Utility has to decide what procedures will be followed if the utility server

fails. In such a case a back-up system should be available.

The procedure used to back up and archive data is important and good

housekeeping is required for any database.

The controls and procedures for collection of revenue from vendors and the

transfer of data between utility server and vending station are important.

The selection criteria for venders should be considered.

9.2. Customer Education:

With prepaid meters consumers are in control of their electricity budgets they decide

for themselves how often they wish to purchase electricity and to what value.

Customer education assumes top priority for success of the scheme. The points to be

considered here are

Consumers must know how and where to purchase credit.

Consumers must be able to read the meter and receive notifications so they

know when they need to re-purchase credit.

Consumers must know how much credit they have available at any time.

Consumers must know how to clean the meter.

Consumers must know what to do or who to contact if they experience

problems with the meter.

Brochures should be available at each vending site. Vendors should be trained both

in the use of the vending equipment and in the use of the meters and the benefits of

42

Page 43: Prepaid energy meter using gprs gsm technology

the system, so that they are able to promote it.

Prepaid meter manufacturers should provide marketing and training videos which

can be used to show the consumer how to use the system and what the benefits are

and a help line should be set up to get help if they are unclear on any issue.

9.4. Regulatory and Ethical Issues associated with Prepaid Meters

Automatic service disconnection is an integral part of prepaid electric service.

But over the years electricity came to be regarded as a right more than a privilege in

every society and hence regulators and law makers have found it difficult to accept

the automatic disconnection feature of the prepaid meters.

In the USA, regulatory rules evolved to protect customers from service

interruption. Before terminating service to a customer whose payment is seriously

past due, the utility must pursue an array of measures to secure payment. But prepaid

electric service with automatic disconnection when the prepayment runs out is

incompatible with the protective measures. Because of that only a few thousand

customers are being served through prepaid metering in the US, mostly in municipal

and cooperative utilities.

Therefore in developing a prepaid electricity system, ethical issues in use of

prepaid electricity should not be treated as an injustice to the society at initial stages

of development. However, caution may be exercised while choosing areas for

deployment of prepaid meters.

10. CONCLUSION

43

Page 44: Prepaid energy meter using gprs gsm technology

The market for the prepaid energy metering is steadily growing due to smart

metering technology, as well as the growing acceptance of the idea of prepaying for

services.But regulators in some countries in the world have not allowed this payment

method because they see it as an issuefor some consumers, such as the elderly or

those on low incomes. And also sometimes this system may be inconvenient because

consumers have to go out to top upthese energy meters and if they can't reach a

vender stationtheir energy can be switched off.Most of the prepaid meters currently

use in the world need to have their prices updated manually after price rises or falls

and which can take months. This means consumers could be left paying old rates and

paying too much.

In this project we have eliminated most of the above barriers

available for the growth of the prepaid energy metering concept. This prepaid meter

allows payments through credit cards and consumers can make their payments

without spending time in vender stations. And also it allows utility to change tariff

rates by login into the utility website easily and it will take only a few seconds. In

addition to that this meter has been included an electricity theft detection method as a

special feature.

11. REFERENCE LIST

[1].

44

Page 45: Prepaid energy meter using gprs gsm technology

1. Ten predictions for prepaid energy in 2015. PREPAID ENERGY HUB. [Online] MArch 02, 2015. http://prepaidenergyhub.com/ten-predictions-for-prepaid-energy-in-2015/.

2. Modeling of GSM-Based Energy Recharge Scheme for Prepaid. B.O.Omijeh, G.I.Ighalo. 2013, IOSR Journal of Electrical and Electronics Engineering, p. 8.

3. Design and Simulation of Single Phase Intelligent Prepaid Energy Meter. Bourdillon.O.Omijeh, Godwin.I.Ighalo. 2013, Innovative Systems Design and Engineering , p. 14.

4. Sanogo, Hamed. EDN NETWORK. Use-Near-Field-communications-and-a-secure-authenticator-to-activate-an-electrical-prepayment-system-in-your-home. [Online] July 09, 2015. http://www.edn.com/Home/PrintView?contentItemId=4439884.

45

Page 46: Prepaid energy meter using gprs gsm technology

46

Page 47: Prepaid energy meter using gprs gsm technology

47

Page 48: Prepaid energy meter using gprs gsm technology

48

Appendix B: Responses of the survey

Page 49: Prepaid energy meter using gprs gsm technology

49

Page 50: Prepaid energy meter using gprs gsm technology

Appendix C: Code of the Arduino microcontroller

50

Page 51: Prepaid energy meter using gprs gsm technology

//scaled using 0.1kWh = 1Wh //Libraries/////////////////////////////////////////////////////////////////////#include <EEPROM.h>#include <LiquidCrystal.h>LiquidCrystal lcd(42, 44, 46, 48, 50, 52);

//Suplementary variables and constants///////////////////////////////////////int energyCount;int powerCount;const float frequencyPerKiloWatt = 0.8889 ;int contactor = 26 ;int buzzer = 24;boolean nextchar=0;byte state=16;int eeAddress=0;int tag=0;int shiledonoff=28;

//User Information/////////////////////////////////////////////long Id = 719266881;float recharged_amount =0.00f ;float remaining_units = 0.00f ;float total_consumption = 00.00f ;float monthly_consumption=0.00f;float last_recharge = 0.00f;float averagePower =0.00f;float temp_recharged=0.00f;

//Unused variables////////////////////////////////////////////////////////////////////////////////float supply_voltage=230 ;float supply_current=0;float supply_pf=1;

//variables related to string decode////////////////////////////////////////////////////////////int mon_reset=0;int dis_connect=0;int tariff_cat=1;float tariff_rate=10.00f;

String datareceive="";String tarifCatogory = "";//Identifiers/////////////////////////////////////////////////////////////int n1 = 1;int n2 = 1;int d = 1;int r = 1;int t=1;long time_int=0;

//Notifications////////////////////////////////////////////////////////////////////String notification1 = "Your remaining energy has reached 5kWh.Please recharge" ;String notification2 = "Your remaining energy has reached 3kWh.Please recharge" ;

51

Page 52: Prepaid energy meter using gprs gsm technology

String Disconnection = "Your connection has been disconnected.Please recharge to get the conection back" ;String Reconection = "Congradulations you have recived your conection back" ;String Verification = " ";

//////////variable address for EEProm///////////////////////////////////////////////

#define addr_recharged_amount 0#define addr_remaining_units 4#define addr_total_consumption 8#define addr_last_recharge 12#define addr_monthly_consumption 16#define addr_energy_count 20

////////////////////////////////////////////////////////////////////////////////////////////void setup()

Serial1.begin(9600); Serial.begin(9600); delay(100); pinMode(contactor,OUTPUT); pinMode(buzzer,OUTPUT); pinMode(shiledonoff,OUTPUT); attachInterrupt(digitalPinToInterrupt(2),pulsecounter,FALLING); attachInterrupt(digitalPinToInterrupt(3),calcounter,RISING); attachInterrupt(digitalPinToInterrupt(20),theft,RISING); shiled_on(); readfromEEPROM(); lcdSetup();

//////////////////////////////////////////////////////////////////////////////////////void loop() time_check(); displayEnergyData(); reconnection(); energyCalculation(); writeEngData(); generateNotification();

//pulse counter and calcounter//////////////////////////////////////////////////////////// void pulsecounter() energyCount++;

void calcounter() powerCount++;

52

Page 53: Prepaid energy meter using gprs gsm technology

//limit switch to detect electricity theft//////////////////////////////////////////////////////////////////////////////////

void theft() //lcd////////////////////////////////////////////////////////////// void lcdSetup() lcd.clear(); lcd.begin(16, 4); lcd.setCursor(0,0); lcd.print("ID : "); lcd.setCursor(5,0); lcd.print(Id);

// reconnection******************************************************************* void reconnection() if(recharged_amount >= 6 && r==1 ) r=0; d = 1; generateReconSignal(); sms(Reconection); //energyCalculation******************************************************************************** void energyCalculation()

if(recharged_amount>= 6.00)

remaining_units += recharged_amount ; last_recharge = recharged_amount ; temp_recharged= recharged_amount ; recharged_amount = 0.00; if (energyCount >= 1) energyCount = 0 ; monthly_consumption += 1; //0.1kWh = 1Wh total_consumption += 1 ; //0.1kWh = 1Wh remaining_units -= 1; //0.1kWh = 1Wh

53

Page 54: Prepaid energy meter using gprs gsm technology

//Power calculation//////////////////////////////////////////////////////////////////////////Power calculation with a maximum error of 1.25W void powerCalculation() float averageFrequency = powerCount/(900); averagePower = averageFrequency/frequencyPerKiloWatt ; powerCount =0; //Display ////////////////////////////////////////////////////////////////////////////////// void displayEnergyData() tariff_display(); lcd.setCursor(0,1); lcd.print(remaining_units); delay(20); lcd.setCursor(11,1); lcd.print(last_recharge); delay(20); lcd.setCursor(0,2); lcd.print(total_consumption); delay(20);

lcd.setCursor(11,2); lcd.print(monthly_consumption); delay(20);

lcd.setCursor(0,3); lcd.print(tarifCatogory); delay(20);

lcd.setCursor(11,3); lcd.print(tariff_rate); delay(20); //discon&recon//////////////////////////////////////////////////////////////////////////////////////////

void generateDiconSignal() digitalWrite(contactor,LOW);

void generateReconSignal() digitalWrite(contactor,HIGH);

//Generating notification//////////////////////////////////////////////////////////////////// void generateNotification() if (remaining_units <=5 && remaining_units > 3 && n1==1 ) n1=0; sms(notification1);

if (remaining_units <=3 && remaining_units > 1 && n2==1 )

54

Page 55: Prepaid energy meter using gprs gsm technology

n2=0; sms(notification2); digitalWrite(buzzer,HIGH); delay(2000); digitalWrite(buzzer,LOW); if (remaining_units <1 && d==1 ) d=0; generateDiconSignal(); n1 = 1; n2 = 1; r = 1; sms(Disconnection); if(temp_recharged>6) n1 = 1; n2 = 1; d = 1; Verification.concat("You have sucsessfully recharged "); Verification.concat(temp_recharged); Verification.concat("units to your account"); temp_recharged=0; sms( Verification); Verification="";

//sms///////////////////////////////////////////////////////////////////////////////////////////// void sms(String x)

Serial.println("\r"); Serial1.println("\r"); delay(1000); //Wait for a second while the modem sends an "OK" Serial.println("AT+CMGF=1\r"); //Because we want to send the SMS in text mode Serial1.println("AT+CMGF=1\r"); delay(1000); Serial.println("AT+CMGS=\"0772273179\""); //Start accepting the text for the message Serial1.println("AT+CMGS=\"0772273179\"");

delay(1000); Serial1.println(x); //The text for the message Serial1.write(26); Serial.println("MESSAGE SENT"); delay(1000); Serial.write(26); //Equivalent to sending Ctrl+Z Serial.println("\r"); Serial1.println("\r"); Serial1.write(26); //Http request to the server//////////////////////////////////////////////////////////////////////////////////////////////////////////void SubmitHttpRequest()

55

Page 56: Prepaid energy meter using gprs gsm technology

Serial1.println("AT"); delay(100); // shiled_on(); ShowSerialData();// this code is to show the data from gprs shield, in order to easily see the process of how the gprs shield submit a http request, and the following is for this purpose too. Serial1.println("AT+CGATT?"); delay(100); ShowSerialData(); Serial1.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");//setting the SAPBR, the connection type is using gprs delay(100); ShowSerialData(); Serial1.println("AT+SAPBR=3,1,\"APN\",\"CMNET\"");//setting the APN, the second need you fill in your local apn server delay(400); ShowSerialData(); Serial1.println("AT+SAPBR=1,1");//setting the SAPBR, for detail you can refer to the AT command mamual delay(200); ShowSerialData(); Serial1.println("AT+HTTPINIT"); //init the HTTP request delay(200); ShowSerialData(); String datasend=""; datasend.concat(Id);datasend.concat("&cur=");datasend.concat(supply_current);datasend.concat("&vol=");datasend.concat(supply_voltage);datasend.concat("&pf=");datasend.concat(supply_pf);datasend.concat("&remunits="); datasend.concat(remaining_units);datasend.concat("&totconsp=");datasend.concat(total_consumption);datasend.concat("&monconsp=");datasend.concat(monthly_consumption);datasend.concat("&reunits=");datasend.concat(averagePower); Serial1.println("AT+HTTPPARA=\"URL\",\"http://192.248.15.244/requestHandler.php?id="+datasend+"\"");// setting the httppara, the second parameter is the website you want to access delay(1000); ShowSerialData(); Serial1.println("AT+HTTPACTION=0");//submit the request

56

Page 57: Prepaid energy meter using gprs gsm technology

delay(10000);//the delay is very important, the delay time is base on the return from the website, if the return datas are very large, the time required longer. //while(!Serial1.available());

ShowSerialData(); Serial1.println("AT+HTTPREAD");// read the data from the website you access delay(300); writeData(); writeEngDataGPRS(); ShowSerialData();

Serial1.println(""); delay(100);

//Display data on serial montor////////////////////////////////////////////////void ShowSerialData() while(Serial1.available()) char c=Serial1.read(); if(nextchar==1) nextchar=0; state=(c-65); Serial.println(c); String datareceive=""; datareceive.concat(c);

if(c==37) nextchar=1;

Serial.write(c);

//write data and string decoding //////////////////////////////////////////////////////////////////////////

void writeData() boolean store = false; datareceive = ""; while(Serial1.available()) char c=Serial1.read(); if(nextchar==1) nextchar=0; state=(c-65); if(c==37) nextchar=1;

57

Page 58: Prepaid energy meter using gprs gsm technology

if (c == '%') store = true; continue; else if (c == '@') store = false; Serial.println("\n");

if (store) Serial.write(c); datareceive.concat(c); Serial.println(datareceive);

int pos = datareceive.indexOf("#"); recharged_amount += datareceive.substring(0, pos).toFloat(); int pos2 = pos + 1;

mon_reset = datareceive.substring(pos2, (pos = datareceive.indexOf("#", pos2))).toInt(); pos++;

dis_connect = datareceive.substring(pos, (pos2 = datareceive.indexOf("#", pos))).toInt(); pos2++;

tariff_cat = datareceive.substring(pos2, (pos = datareceive.indexOf("#", pos2))).toInt(); pos++;

tariff_rate = datareceive.substring(pos).toFloat(); month_reset(); Serial.println(recharged_amount); Serial.println(mon_reset); Serial.println(dis_connect); Serial.println(tariff_cat); Serial.println(tariff_rate);

//reset monthly consumtion end of month//////////////////////////////////////////////////void month_reset() if(mon_reset==1) monthly_consumption=0; ////////////////////////////////////////////////////////////////////////////////////void tariff_display() switch(tariff_cat) case 1 : tarifCatogory = "Domestic"; break;

58

Page 59: Prepaid energy meter using gprs gsm technology

case 2 : tarifCatogory = "Reli&Chari"; break;

case 3 : tarifCatogory = "Hotel"; break;

case 4 : tarifCatogory = "General"; break;

case 5 : tarifCatogory = "Industrial"; break;

//copying values from EEProm///////////////////////////////////////////////////// void readfromEEPROM() EEPROM.get(addr_recharged_amount,recharged_amount); delay(200); EEPROM.get(addr_remaining_units,remaining_units); delay(200); EEPROM.get(addr_total_consumption,total_consumption); delay(200); EEPROM.get(addr_last_recharge,monthly_consumption); delay(200); EEPROM.get(addr_monthly_consumption,last_recharge); delay(200); EEPROM.get(addr_energy_count,energyCount); delay(200);

if(remaining_units>1) generateReconSignal();

///////////////////////put the server every 15 minits////////////////////////////////void time_check() if(millis()<60000 && t==1) time_int=0; t=0; if(millis()-time_int>60000) time_int=millis(); t=1; powerCalculation(); SubmitHttpRequest();

59

Page 60: Prepaid energy meter using gprs gsm technology

//////////////////////////////////////write energy data///////////////////////////////////void writeEngData() EEPROM.put(addr_recharged_amount,recharged_amount); delay(200); EEPROM.put(addr_remaining_units,remaining_units); delay(200); EEPROM.put(addr_total_consumption,total_consumption); delay(200); EEPROM.put(addr_last_recharge,last_recharge); delay(200); EEPROM.put(addr_monthly_consumption,monthly_consumption); delay(200); EEPROM.put(addr_energy_count,energyCount); delay(200);

void writeEngDataGPRS() EEPROM.put(addr_recharged_amount,recharged_amount); delay(200); EEPROM.put(addr_monthly_consumption,monthly_consumption); delay(200);/////////shieldon///////////void shiled_on() if(!(Serial1.available())) digitalWrite(shiledonoff,LOW); delay(500); digitalWrite(shiledonoff,HIGH);

60

Page 61: Prepaid energy meter using gprs gsm technology

61