Zigbee device communication method and system based on beacon transmission and time slot allocation
By using beacon delivery and time slot allocation methods in Zigbee device communication, the data stability and concurrency amount problems in the existing technology in scenarios of dense uplink cycles, numerous terminals and high-frequency position movement of equipment are solved, and the data stability and concurrency amount in the existing technology are realized. More efficient Zigbee network communication.
Patent Information
- Application Number
- CN202210569882.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-24
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2042-05-24
AI Technical Summary
In application scenarios where the existing Zigbee protocol stack is densely packed with uplink cycles, numerous terminals and high frequency position movement of equipment, it is difficult to provide good data stability and high concurrency demand.
Using a Zigbee device communication method based on beacon delivery and slot allocation, through router registration, routing link construction, beacon generation and delivery, and dynamic slot allocation, we ensure that the terminal device can send uplink data within the determined time slot.
It improves the signal bandwidth utilization of Zigbee network, enhances the uplink concurrency of terminal devices, and can be suitable for industrial environments that require high data stability and real-time.
Smart Images

Figure CN114980215B_ABST
Abstract
Description
Technical Field
[0001] The present invention provides a Zigbee device communication method and system based on beacon transmission and time slot allocation, belonging to the technical field of Zigbee device communication methods, and in particular to a Zigbee communication method and system for industrial field equipment requiring a certain amount of uplink data concurrency and reliability. Background Art
[0002] Zigbee is one of the most important technologies in wireless communication. It is widely used in the field of home automation due to its low power consumption and networking capabilities. Its self-organizing networking technology can be applied to most application scenarios with low-frequency location movement and low-frequency uplink data.
[0003] The industry peers generally have the need to apply Zigbee wireless communication technology to the field of industrial data collection and control, which has intensive uplink cycles, a large number of terminals, frequent equipment movement, and requires good data stability. With respect to the above-mentioned related technologies, the inventor believes that the Z-stack protocol stack commonly used in the industry cannot meet the various application requirements mentioned above in many aspects:
[0004] 1. The CSMA-CA carrier detection anti-collision algorithm provided by the Z-stack protocol stack by default is difficult to provide good data stability in application scenarios with dense uplink cycles and a large number of terminals;
[0005] 2. The beacon mode is a time synchronization mechanism provided by the Z-stack protocol stack. It is based on the IEEE802.15.4 protocol and has only a limited guaranteed time slot (GTS) for non-contention access. During the contention access period (CAP), it still relies on random channel preemption, which makes it difficult to meet the high concurrency requirements of a large number of terminals.
[0006] 3. The many-to-one routing discovery protocol provided by the Z-stack protocol stack is designed to solve the routing strategy problem of multiple devices to the concentrator, while the transmission of beacons is a routing strategy problem from the concentrator to multiple devices;
[0007] 4. The terminal device re-entry mechanism inherent in the Z-stack protocol stack is difficult to meet the time-division multiple access communication mechanism of uplink data in the case of high-frequency movement of devices due to the occupation of the channel by a certain amount of network layer data during the re-entry stage. Summary of the invention
[0008] In order to overcome the shortcomings of traditional Zigbee networking communication technology, the present invention aims to solve the technical problem of providing an improved Zigbee device communication method suitable for application scenarios with intensive uplink cycles, a large number of terminals and high-frequency position movement.
[0009] In order to solve the above technical problems, the technical solution adopted by the present invention is: a Zigbee device communication method based on beacon transmission and time slot allocation, comprising the following steps:
[0010] S1: The router to be connected to the network completes registration through the device management platform of the server. The Zigbee gateway reads the registration information of the router, receives the router's network access request and completes the router's network access.
[0011] S2: The Zigbee gateway initiates route discovery requests to all registered routers one by one. Each route discovery determines a unique path. The router submits path information level by level according to the path and establishes a route list based on the B-tree data structure. By non-recursive pre-order traversal of the B-tree list, beacon slots are allocated to all subtree node routers in the B-tree list.
[0012] S3: The Zigbee gateway generates a beacon and sends it in the starting time slot of the beacon cycle. The child node router that receives the beacon synchronizes its own time information according to the timestamp in the beacon payload and transmits the new beacon to the next-level child node router in the time slot determined by the beacon payload.
[0013] S4: Zigbee terminal devices are randomly distributed in areas within the coverage of router signals. They receive beacons sent by routers near the Zigbee terminal devices, synchronize their own time information based on the timestamp of the beacon, and determine the sending time slot of the uplink data based on the device ID. The uplink data is broadcast and sent in time slot mode through the MAC layer interface. The downlink data is cached by the router and sent together with the beacon payload, and reaches the target Zigbee terminal device as the beacon is transmitted.
[0014] The device registration steps of the router to be connected to the network in step S1 are as follows:
[0015] The router to be connected to the network establishes communication with the device management platform of the server. The device management platform reads the 64-bit MAC address of the router to be connected to the network, assigns a 16-bit network short address to the router to be connected to the network, and generates a device information table;
[0016] The device management platform transmits the device information table of the registered router to the Zigbee gateway, and the device information table is saved in a non-volatile form inside the Zigbee gateway until the device is restored to factory settings;
[0017] After receiving the network access request from the router device, the Zigbee gateway compares the MAC address in the device information table, filters the network access requests from non-registered routers, and completes the network joining process for the registered router.
[0018] The steps of constructing the routing chain table in step S2 are as follows:
[0019] The Zigbee gateway uses the route discovery function provided by the Z-Stack protocol stack to initiate route discovery requests to all registered routers one by one;
[0020] The target router that receives the route discovery request extracts the route discovery table in the Z-Stack protocol stack, and then obtains the network short address of the upper-level routing node, and unicasts the path information containing its own node to the upper-level routing node;
[0021] The upper level router adds the received path information to the routing chain table based on the B-tree data structure. As the routing discovery process proceeds one by one, the routing chain table is gradually improved until all the path information with each level router's own node as the root node is constructed.
[0022] As the path information is submitted step by step, the Zigbee gateway receives the path information of all routing nodes in the system and establishes a routing linked list containing routers in the entire system.
[0023] The steps of beacon generation and transmission in step S3 are as follows:
[0024] The Zigbee gateway performs a non-recursive pre-order traversal of the internal B-tree routing list, and assigns device IDs to all subtree node routers in the B-tree routing list according to the order of traversal. The device ID uniquely determines the time slot for sending the new beacon generated by the subtree node router.
[0025] The beacon frame payload contains the network short address and device ID of the Zigbee gateway and the Zigbee gateway subnode router. The beacon frame payload also contains the timestamp of the sending time.
[0026] After the Zigbee gateway generates a beacon, it sends the 0th beacon in the starting time slot of the beacon cycle. The beacon is received by the child node router of the Zigbee gateway. The child node router that receives the beacon performs the following operations in sequence:
[0027] ① Synchronize its own time information according to the timestamp in the beacon payload;
[0028] ② Determine the sending time slot of the new beacon based on the device ID corresponding to its own network short address;
[0029] ③ Then, through non-recursive pre-order traversal of the internal B-tree routing list, beacon time slots are allocated to all subtree node routers of the B-tree routing list according to the order of traversal to generate new beacons;
[0030] ④ The new beacon is sent in the transmission time slot determined by the device ID and is received by the next-level child node router;
[0031] Similarly, the beacon is passed layer by layer by all nodes in the B-tree routing list until the router node at the end.
[0032] A beacon cycle is 41943mS, which is 65536*2 MacTimer cycles, divided into 32 communication cycles, one communication cycle is 1310mS, each communication cycle is divided into 256 time slots, each time slot is 5.12mS, which is 16 MacTimer cycles;
[0033] The first two time slots of each communication cycle (time slot ID = 0~1) are used for beacon transmission, the next two time slots (time slot ID = 2~3) are idle, the next 250 time slots (time slot ID = 4~253) are used for uplink data communication, and the last two time slots (time slot ID = 254~255) are idle.
[0034] The steps for determining the uplink data time slot of the Zigbee terminal device in step S4 are as follows:
[0035] The uplink data time slot of the Zigbee terminal device is determined by the dynamic device ID assigned to the Zigbee terminal device by the check-in router. The dynamic device ID value is 0~249, corresponding to the time slot ID = 4~253;
[0036] In a time period, a group of Zigbee terminal devices establish uplink communication with the sign-in router in a competitive manner and send migration requests. The dynamic device ID is allocated in sequence from 0 to 249 in the order in which the sign-in router receives the data packets. The allocated device ID is in an active state. When all available device IDs are in an active state, the newly migrated device is rejected.
[0037] In the next time period, the previous batch of Zigbee terminal devices successively send outbound requests, and the next batch of Zigbee terminal devices successively send inbound requests. The device IDs of the outbound devices change from active to inactive, and the inactive device IDs are dynamically assigned to the inbound devices, thereby achieving dynamic allocation of uplink time slots.
[0038] Zigbee device communication system based on beacon transmission and time slot allocation, including: server, Zigbee gateway, Zigbee router, Zigbee check-in router, Zigbee terminal device;
[0039] The server is used for equipment management, equipment data display and human-computer interaction;
[0040] The Zigbee gateway establishes a wired or wireless serial port or network connection with the server for establishing a Zigbee network, as well as for the routing discovery function, storage and management of device information tables, generation of beacons, and allocation of beacon time slots;
[0041] The Zigbee router establishes a wired or wireless serial port or network connection with the server for step-by-step submission of path information, management of lower-level routing linked lists, transmission of beacons, reception of uplink data of Zigbee terminal devices, and caching and transmission of downlink data;
[0042] The Zigbee check-in router establishes communication with the host computer, does not participate in beacon transmission, and is used to generate a dynamic ID for the Zigbee terminal device;
[0043] Zigbee terminal devices are used for collecting and caching device data, sending uplink data, receiving downlink data in beacon payloads, and executing downlink commands.
[0044] The server adopts a single-machine device with RS-232, RS-485, USB, and network port communication interfaces or a network server connected to the Internet.
[0045] The Zigbee gateway and Zigbee router respectively have one or more communication interfaces such as RS-232, RS-485, USB, and network port.
[0046] The beneficial effects of the present invention compared to the prior art are as follows: the Zigbee device communication method based on beacon transmission and time slot allocation provided by the present invention adopts an innovative beacon transmission algorithm and time slot allocation strategy, which effectively improves the bandwidth utilization of Zigbee signals and increases the uplink concurrency of terminal devices, so that the Zigbee network can be applied to industrial environments that require high data stability and real-time performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The present invention will be further described below in conjunction with the accompanying drawings:
[0048] Figure 1 is a flow chart of the communication method of the present invention;
[0049] Figure 2 It is a schematic diagram of a method for registering a router device to be connected to the network according to the present invention;
[0050] Figure 3 It is a schematic diagram of a method for constructing a routing chain table according to the present invention;
[0051] Figure 4 It is a schematic diagram of a method for generating and transmitting a beacon of the present invention;
[0052] Figure 5 is a schematic diagram of the beacon period definition of the present invention;
[0053] Figure 6 It is a schematic diagram of the definition of time slots in a communication cycle in the beacon cycle of the present invention;
[0054] Figure 7 It is a schematic diagram of an example of constructing a routing chain table in the present invention;
[0055] Figure 8 It is a schematic diagram of an example of traversal of the path list and transmission of beacons of the present invention;
[0056] Fig. 9 It is a structural schematic diagram of the communication system of the present invention. DETAILED DESCRIPTION
[0057] like Figures 1 to 9 As shown, in order to overcome the defects of traditional Zigbee networking communication technology, the present invention proposes a Zigbee device communication method based on beacon transmission algorithm and time slot allocation strategy, and the method includes the following steps:
[0058] The router to be connected to the network completes registration through the device management platform, and the Zigbee gateway reads the registration information, receives the router's network access request and completes the device network access;
[0059] The Zigbee gateway initiates a route discovery request to all registered routing devices one by one. The routers submit path information level by level and establish a routing list based on the B-tree data structure. Each level of routers allocates beacon slots to all its subtree node routers through a non-recursive pre-order traversal of the B-tree list.
[0060] The Zigbee gateway generates a beacon and sends it in the starting time slot of the beacon cycle. The child node router that receives the beacon synchronizes its own time information according to the timestamp in the beacon payload and transmits the new beacon to its own child node router in the time slot determined by the beacon payload.
[0061] Zigbee terminal devices are randomly distributed in areas within the coverage of router signals. They receive beacons sent by nearby router devices, synchronize their own time information based on the timestamp of the beacon, and determine the sending time slot of their uplink data based on their dynamic device ID. The uplink data is broadcast and sent in time slot mode through the MAC layer interface. The downlink data is cached by the router and sent together with the beacon payload, and reaches the target terminal device as the beacon is transmitted.
[0062] In one embodiment, the device registration method of the router to be connected to the network is as follows: Figure 2 ,include:
[0063] The router to be connected to the network establishes communication with the device management platform of the server. The device management platform reads the 64-bit MAC address of the router to be connected to the network, assigns a 16-bit network short address to the router to be connected to the network, and generates a device information table;
[0064] The device management platform transmits the device information table of the registered router to the Zigbee gateway, and the device information table is saved in a non-volatile form inside the gateway until the device is restored to factory settings;
[0065] After receiving the network access request from the router device, the Zigbee gateway compares the MAC address in the device information table, filters the network access requests from non-registered devices, and completes the network joining process of the registered routing device.
[0066] It should be noted that in the present invention, only the router device performs the network access operation, and the router joining the network formed by the Zigbee gateway is a prerequisite for the subsequent route discovery process;
[0067] The terminal device communicates uplink data through the MAC layer interface of the Z-stack protocol and does not perform network access operations. This can avoid the occupation of the channel by network layer data generated by the router during the re-entry phase in the case of high-frequency position movement, ensure the certainty of uplink data time slot allocation, and strictly avoid channel conflicts within the network.
[0068] In one embodiment, the method for constructing the routing list is as follows: Figure 3 ,include:
[0069] The Zigbee gateway uses the routing discovery function provided by the Z-Stack protocol stack to initiate routing discovery requests to all registered routing devices one by one;
[0070] The target router that receives the route discovery request extracts the route discovery table in the Z-Stack protocol stack to obtain the network short address of the upper-level routing node, and unicasts the path information containing its own node to the upper-level routing node;
[0071] The upper level routing device adds the received path information to the routing chain table based on the B-tree data structure. As the routing discovery process proceeds one by one, the routing chain table is gradually improved until all the path information with its own node as the root node is constructed;
[0072] As the path information is submitted step by step, the Zigbee gateway can receive the path information of all routing nodes in the system and establish a routing chain table containing routing devices in the entire system.
[0073] It should be noted that building a routing chain table is a prerequisite for the subsequent generation and transmission of beacons. The beacon transmission algorithm based on the non-recursive pre-order traversal of the B-tree data structure can enable beacons to be transmitted in a unique time slot in a non-competitive manner, significantly reducing the time window for terminal devices to receive beacons and reducing the power consumption of terminal devices.
[0074] In one embodiment, the method of generating and transmitting a beacon is described in Figure 4 ,include:
[0075] Zigbee gateway and other routers at all levels have built a routing list based on the B-tree data structure with their own nodes as the root nodes. Through the non-recursive pre-order traversal algorithm, the device ID is assigned to the router device in the order of traversal. The device ID is the basis for allocating beacon time slots to each router device.
[0076] For a gateway or router, its neighboring routing nodes are its child nodes. The beacon frame payload it generates contains the network address and device ID of its own node and all child nodes, as well as the timestamp of the beacon sending time;
[0077] After the Zigbee gateway generates a beacon, it sends the 0th beacon in the starting time slot of the beacon cycle, and the beacon is received by its child node router;
[0078] The child node that receives the beacon first synchronizes its own time information according to the timestamp in the beacon payload, and then traverses all subtree router nodes under its root node based on its own node's device ID, and assigns device IDs to router devices in the order of traversal;
[0079] Next, the child node mentioned above adds the device information of its own node and its child nodes in the payload of its new beacon;
[0080] Then, the sub-node described above calculates the sending time slot of its new beacon according to the device ID of its own node in the beacon payload, updates the timestamp of the new beacon, and then sends the new beacon in the new time slot;
[0081] Similarly, the beacon is passed layer by layer by all nodes in the B-tree routing list until the router node at the end.
[0082] In one embodiment, the definition of the beacon period is as follows: Figures 5 and 6 ,include:
[0083] A beacon cycle is 41943mS (65536*2 MacTimer cycles), which is divided into 32 communication cycles. One communication cycle is 1310mS. Each communication cycle is divided into 256 time slots, and each time slot is 5.12mS (16 MacTimer cycles).
[0084] A beacon cycle can also contain more communication cycles to increase the maximum number of routers supported by the system. A communication cycle can also contain more time slots to increase the maximum number of terminals supported by the system in the same time period. However, the lengthening of the beacon cycle will place higher requirements on the accuracy of the router's real-time clock crystal oscillator.
[0085] The present invention can be used for a sensor data acquisition system based on Zigbee wireless transmission in industrial situations, with a minimum acquisition period of 1.31S. Since the present invention is intended for Zigbee system applications in industrial situations, in order to reduce the data delay caused by the Zigbee multi-hop mode and the uncertainty of wireless channel occupancy, the Zigbee gateway and the Zigbee router are both connected to the server in hardware through a wired or wireless Internet network, and the Zigbee data of the terminal device is uploaded to the server nearby through the Zigbee router, which is a prerequisite for the system composition of the present invention and also a prerequisite for the basic method of the present invention.
[0086] After the Zigbee terminal device is powered on, it does not make a network access request, and all data passing through it is sent or received through the MAC layer interface, which is also a prerequisite for the basic method of the present invention.
[0087] 1. About the data frame transmission method
[0088] The transmission of path information is sent and received through the Z-Stack protocol stack AF layer or ZCL layer related program interface;
[0089] The transmission of beacon frames and uplink data packets does not pass through the AF layer or ZCL layer of Z-Stack. Instead, it uses the MAC layer data request interface provided by Z-Stack to send the time slot version of the sending function, and uses the DataIndicationEvent event in the MAC layer event callback interface provided by Z-Stack to extract the data frame.
[0090] 2. About the method of synchronizing own time information based on beacons
[0091] The beacon is sent using the slot version of the sending function, so the beacon is always sent when the macTimer count value is 0. After the device receives the beacon, the MacTimer count value is adjusted to the beacon frame air transmission time, and the timestamp is adjusted to the value of the beacon frame timestamp.
[0092] 3. The following is a specific example of how to construct a routing list. Figure 7 :
[0093] The network short address Addr of the router is allocated by the device management platform during the device registration process. To facilitate system debugging, the routers are deployed in batches in a specific embodiment;
[0094] ① The first batch of deployment: Gateway, Addr = 0x0001, Addr = 0x0003, Addr = 0x0004, Addr = 0x0006;
[0095] ② The gateway initiates route discovery for Addr = 0x0004. The route discovery request is sent along the path of Addr = 0x0000, Addr = 0x0001, and Addr = 0x0004 to reach Addr = 0x0004.
[0096] ③ Path information 0x0004 is submitted by Addr = 0x0004 to Addr = 0x0001, and Addr = 0x0001 adds a new child node Addr = 0x0004 under its own node;
[0097] ④ The path information 0x0001 0x0004 is submitted by Addr = 0x0001 to Addr = 0x0000. Addr = 0x0000 adds a new child node Addr = 0x0001 under its own node, and adds a new child node Addr = 0x0004 under the node of Addr = 0x0001.
[0098] ⑤ The gateway initiates route discovery for Addr = 0x0003. The route discovery request is sent along the path of Addr = 0x0000, Addr = 0x0001, and Addr = 0x0003 to reach Addr = 0x0003.
[0099] ⑥ Path information 0x0003 is submitted by Addr = 0x0003 to Addr = 0x0001, and Addr = 0x0001 adds a new child node Addr = 0x0003 under its own node;
[0100] ⑦ The path information 0x0001 0x0003 is submitted by Addr = 0x0001 to Addr = 0x0000, and Addr = 0x0000 adds a new child node Addr = 0x0003 under the node of Addr = 0x0001;
[0101] ⑧ The gateway initiates route discovery for Addr = 0x0006. The route discovery request is sent along the path of Addr = 0x0000, Addr = 0x0001, Addr = 0x0004, and Addr = 0x0006 to reach Addr = 0x0006.
[0102] ⑨ Path information 0x0006 is submitted by Addr = 0x0006 to Addr = 0x0004, and Addr = 0x0004 adds a new child node Addr = 0x0006 under its own node;
[0103] ⑩ The path information 0x0004 0x0006 is submitted by Addr = 0x0004 to Addr = 0x0001, and Addr = 0x0001 adds a new child node Addr = 0x0006 under the node of Addr = 0x0004;
[0104] 11 Path information 0x0001 0x0004 0x0006 is submitted by Addr = 0x0001 to Addr = 0x0000. Addr = 0x0000 adds a new child node Addr = 0x0006 under the node of Addr = 0x0004.
[0105] The above steps are the process of submitting routing information step by step and gradually improving the routing table.
[0106] Special instructions, such as Figure 7 , on the premise that the path 0x0002 0x0005 0x0007 has been submitted, a route discovery is initiated for Addr = 0x0008, forming the path 0x000B 0x0005 0x0008. This may be related to the sudden increase in the link cost of the path 0x0002 0x0005 due to environmental changes;
[0107] In view of the above situation, it is necessary to perform multiple route discoveries on Addr = 0x0005, select the path with the most occurrences, and update the path information of Addr = 0x0007 and Addr = 0x0008 at the same time.
[0108] 4. The following is a specific example of the non-recursive pre-order traversal algorithm and the generation of device IDs. Figure 8 :
[0109] In the conventional B-tree node structure, the index of the child node currently searched by the current node is added, as well as the parent node pointer, so as to realize the backtracking of the search path, and the search path of recursive operation can be realized without recursive operation;
[0110] ① The function loop body enters a parent node (device ID = 0), and always starts searching from its child node with the smallest index value (device ID = 1). The index value of the child node currently being searched (Index = 0) is saved in real time to the node structure, and the device ID value of the node (ID = 1) increases with the search path;
[0111] ② If the current child node (device ID = 2) does not have its own child node, assign its device ID (ID = 2) and then use the parent node pointer in the node structure to trace back to the parent node of the node (device ID = 1);
[0112] ③ The function loop body enters the parent node (device ID=1), adds 1 to the index value of the child node in the node structure (Index=0) (Index=1), and searches for the next child node (device ID=3);
[0113] ④ When the index value (Index=2) of the child node in the parent node (device ID=1) structure reaches the number of child nodes (Count=2), use the parent node pointer in the node structure to trace back to the parent node of the node (device ID=0);
[0114] ⑤ The function loop body enters the parent node (device ID=0), adds 1 to the index value of the child node in the node structure (Index=0) (Index=1), and searches for the next child node (device ID=7);
[0115] By assigning a value to the device ID of each node in the traversal order of this algorithm, a unique time slot within the beacon period can be established for the beacons transmitted by routers throughout the system.
[0116] 5. The following is a specific example of how to generate and transmit beacons. Figure 8 :
[0117] ① Zibee gateway traverses the B-tree linked list and generates the device ID of each subtree node;
[0118] ② The Zibee gateway sends the initial beacon in the [0, 0] time slot. The beacon identifier is agreed to be [0, 0], and [0, 0] represents the 0th time slot in the 0th communication cycle. Obviously, in a specific example of the present invention, only the 0th time slot and the 1st time slot in each communication cycle are used for beacon transmission;
[0119] ③ [0, 0] The beacon payload contains the device information of its own node and its three child node routers. The three child node routers are as follows: Figure 8They are ID=1, ID=7, and ID=14 respectively. The above three child nodes can receive the [0, 0] beacon at the same time because they are within the coverage of the Zibee gateway radio frequency signal. At the same time, the [0, 0] beacon payload also contains the timestamp 0x0000.
[0120] ④ After receiving the [0, 0] beacon, the router with ID=1 synchronizes its own timestamp to 0x0000, traverses the B-tree linked list with its own node as the root node, generates the device ID of each subtree node router, and generates a new beacon [0, 1];
[0121] ⑤ The router with ID=1 transmits a new beacon [0, 1] in the [0, 1] time slot. The timestamp of the [0, 1] beacon is 0x0001, which can be received by the two child node routers under it at the same time. Figure 8 They are ID=2 and ID=3 respectively;
[0122] ⑥ After receiving the [0, 1] beacon, the router with ID=2 synchronizes its own timestamp to 0x0001 and transmits a new beacon [1, 0] in the [1, 0] time slot. The timestamp of the [1, 0] beacon is 0x0100. Since there is no child node under its own node, the MAC layer data frame of the [1, 0] beacon may be received by the router nodes nearby, but it will not be processed because its payload does not contain child node information;
[0123] ⑦ Router ID=3 transmits a new beacon [1, 1] in the [1, 1] time slot. The timestamp of the [1, 1] beacon is 0x0101.
[0124] ⑧ Router with ID=7 transmits a new beacon [3, 1] in the [3, 1] time slot; the timestamp of the [3, 1] beacon is 0x0301;
[0125] And so on, until the beacon transmission ends and enters the next beacon cycle, the Zigbee gateway sends the [0, 0] beacon, and the timestamp of the [0, 0] beacon is 0x2000.
[0126] What needs to be explained about the specific structure of the present invention is that the connection relationship between the various component modules adopted in the present invention is definite and feasible. Except for special instructions in the embodiments, the specific connection relationship can bring about corresponding technical effects. The components, modules, models of specific components and connection methods appearing in the present invention, except for specific instructions, all belong to the existing technologies such as published patents, published journal articles, or common knowledge that can be obtained by technical personnel in this field before the application date, and there is no need to elaborate, so that the technical solution provided in this case is clear, complete and feasible, and the corresponding physical products can be reproduced or obtained according to the technical means.
[0127] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A Zigbee device communication method based on beacon transmission and time slot allocation, characterized in that: The steps include: S1: The router to be connected to the network completes registration through the device management platform of the server. The Zigbee gateway reads the registration information of the router, receives the router's network access request and completes the router's network access. The device registration steps of the router to be connected to the network in step S1 are as follows: The router to be connected to the network establishes communication with the device management platform of the server. The device management platform reads the 64-bit MAC address of the router to be connected to the network, assigns a 16-bit network short address to the router to be connected to the network, and generates a device information table; The device management platform transmits the device information table of the registered router to the Zigbee gateway, and the device information table is saved in a non-volatile form inside the Zigbee gateway until the device is restored to factory settings; After receiving the network access request from the router device, the Zigbee gateway compares the MAC address in the device information table, filters the network access request from the non-registered router, and completes the network access process of the registered router; S2: The Zigbee gateway initiates route discovery requests to all registered routers one by one. Each route discovery determines a unique path. The router submits path information level by level according to the path and establishes a route list based on the B-tree data structure. By non-recursive pre-order traversal of the B-tree list, beacon slots are allocated to all subtree node routers in the B-tree list. The steps of constructing the routing chain table in step S2 are as follows: The Zigbee gateway uses the route discovery function provided by the Z-Stack protocol stack to initiate route discovery requests to all registered routers one by one; The target router that receives the route discovery request extracts the route discovery table in the Z-Stack protocol stack, and then obtains the network short address of the upper-level routing node, and unicasts the path information containing its own node to the upper-level routing node; The upper level router adds the received path information to the routing chain table based on the B-tree data structure. As the routing discovery process proceeds one by one, the routing chain table is gradually improved until all the path information with each level router's own node as the root node is constructed. As the path information is submitted level by level, the Zigbee gateway receives the path information of all routing nodes in the system and establishes a routing chain table containing routers in the entire system; S3: The Zigbee gateway generates a beacon and sends it in the starting time slot of the beacon cycle. The child node router that receives the beacon synchronizes its own time information according to the timestamp in the beacon payload and transmits the new beacon to the next-level child node router in the time slot determined by the beacon payload. The steps of beacon generation and transmission in step S3 are as follows: The Zigbee gateway assigns device IDs to all subtree node routers in the B-tree routing list according to the order of traversal by non-recursive pre-order traversal of the internal B-tree routing list. The device ID uniquely determines the time slot of the new beacon sent by the subtree node router. The beacon frame payload contains the network short address and device ID of the Zigbee gateway and the Zigbee gateway subnode router. The beacon frame payload also contains the timestamp of the sending time. After the Zigbee gateway generates a beacon, it sends the 0th beacon in the starting time slot of the beacon cycle. The beacon is received by the child node router of the Zigbee gateway. The child node router that receives the beacon performs the following operations in sequence: ①Synchronize its own time information according to the timestamp in the beacon payload; ② Determine the sending time slot of the new beacon based on the device ID corresponding to its own network short address; ③ Then, through non-recursive pre-order traversal of the internal B-tree routing list, beacon time slots are allocated to all subtree node routers of the B-tree routing list according to the order of traversal to generate new beacons; ④ The new beacon is sent in the transmission time slot determined by the device ID and is received by the next-level child node router; By analogy, the beacon is passed layer by layer by all nodes in the B-tree routing list until the router node at the end; One beacon cycle is 41943mS, which is 65536*2 MacTimer cycles, divided into 32 communication cycles, one communication cycle is 1310mS, each communication cycle is divided into 256 time slots, each time slot is 5.12mS, which is 16 MacTimer cycles; The first two time slots of each communication cycle, ID = 0~1, are used for beacon transmission, the next two time slots, ID = 2~3, are idle for standby, the next 250 time slots, ID = 4~253, are used for uplink data communication, and the last two time slots, ID = 254~255, are idle for standby; S4: Zigbee terminal devices are randomly distributed in the area covered by the router signal, receive beacons sent by routers near the Zigbee terminal devices, synchronize their own time information according to the timestamp of the beacon, and determine the sending time slot of the uplink data according to the device ID. The uplink data is broadcasted and sent in time slot mode through the MAC layer interface. The downlink data is cached by the router and sent together with the beacon payload, and reaches the target Zigbee terminal device with the transmission of the beacon; The steps for determining the uplink data time slot of the Zigbee terminal device in step S4 are as follows: The uplink data time slot of the Zigbee terminal device is determined by the dynamic device ID assigned to the Zigbee terminal device by the check-in router. The dynamic device ID value is 0~249, corresponding to the time slot ID = 4~253; In a time period, a group of Zigbee terminal devices establish uplink communication with the sign-in router in a competitive manner and send migration requests. The dynamic device ID is allocated in sequence from 0 to 249 in the order in which the sign-in router receives the data packets. The allocated device ID is in an active state. When all available device IDs are in an active state, the newly migrated device is rejected. In the next time period, the previous batch of Zigbee terminal devices successively send outbound requests, and the next batch of Zigbee terminal devices successively send inbound requests. The device IDs of the outbound devices change from active to inactive, and the inactive device IDs are dynamically assigned to the inbound devices, thereby achieving dynamic allocation of uplink time slots.
2. A communication system applied to the Zigbee device communication method based on beacon transmission and time slot allocation as claimed in claim 1, characterized in that: include: Server, Zigbee gateway, Zigbee router, Zigbee sign-in router, Zigbee terminal device; The server is used for equipment management, equipment data display and human-computer interaction; The Zigbee gateway establishes a wired or wireless serial port or network connection with the server for establishing a Zigbee network, as well as for the routing discovery function, storage and management of device information tables, generation of beacons, and allocation of beacon time slots; The Zigbee router establishes a wired or wireless serial port or network connection with the server for step-by-step submission of path information, management of lower-level routing linked lists, transmission of beacons, reception of uplink data of Zigbee terminal devices, and caching and transmission of downlink data; The Zigbee check-in router establishes communication with the host computer, does not participate in beacon transmission, and is used to generate a dynamic ID for the Zigbee terminal device; Zigbee terminal devices are used for collecting and caching device data, sending uplink data, receiving downlink data in beacon payloads, and executing downlink commands.
3. The Zigbee device communication system based on beacon transmission and time slot allocation according to claim 2, characterized in that: The server adopts a single-machine device with RS-232, RS-485, USB, and network port communication interfaces or a network server connected to the Internet.
4. The Zigbee device communication system based on beacon transmission and time slot allocation according to claim 2, characterized in that: The Zigbee gateway and Zigbee router respectively have one or more communication interfaces such as RS-232, RS-485, USB, and network port.
Citation Information
Patent Citations
Time synchronization method applicable to wireless sensor network
CN102118849A
Linked list-based wireless communication node online state detection method
CN113507724A