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.
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.
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]
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.
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 .
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.
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.
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.
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.
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
- Popular Resources
- Popular amplifiers
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- Principles and Applications of Single Chip Microcomputers 3rd Edition (Zhang Yigang)
- Principles and Applications of Single Chip Microcomputers and C51 Programming (3rd Edition) (Xie Weicheng, Yang Jiaguo)
- STC32G Series MCU Technical Reference Manual
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Chapter 2: Creation of Development Environment
- Summary of netizens' sharing (including works) - 2020 ST MEMS Sensor Creative Design Competition
- TI C64X DSP interrupt vector table configuration (hardware interrupt)
- A four-way digital buzzer using Quartus II simulation and Verilog HDL programming
- Design of CCD camera dimming photoelectric control system based on MSP430 microcontroller
- Verification Method Overview
- 【ST NUCLEO-H743ZI Review】+ USB OTG+FATFS
- MSP432 learning notes: GPIO usage and configuration
- Mir MYC-YT507 Development Board Review: Development Environment Part 2: Python 2048 Game
- Double-T network band-stop filter and its variants