As can be seen from the figure above, the establishment of the network is implemented from ZDO. After the establishment of the network, the application layer receives the ZDO_ATATE_CHANGE message, which contains the current node network status. The following figure shows the process of adding a router node to the network. The process of router joining the network is implemented by ZDO. When the router joins the network, the application program will receive the network status of the current node.
8327-1600 Figure 4-3 Adding the router to the network
The following figure shows how a terminal node joins the network. As can be seen from the figure below, the process of terminal node joining the network is also implemented by ZDO. After receiving the information of the node, the application layer can read the current network status.
Each ZigBee node is initialized for networking, and each terminal node continuously collects environment information. When everything is ready, the coordinator will periodically send environment information to the gateway. The ZigBee subsystem interacts with the gateway through ser2net, transmitting the serial port data of the ZigBee subsystem coordinator to the gateway, and the gateway interacts with the outside world through the TCP protocol. After the intelligent network is turned off, the system is initialized, the network is connected, etc., and the coordinator is waiting for the environment information to be sent. After receiving the data, the data is sent to the cloud through the wireless network. After getting the corresponding data, the cloud draws the temperature and humidity curve of each terminal, and can also view the current environment information in real time. Of course, the mobile terminal can also obtain environmental information, but also control home appliances. In addition, in order to ensure the reliability of data transmission, a simple data transmission protocol is designed to ensure the reliable interaction of data.
4.2 Gateway/Monitoring subsystem
The gateway/monitoring subsystem consists of camera, intelligent gateway and mobile terminal. After the intelligent network is powered off, the board level initialization is completed, the number WiFi is connected, and the camera is initialized. When a user requests video information, the intelligent gateway immediately obtains camera data and sends it to the user.
8327-1600 Use the SmartRF Flash Programmer to burn the Hex firmware to the ZigBee node, and download the Coordinator.hex and EndDevice 1-4.hex to the coordinator and terminal, respectively. Note: If you don’t have that many boards, just download Cocodinater.hex and EndDevice1.hex.
Be sure to power on the coordinator first, because the use of USB to serial port, the program automatically identifies the serial port. The author provides the installation-free and installation-free versions. To use the installation-free version here, double-click ZigBee.exe. The author here this is for auto-refresh data. The author used a terminal and can see the information shown in the figure below.
If you want to control the mobile phone, you need to have a wireless router, the mobile phone opens wifi and connects well, first click the network setting, enter the computer IP address and then click the connection, the mobile phone shows that the connection is successful, it will automatically refresh the data. As shown in the following picture.