Design of the ZigBee Technology-based Wireless Sensor Network for Earth Temperature Monitoring

Aiming at the application of the experimental system of earth temperature monitoring, this study designed a ZigBee technology-based wireless sensor network (WSN) and designed the network topology according to actual demand. The system adopted a tree network model and used the CC2430 as the core chip of the wireless communication network of temperature measuring system. Moreover, DS18B20 temperature sensor was used to collect temperature data. According to the preset routing protocol, the temperature data obtained were uploaded to the coordinator node via the router node by multiple hops. The temperature data collected by coordinator node were transformed to the host after being processed. Applying the Cluster-Tree and AODVjr optimized routing algorithm, this system showed the advantages of low complexity, easy deployment, high efficiency, good real-time performance, low power consumption, and convenient for long-time work. In addition, it provided powerful support for the real-time monitoring of farmland experiment system.


INTRODUCTION
In course of studying irrigation technology, it is needed to obtain the long-term real-time technology data concerning the trend and degree of the influences of irrigation on earth temperature, air temperature, air humidity, evaporation irrigation of farmland under different meteorological conditions and compare the meteorological factors of irrigated and non-irrigated farmlands. The methods above provide an important way for understanding the influences of irrigation on the farmland microclimate and developing the experiments concerning the influences of irrigation on the farmland microclimate. Therefore, it is of great significance for agricultural researches of building the sensor network that can conduct real-time dynamic monitoring on different strata temperatures and can be operated in long term.
Data transfer in traditional monitoring systems basically relies on RS485 or CAN bus. However, due to the inherent wiring difficulty, high cost, aging problem, and vulnerability to lightning strike, such transfer shows low reliability and is adverse to centralized management. In addition, the equipments such as the temperature and humidity sensors, do not need the high transmission rate and power consumption. Zigbee technology has the characteristics of low-cost, low-power consumption and lowrate wireless communication, which fills the current mar-ket vacancy. Furthermore, it is flexible and convenient in utilization since the sensor nodes can be increased or decreased even moved according to actual need. Therefore, the WSN established on the basis of Zigbee technology is applicable to the experimental study system that needs temperature and humidity monitoring and has a broad application prospect.
WSN is a sensing field variable consisting of multiple sensor nodes and a collecting network through a specific node (coordinator) and WSN reads via the multihop path. Its basic idea is indicated as that: by placing a large amount of nodes in the application range and endowing each node with some calculating ability and coverage, the nodes are self-organized into a logic structure to cover a large area by coordination. Through this structure, the data have way to routing, hoping, and executing various functions as migrating from source node to target node.

II. THE TOPOLOGICAL STRUCTURE OF WSN SYSTEM
According to the function, position, and task in the network, the equipments in the WSN network include coordinator, routers, and terminal observing and controlling equipment. The only coordinator in WSN network acts as the core node and takes charge of the establishment of the whole network. In the initial stage of the network establishment, it sends beacon frames to and allocates addresses for the surrounding ZigBee devices. In the operation process, it manages other network member nodes [1,2]. Coordinator is mainly responsible for finding the routing information among nodes, completing the grouping, transforming, collecting, and processing of information etc., uploading and processing the data collected, and sending information to the terminal node. Router is mainly used to find the ZigBee devices that should be involved into the network. Moreover, it assists coordinator to establish the routing that can send data and commands to terminal devices and sends the data collected by terminal devices to the coordinator. When necessary, it is also capable of recovering the network route to maintain the normal operation of the network in case of the fault of coordinator or other nodes. Terminal equipment mainly functions in receiving the commands from the coordinator and sending the field data that it collectes regularly to the coordinator in real time. It is unable and unnecessary to realize the routing function.
ZigBee Network Wizard Kde (NWK) supports star, tree, and mesh network topologies. This system adopted a tree form, considering the comprehensive performance, REGULAR PAPER DESIGN OF THE ZIGBEE TECHNOLOGY-BASED WIRELESS SENSOR NETWORK FOR EARTH TEMPERATURE MONITORING reliability, cost, and networking difficulty, [3] as shown in Figure 1.
In tree network topology, the coordinator node (the root node) and all router nodes (internal nodes) are all fully functional devices (FFD), while the reduced function devices (RFD)( can be dynamic nodes) are merely used as terminal nodes due to their limited functions and incapability in realizing the communication with other devices. The coordinator (root node) or the router (internal node) must be assigned to a unique network address when joining in the network. In the network topology, ZigBee coordinator is mainly responsible for starting the network and selecting some key network parameters to form the basic WSN network; when the need of network expanding arises, ZigBee router can be mainly used to transfer the data and control the information in the network by means of a hierarchical routing strategy [3,4].
The access of any device (FFD or RFD) to the network should get the permission of the coordinator. If the access of a device is permitted, the coordinator will add the information of this device to its neighbor table and acts as the father node of this device. Meanwhile, this device appears in the network as a subnode of the coordinator. Similarly, the newly accessed device also adds the coordinator information to its neighbor table and begins to send beacon frame periodically. Subsequently, other new nodes can send request to this device if they want to be connected to the network [5]. In addition, if request of a device for network access is rejected by the coordinator, this device can also send the request to other coordinators to access the network. If the request is permitted, this device can become a member of the WSN [6].
In actual experiment environment, it is unnecessary to construct a large network in that the experimental field size is limited thus not so many nodes are needed. Therefore, this study constructed a simplified model. Considering the real area and irregular shapes of the experimental farmland, in this system, the real topological structure and node position were arranged as shown in Figure 2.
When the need of collecting temperature data arises, coordinator sends temperature acquisition commands to terminal nodes. The commands are finally sent to the temperature acquisition nodes via the router according to specific routing protocol. After receiving the commands, the temperature data collected are uploaded to the coordinator by the original route. As the temperature data reaching to the coordinator, the data are firstly processed and then transmitted to the monitoring software in the PC for real-time display. Meanwhile, monitoring software can also send control commands. After being parsed by the coordinator, the commands are converted down to the temperature acquisition nodes to control the upgrading frequency of the temperature sent from the temperature acquisition nodes or command specific node to send temperature data etc. [7].
It is noted that the positions of the coordinator and router are basically fixed, while the potion of terminal nodes for temperature measurement slightly fluctuates in certain range according to actual needs, as shown in Figure 2 (the moving distance is generally limited within 10 m). Therefore, WSN network is required to be capable of dynamically managing and reorganizing the nodes to some extent. [8] Gateway Router Redundent Router Temperature-monitoring node is the most terminal node of the system and is mainly responsible for measuring earth temperature and sending data at fixed time.
When selecting sensors for measuring the earth temperature signals, it should mainly be taken into consideration that the terminal nodes for the temperature measurement in the network topology in Figure 2 are obligated to collect the temperature at different stratum depths. Generally, according to different requirements, 4-6 detection points are needed; Meanwhile, considering the low acquisition speed requirement of sensor nodes (generally 1 H/ time), the battery powered mode, and the need of monthly measurement experiments, single-wire digital thermometer DSl8B20 is used as temperature sensor. This sensor applies simple multipoint distribution and is used to read and write temperature. It shows zero power consumption in standby mode. Moreover, multiple DSl8B20 can be connected on a single bus at the same time. This performance is greatly in line with the needs of the system.
In addition, taking into account of the restrictions in aspect of volume, cost, and power consumption of the system, the hardware node of the system was constructed by the CC2430 chip produced by American Texas Instruments Company. This chip can realize the sending and receiving functions of the signals with very few external components. Its receiving sensitivity and transmitting power are high enough to meet demand of experimental environment. Moreover, due to the low power consumption, CC2430 chip is greatly superior to the chips produced by other manufactures. Figure 3 shows the hardware circuit. REGULAR PAPER DESIGN OF THE ZIGBEE TECHNOLOGY-BASED WIRELESS SENSOR NETWORK FOR EARTH TEMPERATURE MONITORING With the circuit module as core, it is able to construct the coordinator, router, and sensor nodes by increasing functional modules according to the actual need and supplementing the modules with corresponding software.
To effectively reduce power consumption and prolong working time, the temperature collection in this system adopts an interrupt wakeup mechanism. Namely, the terminal node is in a dormant state in the case of failing to receive interrupt command of sending temperature data. In this case, part of the microprogrammed control unit(MCU) circuit and sensor module circuit are closed until the coordinator needs temperature data and sends an interrupt wakeup command to the terminal nodes(each node has a unique network address assigned by coordinator node in advance). When receiving a data packet, the terminal node compares the ID number of the data packet with its ID. If the two IDs are consistent, the terminal node accepts the command and begins to collect temperature data. Otherwise, it abandons the command and continuously waits to be waked up.

IV. OPTIMIZATION OF ROUTING PROTOCOL
The data transmission of the temperature monitoring system is mainly completed on the network layer. Network layer is mainly responsible for accessing or leaving network, finding routes, discovering and maintaining routes, and discovering and storing neighbor information etc.. As one of the core technologies of network layer, routing protocol can be used to search the optimal route from the source node to destination node for the data frame and directly affects the performance of the network. In WSN, node energy is limited. If a node is repeatedly used, the energy of this node would be used up eventually. The transmission performance of the network is thereby greatly influenced. Therefore, in real application, it should choose the most suitable routing protocol for application requirements according to different network environments. Based on network topology, routing protocol selects suitable route and evenly distributes the transmission energy of nodes to reduce the power consumption of the network. This is what must be considered when designing the temperature monitoring system.
The routing protocol of ZigBee network has the characteristics of tree network and mesh network and supports multiple routing algorithms such as Cluster-Tree, AODVjr, and Cluster-Tree+AODVjr(C+A) etc..
Tree routing saves resources but shows low routing efficiency unfortunately. Moreover, its excessive information transmission path hop counts affect the network delay; AODVjr routing yields the massive flooding packets and causes serious energy node consumption in the discovery process. In view of this, this system puts forward C+A-based optimization algorithm to solve the low efficiency of tree routing, as well as the massive flooding packets and serious energy consumption of AODVjr [9,10].
The principle of this method is indicated as follows: in WSN, node can only directly communicate its neighboring nodes within its radio frequency transmission range. The neighbor table of each node in tree network contains the information relevant to all the neighboring nodes in the signal coverage area. In the optimized routing algorithm, the data frame sent by source node can reach the target node by one hop using the effective information recorded in the neighboring table. To avoid the nonselective massive flooding of RREQ in the discovery process of AODVjr routing, the optimized routing algorithm applies constraints to the broadcast hops of RREQ according to different conditions so that redundant routings that surpass the limitation condition cannot be started. In this way, it is able to effectively reduce the flooding number and broadcasting range of RREQ, limit the propagation direction of RREQ, and eventually decrease the energy consumption of network [11][12][13]. Figure 4 shows the detail algorithm flow: Test results suggest that the success rate of the data frame transmission from the source node to destination node of the optimized algorithm is significantly higher than that of traditional C+A algorithm. The reason lies in that: after optimization, with the reduction of the routing REGULAR PAPER DESIGN OF THE ZIGBEE TECHNOLOGY-BASED WIRELESS SENSOR NETWORK FOR EARTH TEMPERATURE MONITORING Grouping and Send data frames

RFD?
The destination node is the source node's children?
The destination node and source node at same group?
The neighbor node and the destination node at same group?
Transmit to the rootnode of this time The destination node and current node at same group? Figure 4. The flow of the optimized routing algorithm hops from the source node to the destination node, corresponding node energy consumption is reduced, following with the sharp increase of the number of remaining nodes in the network. Therefore, the success rate of the data frame transmission from the source node to destination node is significantly increased. In addition, since the transmission path of the data frame from the source node to the destination node is shortened, transmission delay is reduced. Therefore, given identical node number, the optimized algorithm shows much smaller transmission delay.

A. Transmission Distance Test
The coverage area of the whole temperature WSN system mainly depends on the depth of tree network and the maximum communication distance among nodes. The depth of the tree network can be designed by ourselves, while the maximum communication distance among nodes is mainly determined by the communication ability of nodes. Therefore, single hop test of node is needed to provide the basis for the real topological ability of the entire temperature monitoring system.
Single hop distance test was performed from point-topoint, namely, from a terminal node to a coordinator. The coordinator was connected to PC connection. The terminal node was put in an active sending mode and sent data to the coordinator periodically. Figure 5 shows the test results. Analysis of the data in Figure 5 reveals that the communication is reliable when the communication distance is less than 70 ms in barrier-free condition and 50 ms in the condition of having obstacles respectively. When the communication distance exceeds the distance limits, package loss rate rapidly increases until complete communication failure. Communication is interrupted thereby.
In real application, considering seasonal differences, i.e. the flourish growth of the crops in summer may show certain influences on the system, this system uses the 50 ms as the maximum node distance.

B. Test of the Networking Ability of Node
Considering the system application characteristics, this study conducted conventional networking ability test as well as network stability test by moving, adding, or eliminating nodes in effective transmission distance range con-REGULAR PAPER DESIGN OF THE ZIGBEE TECHNOLOGY-BASED WIRELESS SENSOR NETWORK FOR EARTH TEMPERATURE MONITORING tinuously for several days. It was found that the network communication was smooth except that some sensor nodes were separated from the network occasionally and temporarily while recovered the communication automatically to join the network communication again after a short time. Test results imply that the network is constructed stably in effective transmission distance. The above phenomenon makes a further explanation: although transient link interruption of node may happen in the communication process occasionally, the nodes in the network can recover in time and access to the network again automatically. Therefore, the network communication is reliable.
In addition, this study further tested the influences of node death on network, as well as the influences of the restart of coordinator and router on the network restructuring to prove the self-networking ability of the system. Test results showed that, with the restart of the coordinator in case of power failure, the self-networking success rate of the system reaches up to 100%, while the accessing success rate of non-coordinator nodes reaches to 97% in case of power failure. This outcome proves the high networking ability of coordinator and the favorable accessing ability of nodes.
The influences of router death on node communication should be explained in particular. In the test, it is found that the sub-nodes of other mobile router nodes sustain sending data packet to the coordinator correctly in time in case of the power failure of router. This result suggests that, in case of the death of routing node, the sub-nodes of the routing node can detect the link interruption and automatically search for new routing paths. These sub-nodes were transferred below the new router and upload data to the coordinator. The test results above prove that the WSN network is provided with favorable self-organizing and self-healing abilities.

VI. CONCLUSIONS
As a new information technology acquisition platform in the application of earth temperature monitoring system, the ZigBee technology-based WSN can monitor and collect the information of the various detection objects in the network distribution area in real time. This system also shows low power consumption, low cost, distributed form, and self-networking ability. Moreover, it allows its member nodes accessing or leaving the network at any time. Without the need of human management, it is fully able to meet the system requirements.
Eight months of operation proved that the proposed routing algorithm shortened the routing path of data frame from the source node to the destination node and effectively controlled the hop number of the RREQ broadcasting. Therefore, the algorithm significantly reduced the energy consumed in data packet transmission and RREQ packet and the dead nodes induced by the exhaustion of energy in turn. Meanwhile, due to the reduction of the routing hops from the source node to the destination node, energy consumption is also reduced, and the number of remaining nodes in the network is increased. Therefore, the success rate of the transmission of data frame from source node to destination node was improved to a great extent.