Design and Implementation of a GSM-Based Single Phase Prepayment Energy Meter with Hybrid Recharge Mode

This paper presents a GSM-based Prepayment Electric Energy Meter implemented with hybrid recharging mode: Mobile Station (MS), Supply Authority Platform and the Keypad. The system was designed around two modules; the hardware and software. The hardware module consists of ADE7755 used to generate the consumption pulses that are measured and recorded by Atmega328P. Atmega2560 was used to manage the unit consumption; control and monitor the activities of the meter. SIM900 was used to achieve the SMS recharging and communication capability. The server consists of Atmega328P and SIM900 for communication. It is interfaced serially with the PC used for the Application Platform. The software module consists of the Application Platform especially for token generation and Database. The SMS Command format for recharging of the meter was also developed. The developed meter has a mean time of 133.46s, 233.3s and 311.1s to consume 0.01KWh on a load of 320W, 200W and 160W respectively with the highest standard deviation of 1.14 at a load of 160W. The results also show a mean time of 28.99sec in the SMS round-trip delay test for SMS recharging and 100% success rate in wireless and keypad recharging. The GSM-based Energy Metering System developed worked satisfactorily. It is reliable and efficient for use by the supply authority and the consumers.


Introduction
Over the years, the measurement of electricity has evolved through the use of various energy meters ranging from meter operated on liquid movement which is analogous to sand watch through various electromechanical energy meters and then the Prepaid Meters [1][2][3].The Prepayment meter is electronic in nature and therefore has some level of intelligence.A Prepayment Energy Meter enables the utility company to collect electricity bill from consumer prior to energy consumption.The Prepayment meter is not limited to Automated Meter Reading (AMR), but it is also attributed with prepaid recharging ability and information exchange with the utility company pertaining to customer's consumption details [4].In Nigeria, as at the time of this research, recharge tokens were only loaded or key-in into the meters through physical contact by the use of keypad.
There are different ways of recharging the Prepayment Meter namely, the use of smart card; the use of infrared and the use of token through keypads [5][6].The most prevalent type of recharge system especially in the Benin Electricity Distribution Company of the unbundled Power Holding Company of Nigeria (PHCN) is the token recharge system.In this system, the consumer will purchase the recharge token either from the vending station at the supply authority's offices, the banks or any other authorized sales outlet.
A number of researchers including Berhanu et al. and Christopher have agreed that various forms of wireless communication technologies can be used to achieve wireless recharging and monitoring of energy meter [1,7].Some of these technologies include Power Line Carrier (PLC) communication, Supervisionary Control And Data Acquisition (SCADA), Internet, Ethernet, Embedded RF module, Wi Fi, Bluetooth and ZigBee.These methods are either expensive to implement and operate or require complement set up of infrastructure or short operating distant and still require field intervention of human operators or they are prone to errors [8].The GSM network is used to achieve wireless recharging of energy meter in this research because, there is an already existing GSM infrastructure with a wide coverage in Nigeria and it supports Short Message Service (SMS) platform that is used to load the token on the meter.

Research Survey on Recharging Prepayment Energy Meter
The Electric Energy Prepayment meter is an important component of the Utility Company as well as electricity consumer's equipment for energy consumption measurement.Again, it is a new technology in electricity metering therefore, it is subject to improvement in several areas.As a result, several researches have over the years been carried out on different aspects of the meter gear towards its improvement.One of such researches carried out in this area of prepayment meter was on measurement and billing efficiency, which was modeled and simulated based on artificial intelligence and cognitive approach using Matlab [9].Similarly, others focused on designing a suitable interface circuit that makes the traditional meter functions exactly the same as Automatic Meter.In this approach ZigBee network was used to send meter reading to Electricity Board [1].
Also, Tariq developed an economical prototype of Wireless Automatic Meter Reading System (WAMRS) in the Sultanate of Oman, in which wireless communication is based on IEEE 802.15.4 ZigBee standard [3].Chunjuan and Junjie proposed the combination of Power Line Communication (PLC) and General Packet Radio Service (GPRS) to achieve meter reading transmission from the various meters to the master station for effective real-time overview of consumption by the utility company and the user, thus promoting improvement in energy management and budget planning [10].This was to ensure backup of transmission link in AMR system through redundancy arrangement.Boyina et al. in their research interfaced a GSM module addressed with AT Command to a PIC16F877A microcontroller to take meter readings continuously and send the readings to the Electricity Board by SMS [11].This was an aid to accurate meter reading in AMR which reduces the labour and man hour required by personnel in manual meter reading in a post-paid metering system.Rachitha et al., and Diya with Alpha while working in their separate projects proposed a wireless method to replace the manual means of taking meter readings for billing purpose.They interfaced the existing meter to a microcontroller which in turn is interfaced to a GSM modem used for SMS communications with mobile phones and electricity provider.This enables data to be transmitted from the meter to the supply authority, processed and then the generated bill sent through SMS to the consumer.This is an improvement of the postpaid meter reading to an AMR [12][13].Similarly, Jubi and Mareena used GSM technology to keep track of the real-time consumption of power by sending messages to consumers about the consumption of power and also alerting them at the minimum level of units [14].This was only an alert system as it never attempted recharging the meter wirelessly.Concerned with the low level of energy billed compared to energy delivered and the low level of consumers' response to bill payment, Anthony et al. designed an energy meter that uses Atmega32 and a GSM modem to communicate in SMS with the consumer in sending low level credit alert, and sending consumption information to the supply authority.This was to ensure that the supply authority has maximum response in bill payment from the consumers [15].Though, they stated that the device is a prepaid meter, they however did not state the means of recharging this meter.
With the new trend in web technology, instead of using SMS as a means of sending meter reading to server in the Electricity Board in AMR, some researchers have proposed a system were power consumptions measured by wattmeter are constantly transmitted to clouds using Wi-Fi module where the data can be view by all concerned [16][17].This is an Internet of Things (IoT) method of transmitting, storing and accessing meter readings, therefore it is not a prepaid meter.Mayur et al. proposed the interfacing of an electronic circuitry called Eliot with a unique identification to an electric meter, and a web application also designed where the device can be recharged and the consumer can view the information about their real time consumption as well through a user account created, which the consumer can log into using a password [18].This is a web based energy consumption monitoring system and not a prepaid meter.
However, Omijeh and Ighalo presented a robust and a more efficient prepaid energy metering which used the existing Global System for Mobile communication (GSM) networks [19].This proposed SMS recharge was through a server and not directly to the meter and the validation of the token was outside the meter.

Materials and Method
The implementation of this work was done in two stages.These include the hardware and the software stages of implementation in this order.These enabled the objectives of this work to be realised.

Hardware Implementation
The hardware component of the design is as shown in Figure 1.It consists of the energy meter section and the supply authority section linked by GSM network coverage.The power supply of the system is not represented here.The power supply of the meter is transformerless.The power supply of the server/supply authority circuit is sourced from the computer used through the USB port of the system.This provides the 5Vdc required for the operations of its microcontroller and other circuitry in the system.The stages of the hardware implementation are discussed in the Henry Erialuode Amhenrior and Fredrick Edeko: Design and Implementation of a GSM-Based Single Phase Prepayment Energy Meter with Hybrid Recharge Mode following subsections.

Interfacing Between the Microcontrollers
The two microcontrollers in this design are the Atmega2560 and Atmega328P.Atmega328P is dedicated to monitoring pulses generated from the ADE7755 for measuring the energy consumption through the meter.These pulses are received in the controller pin 4 (INT 0).This controller keeps count of these pulses and updates the Atmega2560 controller every second at its request.Atmega2560 pin 6 (INT 4) is connected to pin 15 (PCINT1) of Atmega328P and this is used to request for update from it.Pin 14 (PCINT0) of Atmega328P is connected to pin 63 (RXD3) of Atmega2560 and this is used to obtain the pulse readings for records and other operations.Figure 2 shows the interface connection between the microcontrollers.

The Energy Measurement IC (ADE7755) Connections
The ADE7755 IC is one of the most important components in this work as the energy measurement is carried out in this chip.Figure 3 shows the connections.
The important inputs of ADE7755 used in this work are the transducer inputs.PINs 5 and 6 are the analog current input Pins of the IC and they are fully differential inputs.The signal from the current transducer are fed into the IC through a current limiting resistor of 10k each with C 6 and C 8 as filtering (decoupling) capacitors for the current signal channel.Similarly, the voltage ratio is fed into the IC PIN 8 through a simple voltage divider network of R 12 and R 13 which measures the voltage across R 13 based on voltage divider rule with C 9 as a filtering (decoupling) capacitor for this voltage signal channel which is also fully differential.The ADE7755 output frequency (CF) in PIN 22 is connected to the optocoupler for noise isolation before connecting to the interrupt 0 (PIN 4) of the microcontroller (Atmega328P).

The Keypad and LCD Connections
The Keypad and the LCD are the meter user input interface unit (UIU) and output display unit (ODU) respectively apart from the interaction from the mobile devices and the supply authority server.The interfacing of these units to the microcontroller are shown in Figure 4.
The keypad rows are interfaced to the microcontroller port K PINs 85, 86, 87 and 89 which are pin change interrupt (PCINT) pins, the columns are interfaced to port D PINs 45, 46 and port E PIN 7 which are interrupt pins 2, 3 and 5 respectively.
The 192X64 Dots matrix LCD has its eight data lines interfaced to the port A PINs 71 to 78 which are address data input/output ports.The LCD is a three page display with three column select (CS1, CS2 and CS3), Reset (RS), Read/Write (R/W) and chip enable (EN) interfaced to microcontroller PINs 35, 37, 15, 41, 40 and 39 respectively in that order.

Other Microcontroller Interfaces
Among these interfaces are the SIM900, the Real Time Clock (RTC), the Buzzer, the SD Memory Card, the Tamper Switch and the Output Power Control interface.Figure 5   shows these interface connections.The SIM900 is interfaced to the port H 0 (PIN 12) and 1 (PIN13) of the microcontroller which are the Received Data (RXD2) and Transmit Data (TXD2) pins.The receive data of the controller is connected to the transmit data of SIM900 while the transmit data of the controller is connected to the receive data of SIM900.The DS1307 real time clock (RTC) is connected to the controller through the I 2 C protocol.The integration of the crystal resonator enhances the long-term accuracy of the device.The Serial Clock (SCL) and serial data (SDA) terminals of the RTC are interfaced into the port D 0 (PIN 43) and 1 (PIN 44) of the controller which are the controller's SCL and SDA pins.The SD card communicates with the microcontroller through an SPI interface.The SPI is a synchronous serial data link made up of four wires: one for the clock signal, one for the data in one direction, one for the data in the opposite direction and one to select the chip.It is interfaced to the controller port B 0 to 3 (PINs 19 to 22).The buzzer is interfaced to the controller port F5 (PIN 92) through a 555-timer, while the tamper switch is connected to the controller port B5 (PIN 24) and pulled up to +5V through a 10k resistor R1. Figure 6 shows picture of the developed metering system.

Software Implementation for Recharging
The software implementation of this work is mainly in three areas namely the recharge command development; the microcontrollers programming that ensures meter correct operations and the Application Platform development.

SMS Recharging
This involves the development of commands in C++ Language which can be used to send SMS in SMS capable devices to recharge the meter."*02#TOKEN" is the command.This command is used to recharge token remotely/wirelessly to the meter.The *02# command is followed by the 20 digit recharge token.When the token is recharged with this command, it uses the decryption algorithm to check the validity of the token and then accepts it and increment the unit value by an amount that is decrypted and writes the new unit balance in Kilowatt hour to a location in the EEPROM or rejects the token if it fails the decryption test.After successful decryption and the token is discovered to have been used previously by the meter, it will reject the token and sends the message "this recharge card has been used!" to the customer [22].Figure 7 shows a snapshot of the use of *02# command and the feedback from the meter.

Keypad Operations
The keypad is the manual option of interacting with this energy meter and it is a menu based system which consists of five (5) main menus with each number (numbers 1 to 5 in the keypad) corresponding to the associated operations as shown in table 1.In the keypad, there are numbers 0 to 9 keys, the "*" key and the "#" key.The "*" in this keypad operation serves two other functions apart from its primary purposes.It serves as the MENU key when pressed once and EXIT key otherwise.As the menu key, it opens up a page that displays the various operations with their corresponding number input to achieve each of those operations.As an exit key, it closes any page that is currently open on the screen once pressed.
The "#" key serves as the ENTER key apart from its primary function.As enter key, it is used to confirm operations or a selection on any page that is opened at that moment.These two keys retains these function even in the submenus of these main menu.

Application Platform
This is the platform for the administration of the system by the utility company and for managing the database of consumers.It is made up of two parts namely the server part and the application platform part which is the user interface (UI) part of the utility company.The application platform was developed using visual studio (visual basic).The server software is embedded in the Atmega328P (Arduino Uno) microcontroller which enables it to communicate with the meter through the modem (SIM900), while the application platform software and UI resides in the PC. Figure 8 shows the Application platform.
The application platform is used to generate token and this token can be recharged to the meter from this platform by clicking the recharge button and the token will be transferred to the "Test" editable textbox.Clicking the "Test" button sends the token to the meter through the server hardware for recharge.

Test
Test and measurement were carried out to determine the compliance level of the developed meter with the objectives of the work.The two major test carried out were the load test and the token test which are discussed in sections 4.1 and 4.2.

Load Test
The load tests were carried out at 320W, 200W and 160W respectively at 220V and the time taken for 0.01KWh (0.01 unit) in each case were recorded.It was done repeatedly for a number of times and the mean time on each load category was obtained and recorded as shown in Table 2.The purpose of this test was to show the measuring ability of the developed meter.The smallest unit of 0.01 unit was taken as a referenced unit of measurement.This test was carried out with the aid of stop watch, variable load, and the energy meter developed.

Token Test
Table 3 shows the success rate for token generation and validation by the three means of recharging the developed meter namely SMS, Keypad and Supply Authority Application Platform.

Discussion
Having successfully develop the energy metering system with hybrid recharging mode, it was subjected to load and token tests to ensure the performance ommunication show that this form of communicatio is optimal.
One of the quality that shows the good performance of this meter is the increase in time for the consumption of the same unit of energy as the load decreases.This shows that the developed meter in this research is indeed an effective energy measuring meter.At 320W, 200W and 160W load, the mean time required for the consumption of 0.01KWh for the developed meter were 133.46s, 233.3s and 311.1s respectively with their corresponding standard deviation of 0.88, 0.64 and 1.14.
The SMS communication here is a two-way communication and this enables the meter to be recharged wirelessly and get the unit balance whenever any of the three means of recharging is used.A mean time of 47.5s of round trip time was recorded for SMS recharging.The test results of this SMS c n is very effective and successful.The results also show 100% success rate recharging in the three mode of recharging the meter namely SMS, Keypad and Supply Authority Platform.Also, 100% token validation in the meter in SMS recharging was achieved as opposed to the validation in the server as proposed by Omijeh and Ighalo [19] and other researchers.This has shown a considerable advantage over the traditional way of recharging Prepayment meters in Nigeria through one means.Again, it has help to remove distance as a barrier to recharging meters and the risk of odd hour recharging.

Conclusion
Prepayment Energy Meter is a veritable tool for electrical power consumption measurement for both the electricity distribution companies and the consumers.Therefore, improvement in the design and functioning of the meters especially in the recharging mode is very imperative.In this research work, a wireless GSM-Based token recharge system in addition to the keypad system, providing an alternative means of recharge for the energy meter was developed.This system has made token recharge more flexible, easy, and reduces the risk of going out to key-in recharge token into meters at odd hours in environments where security is an issue at such time for the consumer.Most importantly, meters cannot be declared obsolete whenever the keypad is faulty as SMS means of recharging will still be available.This developed hybrid recharge technology is a marked improvement over the traditional method of energy meter recharging.
The mean time of 47.5s recorded from the SMS round trip time showed that SMS platform of the GSM communication network is very efficient and effective in wireless recharge of token into the energy meter.In order to guaranty this negligible SMS recharging, the GSM Network Operators will be the key driver of the communication component to ensure a minimum level service provisioning and availability of network in the areas of coverage at a cost that is relatively moderate.This, therefore calls for a service agreement between the GSM Network operators and the distribution companies Based on the results obtained, the GSM-Based single Phase Prepayment Energy Meter with hybrid recharge system developed in this work is reliable and efficient for use by the supply authority and the consumer.With this, the objectives of this work are fully realized.
and Fredrick Edeko: Design and Implementation of a GSM-Based Single Phase Prepayment Energy Meter with Hybrid Recharge Mode
and Fredrick Edeko: Design and Implementation of a GSM-Based Single Phase Prepayment Energy Meter with Hybrid Recharge Mode