Time Synchronization and Communication Program of Wireless Sensor Network for Online Monitoring of Electrical Equipment

— In wireless sensor networks, for improving the time synchronization perfromance of online monitoring and application of ZigBee protocol, a scheme is designed. For this objective, first of all, the ZigBee protocol specification is summarized, a profound analysis of the hardware abstraction architecture of TinyOS operating system is made; the advantages of the ZigBee protocol compared with the traditional radio technology are comparatively analyzed. At the same time, the node design block diagram based on CC2430 and related development system is provided. In the TinyOS2.x operating system, we analyze CC2430 application program abstract architecture, and on this basis, give the realization process of program design. The research results showed that we achieve an on-line monitoring system based on ZigBee protocol, which has realistic significance of applying ZigBee protocol in wireless sensor network of electrical equipment online monitoring. Based on the above research, it is concluded that the online monitoring system can collect the temperature parameters of the monitored object in real time that it can be widely applied in wireless sensor networks.


Introduction
With the rapid development of China's economy, the demand of national economic life for electricity is increasing. Electrical equipment is the basic component of power system, which is the basis for ensuring power supply reliability. In order to ensure the safe and reliable operation of electrical equipment, it is necessary to monitor the working state of the electrical equipment in real time, for knowing the operation of the equipment at any time. The online monitoring system of electrical equipment commonly used at present needs to transmit the signal collected by each sensor to the data processing center in cable way [1]. This approach has many disadvantages: it cannot make contact monitoring of electrical equipment; a large number of cable are difficult to lead out, and it will increase the wiring cost and may damage the insula-tion; sensor aging or failure will cause the loss of state information amount; sensor configuration change may need to modify the source program of the system software.
These defects put forward new requirements for the electrical equipment in technique, and the emergence of wireless sensor network makes it an ideal choice. Wireless sensor is a new type of network technology generated with the rapid development of micro electromechanical technology, low energy consumption radio frequency (Radio Frequency, RF) technology, and sensor technology. A large number of sensor nodes, in self-organized network, can obtain real-time detection region information, data reaches a sink node after a single hop or multi hop transmission in the network, and users, according to the returned data from the network, make the appropriate analysis processing and publish monitoring tasks. Wireless sensor network has a potential application prospect in military applications, environmental observation and forecasting system, medical care, intelligent home furnishing, building condition monitoring and so on.
The traditional radio technology that wireless sensor network uses is very powerconsuming, and it takes up more computing and communication resources, which is a bottleneck for wireless sensor networks with limited resources. The application field of wireless sensor network does not require too high bandwidth, but only requires low latency and low power consumption, and the ZigBee protocol just meets this requirement. ZigBee protocol is a standard wireless network protocol designed for low rate measurement and control network. It has many advantages, such as low complexity, low cost, low power consumption, high security and so on [2]. ZigBee protocol is especially suitable for industrial monitoring application environment with low data transmission rate, small equipment spacing and difficult power supply. CC2430 is a radio frequency chip based on ZigBee protocol. Based on this, this paper designs online monitoring system based on ZigBee protocol in the TinyOS2.x operating system, which is an experimental study for wireless sensor network using ZigBee protocol in the electrical equipment on-line monitoring.

2
Introduction to Theory and Technology

Summary of ZigBee protocol
ZigBee protocol is a new low cost and low power short distance wireless communication technology. The underlying technology of ZigBee is based on IEEE802.15.4, the physical layer and the MAC layer directly refer to the technical standards of IEEE802.15.4, and ZigBee protocol make a standardization for its network layer protocol and API. Its objective function is automatic control, which uses frequency modulation technology, and the frequency bands used are 2.4GHz (ISM), 868MHz (Europe) and 915MHz (USA) [3]. They are unlicensed band, and the effective coverage is 10 ~ 75m. When the network rate is reduced to 28kb/s, the transmission range can be extended to 134m, thus having higher reliability.
The main technical features of ZigBee are: 2. low power consumption: in a low power standby mode, two ordinary No. 5 batteries can be used 6 months to two years, while Bluetooth technology can only work for a few weeks, and WiFi can only work several hours; 3. low cost: ZigBee data transmission rate is low and the protocol is simple, so it greatly reduces the cost; 4. large network capacity: each network can accommodate thousands of nodes; 5. short time delay: delay are usually between 15 ~ 30ms; 6. it provides data integrity check and authentication function, using AES-128 encryption algorithm; 7. small effective range: the effective data covers the range between 10 ~ 75m [4]; 8. use frequency of 2.4GHz, 868MHz (Europe) and 915MHz (United States), unlicensed band. The comparative analysis between ZigBee and traditional radio technology is shown in table 1.

Radio frequency module CC2430
Wireless RF chip CC2430 is the first 2.4GHz RF system single chip that is suitable for the ZigBee protocol produced by Chipcon company, which is suitable for low power short distance communication occasions (such as wireless sensor network node). The CC2430 module uses ZigBeeSoC radio frequency chip CC2430-F128 produced by TI company, and the chip integrates the high performance 8051 core, ADC, UART and so on; it supports the ZigBee protocol stack; the user may use all resources on the chip. CC2430 chip uses the previous CC2420 chip architecture, and integrates ZigBee radio frequency (RF) front-end, memory and microcontroller on a single chip. It uses 1 8-bit MCU (8051), with 128KB programmable flash memory and 8KB RAM, and it also includes analog digital converter (ADC), several Timers, AES-128 timer coprocessor, watchdog-timer, 32kHz oscillator sleep mode timer, reset circuit, power-on-reset, brown-out-detection, and 21 programmable I/O pins. The ultra-short time characteristics of conversion of CC2430 sleep mode to active mode are particularly suitable for applications requiring very long battery life.
CC2430 wireless MCU transplant system includes a simulator, 2 CC2430 wireless modules, 2 2.4GHz antennas, and a USB cable. Download program uses the USB cable, no serial cable. The left side of the circuit is the designed serial conversion circuit, which is the medium for CC2430 and PC communication.

TinyOS architecture
The program design of this chapter is based on the TinyOS2.x, as shown in figure 1. We define 3-layer hardware abstraction architecture in TinyOS: hardware presentation layer (HPL), hardware adaptation layer (HAL), and hardware interface layer (HIL). It effectively combines the component model with 3 different abstraction layers. In the system, it is mainly used to shield the characteristics of the upper layer, and the upper part and the physical hardware are isolated to facilitate the transplant of the system. In function, the hardware abstract component is equivalent to the driver of the underlying hardware, and the upper components call through the interface.

Platform-independent application components
Application -specific components of a particular platform 1  The arrow in figure 2 shows the interface between the components, the down arrow refers to the command provided by the lower layer, and the up arrow is an event triggered by the lower component. The current CC2430 hardware abstract components do not support serial stack, but only perform the serial operation through the command and event provided by Serial Byte Comm under UartC; the CC2430 module provides two LED indicators, to show the current program simple information for judging the situation of the implementation of the program, in which LED1 is controlled by P1.0, and LED2 is controlled by P1.3.

Serial program design
This section explains the process of transplantation of the program with a serial communication program transplantation as an example, and the serial communication program is of instructive significance in the follow-up receiving, analysis, and display in the PC of wireless sensor network data based on ZigBee protocol. The basic flow chart of the program is shown in figure 3.
Procedures make use of SI (Source Insight) code editor to write code, and then compile code in the Cygwin environment. Cygwin is the Unix simulation environment running on a Windows platform, which is a free software developed by CygnusSolutions company. It is very useful for learning Unix/Linux operating environment, or applications transplant from Unix to Windows, and some special development work, especially for the use of gnu tools to make embedded system development in Windows. Target file is a.Hex file, which can be achieved by adding MAIN_IHEX=$(BUILDDIR)/app.hex in mcs51.rules. The hardware programming tool used in the paper is SmartRF Flash Programmer. It is ChipCon flash programmer, which only supports Windows operating system. Using it to write .hex document compiled in Cygwin into the CC2430 RF chip so that it can operate.
The serial port reading and writing procedures of the PC use LabVIEW to compile. LabVIEW has abundant graphics and signal processing function, which has great advantages for the follow-up receiving, graphics rendering, and data analysis of wireless sensor network data based on ZigBee protocol [5]. Serial program parameters setting is: serial port COM1, the baud rate 115200, 8 data bits, no parity codes, and 1bit stop bit.
On the basis of the ZigBee protocol, we profoundly analyze the hardware abstraction architecture of TinyOS operating system, and provide the abstract architecture of CC2430 applications under the TinyOS2.x operating system. Based on this, we realize the CC2430 program transplant, which is a kind of innovative experimental research compared with the existing theory.

Monitoring system composition
The structure diagram of the online monitoring system based on ZigBee protocol is shown in figure 4. Monitoring sensor node is provided with a motor inside buried thermal resistance (called heat resistance), suitable for motor windings and the motor core temperature measurement. Using platinum resistance as temperature sensor and display instrument to measure the temperature of motor winding or stator iron core, also applying to other mechanical devices with similar temperature measurement requirements [6]. The installation is very simple, directly displaying the actual temperature of the coil.
The parameters monitored by the system are the temperature change of the monitoring points in the working condition of the motor. The front-end acquisition module uses the wireless sensor node, which is designed to meet the electrical equipment temperature measuring points, dispersion and heat resistance, and a single sensor node can realize multi channel acquisition; between the sensor nodes and the base station, we use 2.4G frequency based on international standard for data communication transmission. The communication between the base station and the PC is based on the half duplex RS232 as the communication hardware interface, and the software protocol is the standard UART communication protocol. The system monitoring module of PC is based on virtual instrument realization, and its acquisition program is based on LabVIEW serial communication protocol module. The same serial port protocol ensures the correctness of data acquisition and reception.

Monitoring system software
The PC software of the online monitoring system based on ZigBee protocol is developed by using graphical programming language by NI company, to realize data acquisition, processing, display, storage and other functions, and the structure diagram is shown in figure 5. The figure shows the function module structure of monitoring system software. The system software includes man-machine interface monitoring module, remote data communication module, database management module, data analysis processing module, real-time monitoring module, parameter setting module, event recording module and so on [7]. Among them, the data acquisition module is to realize data collection of wireless sensor base station based on serial communication protocol; remote data communication module adopts DataSocket technology for remote transmission of the local computer monitored data; database management module is responsible for storage, query and so on; data analysis processing module is mainly for digital filter, signal spectrum analysis, and the comparison with the set alarm value according to various state signals; real-time monitoring module, based on the data analysis processing module, shows whether PD, vibration, temperature, speed, pressure and other parameters are normal or not with red and green lights (red light suggests abnormal alarm, and green light refers to normal); parameter setting module is used for the alarm parameters setting for the various monitoring states; event recording module is used to achieve the query and display of the state signal alarm events.  Figure 6 shows the real-time temperature change curve of the generator winding temperature under the operating condition collected by the monitoring system, and table 2 is a part of the monitoring temperature parameter variation values. From Fig. 6 and table 2, it is known that when the generator is in the normal working state, the measured temperature of winding phase A is between 54-64 DEG, lower than the alarm value of 115 DEG C (the motor winding insulation is class F) [8]; the winding B phase temperature is between 55-62 DEG C, below the alarm value; the winding C phase temperature is between 53-61 DEG C, similarly below the alarm value, in line with the test parameters value requirements. The experimental results show that the on-line monitoring system based on ZigBee technology can collect and display the change of working condition parameters in real time.  In this paper, we make an experimental study on the application of ZigBee protocol in wireless sensor networks. First of all, the ZigBee specification is summarized, and a profound analysis of the hardware abstraction architecture of TinyOS operating system is made; in addition, a comparative analysis of the advantages of TinyOS2.x operating system compared with the TinyOS1.x is performed, and the design diagram of CC2430 and the related development systems are given. On the basis of analyzing CC2430 application abstract architecture in the TinyOS2.x operating system, we give the realization process of program design, realize a wireless sensor network on-line monitoring system based on ZigBee protocol, and carry out the related experiments. The experimental results show that the online monitoring network system can realtime collect the temperature parameters in the monitoring object.

Conclusion
In this research direction, according to the characteristics of wireless sensor network for electrical equipment online monitoring, combined with the characteristics of the existing wireless sensor network communication technology and the existing wireless sensor network time synchronization algorithm, a wireless sensor network time synchronization scheme is designed for electrical equipment online monitoring and relevant communication program development and communication technology improvement. The experimental research is made on ZigBee protocol applied in wireless sensor networks. Based on the analysis of the abstract architecture of CC2430 application in TinyOS2.x operating system, the realization process of the program design is given, and the related experiment are carried out. At the same time, an online monitoring system based on ZigBee protocol is realized. The experiments show that the system can collect the temperature parameters of the monitored object in real time. That is to say, the system has very good performance and it is of great significance in the monitoring process.