4. Detailed design
The system provides the function of online viewing security monitoring data, collects data through multiple sensors, builds wireless local area network, synchronizes the information of each sensor in real time, and realizes the all-round security monitoring and alarm function; At the same time, a Web server is set up for users to remotely view monitoring information.
4.1 ZigBee wireless sensor monitoring subsystem
8201-HI-IS ZigBee protocol provides a wireless LAN solution for smart home environment monitoring. The coordinator node can obtain the environment information of each terminal node in real time and transfer it to the user in real time for the user to check. The routing node is used for the secondary transmission of the terminal node and plays the role of information transmission. The terminal node is used to collect environmental information through various sensors, determine whether the collected information reaches the threshold of early warning and alarm, and whether to perform corresponding actions. The information data specified by the user is transmitted to the terminal node through the router, and finally to the user to facilitate the user to understand the environmental information.
4.1.1 ZigBee working flow chart
ZigBee’s working flow chart is shown in the figure below.
Figure 4-1 Z-Stack working flowchart
Z-Stack is built with an operating system in mind, using an event round-robin mechanism, and has a dedicated Timer2 to take care of timing. Starting from the CC2530 work, Timer2 clock again and again, and execute tasks such as acquisition, sending, receiving, and display when they are to be executed. After each layer is initialized, the system enters the low-power mode. When an event occurs, the system wakes up, starts to enter the interrupt processing event, and continues to enter the low-power mode after the end. If several events occur at the same time, determine the priority and process the events one by one. This software architecture can greatly reduce the power consumption of the system. The main workflow of the whole Z-8201-HI-IS Stack, as shown in the figure, is roughly divided into the following 6 steps:
• Close all interrupts;
• Chip external (onboard peripherals) initialization;
• On-chip initialization;
• Initialize the operating system;
• Open all interrupts;
• Execute the operating system.
4.1.2 ZigBee network establishment and network joining process analysis
This design is mainly to use ZigBee to build a network system, establish a network, join the network as a focus of the design, the following describes the coordinator to establish a network, router to join the network, the terminal node to join the network networking process. The networking process of the coordinator is shown in the following figure.