Real Time Wireless Smart Electrical Energy Meter System

Real time smart electrical energy meter network is one of the backbones for modern smart grid. It is very critical to have the right technologies for the efficient operation of smart meter network. In this paper, real time wireless smart electrical energy meter system has been designed and implemented which PIC microcontroller is used for real time energy measurements. In this system, all real time energy measurements will be send to base station through ZigBee wireless sensor network (WSN) for managements and monitoring. Also database will be design to record and manage all data and information of consumers.


‫اﻟﺤﻘﯿﻘﻲ‬ ‫اﻟﺰﻣﻦ‬ ‫ﻓﻲ‬ ‫اﻟﻤﺴﺘﮭﻠﻜﺔ‬ ‫اﻟﻜﮭﺮﺑﺎﺋﯿﺔ‬ ‫اﻟﻄﺎﻗﺔ‬ ‫ﻟﻘﯿﺎس‬ ‫ذﻛﻲ‬ ‫ﺳﻠﻜﻲ‬ ‫ﻻ‬ ‫ﻧﻈﺎم‬
.In fact, solving the problem of electrical energy demand needs for controlling the consumption of customers of electric energy and control must rely on an efficient and reliable system for accurate readings and this reduces the cost of measurements, in addition to providing an environment to monitor energy factor which is an important factor that increasing consumption or pressure on the network.Change in the national distribution network must include providing a safe environment for measurements and calculations cost which this matter will increase network efficiency and reduce consumption as well as to increase the value of the financial benefits.There are many methods for measuring electrical energy at home are: • Manual meter reading: it is the oldest method and it is weak because; for each house there is its own meter, this method required employers which taking readings of metrics manually, high cost of measurements, low accuracy of readings, and difficult to monitor gauges that these devices vulnerable to abuses.This method is still used in Iraq so far [3].

•
IC card prepaid meter: it is used pay-before use therefore it does not need employers to reading meters on site.It is partially solved the problem of manual meter reading because of no need to be on site and less measurements cost.But some problems exist in the actual operation process: IC card meter is easily damaged due to its direct contact with user and no realtime monitoring.It also fails to avoid theft, damage, and fault of meter [3].

•
Wire-line metering control system: in this method, the problem of measurements in real time has been solved, so all meters can be monitored and controlled in real time, also this type of meters can be connected to main station through telephone lines, energy line, TV network, etc. therefore it has low measurements cost.But it has problems of long construction period, high installation cost and maintenance cost, expansion of the system upgrade and compatibility with other network [3].• Wireless meter reading system: it is a process that the meter data is read and processed automatically via special equipment using wireless communication and computer network technology.In this type of meters all problems of real time measurement, monitoring and control has been solved.Compared with the traditional meter reading, it not only effectively saves human resources but also save the wiring cost and helps the management department find problems in time and take appropriate measures to deal with.Also it has easy and low cost installation, easy to extended, and more secure than other methods [4] [5].Wireless meter system required wireless network technologies to support the wireless I communication between base station and consumers.There are many types of wireless technologies like embedded RF module, Bluetooth, WIFI, WIMAX, GSM, ZigBee, etc. some of these techniques have high baud rate with wide bandwidth like WIFI, WIMAX, etc.These systems are suitable for internet and multimedia application [6][7][8].The problems of these system is the cost and complexity of installation and some of these types provides short range communication and the other is used for mobile phone system like GSM which it is required permission from communication company.In recent years there comes requirement for low cost equipment of wireless networking technology, called ZigBee.It is a low-complexity, low cost, low energy consumption, low data rate two-way wireless communication technology with high network capacity, short time delay, safety and reliance.Its main application areas include industrial controls, consumer electronics, car automation, agricultural automation, and medical equipment control.The core of this technology is established by IEEE 802.15.4 Working Group, and the ZigBee Alliance founded in 2002 is responsible for high-level applications, interoperability testing, and marketing [9].In this paper, ZigBee wireless sensor network (WSN) will be used for wireless meter communication supported by PIC microcontroller which used for energy unit measurements.Wireless routing system will be achieved in order to provide long distance of communication system.Wireless metering system will be controlled by central computer which place in base station; also database will be design to record and manage all data and information of consumers.

The Comprehensive Structure of Wireless Meter System
The comprehensive structure of wireless electric energy meter system is shown in Fig (1).Wireless electric energy meter has been used for each costumer (House, Hospital, University, etc.).These meters have been used to measure the instantaneous electrical power in hour (KWh) and power factor (pf) by using Microcnotroller circuit which are sends the values of (KWh and pf) to base station through ZigBee wireless network technology.
Normally base station located far away from costumers, in this case routing devices based on ZigBee wireless standard have been used in order to arrive the measurements of electrical energy meter to the base station.Final stage of system is located at base station which the server based on ZigBee standard has been used to receive all measurements of costumers and store these data in database for management and analyzing.
The Xbee kit has been used for ZigBee wireless communication.The XBee/XBee-PRO RF Modules are designed to operate within the ZigBee protocol and support the unique needs of low-cost, low-power wireless sensor networks.The modules require minimal power and provide reliable delivery of data between remote devices [10].

Figure (1).Comprehensive structure of real time wireless smart electrical energy meter. Design of the electrical energy meter.
The implementation of a basic watt/hour meter using microcontroller circuit has been achieved.In the process, ADC has been used to digitalize both voltage and load current.And then KWh and pf has been calculated by PIC microcontroller which sends to XBee kit through RS232 serial connection.The design discussed here uses the PIC24FJ128GA010 and Current Transformer (CT) for current sensing.

Principles of measurement
Basically, a watt hour meter is designed to measure power consumed over time.If measurements of both instantaneous voltage and current have been repeated for N times, the total energy consumed during specific time can be calculating by Measurements are performed in a specific sequence, with the entire sequence being repeated every (T s = T/N ms) which (F s =1/T s ).
For alternating current, average power can be calculated by V I cos(θ), where V and I are average rms voltage and current, and θ is the phase angle between the V and I. Instantaneous sampling does not directly use power factor; the value of the phase angle is essentially embedded in the instantaneous current measurement.Recovering the actual phase angle for the purpose of calculating and displaying the power factor can be done separately by evaluating delay time between voltage and current signals.
For this application, the derived voltage reading, V d , is related to the actual instantaneous line voltage V i by the expression, V d = V i K d /K v , where K d is the digitization constant for the ADC in this application and K v is the voltage proportionality constant for the circuit design.Similarly, the derived current reading, I d , is related to I i by the expression, I d = I i K d /K i , where K i is the current proportionality constant specific to this design; it is calculated by dividing the CT turn ratio by the product of the current amplifier gain and the input burden resistance.The total consumed energy of indirect voltage and current measurements will as follow.
Energy Consumed (wattsecond) = It is more practical to accumulate up to some fixed amount, and then increment a counter to indicate energy consumption.In this paper, for each accumulating 1000 Wh (1 KWh) the counter will be increment.This value represents the resolution limit of the meter.It is equivalent to 3,600,000 watt seconds (1000 W x 60 x 60).The resolution limit D can be calculated by any time that the accumulated sum of the voltage and current products equals or exceeds D, the counter will be increment the KWh.

Sampling Voltage and Current
Calculating power assumes that the voltage and current are sampled exactly the same time.By using a single ADC with one sample-and-hold circuit makes this impossible.By using an interpolated voltage value that very closely approximates what the voltage would be when the current is sampled.The principle is graphically represented in Fig (2).In this paper, the sampling time t has been taken in order to measure voltage and current.The procedure has been achieved to calculate the voltage for a particular current measurement: 1. Measure the first voltage sample at time t 0 .2. After an interval of t, measure the current (time t 1 ).3. After another interval of t, measure the voltage again (time t 2 ). 4. Calculate the voltage at t 1 as (V dt0 + V dt1 )/2.

Hardware Design
The conceptual design for the energy meter is shown in Fig( 3) ; a more detailed schematic is presented in Fig( 4).This design was prototyped using the PIC24FJ128GA010.As shown in Fig( 4), line voltage and current are sampled sequentially at regular intervals, with voltage and current being presented to different analog input channels.To measure voltage, the AC line is sampled across a potential divider, R 1 and R 2 .For current measurement, a current transformer create voltage signal across burden resistors (R 5 and R 6 ) that are proportional to the load current.For the current signal, an amplifier with two selectable gain stages follows the analog switches; it is used to compensate for the wider dynamic range of the current sample.Single stage gain is set by the values of R 7 and R 8 ; together with the turn ratio of the CT and the value of the burden resistors, these determine the value of the current proportionality constant, K i .
Information of energy consumption is sent to an external LCD.The current version of the application firmware displays cumulative energy use to date, as well as several other parameters, in a continuous rollover fashion.The core hardware design also includes a serial RS-232 interface for data communication.

Electrical Energy Meter Firmware.
A high-level overview of the energy metering firmware is shown in Fig. 5.The first step of firmware is initialized the required procedures for ADC and serial data transmission protocol UART while the second step is to select all suitable value for evaluating consumed KWh.The main loop is responsible for updating the KWh counter and maintaining the visual display shown on the LCD.The KWh counter is incremented on the basis of a status flag, set in an interrupt driven energy measurement routine.A separate display timer is used to determine how long each measured value is displayed before rolling over to the next value.
Voltage and current measurement are performed during an interrupt service routine triggered by the Timer0 interrupt.Measurements are performed in a specific sequence, with the entire sequence being repeated every (Ts = T/N ms).Interleaving samples of voltage and current are taken, with the simultaneous voltage values for the current measurements being interpolated by the application.For each instantaneous voltage and current, the consumed energy has been evaluated and repeated for each full time cycle T.The consumed energy has been accumulated.When accumulated consumed energy is exceeding the value of D, the value of KWh counter will be increments.Finally KWh will be send to LCD for monitoring, and to base station through ZigBee wireless communication standard.

Wireless Network System
Since wireless communication links can be quickly built, engineering cycle significantly shortened, and has better scalability compared to a wire-line system.If a fault occurs, only check wireless data module for causes quickly, and then restores the system back to normal operation [11] [12].In this project, ZigBee wireless standard has been used for wireless communication.

ZigBeeWireless Sensor Network (WSN)
ZigBee technology is a bidirectional wireless communication technology mainly works on 868 MHz or 2.4 GHz ISM band with 20 ~ 250 kbit/s data rate, 100 m ~ 40 km maximum transmission range [13].ZigBee network supports star, cluster tree, and mesh network architectures.ZigBee network has self-organizing and self-healing capabilities, and supports complex network topology, making message communicate among nodes in the network via different routes.Network not only has good scalability, but also makes data transmission more reliable.Multiple subnets can be connected at the same time to form a large, geographically dispersed network, making cross-zone metering and control is easily achieved [9].

XBee/XBee-PRO OEM RF Module
XBee/XBee-PRO OEM RF module is shown in Fig( 6) has been used for support ZigBee wireless network.For the applications where robust mesh networking topologies are preferred, XBee/XBee-PRO OEM RF modules provide developers with both ZigBee mesh and the soon-to-be-released proprietary DigiMesh™ topologies.These networks allow devices to harness the entire network of RF modules to effectively extend range beyond that of a single module, and create a more stable and reliable network.Employing dynamic self-healing, self-discovery functionality for reliable communications, XBee/XBee-PRO OEM RF modules make mesh networking simple and easy to deploy [14].The XBee module is very easy to use, and the interface is based on a simple dialogue with a serial port, which can be easily handled by a microcontroller or a PC.

Figure (6).XBee/XBee-PRO OEM RF module [14].
The XBee/XBee-PRO OEM RF Modules interface to a host device through a logic-level asynchronous serial port.Through its serial port, the module can communicate with any logic and voltage compatible UART; or through a level translator to any serial device (For example: Through a Max-Stream proprietary RS-232 or USB interface board) [14].

XBee/XBee-PRO Configurations
In this project X-CTU software has been used to configure XBee module as: 1. END device which connected to power meter through RS232 to received measurement parameters that will be send to base station.2. Router device which used to routing messages to destination also it is used to retransmit messages for long distance communication.
3. XBee has been configured as Coordinator device in base station side which connected to PC server through RS232 in order to receive messages of all END devices.XBee module has been configured in Application Programming Interface (API) mode which is transparent operation mode.API operation requires that communication with the module be done through a structured interface (data is communicated in frames in a defined order).The API specifies how commands, command responses and module status messages are sent and received from the module using a UART data frame as shown in Fig (7).When API mode is enabled (AP = 1), the UART data frame structure is defined as follows:

•
Start Delimiter is used for indication of starting frame.

•
The length field has two-byte value that specifies the number of bytes that will be contained in the frame data field.It does not include the checksum field.

•
Frame data of the UART data frame forms an API-specific structure as cmdID frame (API-identifier) indicates while API messages will be contained in the cmdData frame (Identifier-specific data).• Checksum to test data integrity.

Base Station Control Panel Software.
Instantaneous voltage and current have been measured by electric energy meter which rms values of voltage and current, power factor, and KWh have been evaluated by microcontroller.These information have been sent to the base station through ZigBee wireless network.In base station side the information have been stored in PC server for monitoring and management.System software has been designed by Visual Basic Dot Net in order to manage and monitor the electric energy parameter and personal information of customers as shown in Fig (8).For customer's information management, database has been used.For each customer there are (ID, Name, Address, City, Phone No., Email, Vrms, Irms, PF, KWh, and KWh Cost).The information of KWh and cost has been updated during period time.Also the information of KWh costs will be sends to customers through email or mobile phone messages for cost payment.

Experiments Results
Several experiments have been achieved in order to emulate the operation of wireless electrical energy meter system which the system has been tested in Al Maqal / Basrah / Iraq as shown in Fig (9).The distance between wireless electrical energy meter and base station is about 600 m.The prototype of practical wireless electrical energy meter circuit is shown in Fig( 10).The measurements starting through potential divider step which the AC voltage supply damping to low level voltage as shown in Fig( 4).R 1 and R 2 have been selected as (210 KΩ and 750 Ω respectively) to attenuate input peak voltage (304 V) to (1.08 V) peak supply voltage.The load current has been attenuated by CT of 100/5 transformation ratio which reduces (15 to 0.75 A) peak load current.The load current converted to voltage by using R 6 as shown in Fig. 4 which selected as (1 Ω) to evaluate 0.75 V. Next step is modifying the instantaneous values of input voltage and load current by non-inverting Op-Amp amplifier which amplifier output has been converted to digital value by 8 bit -ADC.In microcontroller the consumed energy has been evaluated which KWh counter will be increment when consumed energy exceeds the value of D. R 3 , R 4 , R 7 , and R 8 have been selected as (647 Ω, 5 KΩ, 5 KΩ, and 3.33 KΩ respectively) while F s has been selected as (400/50).The value of D has been evaluated as (115,302) by using equations 3, 4 and 5.The comparison between practical and theoretical values is shown in Table (1).Each customer communicate with base station through ZigBee wireless network which all measurement data of each customer has been send to base station and stores in server in order to monitored and analyzed.The server is connected to XBee Kit which is sets as Coordinator Device with ID=5000 and exchange data with base station through Also the electrical energy meter of customers is connected to XBee Kits which set as END Device with ID=5001, 5002, etc. and exchange data with microcontroller through RS232.all measurement data of each customer has been send to base station and stores in server rder to monitored and analyzed.The server is connected to XBee Kit which is sets as Coordinator Device with ID=5000 and exchange data with base station through RS232.

Figure (10).The prototype of pra
meter of customers is connected to XBee Kits which set as Device with ID=5001, 5002, etc. and exchange data with microcontroller through .Wireless electrical energy meter experiment in Al Maqal zone.
.The prototype of practical wireless electrical energy meter circuit.

Energy
all measurement data of each customer has been send to base station and stores in server rder to monitored and analyzed.The server is connected to XBee Kit which is sets as RS232.meter of customers is connected to XBee Kits which set as Device with ID=5001, 5002, etc. and exchange data with microcontroller through At the base station, the information has been received and stored in database depending on ID of each customer.In this project the ID o XBee Kit ID which is represents the source address of XBee Kit.The measurement information has been sent from END devices to coordinator by Frames includes source address.The electric energy measurement information ha printed or sends to costumers as report through cell phone SMS or email.The repo customer is shown in Fig (11).
Table (1).Comparison between practical and theoretical results.At the base station, the information has been received and stored in database depending on ID of each customer.In this project the ID of customer has been selected same as XBee Kit ID which is represents the source address of XBee Kit.The measurement information has been sent from END devices to coordinator by Frames includes source measurement information has been analyzed and can be printed or sends to costumers as report through cell phone SMS or email.The repo rt of Comparison between practical and theoretical results. .Email and SMS report of customer.

Energy
At the base station, the information has been received and stored in database depending f customer has been selected same as XBee Kit ID which is represents the source address of XBee Kit.The measurement information has been sent from END devices to coordinator by Frames includes source s been analyzed and can be rt of

CONCLUSIONS
Wireless smart electricalenergy meter prototype has been implemented and successfully tested for demand of 304 V and 15 A (peak value) which is the consumed energy has been evaluated theoretically is 31.5 KWh while the practical value is 32 KWh so the error is only 0.5 KWh.This system increases the accuracy of KWh, pf readings compared with manual electrical energy meters.In addition, this system increases security of meter reading and not be manipulated by the customers and uncover abuses.Also, the cost of the amount of power factor can be added if the customer doesn't improve the power factor conditions.By using this system, the cost of measurement can be reduces which requires low number of staff.The complete system setup and upgrade take a little time, requires low cost and the setup is very safe.