Efficient Energy Management for a Proposed Integrated Internet of Things-Electric Smart Meter (2IOT-ESM) System

I n this work, an efficient energy management (EEM) approach is proposed to merge IoT technology to enhance electric smart meters by working together to satisfy the best result of the electricity customer's consumption. This proposed system is called an integrated Internet of things for electrical smart meter (2IOT-ESM) architecture. The electric smart meter (ESM) is the first and most important technique used to measure the active power, current, and energy consumption for the house’s loads. At the same time, the effectiveness of this work includes equipping ESM with an additional storage capacity that ensures that the measurements are not lost in the event of a failure or sudden outage in WiFi network. Then then these measurements are sent using the internet of thing (IoT) technology to Google Firebase cloud, where the electric consumer's service center is located to store, analyze the measured data, and detect cases of energy penetration when it exceeds 53 𝑘𝑤ℎ, and the cases of the electrical energy theft if any below 20 𝑘𝑤ℎ and then take the appropriate decision about it. Finally, an electric smart metering application (ESM-app) is designed and implemented to read and pull data information from the Google firebase cloud and then send the electric bill to the end consumer, and sending alert messages to the thieves and electrical power hackers to prohibit them if something wrong has detected.


INTRODUCTION
The electric smart meter is the electronic digital instrument that has become smart because the Internet of Things (IoT) technology is used to find out how much energy consumers consume in real-time at least once in today's use. IoT technology can be accessed and controlled remotely by a utility center which decreases human effort by enabling machine-to-machine communication as part of the smart grid specifications; the value of these meters is to be used. The research work (Araya, et al., 2019) had presented many systems that have to talk about smart energy meters like an Intelligent Energy Meter (IEM). The primary goal of this system is to develop an energy metering system using IoT technology based on designing a WiFi module smart energy meter that uploads the energy consumption in real-time and issue the measured bill at a cloud server. Still, this research has a drawback; it did not consider the case where there was a problem with the WiFi network or when the entire internet network was breakdown, and how to handle this situation to store the consumer's data of their profiles. Another research proposed Smart Energy Monitoring System (SEMS) (Govindarajan, et al., 2019). This work introduced SEMS using the cloud-computing framework, which is useful for tracking data and storing data in the cloud server (Abdulredah, et al., 2020) using the protocol of two-way messaging. This research has a drawback, it didn't consider the theft case for the energy consumption from some consumers. So, the traditional system and many other smart energy systems may have many problems, including:  The electric meters are working as a stand-alone, and the power consumed is not measured, which makes these devices are less accurate and their measurements are volatile.  Most traditional electric smart meter designs depended on displaying the amount of energy consumed and computing the bills without energy-saving work.  Designing traditional electric smart meters does not focus on improving power efficiency, electricity performance, and network reliability but only provides the energy saved.  Traditional smart meter design does not include reducing utility centers' operation and management costs.  Another drawback of conventional techniques is not including the methods of fault detection or theft in electrical power.
This work proposes a solution that satisfies a new architecture by using IoT technology, so the proposed system is called an integrated Internet of things -Electric Smart Meter (2IOT-ESM) system. The 2IOT-ESM system is designed as smart energy management for energy bills system with IoT and cloud computing technologies. In this proposed system, three technologies were used: IoT, google firebase cloud, and smart electric meter, which has support systems that worked together for satisfying more efficient energy management on the electric billing system. Also, to satisfy more efficiency in the electric measurements of the new electric smart meter. The meter's data includes not only the power consumption but also the current, voltage, frequency, power factor, and the meter's stability and position. Additionally, providing additional improved capacity called Micro SD Card Adapter. It contains a capacity of (2-32) GB to store and record measured data in the electric smart meter. And it is used to solve the problem of a sudden outage or failure in the WiFi network. In addition, in this work, the utility system detects the owners of meter hacks, electricity theft, and the security measured meter data and metering data management software by using the Arduino IDE software and WiFi network for wireless two-way communication between multi-consumer utilities. The work of this research is organized as follows: Section 2 describes our proposed 2IOT-ESM system architecture, including its main layers (physical layer, data management layer, and utility management layer). Section 3 explores designing and implementing main used technologies for our proposed 2IOT-ESM system, including (electric smart meter, Google firebase cloud, and electric smart meter IoT application). Section 4 gives the implementation results for our proposed 2IOT-ESM system and discusses these results. Finally, section 5 describes the main conclusions of this work and the suggestions for future works.

2IOT-ESM SYSTEM ARCHITECTURE
A 2IOT-ESM system allows for two-way communication with electric smart meters, allowing for a variety of functions such as managing real-time values and, among other things, adjusting the frequency of readings using the Arduino IDE software. The network connecting electric meters to the utility center enables consumers' providers and service providers to collect, distribute information, and pay their electric bills online. The architecture diagram for our proposed 2IOT-ESM system model is shown in Fig. 1. The suggested 2IOT-ESM system model has a layered design based on the features and goals of customers' needs. Our system architecture's components and interfaces can be classified into various working groups. There are three layers; our architecture layers for the 2IOT-ESM system are shown in Fig. 2. Every layer in the 2IOT-ESM system is divided into two parts: the hardware part and the software part, which are working together on the same layer side but with different locations and responsibilities. There are three layers for the 2IOT-ESM system model:

Layer 1 (The Physical Layer)
The physical layer is located at the bottom of the 2IOT-ESM system architecture layers; this layer includes:

Hardware Parts
Hardware parts of the physical layer include electric meters, multi-utility meters, microcontroller Arduino mega, and end-customer devices.
 Electric meter: is an electric instrument that is used to determine how much electricity was used by consumers to take or read a monthly bill, is typically made of an aluminum circular disc that moves in a circular motion to drive several gears that move the numbers that show us the cost, and it consists of a current coil that is connected in series, a voltage coil that is connected to the branch, a set of numbers that show the consumption value, and a plate that links electrical wires in a circular motion (Kong, et al., 2021).  The multi-utility meter is the link between electric consumer meters and the Utility Center's utility meter, which is responsible for collecting data from all customers' electric meters from a distant location.  Microcontroller Arduino mega 2560: is open -source software and hardware company. In this part, the hardware is used to receive the measured electricity meter consumed by the customer.  End-customer device: direct connection between end-customer devices to multi-utility meters.

Software Parts
Software parts of the physical layer include the WiFi network, Arduino IDE program, and electric Smart meters systems.  WiFi network: is a wireless (no wires) network that connects to the internet router and wirelessenabled Devices (such as laptops, smartphones, and printers) in the customer's home using a radio signal. A WiFi Network gives us the convenience and mobility to access end-customer electric meters data to the utility data center.  Arduino IDE program: is an Arduino integrated development environment (IDE) program that is used to facilitate electric smart meters through the internet IOT gateway by using a WiFi Journal of Engineering Volume 28 January 2022 Number 1 112 network using for calculating the measured data of the electricity meter that consuming by the customer.  Electric meters systems are groups of electric meters for customers combined to formation multi-electric meters systems were uni electric meter systems for each customer.

Layer 2 (The Data Management Layer)
The second layer is located in the middle of the 2IOT-ESM system architecture layers, responsible for receiving data measured from the physical layer.

Hardware Parts
The Hardware Part of this layer is a display unit for sees management's measured data and control on it: a cable on the microcontroller Arduino mega 2560 to see the measured data consumed by the consumers connects this unit.

Software parts
Software parts of the data management layer are:  Electric Meter data management: connected to the microcontroller Arduino for calculation of these data.  Arduino IDE program: for executing the measured data by the electric smart meter then, Arduino mega 2560 checks the power calculation itself. Finally, it sends a signal to the Nextion (NX8048T050_011R) display unit to display the AC voltage (V), AC (current), power (P), frequency, power factor (PF), and energy consumption for the given loads after verifying calibration work, and the WiFi network is finally stored in the google firebase cloud of the utility side.  Nextion Editor Program: is a program that is used to program the LCD Display (NX8048T050-R). We exported a suitable program for our task on the output screen, then sent it to the USB Read Access Memory (RAM) from the output file, and then connected this external RAM to the USB pins in the NX8048T050-R to transport the program to it.

Layer 3 (Utility Management Layer)
The third layer is located at the top of the 2IOT-ESM system architecture layers, responsible for receiving the management data from layer 2 and choosing a suitable decision.

Hardware Parts
The utility management layer's hardware implies the device used in the billing system like the electric bill tips and the printer that prints these electric bills.

Software Parts
Software parts of the utility management layer are decision support systems, google firebase cloud, and the MIT app inventor.  Google firebase cloud: firebase helps mobile and web apps. Teams succeed in building apps fast. Without managing infrastructure, firebase gives functionality like analytics, databases, messaging, and crash reporting so you can move quickly and focus on our electricity consumption (Vinay, et al., 2020).  MIT app inventor: is a drag-and-drop visual programming tool for creating fully working Android mobile apps. It encourages a new era of personal mobile computing. People are enabled to design, create, and apply individual management companies' technology solutions in infinitely unique settings for their daily lives.

2IOT-ESM System Technologies
To specify the 2IOT-ESM system must be achieved efficient energy management (EEM), we used three technologies that worked together:

Electric Smart Meter
It is the first and most essential technology used to measure active power, current, and energy consumption for the house's loads. The smart electric meter starting with writing a code in the IDE Arduino program, a text editor for writing code, a message area, a text console, a toolbar with buttons for basic tasks, and a series of menus are all included in the Arduino Integrated Development Environment (IDE) software. It connects to the Arduino Mega 2560 and is designed to improve personal devices by connecting to them and uploading code. The Arduino Mega2560 is built so that it can be reset by software running on a connected computer instead of requiring a physical click of the reset button before an upload. A USB cable is used to connect the board to a laptop; uploading the code for the connection is shown in Fig. 3. The libraries in the Arduino IDE program are used to activate the platforms' codes for hardware components and to enable the linked components of the electric smart meter to receive all incoming orders and upload the measured data to the Firebase cloud.
The Arduino IDE program library that we will require for our project is as follows:  Firebase-Arduino-master: This library allows the Arduino Mega 2560 to communicate with the Google Firebase cloud.  Firebase JSON: This is the first Arduino library JSON parser builder and editor for ESP8266, ESP32, TEENY3.x, and other MCUs. It is used to activate the connection between the Arduino mega 2560 and the Google Firebase cloud. Simply specify the relative node/element path to parse, create, and edit basic or complicated JSON objects.  ITEADLIB-Arduino-Nextion master: This library is used to activate the Nextion LCD touch unit's connection to the Arduino mega 2560.  PZEM004Tv30: using for (PZEM-004T-10A and PZEM-004T-100A v3.0) Energy Monitor Arduino Communication Library, it is a library that is used to activate the connection between the Arduino mega 2560 and the PZEM004T (AC measuring: voltage, current, active power, frequency, power factor, and active energy) and is used when the PZEM-004T has been updated to include.  ESP8266WiFi: This is a library that allows the Arduino Mega 2560 to communicate with the WiFi (ESP8266 modulo) IC.  Software Serial: This library enables the connection between the Arduino Mega 2560 and the serial data output measurement for all of our measurements.  ACS712-20-AC: This library is used to activate the connection between the Arduino Mega 2560 and the current sensor ACS712. The output current measurement can be seen on the serial display, and the measurements may be tested using the RobotDynACDC 20A module.

Google Firebase Cloud
The second technology is represented by the Google Firebase cloud (Ramkumar, et al., 2020). The electric consumer service center must have an account to manage the measured data by the smart electric meter and make decisions on it. Firebase helps mobile and web apps and gives the utility centers designer functionality like analytics, databases, messaging, and crash reporting to move quickly and focus on his electric customers, backed by Google, trusted by top apps (Jabbar, et al., 2018). Firebase is built on Google infrastructure and scales automatically for even the largest apps. One platform with products that work better together is Google's mobile development platform that empowers you to build and grow our app quickly. It is built to easily pull in Google Cloud Platform (GCP) products as the team or infrastructure needs grow (Wilcox, et al., 2019).
More than one project can be built in the same firebase platform, where a project is a group of applications. All applications in the same project that can use the same cloud fire store, real-time database, and cloud storage back-ends and you can view combined analytics data across all apps, all firebase projects in my account showed in Fig.4. Firebase projects are containers for our apps and all services that the firebase platform introduced. Every application has a function, storage, hosting, real-time database, cloud fire-store, authentication, and machine learning. Different applications can be used in the same project, like android apps and web apps. Each of those platform-specific apps can be connected to the same firebase project. This way, the customers can access the same data if they switch back and forth between different versions of the app, and different firebase products can be used. The real-time database was chosen as firebase's original database in this efficient energy consumption project. It is an efficient, low-latency solution for mobile apps that require synced states across clients in real-time. Therefore, it is required and essential for the project requirement. The real-time database is shown in Fig. 5. The Firebase real-time database is cloud-hosted. Data is stored as JavaScript Object Notation (JSON) and synchronized in real-time to every connected client. JSON is a lightweight text format for storing and transporting data for any particular code, so it is used when data is sent from a server to any customer's web page. The fiberbase real-time database enables the utility center to Journal of Engineering Volume 28 January 2022 Number 1 116 store and exchange synchronous data in real-time between its customers, making it easy to access their data from any computer, web, or mobile and allowing customers to cooperate if any customer updates their data.

Energy Smart Metering Application (ESM-app)
Among these technologies, the third part is created using the MIT APP Inventor program (Ahmet,  et al., 2021). ESM-app contains information about energy consumers and pulls its data from the Google Firebase cloud, and finally, the billing system has become ready. After installing the MIT App Inventor and its emulator on our computer, the MIT App Inventor program is used to develop the ESM-app application. Even if there is no Android phone or tablet, the App Inventor tool can be used to create apps. The ESM app has the icon's picture shown in Fig.6.   Figure 6. The ESM-app icon's picture.

ESM-app Types
There are two sorts of ESM-app in our 2IOT-ESM system that have the same icon's picture:

ESM-admin app
This application is the ESM app for the admin. It is linked to Google Firebase projects, which are used to add all information about electric customers, such as their name, phone number, address, account number, the last date of their electric bill payment, how much electricity they consume and what their current electric bill reads. The utility center can be accessed through the ESMadmin application. It sends a message to the electric customers to educate them about their electric bill's information by using this application to update their consumers' bills information in realtime.

ESM-consumer app
This application is the ESM-app for the consumer, and it linked to Google Firebase projects, which used this project to get information on their private data and see whether there were any flaws. Electric customers were unable to add or change their information. Consumers can receive information from the utility center via this application, including details about their account and power bill.

RESULTS
The smart electric meter uses the Arduino IDE software to send as measurement output data, the power calculation. It sends its energy consumption management data through a WiFi network to google firebase cloud of the utility side to choose the efficient energy consumption. The output data in the electric smart meter is saved in two files named as (File.TXT), the first text file is called a PRIMARY.TXT for all loads in one house. These output data for all loads in it are the total voltage (V), the current loads (p_current), power, energy consumption (energy), frequency, and the power factor (PF). If one of the electric consumers who have a house with four rooms is chosen, the output data for his house according to his energy consumption as shown in Fig.7.   Figure 7. The PRIMARY.TXT Output Data.
The second text file is called a SECONDARY.TxT for loads in each room in the same house. The output measurements for the energy consumption for the same electric consumer's are the current loads through the first room (c1), the current loads through the second room (c2), the current loads through the third room (c3), the current loads through the fourth room (c4), the power consumption through the first room (p1), the power consumption through the second room (p2), the power consumption through the third room (p3), and the power consumption through the fourth room (p4) as shown in These output data are instantly translated to the google firebase through a WiFi network device using the Arduino IDE Program. Then they are saved there as JSON data where the utility center for the electric consumer's services be worked on to find how much the electric consumer's consumption energy instantly and how to learn them to satisfy the efficient energy consumption as shown in Fig. 9. Also, these output data instantly are translated from the google firebase through a WiFi network to the ESM-admin application to show the output measurement data on the admin mobile, where the utility center for the electric consumer's services sees it to find how much the electric consumer's consumption energy instantly as shown in Fig. 10, Fig. 11, and Fig. 12 of the electric bill information in the admin ESM application The lower screen Figure 12.
of the electric bill information in the admin ESM application The customers' energy usage data is analyzed by the admin person in the utility center, then exports the billing to the consumers' mobile application (ESM-consumer) as SMS. Depending on the program code settings, messages can be sent to mobile phones every 10 seconds, 30 seconds, 1 hour, 1 day, 1 week, or 1 month. The code set is chosen every 1 second in our project.

CONCLUSIONS and FUTURE WORK
The readings of the energy consumption of smart meters shortened the time and effort of the people responsible for measuring standard meters in homes. It also saved spending money calculating salaries for these people. It also guaranteed the extent of the validity of these readings and that they were not exposed to errors in human calculations while continuing to save these readings and ensure that they were not lost. The readings of this system have ensured that we shorten the time of recording the readings and easily raise them to the google firebase cloud and make procedures on these readings to determine the amount of electrical energy cost to the consumer with accuracy and efficiency higher than the efficiency of the standard electric meter. Also, after the measurement data by the electric smart meter are sent to the google firebase cloud of the utility side, efficient energy consumption in the real-time with consumer consumption energy is calculated by using machine learning (ML) technology that is minimum the energy consumption and learn the electric consumers how to use the energy in a true way to reach energy to all the city in a useful way and detecting the thieves of meter hacking and electricity theft, as well as authenticating the measured meter data, using the Google Firebase cloud's data in tables. In the future, it is suggested increasing the number of using this electric smart meter system to cover the largest possible number of homes in all regions, cities, and governorates to take advantage of the greater spread and increase the number of people who download the smart application in their mobile phones.