Design and Implementation of a Zigbee, Bluetooth, and GSM-Based Smart Meter Smart Grid

The first step in upgrading the billing and metering systems available in Iraq in most areas supplied by IMOELC (the Iraqi Ministry of Electricity) is the development and application of smart meter systems. These systems are based on two-way communication between consumers and suppliers, and the smart meter approach is thus more reliable than even digital meters with regard to billing and tamper prevention, as well as allowing the government to monitor electricity consumption in an enhanced and organised way based on the information obtained from data centres. To facilitate this data exchange, a new meter was proposed and tested in real-time in a few houses in Karbala, with the measured voltage, current, and power factors for energy multiplied every second and summed to determine energy consumption before being stored on the SD (Secure Digital) card in a backup text file in case of shutdown. The readings collected from the tested region were send to a Data Concentrator Unit (DCU) using three communication methods (Bluetooth, XBee and GSM). The data was then transferred from the DCU to the server via GSM, as GSM offers the lowest interference and fault occurrence, making it most suitable for long-distance transfers. Bills were generated based on the readings over time, with the division by time shown on the bill to urge users to rationalise their energy use at certain times during the day. The final error in current reading was less than 8% and the error in voltage reading was less than 0.64%.


Introduction
A smart meter is a device based on bidirectional communication systems linking consumers and suppliers that includes a smart monitoring system. Smart meters are more reliable than digital meters in terms of billing and tamper prevention, as well as increasing consumer awareness about electricity usage; they also allow the government to efficiently manage energy distribution based on the information received. Smart meters are next generation devices thus represent the first step in changing traditional billing and metering systems to create a more effective smart grid management system based on bills being produced according to the timings of readings. Time splitting of the bill can thus be used to encourage consumers to rationalise resources and to control power consumption throughout the day.

Related Work
Several researchers have addressed the topic of developing smart energy meters, and numerous research projects have focused on the use of Bluetooth, ZigBee, and GSM-based meter communication. In [1], researchers discussed increasing the performance of legacy power generation, transmission and distribution systems alongside promoting the use of clean renewable energy through the implementation of modern smart grid communication networks. Ezeodili and Adebo [2] proposed a design using GSM communication protocols to convey information about usage to the utility companies to facilitate accurate billing; the proposed device could also remotely connect or disconnect customers according to their IOP Publishing doi:10.1088/1757-899X/1067/1/012130 2 preferences, and current energy metering systems could be incorporated into the new system's design, significantly reducing the cost of implementing the smart meters. In [3], the design and implementation of an open-source and standardised smart meter platform as an educational resource to provide a versatile interface for future changes was developed, while in [4], several surveys were analysed to examine responses to smart power meter and billing systems. In [5], an ACS712 was used as a current sensor, with ZMPT101B as a voltage sensor and an Arduino and IoT server to preset a device to provide real-time energy meter readings in kWh, thus showing the energy consumed and amount to be charged. The user interface was an Android device, and the current measurement error was less than 2% with a peak to peak voltage measurement error of 4%. Some previous researchers have discussed only the design of the smart meter, while other researchers have discussed connection between meter and server. The current research discusses the design of the smart meter, the connection between the smart meter and server, and the design of a Windows application for billing systems.

System Overview
The system designed to implement a smart meter and smart grid was composed of four devices: the smart power meter that measures customer power use; the data meter, which sends the data using ZigBee, Bluetooth, and Wi-Fi; the DCU that receives those communications; and the requisite GSM technology to transfer the data to the server. Figure 1 provides an overview of the system. The meter reads the ongoing energy usage and sends it to the receiver using Bluetooth, Wi-Fi, or ZigBee. The data management system Figure 1. General block diagram of the system. collects and stores the data and uploads it to the server. The server then generates the appropriate bill and prints it to be sent to the consumer [6].

Proposed System: Hardware
The proposed system has a home node, a DCU, and a server.

Home Node
The home node used in this research was a half effect-based AC current sensor and transformer-based AC voltage sensor with an Arduino Uno microcontroller used to calculate the real-time power consumption of all connected electrical appliances. A ZMPT101B voltage sensor, was used to record voltages. This sensor is a single-phase AC sensor that offers high precision and good consistency in the measurement of voltage and power and which can reach 250 V AC. In addition to its low price, its small size and simple assembly on the circuit board were useful. The output signal was sent to the analogue input channel of the microcontroller [7]. An ACS712 was used as a current sensor. The main features of this sensor its ability to measure AC/DC current up to 30A at an operating voltage of 5 V. This output signal was also sent to the microcontroller's analogy input channel. This sensor works on the principle of the Hall effect. When a current flows through a conductor placed in a magnetic field, a voltage is generated at its edges that is orthogonal to the direction of the current and the magnetic field [8]. To calculate the power of a single-phase AC circuit, the volt and ampere outputs are thus multiplied by the power factor, which is the cosine of the phase angle of the voltage and current waveforms, as shown in Figure 2. When the voltage and current are in the same phase, the output signal of the current sensor depends entirely on the type of device connected, regardless of whether the connected load is ohmic, capacitive, or inductive [9]. Power was thus measured in the microcontroller after the current and voltage outputs were received from the respective current and voltage sensors, calculated as in equation (1) P = Vrms × Irms × P. F (1) where P is the Calculated Power, Vrms is the supplied voltage, Irms drawn current, and P.F is the power factor = cos (ɸ). Accumulated power consumption was then calculated based on the run time of appliances in order to calculate used KWh, as in equation (2) [11].
After completing these calculations, the measured reading was displayed on the attached Liquid Crystal Display (LCD). A ZigBee or Bluetooth module was then used to wirelessly send all the measured readings to the DCU. Figure 3 shows the devices implemented, with Bluetooth in the first instance and ZigBee in the second.

DCU Node
The objective of the DCU is to obtain all measured readings transmitted from a home node and then to transmit the data via GSM to the server; this data is also stored in the local database to allow calculation of the bill as necessary. For information accumulation and information preparation, the DCU in this study used a GSM single chip microcontroller, as shown in figure 4, as this offered the ability to perform GSM related activities such as IoT applications and home automation. It also offered an alternative to the Arduino GSM shield for connecting to the GSM network and transmitting data over long distances, offering an inexpensive method bult in to the default firmware with the same functions as GSM Shield.

Server Node
There were three major parts to the server: the device, the local server, and the desktop application. All features and techniques utilised in this project are outlined below. The PoAPP (Power Application) was a desktop app written in C#. Figure 5 shows the server node connection to the database.  Figure 5. Server node with GSM (SIM800l) connection Figure 6 shows the wired connections the of home (with Bluetooth, and ZigBee S1), DCU, and Server nodes.

Proposed System: Software
Software was designed to retrieve readings from the home nodes and to store this data in a local database and then transmit it to a global server. This software database had five parts: The first part contained the accounts, second part read the data, the third stored unit values, the fourth part allowed users to control the software and finally the fifth part controlled billing. As shown in figure 7, all tables were designed in the local database. Software was written in virtual C# to designate the design of the general forms and bill. Eight forms were thus created in the PoAPP (Login, Main, Accounts, Units, Users, Bills, Voucher Generation, and Export Bill form).
The main form displayed all items in the interface (menu bar, tools bar, and image section). The menu bar had six icons (file, accounts, units, settings, bill, and report), while the tools bar had five tools (add account, unit price, add users, get bill, and voucher report); the image section allowed viewing of a subset of images or each application.
The account form in PoAPP allowed the addition, deletion or update of account data in the local database, as well as showing account information (Account ID, Account Name, Email, Contact, Address, and Account Type). Figure 8 shows the login and account forms in PoAAP. The user form allowed user control of the PoAPP settings, as well as showing costumer information (full name, user name, password, and date of create), and allowing amendment of accounts. The unit form allowed information about the unit to be viewed (unit type, unit value, unit description, and time number), and amendments made. The billing form allowed bills to be generated for any account for any period needed; to use this form, the user had to select the account name or account ID and the required dates; the appropriate cost was then generated and the bill saved in the local database, where it could be viewed in the voucher report. The voucher report for any two date showed a report with account names and total costs for the period between the from date and to date). Figure 9 shows the user, unit, bill, and voucher report forms. (c) (d) Figure 9. (a) users, (b) units, (c) bills, and (d) Voucher Report forms.
The final form of the exported bill of the selected account, available in the tools bar of the form, is shown in Figure 10.

Smart Grid Communication
The smart grid had two types of communication, wired and wireless to serve three level of network: home (Home Area Network), DCU (Local Area Network), and server (Metropolitan Area Network).

Wired communication:
In wired communication, Power Line Communication (PLC) was used to connect two or more devices in two types: NB-PLC (Narrowband-Power Line Communication) and BB-PLC (Broadband-Power Line Communication).

Wireless communication
Wireless communication of several types was used: Bluetooth, Wi-Fi, ZigBee, and GSM. In the HAN, Bluetooth or Zigbee communication were utilised because of their low cost, and low distance coverage, while communication between the DCU and server was done in GSM, based on low cost, low interference, and high distance coverage.  Figure 11 shows a data sample sent between the DCU and the server, during real time project processing in the PushingBox API, connected to Google Sheet. Figure 11. Arduino sending data to the PushingBox API. Figure 12 shows the smart grid block diagram

Results and Discussion
As a proof of concept, a hardware prototype was implemented as shown in figures 3,4, and 5; figure 6 demonstrates the hardware prototype used for the Smart Energy Meter and the wire connections required. Using five different types of load (laptop charger, phone charger, printer, soldering iron, and vacuum cleaner), the accuracy of the smart meter sensors was calculated. The measured voltage was read and registered by the ZMPT101B voltage sensor and multimeter, and these values are shown in Figure 13 as a graph. The reading accuracy of the ZMPT101B voltage sensor was 77.34%. The current estimated by the ACS712 current sensor and multimeter were also recorded and compared. The value and error rates are shown in Figure 14, and the ACS712 current sensor's accuracy was 99.82% overall. Figure 14. Accuracy of current reading.
The system design was implemented and tested in a few houses in Karbala with readings registered and bills generated for every house in the sample, as shown in figure 10.

Conclusion and future work
This research introduced an intelligent system for metering on a smart grid. The system can measure, monitor, and generate invoices for any account (home, factory, company, government building, farm, etc) based on the account type, reading time, and reading values. Reading time can then be used to promote rationalisation of energy use to users based on allowing a more detailed understanding of the electricity consumption in a home or building. The combination of ZigBee and IoT technologies to measure and control energy consumption in real time is an effective way to reduce energy use. On seeing the results of effectively managing energy consumption and controlling home appliance use, customers are likely to be motivated and encouraged to change their energy consumption behaviours, adopting IOP Publishing doi:10.1088/1757-899X/1067/1/012130 10 habits such as turning off lights or reducing heat. These small changes in behaviour may in time result in significant energy savings.
In the future, the system can be developed further to incorporate other features such as a smartphone app to help develop smart home management by connecting to the PoAPP desktop app. Expanding the proposed system should further reduce energy expenditure and thus bills for the average user. Future work may also need to divide users into types such as household, commercial, industrial, governmental, or agricultural, and divide use times into specific periods, as the operation of factories and government institutions vary in terms of timing to residential applications.