A Novel IoT Based Smart Energy Meter with Backup Battery

Energy consumption is currently on the ascendency due to increased demand by domestic and industrial consumers. The quest to ensure that consumers manage their consumption and the utility companies also monitor consumers to manage energy demand and production resulted in smart energy meters which are able to transmit data automatically at certain intervals being introduced. These Smart Meters are still fraught with challenges as consumers are unable to effectively monitor their consumption and the meters are also expensive to deploy. This research aims to present a novel IoT based Smart Energy Meter that will gather consumption data in real time and transmit it to a cloud data repository for storage and analysis. The novelty of this inexpensive system is the introduction of an ADM25SC Single Phase DIN-RAIL Watt-hour Energy Meter which sends power to the microcontroller and also the introduction of a backup battery that keeps the meter on for some time to transmit outage data during power outages. Data gathered from the proposed IoT based Smart Energy Meter for a period is compared against that of the same period from a Smart G meter, a widely used energy meter, and is found to be very close confirming the accuracy of the IoT based Smart Energy Meter.


I. INTRODUCTION
ORLD-wide energy demand is rapidly increasing due to rapid population growth, urbanisation, and industrial development. To ensure the efficient utilisation of energy, consumers should have a way of knowing their energy consumption. Energy meters are usually installed at the premises of consumers to monitor their energy usage, and based on the data gathered, a bill is generated for payment periodically, like once a month, for payment where the customer is a post-paid customer. Prepaid customers purchase power units and is loaded onto the meter for consumption. Energy meters used to be read manually and the data sent to the premises of the utility companies for manual entry to generate bills, smart meters have been developed and deployed in recent years to overcome this drawback. A smart energy meter is a digital meter that measures power consumed and provides the power distributors and their consumers the ability to both gain access to electricity consumption data, a feature that the traditional meters lack. In the estimation of [1], smart meters are seen as an important component of the smart grid; it allows the service providers to interact with their consumers more effectively. They further posit that with the advent of smart meters, the total consumption of energy could be reduced even though demand is accelerating.
Energy consumption has significantly increased as a result of population growth and new equipment usage, huge challenges to energy security has been presented as a result [2]. This research aims at presenting a novel low cost IoT based Smart Energy Meter that gathers data in real time and transmits it to a cloud data repository for storage and analysis. The novelty of the proposed meter is rooted in the fact that it is equipped with a backup battery that allows the meter to stay on for some minutes in order to transmit outage data to the data repository when there is an outage. Consumers are presented with an opportunity to track their consumption periodically so as to be able to monitor and manage their consumption patterns to obtain financial W benefits through efficient energy usage. Utility companies will also be afforded the opportunity to monitor the consumption patterns of their consumers and also be able to identify pilferage. A smart meters' function currently extends beyond a measuring device and have become the most important component in the area of smart power grids. The Internet of Things (IoT) is the newest technology that has transformed the traditional computing field in all spheres including the energy sector. The IoT system is made up of linked computing devices, digital equipment, animals, or people and each is provided with a unique address for identification. Through the IoT, data can be seamlessly transferred from devices to cloud data repositories for storage and subsequent analysis. The deployment of traditional systems for remote monitoring has been fraught with a number of challenges such as security, power consumption, and inefficiency in data exchange thus giving the IoT an edge in this domain. Deployment of IoT in the energy metering system is expected to bring significant revolution in billing, monitoring, and security in the energy sector. The introduction of the ADM25SC Single Phase DIN-RAIL Watt-hour Energy Meter enables the system to withstand power fluctuations as power is transmitted to the microcontroller and the sensors through it. The low cost of the devices used in building the meter makes it inexpensive to deploy.
The IoT based Smart Energy Meter is deployed on the premise of a small business and was able to capture consumption data every 15 minutes in real time and the data was transmitted to the cloud data repository, ThingSpeak. Analysing the data showed high consumption during peak working hours and low consumption during off peak periods such as break times, holidays and weekends. To confirm the accuracy of the proposed meter, data for a period is compared to data gathered using a Smart G meter [25], a widely used meter, for the same period. The IoT based Smart Energy Meter's data was very close to the Smart G's data thereby confirming its accuracy.

II. RELATED LITERATURE
Traditional meters which could not automatically transmit data and made it impossible to identify those engaged in pilferage are being replaced with Smart Energy Meters. Different types of energy meters that are deemed smart have been presented. According to [3], errors are made in reading consumers electricity consumption data and also in billing them, to overcome this challenge, they proposed an IoT based prepaid energy meter. This meter is made up of an ADE7758 meter circuit, Atmega328p microcontroller and Wi-Fi module, it can transfer the units through the internet to the meter and has the capability of identifying demand theft by using current balance method. A three-phase cost effective energy meter that collects, processes, and transmits consumer side consumption information was also presented by [4]. A new smart energy meter using an IoT approach incorporating a sizable number of communication interfaces with multi-protocol connections for easy integration with energy monitoring software was also proposed by [2]. A new low-cost smart energy meter based on the Internet of Things (IoT) for measuring and billing energy consumption online was presented by [5]; the proposed meter in their estimation gives information on real-time voltage, current, and power consumption to the consumers via their smart phones. Energy distribution companies are able to use the system to identify power thefts and faults. A smart energy meter that has a smart energy theft detection system based on machine learning and statistical models that is capable of identifying theft was also presented by [6]. An IoT based smart energy system in energy management in the smart home was also proposed by [7]. A smart meter was also designed by [8] for efficient dynamic power management for consumables in households using IoT; the system is composed of a metering device, billing system, and base station. It is postulated by [9] that smart energy meters provide real time information on electricity consumption data and helps consumers efficiently and economically manage their power requirement efficiently. They therefore presented an IoT based smart energy meter that is able to efficiently manage load in real time and controls electrical appliances remotely in the smart home based on user-set events. It is also alluded by [10] that deploying the IoT in smart energy meters will result in saving energy, they thus presented a low cost energy monitoring system by identifying high energy consuming devices and devices that can be turned off using the App.
According to [11], existing energy meters are bedeviled with a lot of problems and one of them is the lack of full duplex communication; to solve this challenge, they proposed an IoT based smart energy meter. This meter they posit will control and calculate the energy consumption of consumers and the data will be uploaded to a cloud data repository where consumers and the utility companies will have access. In their study, [12] also presented an IoT based smart energy meter that is capable of providing data on energy consumed on daily basis and also it is capable of generating an alert where the energy consumption is more than a specified limit. It also has the capability of stopping the supply of power to a consumer when they are out of the premises to minimize wastage. A GSM and Zigbee based smart energy meter was developed in [1], it is capable of measuring and sending the information to the power distribution company to store and notify the consumer using SMS or internet medium. For automatic metering and billing system, [13] also proposed a smart energy meter, the quantity of energy used and the corresponding amount are displayed on an LCD and communicated to a base station continuously. Communication is done using Zigbee and SMS is sent using GSM on the occurrence of theft. An Arduino and GSM based smart energy meter for innovative metering and superior billing was presented by [14]. It is the allusion of [15] that cost of deploying smart meters is very high and the energy distribution companies pass the cost to consumers which makes it expensive, they therefore advocated for a good business model that will relieve consumers of the high cost of meters. They contend that Germany is rejecting the rapid EU's deployment of smart meters by 2020 due to high cost.
Engaging consumers to fully appreciate the successful deployment of smart meters is critical [16]. They should be educated to appreciate the benefits that will accrue to them, such as being able to monitor and control their consumption to lower cost. The increasing demand for electricity calls for more reliable, efficient and resilient power grids [17], current meters are susceptible to manipulation. Manipulating energy meters to steal electricity is reported to cost the U.S. six million dollars every year [18]; proposed meters should be able to curb these thefts. Energy usage is reputed to be higher than being predicted by current models [19], a meter that is able to gather accurate data for storage and analysis is therefore a priority. The IoT holds the key to building efficient energy meters; however, the large number of insecure IoT devices makes them vulnerable to attacks by malicious users [20][21][22][23]. Proposed IoT based smart energy meters must therefore be secured against malicious attackers [21]. The device being designed should encompass green IT technologies, which will ensure energy efficiency, safety, and also safeguard the environment [26].
All the smart meters presented go off immediately there is power outage which makes it difficult to analyze outage data to track pilferage. Smart meters should be able to send accurate data to a data repository on the time an outage occurred and when power was restored for analysis to determine if the outage was not due to meter tampering. The introduction of smart meters has rather exacerbated electricity theft contrary to the earlier held notion that it was going to curb it.

III. MATERIALS AND METHODS
The design of the proposed IoT based Smart Energy Meter is done by interfacing an ADM25SC Single Phase DIN-RAIL Watt-hour Energy Meter to an Arduino Uno microcontroller. The ADM25SC Single Phase DIN-RAIL Watt-hour Energy is used because its power consumption is low, less than 1 watt, it has a single phase with a 240V reference voltage. The sensors picking power from this meter will result in a more accurate reading since it can withstand fluctuations in power which is rampant in especially developing countries instead of picking it from the mains directly. The Arduino Uno microcontroller operates at a voltage of 5V with an input voltage from 7 to 12 V and 5V working voltage. It has digital input and output pins of 14, 6 analogue inputs and 32KB flash memory of which the bootloader uses 0.5KB, SRAM uses 2KB and EEPROM also uses 1KB.
A current sensor that reads AC and DC data is also connected to the microcontroller. It is capable of detecting and managing load. The current sensor is able to detect electric current flowing through a wire whether AC or DC. A hall-effect sensor that detects the presence of a magnet is also connected to the microcontroller. The output voltage of the sensor fluctuates when it is exposed to a magnetic field enabling it to detect magnetic field near it. Theft of electricity is perpetrated using large size magnets, the IoT based Smart Energy Meter should be able to detect the presence of a magnet and alert an impending theft accordingly. A voltage sensor that detects the presence of voltage is also interfaced to the microcontroller. An ESP 8266 Wi-Fi transceiver module is also connected to the Arduino Uno microcontroller, this enables a connection to be established to the internet for the transmission of energy consumption data to a cloud data repository. The Wi-Fi module has an integrated TCP/IP protocol stack, its power down leakage current is <10uA with an output power of +19.5dBm and operates in 802.11b approach. ThingSpeak, a cloud data repository of the Internet of Things is used to collect data from the sensors for analysis. Power outages occur frequently in developing countries and during bad weather in developed countries, the meter is designed with a backup battery of 1000mAH 9V capacity to stay on for some minutes to record outage data instead of going off abruptly like current smart meters. The battery is charged when current flows through the microcontroller. Fig. 1 shows the IoT based Smart Energy Meter's block diagram; it depicts the interfacing of the various components to the Arduino Uno Microcontroller. As depicted in Fig. 1, the ADM25SC Single Phase DIN-RAIL Watt-hour Energy Meter is connected with live (L) and neutral (N) wires; the live wire is connected to pin (-3) while the neutral (L) from the meter is also connected to the GND of the digital PVM of the microcontroller. Live current flowing from pin 3 of the Watt-hour meter is connected to the current sensor's input P1. The analog input which is labelled A0 on the Arduino microcontroller receives output transmitted from the current sensor. The current sensor is linked to 5V power on the microcontroller. In connecting the Hall Effect sensor, its GND is connected to the current sensor's GND and it is also connected to 5V power on the microcontroller and the output is transmitted to digital PVM at Pin 4 of the microcontroller. The ESP 8266 Wi-Fi transceiver module is connected to the microcontroller to transmit the data collected by the sensors to the cloud data repository via the internet. The power unit VCC and GH_PD of the Wi-Fi module are connected to 3.3V power on the microcontroller. The Wi-Fi module's GND is then connected to the GND of the microcontroller. From the microcontroller, Pins TX1 and RX0 on the digital PVM are connected to the Wi-Fi module's pins TXD and URXD respectively as shown in Fig.  1. A 16 × 2 character LCD is connected to the microcontroller to display the current consumed at a specified time. The LCD has an operating voltage of 5V, a screen resolution of 2 lines with 16 characters, and a character resolution of 5 x 8 pixels. The module dimension is 80 x 36 x 12 mm and the dimension of the viewing area is 64.5 x 16.4 mm. The LCD is connected to the Arduino microcontroller by connecting VSS on the LCD to the GND on the Arduino for signal ground. For power, VDD of the LCD is connected to 5V on the Arduino, V0 on the LCD is connected to 10 kΩ potentiometer on the Arduino to enable the screen contrast to be adjusted. From the LCD, RS is connected to Pin 2 on the Arduino to register select signal and R/W is also connected to GND on the Arduino for Read/Write select signal. A 1000mAH 9V backup battery is connected to the microcontroller to enable the meter to stay on for some time to enable it transmit outage data to the data repository, this will help in identifying electricity theft when the data is analysed. From Fig. 1, when there is voltage coming from the meter, the relay R1 will be on constantly and the NO (Normal Open) will turn on the power of the microcontroller from AC/DC adapter. Where there is no power from the ADM Meter, the relay R1 will go off and the NC (Normal Close) switches the battery power from the microcontroller on. Data on the time of outage together with the Meter Number, time and date of outage will be transmitted to a data repository. This can be used to identify those who engage in theft.
The data is transmitted to the open source IoT data repository ThingSpeak which stores and retrieves data using HTTP protocol through the internet. ThingSpeak configuration is done using the Arduino Library Manager, an account and a channel are created in ThingSpeak to receive the data from the microcontroller. The ACS712 Current Sensor is configured to measure the DC current. The Arduino code written in C++ for the implementation is adopted from [24] and modified to suite this project. To measure the current value, (1) is used: where: denotes the analog signal value that is read and converted to the actual voltage from the analog channel to which the output of the sensor is connected.
is the normal voltage output at pin Viout when no current is flowing.
represents the ACS712 Current Sensor's change in current.
The code snippet below shows the configuration of the LCD and current sensor to the Arduino Uno board which enables the sensor to read the current data and display it on the LCD screen.
The code snippet below enables the Arduino Uno board to transmit the current data to the cloud data repository ThingSpeak.

IV. RESULTS
The resultant prototype of the IoT based Smart Energy Meter is shown in Fig. 2. To validate the prototype, it is mounted in a small sized business premise for 154 days.   Fig. 3 shows a representation of the electricity consumption data, the small business that was used in gathering the data work for 24 hours during weekday and 12 hours during weekend, with break of 2 hours in the afternoon and 2 hours in the evening. They however do not work on holidays. Fig. 3 shows the data captured in 15 minutes interval which is aggregated daily and shown in Fig. 4.  Fig. 4, it could be seen that on weekdays the consumption is higher during peak working hours and lower during break times. Christmas and New Year holidays are celebrated from December 25 to January 2 and from Fig. 4, that period's consumption is very low. The consumption pattern of a customer as regards periods of higher and lower consumption is clearly depicted in Fig. 4 which confirms that the proposed IoT based Smart Energy Meter accurately measured electricity consumption for the period that it was mounted at the premise.

A. VALIDATION OF DATA ACCURACY
To validate the accuracy of the consumption data recorded by the IoT based Smart Energy Meter, the current data recorded in kWh is compared against that recorded by a commercial prepaid meter, Smart G [25]. To load money into the Smart G meter from a vending station, a smart card with GPRS technology is used. It has a screen which displays the remaining credit in monetary value, the cumulative energy consumed since the meter was installed, and power consumed in kWh. Daily consumption in kWh is monitored from the Smart G meter for 30 days, and for the same period, the data from the IoT based Smart Energy Meter stored in ThingSpeak is also gathered. The data from both devices are presented in Fig. 5.
As depicted in Fig. 5, the electricity consumption data recorded by the IoT based Smart Energy Meter is very close to that gathered from the Smart G energy meter which is widely deployed in many countries due to its accuracy. This confirms the accuracy of the data gathered by the IoT based Smart Energy Meter.

B. VALIDATION OF METER FEATURES
The IoT based Smart Energy Meter has the capability of storing data in a cloud data repository, the utility service providers and the consumers can both access this data. The IoT based Smart Energy Meter has a backup battery which enables it to stay on for a few minutes when power goes off. Data on the time an outage occurs and when the power came back is stored in the data repository for analysis. The features inherent in the proposed meter is compared against the widely used Smart G and the meters proposed in literature by [4], [5] and [6] which is depicted in Table 1. The Smart G only stores data on purchase of power units which the consumer has no access to. The data can only be accessed by the service provider. Further, Table 1 shows that only [4] and [5] afford consumers the opportunity to view their consumption data. The IoT based Smart Energy Meter has a backup battery to transmit outage data, a feature that all the benchmark meters listed in Table 1 lack. They assumed the ideal situation where there is no power outage. Power outages occur frequently in most developing countries and without tracking outage data, it will be difficult to accurately identify electricity pilferage.

V. CONCLUSION
In recent times, energy consumption has increased significantly due to population growth and rapid increase in industries, requiring enhanced security measures against theft and providing consumers with the ability to track their periodic consumption for energy management. In this research, a novel low cost IoT based Smart Energy Meter is designed and implemented, it is validated by mounting it in the premise of a small sized business for 154 days. The consumption data is read every 15 minutes and transmitted to the cloud data repository ThingSpeak for storage and analysis. Various IoT Smart Energy Meters have been presented, however, the proposed IoT Meter has an additional device, an ADM25SC Single Phase DIN-RAIL Watt-hour Energy Meter or its equivalent, which is able to withstand power fluctuations, and transmits power to the microcontroller. The proposed meter is embedded with a backup battery that enables the meter to stay on for some minutes to transmit outage data to the data repository. The data gathered from the IoT based Smart Energy device is compared to data gathered from a Smart G meter for the same period to confirm its accuracy which showed both data to be very close to each other. The IoT based Smart Energy Meter that has been presented is therefore more robust, inexpensive, and accurately reads energy consumption for transmission to a cloud dat repository for analysis.
As a future work, a predictive model that uses data from the IoT based Smart Energy Meter to identify theft in real time is proposed.