Design of environmental monitoring system based on ZigBee technology

Publisher:Meilin8888Latest update time:2014-03-05 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0 Introduction

All walks of life, especially in the fields of industrial and agricultural production, environmental monitoring, etc., have put forward great demands and higher requirements for wireless digital monitoring systems. The rapid development and gradual maturity of wireless sensor networks have better met this demand. Wireless sensor networks based on ZigBee technology have the advantages of self-organization, low power consumption, data-centricity, strong anti-destruction and no need to set up network facilities. They can complete tasks that other monitoring methods cannot complete under extremely harsh external conditions, representing a new development direction for digital monitoring. This paper takes TI's CC2530 and zstack protocol stack as the platform, and gives the design method of temperature and light intensity wireless sensor network based on ZigBee technology.

1 Overall system design

The wireless sensor network based on ZigBee technology designed in this paper consists of a coordinator node, several routing nodes and many sensor nodes. The overall structure of the system is shown in Figure 1. Among them, the sensor node is responsible for monitoring data such as ambient temperature, and then sends the data to the coordinator node through the routing node in a multi-hop manner. The coordinator node is responsible for reporting the data to the monitoring center PC.

Design of environmental monitoring system based on ZigBee technology

2 Node Hardware Design

According to the different applications of nodes in the system, they can be divided into sensor nodes, routing nodes and coordinator nodes. The functions of each node are different, which can be divided into data acquisition, data processing, wireless communication, energy supply and serial communication. Each functional module is designed in a modular way, which can realize the parallel design and debugging of each module, shorten the development cycle, and facilitate the replacement and expansion of sensors in the later stage, so as to facilitate the later maintenance or transplantation to other monitoring fields.

2.1 ZigBee Module

Each node in this design uses CC2530 chip as ZigBee module to realize data processing and ZigBee wireless communication functions. CC2530 integrates a high-performance 2.4 GHz RF transceiver and an enhanced 8051 microprocessor, with a maximum of 256 KB programmable FLASH, 8 KB RAM and a wide range of peripherals, providing a SOC solution for 2.4 G IEEE 802.15.4 and ZigBee applications. The circuit of the module is shown in Figure 2, which includes the minimum system, RF front end and I/O interface circuit.

Design of environmental monitoring system based on ZigBee technology

2.2 Data Acquisition Module

Each sensor node collects data on ambient temperature and illuminance through a one-wire digital temperature sensor DS18B20 and a CDS photoresistor 5516. Figure 3 shows the circuit diagram of the data acquisition module. Among them, DS18B20 can achieve a measurement range of -55 to +125°C and a maximum temperature measurement resolution of 12 bits. The temperature measurement accuracy can reach ±0.062 5°C, and the power supply voltage range is +3 to +5.5 V. In this design, the power supply voltage is selected from the +3.3 V output of the LD1117 voltage regulator chip. The data line DQ is connected to P2.0 of the CC2530 chip to realize a one-wire interface, as shown in Figure 3(a). The light resistance of the 5516 photoresistor is 5 to 10 kΩ, and the dark resistance is 500 kΩ. The circuit is shown in Figure 3(b). The output voltage is 0 to 2 V, which is sent to P0.5 for AD conversion. [page]

Design of environmental monitoring system based on ZigBee technology

3 Node Software Design

The node software is developed and designed based on TI's ZigBee protocol stack, Z-stack, which supports the establishment and joining of ZigBee networks, ad hoc networks, multi-hop transmission, and dynamic network topology.

3.1 Operation Mechanism of Z-stack Protocol Stack

OSAL is a round-robin query operating system developed by TI for the Z-Stack protocol stack. OSAL puts priority in the most important position. All events in high-priority tasks have high priority. As long as there are events that have not been processed in the high-priority task, they will be processed until all events are processed before querying the events of the next task. In addition, even if there are more than two events waiting to be processed in the currently processed task, after processing one, it is necessary to go back and query the task with a higher priority. Only when the task with a higher priority has no events to process will the event with the second highest priority of the original task be processed. If it is found that the task with a higher priority has a new event to process at this time, the event will be processed immediately. Through this scheduling method, the task with a high priority is given the greatest power, and every event of the high-priority task can be processed as timely as possible.

3.2 ZigBee network construction process

The networking process of ZigBee network includes two aspects: network establishment and network joining. This part is realized through primitive communication between the layers of Z-Stack protocol stack. The coordinator node is responsible for the parameter configuration and establishment of the network. The application layer calls the network layer function NLME NetworkFormationRequest() through the ZDO layer to perform active scanning on the specified channel, that is, send the MAC layer beacon request command to detect the existing network on the channel; then the network layer sets the PAN ID, network address, extended PAN ID and other parameters according to the active scanning results; finally, it notifies each application endpoint that a new ZigBee network has been established. The network establishment process is shown in Figure 4.

Design of environmental monitoring system based on ZigBee technology

There are many ways to join the network, such as joining the network by connecting, rejoining the network, joining the network as an isolated point, joining the network in advance, etc. The process diagram of a subnode joining the network by connecting is shown in FIG5 .

Design of environmental monitoring system based on ZigBee technology

The child node application layer calls the network layer function NLME_NetworkDiscoveryRequest() through the ZDO layer, performs active scanning on the specified channel, and then listens for a period of time to see if a beacon is received. By sending the MAC layer beacon request command multiple times, the child node can know the relevant information of the existing network around it, so as to determine the PAN ID to join the network, and then send the MAC layer connection request command to the node to join through the NLME_Join Request() function. If a successful MAC layer connection response command is received, the network address assigned by the parent node can be obtained. If the child node is a terminal node, the network joining process is completed here. If the child node is a routing node, the child node must also start the router through the NLME_StartRouterRequest() function. Regardless of whether the child node is a sensor node or a routing node, the result of joining the network must be notified to each application endpoint in the end. [page]

The coordinator and router nodes can decide whether to allow child nodes to join their own network through the NLME_PermitJoining Request() function. This can easily control the child nodes to join a specified routing node, thereby realizing multi-hop networking.

3.3 Data acquisition program design

DS18B20 is used as the temperature measuring element. Its hardware circuit is quite simple. However, for the single-chip microcomputer, in order to obtain temperature data once, it is necessary to perform a reset operation on it, send ROM command and RAM command operations, and start the temperature conversion; after waiting for the temperature conversion to be completed, repeat the above three steps to realize the temperature reading. According to the different configuration registers of DS18B20, it can be divided into 9, 10, 11 and 12 bits of resolution, and the required conversion time is minimum 93.75 ms and maximum 750 ms. In other words, after starting the temperature conversion, it is necessary to wait for a long time before the temperature reading operation can be performed. In order to avoid unnecessary waiting, the temperature measurement is divided into two events in this design: temperature "conversion" and "reading" events. When collecting temperature, a "conversion" event timer can be set. When processing the "conversion" event, first send a temperature conversion command to DS18B20, then set a "reading" event timer, and then return to OSAL to process other events, so as to ensure that the system can respond to other events in a timely manner. When processing the "read" event, you only need to read the temperature directly, and then set the "convert" event timer again to achieve periodic data collection. The "convert" and "read" event processing flow of the temperature sensor is shown in Figure 6.

Design of environmental monitoring system based on ZigBee technology

4 Experimental results analysis

4.1 Networking Experiment

During the network test, TI's CC2531UD USB DONGLE and SmartRF Packet_Sniffer software were used to capture and analyze wireless data packets in the air. The data packets captured during the child node joining the network are shown in Figure 7. The child node (IEEE address is 0x001248000201781D) first issued a MAC layer beacon request command, and then the coordinator node (network address is 0x0000) issued a beacon frame as a response. Then, the child node issued a MAC layer connection request command, and then the coordinator node returned a response frame. Finally, the child node sent a MAC layer data request command to the coordinator node, and then the coordinator node issued a MAC layer connection response command as a response, and assigned a network address 0x0001 to the child node. It can be seen from the data packet diagram that the child node has successfully joined the network.

Design of environmental monitoring system based on ZigBee technology

4.2 Data collection experiment

In the experiment, each sensor node is set to collect data every 2 seconds, and then the collected data is sent to the coordinator through the routing node. The coordinator uploads the data to the PC through the RS232 serial port. The collected data is finally displayed as shown in Figure 8. The collected data in Figure 8 are sent to the coordinator by two sensor nodes with node numbers 10 650 and 10 120 through routing node 2 181 (parent node). The temperature value measured manually during the experiment is 20.3℃, which is basically consistent with the collected data.

Design of environmental monitoring system based on ZigBee technology

5 Conclusion

Wireless sensor networks based on ZigBee technology can better meet the needs of various industries for wireless digital monitoring. This paper uses CC2530 and Z-stack protocol stack as platforms to build a multi-hop ZigBee network to achieve wireless monitoring of ambient temperature, light intensity and other data. The experimental results show that the multi-hop network of this design is successful and the data collection results are correct.

Reference address:Design of environmental monitoring system based on ZigBee technology

Previous article:Design of home environment monitoring and early warning system based on Basic-RF
Next article:Design and implementation of engine low-frequency vibration signal acquisition system

Recommended ReadingLatest update time:2024-11-16 18:05

Coffee machine application solution based on 8051 main control chip TM52F1376
There are many types of coffee machines on the market today, and they are divided into two types: semi-automatic and fully automatic according to the operation mode. No matter what type of coffee machine there is, there is a very strong market demand. In order to meet this demand, this article mainly introduces a simp
[Microcontroller]
Coffee machine application solution based on 8051 main control chip TM52F1376
Design of digital multi-motor control platform based on single chip microcomputer C8051F020
0 Introduction Stepper motors are very suitable for open-loop position control systems because of their low rotor inertia, high positioning accuracy, and no cumulative error. DC motors are commonly used in servo control. However, in actual systems, multiple moving parts often exist at the same time to meet different
[Microcontroller]
Design of digital multi-motor control platform based on single chip microcomputer C8051F020
Flash security options for C8051F
The set of security lock bytes stored at addresses 0xFDFE and 0xFDFF protects the FLASH memory so that its contents cannot be read or modified through the JTAG interface. Each bit in the security lock byte protects an 8k-byte memory block. Clearing a bit in the read lock byte to 0 prevents reading the corresponding FLA
[Microcontroller]
Design of infrared temperature monitoring system based on C8051F340 single chip microcomputer and CPLD
0 Introduction     During the spiral charging process, bubbles often appear in the medicine due to the uneven temperature distribution of the internal medicine, which seriously affects the quality of the medicine in the projectile and the parameters of the ammunition. Therefore, this paper hopes to detect the temperatu
[Microcontroller]
Design of infrared temperature monitoring system based on C8051F340 single chip microcomputer and CPLD
8051 MCU (STC89C52) implements countdown timer in timer interrupt mode
Previously, the polling method was used to achieve accurate timer timing. Here, the countdown timer is implemented using the front-end and back-end system architecture.   The interrupt handler T0_INT() is triggered every 10ms. Depending on the value of tcount, it is decided whether to display the unit digit or the t
[Microcontroller]
8051 MCU (STC89C52) implements countdown timer in timer interrupt mode
Application of C8051F320 in USB Design
       With the rapid development of USB technology and the wide application of USB peripherals in more and more occasions, more and more chips support USB interface technology. For the design of USB interface, if it is not for expansion, the selection of USB controller with MCU is of course the first choice of designe
[Microcontroller]
Common Problems of 8051 Microcontroller
1. Basic concepts of 8051 1. What is MCS8051? Answer: Initially, MCS8051 refers to the MCS51 series of microcontroller chips produced by INTEL. Later, many manufacturers' 8051 instruction sets were compatible with INTEL's, so MCS8051 also refers to the 8051 basic instruction set. 2. What are the common MCS8051 com
[Microcontroller]
8051 packaging and pinout
  Usually, a microcomputer system consists of three parts: central processing unit (CPU), memory and input/output unit (I/O), as shown in the figure below. CPU is like the human brain, dominating the operation of the entire system; memory is used to store programs and data required for system operation, including read
[Microcontroller]
8051 packaging and pinout
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号