A Reliable Data Collection Scheme with Efficiency Consideration for ZigBee Wireless Sensor Network Applications

ZigBee devices and ZigBee wireless sensor networks (ZWSNs) are popularly utilized in developing monitoring and control (MC) applications. In this paper, a reliable data collection scheme with efficiency consideration for ZWSN-based MC systems is proposed. An empirical approach is adopted to tackle the issues of transmission reliability and data collection efficiency. Several experiments are performed to facilitate the analysis of factors that may result in packet losses and the measurement of data transmission times between ZigBee nodes. Therefore, a reliable data transmission method that contains mechanisms of receiving confirmation, retransmission for overdue, and retransmission for busy delay is developed to successfully solve the packet loss phenomenon. In addition, a new data collection scheme that utilizes the last-stage ZigBee router to perform polling to ZigBee end devices is proposed to effectively enhance the total data collection efficiency. In particular, the experimental results show that the total data collection time of our method can be 4.45 times lower than that of the traditional approach if there are 8 ZigBee routers and 8 ZigBee end devices in the MC system.


Introduction
ZigBee devices possess characteristics of small size, light weight, and low power consumption. A ZigBee wireless sensor network (ZWSN) can have up to 65535 nodes theoretically. Therefore, ZWSN is very suitable for various monitoring and control (MC) applications, such as remote healthcare, (1) remote control of home appliances, (2,3) industrial control, (4) and environmental monitoring. (5,6) A ZWSN has three typical types of topology: star, tree, and mesh. (7) In a ZWSN with star topology, the distance between the coordinator and the sensor nodes is less than 100 m. This fact limits the operating extent of a MC system based on the ZWSN with star topology. The meshtopology ZWSN is more complex than the ZWSN with star or tree topology. Thus, the MC system based on the mesh-topology ZWSN is more complicated than those based on the ZWSN with the other two topologies in terms of the control and management mechanisms of sensor nodes. By contrast, in a tree-topology ZWSN, the coordinator is the root of the tree, and the router nodes can relay data to other ZigBee nodes. Thus, by adding extra routers between the coordinator and the ZigBee sensor nodes, the operating extent of a MC system based on the tree-topology ZWSN can extend through multihop transmission. In addition, the tree topology is less complex than the mesh topology. Therefore, the tree-topology ZWSN is popularly utilized in various remote MC systems. We also focus on the tree-topology ZWSN in this study.
The ZigBee protocol stack consists of several layers. The bottom two layers are the physical layer (PHY) and the media access control layer (MAC), which are specified by the IEEE 802.15.4 standard, whereas the ZigBee Alliance defines other layers, such as the network layer (NWK) and the application layer (APL). (8,9) Most studies that focused on the data transmission reliability and efficiency issues of WSN worked on the MAC layer. The communication on the MAC layer contains two modes: beacon and nonbeacon. In the beacon mode, the sensor nodes can utilize guaranteed time slots (GTSs) to achieve reliable communication. (10)(11)(12) However, the MAC beacon mode can provide only 7 GTSs. (13) Once the number of sensor nodes is excessive (greater than 7), the contentionless media access may be broken, thereby adversely affecting the transmission reliability. On the other hand, the coordinator can wirelessly collect data from the sensor nodes using the nonbeacon mode. However, the rate of packet losses will increase as the number of sensor nodes increases while using the nonbeacon mode for wireless data transmission. (14,15) To improve the data transmission reliability in the nonbeacon mode, some studies, such as those described in refs. 16 and 17, adjust the values of the backoff parameters in the carrier sense multiple access with collision avoidance (CSMA/ CA) algorithm. However, this approach cannot achieve 100% reliable data transmission. Besides, enlarging the back-off parameters will increase the latency of data transmission. Some other studies, such as those proposed in refs. 18-20, utilize the coordinator to perform polling on sensor nodes to reduce the rate of packet losses. Nonetheless, this approach may cause delay in data transmission of the whole WSN, which will reduce the total data transmission efficiency.
In this work, we aim to improve the aforementioned shortcomings of the existing methods in terms of transmission reliability and data collection efficiency. First, we introduce the architecture of the ZWSN-based remote MC system used in this study. Then, we investigate the packet loss phenomenon of the ZWSN in the nonbeacon mode. Accordingly, we develop a reliable data transmission method to effectively solve the packet loss phenomenon between two ZigBee nodes. Next, on the application layer, instead of the MAC layer, we develop an efficient data collection scheme for the ZWSN. Finally, we construct a ZWSN-based MC paradigm system to validate the effectiveness of the proposed methods. Figure 1 shows the architecture of the ZWSN-based remote MC system under study. The abbreviations used in Fig. 1 are explained as follows.

Architecture of the ZWSN-Based Remote MC System under Study
(1) ZigBee coordinator (ZC): The ZC is responsible for creating the ZWSN, together with managing and controlling other ZigBee nodes in the ZWSN. The ZC connects with the remote MC server (RMCS) through a universal serial bus (USB) connection. (2) ZigBee end device (ZED): The ZED connects with various sensors and is deployed in the storeroom. It can acquire various environmental data, such as temperature, humidity, pressure, and luminosity, through sensors for the MC system. Thus, a ZED is referred to as a sensor node. (3) ZigBee controller router (ZCR): In each MC area, we install a ZCR to control and manage all of the sensor nodes in that area. The ZCR is also responsible for collecting data from the underlying sensor nodes and sending the collected data to the ZC. (4) ZigBee pure router (ZPR): The ZPR is utilized only for relaying messages for other ZigBee nodes. By using ZPRs, we can extend the operating extent of the ZWSN through multi-hop transmission.
The architecture of the ZWSN-based remote MC system consists of three parts: equipment side, server side, and client side. The equipment side contains a ZWSN with sensors. Each storeroom is equipped with a ZCR and many ZEDs. Several ZPRs may be deployed between the ZC and the ZCR for extending the communication distance. The ZC connects with the RMCS through a USB connection. The server side consists of a RMCS and the system database. The RMCS can send commands to and receive data from the ZC through a USB interface. The users on the client side can utilize PCs and notebooks to remotely operate the MC functions of the RMCS through the Internet.

Analysis of packet losses
In order to investigate the packet loss problem of ZigBee wireless data transmission, we built an experimental environment by constructing a ZWSN in an indoor space, as shown in Fig. 2. The indoor space is 61 m long and 23.7 m wide. In the figure, the ZC, ZCR, and ZEDs are indicated by a yellow circle, a red circle, and blue triangles, respectively. The ZC is installed in a room, located in the lower right corner, and connected with the RMCS. The room has side walls so that the ZC cannot directly communicate with ZEDs. The ZCR is deployed in the middle of the right-hand side to collect the sensed data from the ZEDs. N denotes the number of ZEDs, and L represents the communication distance between the ZCR and the ZEDs. In this experiment, we conduct three tests with L values of 10, 30, and 60 m. In each test, the N value varies from 1 to 8.
The experimental procedure of each test is described as follows: Step 1: The RMSC sends the data collection command to the ZC through a USB connection.
Step 2: The ZC transmits the command to all of the ZEDs through the ZCR using broadcast communication.
Step 3: After receiving the command, each ZED sends data of S bytes to the ZCR using the CSMA/CA algorithm, where S is 10 or 80.
Step 4: Once the data of S bytes is received, the ZCR sends the data to the RMCS through the ZC.
Step 5: After receiving the data, the RMCS stores the data into the database for calculating the packet loss rate.
The testing results of packet loss rate are shown in Fig. 3

. As Figs. 3(a)-3(c)
show, if the number of nodes, N, equals one, there is no packet loss. By contrast, if N is more than one, the packet loss phenomenon may occur and tends to be severe as N increases regardless of the payload size S and the communication distance L. This means that the number of nodes is the dominant factor affecting the packet loss rate. Besides, at the same L and N values, the packet loss rate of sending 80 bytes of data is higher than that of sending 10 bytes of data. In addition, as shown in Fig. 3(d), the communication distance does not affect the packet loss rate much under the same payload (S = 10 bytes).

Reliable data transmission method
In this section, we present a reliable data transmission method for the ZWSN. According to the above experimental results, if the number of ZEDs is greater than one, packet losses may occur. The main reason is that the ZEDs adopt the CSMA/CA algorithm for media access control. Before sending out a packet, each ZED evaluates the clearness of the communication channel (CC). If the CC is clear, the ZED sends the packet out. If the CC is busy, the ZED will wait for a random back-off time and then evaluate the CC again. The above process may repeat several times, which is a preset value, until the ZED abandons the transmission task. When there are more than one ZED needing to send packets out, some of the ZEDs may not be able to gain access to the CC through the CSMA/CA process, thereby giving up their transmission tasks and resulting in packet losses. In contrast, if we allow only one ZED to transmit data at any time, the above problem can be avoided, thereby resulting in no packet losses.
Hence, a possible way of achieving reliable wireless data transmission between two ZigBee nodes is by the one-to-one and receive-then-acknowledge mechanism. In other words, at any time, only one ZigBee device (sender node) sends data to another ZigBee device (receiver node). Also, after receiving the data, the receiver node sends an acknowledgement (Ack) message to the sender node to confirm the successful data transmission. However, there are still some circumstances that may break the reliable data transmission. In the following, we discuss these circumstances and propose related solutions to make the transmission reliable.
(1) Retransmission-for-overdue mechanism When the ZWSN encounters unstable linkage or wireless interference, the following two situations may take place. First, the receiver node does not receive the packet sent by the sender node, as shown in Fig. 4(a). Second, the sender node does not receive the Ack message sent by the receiver node, as shown in Fig. 4(b). To cope with this problem, we propose a retransmission-for-overdue mechanism, as shown in Fig. 4(c). After sending a packet out, the sender node will start a timer. If the sender node still does not receive the Ack message from the receiver node after a preset period of time, the sender node will retransmit the packet to the receiver node. The above retransmissionfor-overdue process can repeat ten times at most. If the transmission still fails, meaning that the communication channel is heavily unstable or suffers severe interference, the sender node abandons the transmission task.
(2) Retransmission-for-busy-delay mechanism When the receiver node is busy and receives the packet from the sender node, it will send a busy message to the sender node, causing the transmission failure. Hence, we proposed a retransmission-for-busy-delay mechanism to deal with this problem. If the sender node receives a busy message from the receiver node, it will retransmit the packet to the receiver node after waiting for a preset period of time, called busy delay. The above retransmission-for-busy-delay process can repeat ten times at most until the sender node receives the Ack message from the receiver node.
The proposed reliable data transmission method contains the one-to-one and receivethen-acknowledge mechanism, the retransmission-for-overdue mechanism, and the  retransmission-for-busy-delay mechanism. To verify the effectiveness of the proposed reliable data transmission method, the experiment described in § 3.1 is conducted again, but these three mechanisms are used for data transmission. The testing results are shown in Fig. 5. The packet loss rates of all the tests reduce to zero, thereby demonstrating that the proposed method can solve the packet-loss problem.

Efficiency analysis of data collection
The data collection efficiency of the ZWSN using the proposed reliable data transmission method is analyzed in the following. Figure 6 shows the procedure of data collection by using multi-hop transmission in a ZWSN-based MC system. The proposed reliable data transmission method is used for wireless data transmission between two ZigBee nodes. N denotes the number of ZigBee routers. The data collection procedure is described as follows. (1) The RMCS sends the command of data collection to the ZC through a USB interface. (2) The ZC passes the command to Router 1 (the firststage router) over the air, and Router 1 sends an Ack message to the ZC after receiving the command. (3) In a similar way, the command is sent to the ZED through multihop communication, i.e., the command passing through Router 2 to N, sequentially. (4) After receiving the command, the ZED sends the collected data to the RMCS through the reverse path.
In the experiment, the maximum number of hops is 4, and the data size is 10 or 80 bytes. The data collection times with different hops and different data sizes are shown in Table 1. The data collection paths are depicted in the first row. RMCS↔ZC indicates the round-trip path between the RMCS and the ZC, RMCS↔ZC↔ZR1↔ZED denotes the round-trip path between the RMCS and the ZED in Fig. 6 with only one hop, and so  Table 1, the relationship between the data collection time and the number of hops is plotted in Fig. 7. The data collection time is almost linearly proportional to the number of hops.
The detailed time latency in each path is further analyzed as follows.

(1) Time computation from RMCS to ZC
The baud rate of the serial port of the RMCS is set at 38400 bps in order to match the baud rate of the ZigBee device. Thus, the time consumption for sending B bytes from the RMCS to the ZC through the serial port can be computed as (2) Time computation over the air The maximum transmission rate in the ZWSN is 250 kbps. Thus, the time consumption for sending one byte over the air can be computed as However, in addition to the payload, each ZigBee packet contains the stack's headers and checksum whose size is about 34 bytes. Hence, the time consumption for sending a payload of B bytes over the air can be computed as (3) Time consumption for processing CSMA/CA algorithm According to the ZigBee specification, we set the parameter of back-off time to 3, the average value. Thus, the back-off time can be computed as After waiting for a back-off time, the ZigBee device will execute clear channel assessment (CCA) to check whether the channel is available for the transmission. CCA needs 8 symbol durations, and one symbol duration takes about 0.016 ms in 2.4 GHz. Therefore, the time consumption of CCA can be computed as The time consumption for processing the CSMA/CA algorithm is the sum of T b and T cca .
T CSMA /CA = T b + T caa = 1.12 + 0.128 = 1.248 (ms) According to the testing results in Fig. 7, we can compute the data processing time, called overhead, in the RMCS and the ZigBee devices in the data collection process as follows. The data processing time in the RMCS and the ZC is represented by T 1 and can be estimated as The data processing time in the ZC and the ZED is denoted by T 2 and can be estimated as The data processing time in the ZR1 and the ZED is denoted by T 3 and can be estimated as  By using the data in Table 1 and eqs. (1)- (9), the data processing times of different data sizes are estimated, as shown in Table 2. Note that the data processing time in the ZigBee devices is much greater than the time consumed in data transmission over the air and in processing the CSMA/CA algorithm. Hence, T CSMA/CS and T air are ignored in the following analysis of the total data collection time.

Proposed method to enhance data collection efficiency
Traditionally, the data collection scheme uses the RMCS to perform polling on the ZEDs. To enhance the data collection efficiency, we propose a new data collection scheme that utilizes the last-stage ZigBee router to perform polling on the ZEDs.
(1) Traditional data collection scheme In the procedure of a traditional data collection scheme, the RMCS performs polling to the ZEDs. The RMCS collects data from each ZED by following the procedure in Fig. 6. Thus, the total data collection time from a ZED with one ZigBee router can be estimated as If there are N ZEDs, the total data collection time through one ZigBee router can be estimated as If there are N ZEDs and M ZigBee routers in the ZWSN, the total data collection time can be estimated as (2) Proposed data collection scheme The proposed data collection scheme uses the last-stage ZigBee router, instead of the RMCS, to perform polling to the ZEDs. The procedure of the proposed data collection scheme is shown in Fig. 8. If there are N ZEDs and one ZigBee router in the ZWSN, the total data collection time can be estimated as If there are N ZEDs and M ZigBee routers in the ZWSN, the total data collection time can be estimated as

Efficiency comparison of data collection schemes
The difference in the total data collection times of the above two data collection schemes can be computed using eq. (12) minus eq. (14): From eq. (15), the proposed data collection scheme can have a shorter total data collection time than the traditional one. The more routers in the ZWSN, the more time can be saved by using the proposed scheme. A performance enhancement index (PEI) is defined as follows to indicate how efficient the proposed scheme can be: In the case that the payload size is 10 bytes, we can get T S =2.86 ms, T 1 = 7.82 ms, T 2 = 22.60 ms, and T 3 = 25.26 ms. By varying the values of N and L in eq. (16), we can evaluate the PEI under various conditions. For example, in the case of N = 8 and M = 8, the PEI is about 4.45, meaning that the proposed data collection scheme is much more efficient than the traditional one.  Fig. 8. Procedure of the proposed data collection scheme using the last-stage ZigBee router to perform polling to ZEDs.

Experimental Evaluation of the Proposed Data Collection Scheme
Finally, we construct a ZWSN to conduct tests for evaluating the actual performances of the above two data collection schemes. In this experiment, the number of ZEDs is set to be one to eight (N = 1, …, 8), a ZigBee router is used, and the transmission distance between the ZCR and the ZEDs is set to be 10, 30, and 60 m (L = 10, 30, and 60 m). The testing results are shown in Fig. 9. We can easily observe that the total data collection time is almost unaffected by the communication distance L. The actual data collection times and the associated PEIs of the two data collection schemes are shown in Table 3. The total time to collect data from 8 ZEDs by using the proposed scheme is about 314.2 ms, and the associated PEI is about 1.94. The PEIs approximated using eq. (16) are also shown in Table 3. As shown in the table, the actual PEIs are very close to the PEIs approximated using eq. (16). This means that the data collection time analyses and approximations presented in § 4 can be useful references for evaluating the data collection time in the ZWSN. Table 3 Actual data collection times and associated PEIs of the two data collection schemes.

Conclusions
In this paper, an empirical approach is adopted to tackle the issues of transmission reliability and data collection efficiency in the tree-topology ZWSN. First, the packet loss phenomenon is investigated by experiments. On the basis of the testing results, we propose a reliable data transmission method to avoid the packet losses between two ZigBee nodes. Furthermore, we present thorough analyses of the time consumption in the data collection process by deriving various time estimation formulations. Accordingly, we propose a new data collection scheme for the ZWSN-based MC system. Finally, we use experimental results to validate the effectiveness of the proposed reliable data transmission method, the efficient data collection scheme, and the various time estimation formulations. In particular, the experimental results illustrate that the total data collection time of our method can be 4.45 times lower than that of the traditional approach if there are eight ZigBee routers and eight ZEDs. The results shown in this paper can be useful references for developing ZWSN-based MC systems.