An Implementation Method for Zigbee Network Layer

The basic functions and the relative concepts of ZigBee network are analyzed in this paper. The implementation method of ZigBee network layer is proposed, and then a algorism about how to built a Zigbee network is defined. Finally, a experiment is simulated by prove the liveness of the Zigbee network, the result shows the PC can get the monitored data from the Zigbee network.


Introduction
ZigBee [1][2][3] network layer support star, tree and mesh topology structure.The tree structure and the network structure is naturally the P2P network.In the star structure, there is a device called ZC (ZigBee Coordinator, ZigBee) which is used to start up and maintain the devices of the network, and the other devices just communicate with ZC.
The coverage range and communication distance is relatively small.In the network and the tree structure network, ZC [4][5][6] is responsible for starting up the network and choosing the key network parameters, and the coverage range of network can be extended by ZR.The tree structure can be used in the beacon network described by IEEE 802.15.4.In the tree structure, ZR (ZigBee Router) uses the hierarchical routing strategy to transfer the data and control information.The routing algorism is routing the data to its father node or routing it to its child node, but if one of the nodes have fault, the communication between all the child nodes with the external nodes will be interrupt.So the robustness should be considered in the tree structure network.
The communication methods of ZigBee have three models, and they are unicast, broadcast and multicast.The unicast data can just be transferred to some single device.The broadcast data is transferred to all the devices of the network.Multicast data is transferred to all the devices to some group, which can be called groupcast.Group is a notion in Zigbee, and a group is composed by one or many devices, every group is using a group id to be identified.In the Zigbee network, the location and data transferring can be received and transferred, so many devices can controlled in one operation.

The Frame Format
The network layer protocol data unit (NPDU) is organized by frame.There are two types of network, data frame and network command frame.
The general network format is showed as Table 1.The frame head is the same for the different types of frame with the different frame load.Every frame has two parts such as NWK header and NWK payload.
The format of network command frame is the same with the general network frames, just giving the details of frame load showed as Table 2.The network identifier can divide the different network command.

ZigBee Network Routing Protocol
ZigBee network is a self-organization and self-healing network with the characters of multi-leap, dynamics topology, resource limit, taking the big challenge for the design of algorism.The protocols can be classified to table driven protocols, on-demand driven protocols and blending routing showed as Figure 1.

Building Network
ZigBee network can just be implemented by the device having cooperative ability.The device is initialized to a   ZigBee coordinator (ZC) after building the network.The ZigBee network just has one ZC.

Adding Nodes to Network
When a device in the network admits a new device adding to the network, the new adding node is the son device.The first device is parent device.A son device can be added to the network by the following ways: through the MAC layer association process or the pre-appointed parent device, it can be added to the network directly.Moreover, isolated point device can be added or read to the network by isolated point manner.

Sending or Receiving Data of Network Layer
The Network layer transfer NPDU to the data service entity of MAC layer, and request MAC layer sends NPDU.MAC layer returns the data sending result to network layer.The process of network layer receiving data is as follows: after the data frame received from MAC layer, the network layer does validity check and examines whether the destination address of the frame is accord with the network address of the device.If the address matched, then the frame will be send to the top layer to be managed, otherwise, if the address is not matched and the device has no route ability, the device network will query the route table to choose the suitable next hop to do the data transfer.

The Experiment Simulation
The experiment is implemented by using C#.NET.The data management center receive, manage, save and display the sampling data of each monitoring nodes or send the configuration and command information to them by using the connected ZigBee Coordinator (ZC).It shows the whole system structure by the way of graph structure, and allows the users manage and maintain each monitoring nodes.It also provides relevant query interface and operation interface, for example query a node's real-time data or historical data, set the sampling cycle etc.
In order to apply the ZigBee protocol stack in our equipment monitoring system, we realize a simple application above the Network layer of protocol stack, which achieves automatic networking of nodes to reduce the workload of the user.

The Graphical Display of System and User Interface
The user interface for the software of data management center is shown in Figure 2. The symbols in figure indicate the type of the ZigBee nodes (the legends "C", "R", "E" correspond to the type ZC, ZR, ZED), and distinguish them by different color.Click each node by the right key of mouse, a right key menu appear which includes various functional operating sub-menu for this node( such as "query and modify the equipment information", "query the real time data of equipment", "query the historical data of equipment", "send relevant control- Copyright © 2011 SciRes.IJCNS ling command to this equipment" etc.).When the mouse stop above each node, a hints box come out to display the simple information of this node.

The Analysis of the Experiment Result
Data management center can actually query and display the data of single equipment monitoring node.As shown in

Conclusions
The reference model and the basic function are general- ized.The network frame type and the format definition are given.The network building, adding node, data sending and receiving are realized.Finally, after the Zigbee network is built, and the Zigbee network is linked to the PC to get the data or transmit the data, and the experiment shows it has the good scalability and customizable.

Figure 2 .
Figure 2. The user interface of data management center in PC.

Figure 3 ,
Three physical value such as temperature, humidity and Motor speed etc are measured and displayed, which is distinguished by different color and can be displayed in the same interface using different scale.Being use the special data sampling interface board, user can decide what physical value should be sampled, and can add new physical value sampling sensor.Because ZigBee network has self-organizing and self-recovery features, equipment monitoring nodes can optionally move within the network coverage.Therefore user can freely decide what equipment's information should be sampled only by joining the equipment monitoring nodes with the monitoring equipment.The whole system is customizable and with good scalability.

Figure 3 .
Figure 3.The querying interface for real time data of equipment.