Design and Implementation of Wireless Electric Power Meter Based on XBee Model

Since the 1991 Gulf War, Iraq is still suffering from the crisis and irregular in the processing of electric power to customers. Damage to the network, the old measurement devices for measuring electrical energy consumption, and irregularities and corruption in the process of measuring and calculating fees of the consumption, all these reasons led to the deterioration of the performance of the distribution network in Iraq. In this paper, Wireless Electric Power Meter Based on XBee Module has been designed and implemented which ZigBee wireless sensor network (WSN) will be used for wireless electric power meter communication supported by PIC microcontroller which used for power unit measurements. 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.


Introduction
Increased importance of Smart Grid after 2005 [1][2][3][4], which include monitoring and control the consumption of customers of electric power [5].Also the rapid development of automation and measuring techniques, automatic recording of the data in the meter reading instrument has gradually become the target of people whose working, living, and home conditions are of increasingly high level of intelligence.There are many methods for measuring electrical power at home are manual meter reading which is the oldest method and it is weak because it needs a large number of staff, low accuracy of readings, and difficult to monitor gauges that these devices vulnerable to abuses.This method is still used in Iraq so far, IC card prepaid meter is used pay-before use therefore it does not need employers to reading meters on site, but some problems exist in the actual operation process: IC card meter is easily damaged due to its direct contact with user and no real-time monitoring, Wire-line metering control system, the problem of measurements in real time has been solved, also this type of meters 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 [6], and finally; Wireless meter reading system which 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 [7,8].Wireless meter system required wireless network technologies to support the wireless 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 suitable for Internet and multimedia applications [9][10][11][12][13][14].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 power consumption, low data rate two-way wireless communication technology with high network capacity, short time delay, safety and reliance.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 [15].
In this paper, ZigBee wireless sensor network (WSN) which represents by XBee kit will be used for wireless meter communication supported by PIC microcontroller which used for power unit measurements.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 outline of the paper is as follows.The comprehensive structure of wireless meter system is described in section II.In section III, wireless communication will be described while the microcontroller and base station PC software has been described in section IV, results discussion in section V, while conclusions are summarized in section VI.

2.The Comprehensive Structure of Wireless Meter system.
The comprehensive structure of wireless electric power meter system is shown in Fig. 1.Wireless electric power meter has been used for each costumer (House, Hospital, University, etc.).These meters have been used to measure the instantaneous electrical power per hour (KWh) and power factor (PF) by using microcontroller circuit which is sends the values of (Vrms, Irms, 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 power meter to the base station.Final stage of system is located at base station which the server has been used to receive all measurements of costumers and store these data in database for management and analyzing.In this paper 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 [16].

3.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 [17,18].If faults occur, only check wireless data module for causes quickly, and then restore the system back to normal operation [15].In this project, ZigBee wireless standard has been used for wireless network.ZigBee network supports star, cluster tree, and mesh network architectures [15].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 be easily achieved.

B. XBee/XBee-PRO OEM RF Module
XBee/XBee-PRO OEM RF module 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.XBee/XBee-PRO OEM RF modules make mesh networking simple and easy to deploy [20].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 as shown in Fig. 2. 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) [20].

C. 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 API (Application Programming Interface) mode which is Transparent Operation mode.API operation requires that communication with the module be done through a structured interface.The API specifies how commands, command responses and module status messages are sent and received from the module using a UART Data Frame.
When API mode is enabled, 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 APIspecific structure as follows: The cmdID frame (API-identifier) indicates which API messages will be contained in the cmdData frame (Identifier-specific data). Checksum to test data integrity, a checksum is calculated and verified data.To calculate: All bytes (not including frame delimiters and length) have been added, only the lowest 8 bits of the result has been kept and subtract the result from 0xFF.To verify: All bytes (include checksum, but not the delimiter and length) has been added.If the checksum is correct, the sum will equal 0xFF.
In this paper, X_CTU software has been used to configure XBee devices .
1. Programming the Coordinator: (Talks to everyone in broadcast mode) 1.1 PAN ID: Select same value for Coordinator and all END devices.1.2 Set destination high address (DH) as (13A200).

Select the destination low address (DL) as (FFFF)
for broadcast manner.2. Programming the End Device (Talks only to Coordinator) 2.1 PAN ID: Select same value for all END devices and Coordinator.2.2 Set destination high address as (13A200).

Set destination low to be the same DL of
Coordinator this will ensure that the end device will talk only to the Coordinator.

Power meter software design
For this system there are two software codes, first code of PIC microcontroller has been written by c language while the other one has been written by visual basic dot net for base station side.
A high-level overview of the energy metering firmware is shown in Fig. 4. 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 power measurement routine.
Voltage and current measurement are performed during an interrupt service routine triggered by the Timer 0 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 power has been evaluated and repeated for each full time cycle T.The consumed power has been accumulated.When consumed power exceeding the value of resolution limit D, the value of KWh counter will be increments.KWh will be send to LCD for monitoring, and to base station through ZigBee wireless communication standard.
In Fig. 5 base station software which designed to manage and monitor the electric power parameter and personal information of customers.For this reason, database has been designed by using visual basic dot net.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.

5.Experiments results
The prototype of practical wireless electrical power meter circuit is shown in Fig. 6.The Vrms, Irms, KWh, and PF have been measured by electric power meter as shown in Table 1.
Figure 6: The prototype of practical wireless electrical power meter circuit.

Table 1:
Comparison between practical and theoretical results.
Each customer communicate with base station through ZigBee wireless network supported by XBee Kit 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 personal computer through RS232.Also the electrical power 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.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 source address.The measurement information has been sent from END devices to coordinator by Frames includes source address.The electric power measurement information has been analyzed and can be printed or sends to costumers as report through cell phone SMS or email.The report of customer is shown in Fig. 7.

Conclusions
The design and development of the wireless automatic smart power meter reading system described in this paper is based on the microcontroller and high performance, extremely low power consumption، high level of integration, and low price of ZigBee technology.Wireless smart electric power meter prototype has been implemented and successfully tested for demand of 304 V and 15 A (peak value).By using this system, the problem of the demand for electricity in Iraq can be reduced, where the cost of the electric power meter is a few compared to the cost of the device available in the market because it consists of a low-cost electronic items.Also this system reduces the cost of measurement which needs less measurement staff.The complete system setup and upgrade take a little time, requires low cost and the setup is

Figure 1 :
Figure 1: Comprehensive structure of smart wireless electric power meter.

Figure 5 :
Figure 5: Power meter software at base station side.

Figure 7 :
Figure 7: Email and SMS report of Customer.
[19]ee 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, and a typical 100 m distance[19].The technical features include security, reliability, low cost, power saving, high network capacity, and short delays which enhanced communication delays for delay-sensitive applications.