Design and Implementation of Zigbee Wireless Sensor Network Platform
[Date: 2008-8-1] |
Source: Electronic Technology Application Author: Dong Haitao, Qu yugui, Zhao Baohua |
[Font:Large Medium Small] |
A wireless sensor network is an Integrated Intelligent Information system integrating information collection, information transmission, and information processing. It features low cost, low power consumption, low data rate, and self-organizing network. The Zigbee technology is a standard wireless network protocol stack designed for low-speed sensors and control networks. It is the most suitable standard for wireless sensor networks. Zigbee wireless sensor network is a wireless sensor network based on Zigbee technology. It has huge application potential in many industries, such as environmental monitoring, logistics management, medical monitoring, traffic management and military reconnaissance applications [1-2].
Currently, the most widely used wireless sensor network platforms include Mica2/MicaZ of Crossbow and PICDEMZ of Microchip. Although MicaZ has a Tinyos operating system, it does not combine Zigbee technology. The Zigbee protocol stack of PICDEMZ does not fully conform to the Zigbee definition and has simple functions. Therefore, the design of a Zigbee wireless sensor network platform can better develop wireless sensor network applications and Zigbee technology.
Based on the analysis of the characteristics and Key Technologies of Zigbee wireless sensor network, this paper proposes the design and implementation scheme of the Zigbee wireless sensor network platform, and implements the Zigbee protocol stack using modular methods, the wireless sensor network platform is used for Temperature Monitoring Experiments. The results show that the platform realizes the basic functions of the Zigbee wireless sensor network and can better develop the Zigbee technology.
1 ZigBee Wireless Sensor Network
1.1 Wireless Sensor Networks
A typical wireless sensor network consists of at least wireless sensor nodes, network coordinator, and central control points. A large number of sensor nodes are randomly deployed inside or near the monitoring area, and can form a network through self-organizing. The data monitored by sensor nodes is transmitted along other sensor nodes step by step. During transmission, the monitoring data may be processed by multiple nodes and then routed to the network coordinator, finally, it reaches the central control point. In this process, sensor nodes act as both sensor nodes and data forwarding routers. Users can configure and manage wireless sensor networks through central control points, release monitoring tasks and collect monitoring data [3]. Figure 1 shows the structure of a typical wireless sensor network.
1.2 ZigBee technology
ZigBee technology is a short-range wireless communication technology with unified technical standards. The complete Zigbee protocol stack consists of the physical layer, media access control layer, network layer, security layer, and application layer. The physical layer and media access control layer protocols are 802.15.4 protocol standards [4]. The network layer and security layer are developed by the ZigBee Alliance. The development of the application layer should be based on the user's own needs, [1, 5].
In terms of wireless communication technology, the non-conflict multi-carrier Channel Access (CSMA-CA) method is adopted to effectively avoid the conflict between radio carriers. In addition, a complete response communication protocol is established to ensure the reliability of data transmission.
ZigBee is a low-power device with a transmit/output power of 0 ~ 3.6dbm, the communication distance is 30 ~ 70 m, capable of Energy Detection and link quality indication. Based on these detection results, the device can automatically adjust the transmit power to consume the energy of the device to a minimum while ensuring the quality of the communication link.
In terms of network performance, ZigBee can be constructed as a star network or point-to-point peer network. In each ZigBee wireless network, the connection address code is divided into 16-bit short address code or 64-bit long address code, with a large network capacity.
2 hardware design of ZigBee Wireless Sensor Network Platform
2.1 design objectives
ZigBee wireless sensor network platform has some constraints in various application systems []:
(1) the shape should be as small as possible. The chip size determines the size of the entire node.
(2) as high as possible. Various sensor nodes usually require various hardware resources such as program memory, static memory, A/D converter, timer and counter. In particular, there must be enough rom space to store the ZigBee protocol stack.
(3) low power consumption and support for sleep mode. The sleep mechanism is directly related to the length of the node's life cycle. Therefore, the chip must support low-power sleep.
(4) run as fast as possible. The system should complete the work in the shortest time to quickly enter the sleep state to save system energy.
(5) working in the free ISM (Industial Scientific Medical) band, GHz it is a free and application-free radio band, in which the data transmission rate is kb/s.
(6) the cost should be as low as possible. Chips account for a large proportion of sensor node costs.
2.2 cc2430-Based Hardware Design
Currently, the common Zigbee Wireless Sensor platform is composed of an 8-or 16-bit microcontroller and Zigbee RF chip. With the development of chip design, wireless single-chip microcomputer has emerged, that is, the processor module and RF module are integrated into the same chip. The CC2430 OF Ti-Chipcon is one of the representative. Its typical application is 2.
CC2430 integrates the Zigbee RF front-end, ROM, and 8051 microcontroller in one chip, and the size is only 7mm × 7mm. This ensures high integration, few peripheral devices, and a small shape; in the receiving and transmitting modes, the current loss is less than 27mA or 25mA, and supports four sleep mechanisms to greatly reduce power consumption. The CC2430 works in the free GHz band, in addition, the chip price is only about $5, and the cost of use is very low. Therefore, the CC2430 meets the design requirements of the Zigbee Wireless Sensor Network Platform [2].
3 Software Design of ZigBee Wireless Sensor Network Platform
3.1 software structure
Software on Zigbee wireless sensor network equipment is mainly composed of embedded operating systems, Zigbee protocol stacks and applications, the embedded operating system kernel provides simple and efficient Task Transfer, interrupt processing, and time queue management. It also includes the underlying drivers of all hardware. Applications include serial communication, RF communication, and signal strength detection. The modular design protocol stack makes the entire system have a clear hierarchy, good scalability, and is conducive to secondary development of Zigbee technology.
3.2 protocol stack design
The Zigbee protocol stack ensures the interoperability of wireless devices in low-cost, low-power, and low-speed networks. Different layers of the Zigbee protocol stack communicate through service access points. Most layers have two interfaces: data entity interface and Management Entity interface. The goal of the data entity interface is to provide the required regular data services to the upper layer. The object management interface aims to provide a mechanism for accessing internal layer parameters, configuring and managing data at the upper layer [1]. The basic structure is shown in table 1.
The PHY layer consists of the RF transceiver and the underlying control module. It defines the interface between the physical wireless channel and the MAC layer. The main functions are to enable and disable wireless transceiver, energy monitoring, link quality monitoring, channel selection, channel clearing evaluation, and send and receive packets through physical media.
The MAC layer provides point-to-point communication service interfaces for High-level access to physical channels. The specific functions include beacon management, Channel Access, time slot management, sending confirmation frames, sending connections, and disconnecting requests. In addition, the MAC layer provides some methods for appropriate security mechanisms of applications.
The network layer is used to establish and maintain network connections. It independently processes incoming data requests, associations, disconnections, and isolated Notification requests.
The Application Layer mainly provides some application framework models for practical application of Zigbee technology, so as to develop and apply Zigbee technology.
Because Zigbee technology has defined standard specifications for the physical layer, media link layer, and network layer, the implementation of these three layers is usually similar. Different applications of wireless sensor networks are composed of basic applications, such as joining networks, disconnecting networks, and sending data. This article uses the IAR Embedded Workbench for 8051 Software to write the program code of the physical layer, media link layer, and network layer of the network platform, the header file of each layer defines the services and application interfaces supported by this layer. The Platform also provides some application interfaces, such as aplFormNetwork (), aplJoinNetwork (), and aplSendMSG (). You can call these functions to implement your own development and application.
3.3 sample code
After some initialization, The Zigbee Wireless Sensor Network Coordinator calls aplFormNetwork () to establish the network. The Coordinator scans an empty channel to create a new network, selects a random pan id, and starts to listen to the channel. At the same time, the Coordinator also has a list of currently connected devices to support other devices to join the network.
Main (){
HalInit (); // hardware initialization
AplInit (); // initialize the protocol stack Module
ENABLE_GLOBAL_INTERRUPT (); // enable global interrupt
AplFormNetwork (); // create a network
While (apsBusy () {apsFSM () ;}// wait until the network is established successfully
While (1) {apsFSM ();} // run the protocol stack
}
Similarly, Zigbee routers and terminal devices are added to the network created by the Coordinator through aplJoinNetwork. The terminal device scans the channel to find the coordinator and applies to join the network, obtains the Coordinator address, and sends the address of the device to the Coordinator. After the network is successfully added, the terminal device enters the sleep state until data is sent.
Main (){
HalInit (); // hardware initialization
AplInit (); // initialize the protocol stack Module
ENABLE_GLOBAL_INTERRUPT (); // enable global interrupt
Do {
AplJoinNetwork (); // Add to the network
While (apsbusy) () {apsfsm () ;}// wait until the network is successfully added
} While (aplgetstatus ()! = Lrwpan_success );
While (1) {apsfsm ();} // run the protocol stack
}
4 Applications
ZigBee wireless sensor networks are short-distance wireless communication networks with low cost, low power consumption, and low speed. in practical applications, the following conditions must be met: Low equipment cost and small size; use of disposable batteries; large communication coverage and small amount of data transmitted. This wireless sensor network platform is used to conveniently develop applications using ZigBee technology. Next we will focus on the Experiment of temperature monitoring based on this platform.
The wireless temperature monitoring system consists of multiple independent terminal nodes, a network coordinator, and a PC. Sensor nodes are distributed in the areas to be detected. sensor nodes are responsible for data sensing and processing and transmitting data through Wireless RF signals. The Coordinator receives Wireless RF signals from each sensor node, it is sent to the PC host through the serial line of the RS-232. The PC host is responsible for storage and further processing of data.
As long as the application layer program is designed on the basis of the Platform, wireless temperature monitoring can be realized without the need to design the code at the physical layer, MAC layer, and network layer. The temperature is collected every 10 seconds, and the node enters sleep state during the two temperature acquisition to reduce power consumption. At a certain time point, we can see from Figure 3 that the collected data increases significantly in about 60 seconds. While Node 2 collects the ambient temperature at the moment, it can be seen that the collected data is basically a straight line. The experimental results show that the temperature monitoring function can be well implemented, and has the characteristics of low power consumption and low speed, which frees you from the limitations of cables.
In this paper, the cc2430 chip is used to design and implement the ZigBee wireless sensor network platform. The End Node is designed with low cost and low power consumption, and the ZigBee protocol stack is designed using modular methods, this platform is universal and easy to develop. It solves typical problems from system design to product design and accelerates the development and application of ZigBee wireless sensor networks.