A time slot allocation method and system for a LoRa terminal

By introducing a server-managed time slot allocation table into the LoRa terminal, the problems of no time slot allocation and GPS dependence in LoRaWAN are solved. This enables reasonable data transmission timing configuration under GPS-free conditions, avoids air collisions, and ensures the reliability and integrity of data transmission.

CN116074957BActive Publication Date: 2025-12-19ZHEJIANG HANQING INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211121256.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-15
Publication Date
2025-12-19
Estimated Expiration
2042-09-15

AI Technical Summary

Technical Problem

In LoRaWAN, under multiple 8-channel LoRa gateways with the same channel coverage, there are insufficient terminal support without time slot allocation. The class_b protocol requires GPS support, but cannot manage time slots when there is no GPS or the GPS cannot find a satellite. In the class_a protocol, the timing of terminal data transmission is not maintainable, which leads to multiple data transmission conflicts and loss. When there are many times when data is lost, over-the-air transmission conflicts are likely to occur.

Method used

The terminal sends a clock synchronization request and a time slot allocation request to the gateway. The server selects idle time slot data from the time slot allocation table. After the terminal synchronizes its clock with the server, it sends data according to the selected idle time slot data. The server manages and reclaims the time slot allocation table to ensure that the terminal's data transmission timing is configured reasonably.

Benefits of technology

Even when the gateway has no GPS or cannot find a satellite, time slot allocation can still be achieved, avoiding air collisions in terminal data transmission and ensuring the reliability and integrity of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116074957B_ABST
    Figure CN116074957B_ABST
Patent Text Reader

Abstract

The application provides a time slot allocation method and system of a LoRa terminal, the method comprising: each terminal selecting a channel as a channel for sending a request; the terminal sending a clock synchronization request and a time slot allocation request to a gateway through the selected channel; the gateway forwarding the request to a server; the server selecting data according to the request; the server issuing idle time slot data and a clock synchronization instruction to the gateway, and the gateway forwarding the data to the terminal; after the terminal receives the data, the terminal performs clock synchronization with the server and subsequent data transmission, and the system comprises the terminal, the gateway and the server. According to the application, the terminal obtains a clock synchronization instruction from the server through the gateway for synchronization of the local time of the terminal, so that even if the gateway does not have GPS or cannot search for stars, the subsequent time slot allocation scheme can still be implemented, and even if there are a large number of terminals, air collision problems in the data transmission process can be avoided, and data loss is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of wide area network communication, in particular to a time slot allocation method and system for LoRa terminal. BACKGROUND

[0002] LoRa is a kind of low-power wide-area network communication technology, which is a kind of ultra-long distance wireless transmission technology based on spread spectrum technology owned by Semtech Company, and LoRaWAN is a set of communication protocols and system architecture designed for LoRa long-distance communication network.

[0003] LoRaWAN is generally applied to the communication of technical fields such as temperature and humidity, water and electricity meter data collection, which is not frequent, and there are problems such as air transmission conflict in the application of frequent data collection or more terminals.

[0004] LoRaWAN generally includes class_a protocol and class_b protocol, that is, LoRaWAN nodes have the above two working modes, and the following defects exist in the use of LoRaWAN:

[0005] 8-channel LoRa gateway covered by multiple same channels supports a small number of time slot allocation terminals;

[0006] The time slot allocation in the class_b protocol needs the GPS support of the gateway, wherein the GPS support of the gateway can be understood as obtaining the GPS time of the LoRa gateway, and under the condition of no GPS or GPS cannot search for stars, the time slot of the terminal cannot be managed;

[0007] And there is no terminal time slot allocation mechanism in the class_a protocol, the data sending time of multiple terminals cannot be maintained and managed, and when the number of terminals is large or the data sending is frequent, air transmission conflict and data loss are easily caused. SUMMARY

[0008] In view of the defects in the prior art, the purpose of the present application is to provide a time slot allocation method and system for LoRa terminal.

[0009] According to the time slot allocation method for LoRa terminal provided by the present application, the following steps are included:

[0010] S1, each terminal selects a channel as a channel for sending a request;

[0011] S2, the terminal sends a clock synchronization request and a time slot allocation request to the gateway through the selected channel;

[0012] S3, the gateway forwards the received clock synchronization request and time slot allocation request to the server;

[0013] S4, the server selects corresponding idle time slot data from the time slot allocation table according to the corresponding time slot allocation request, and sets the idle time slot data as used in the time slot allocation table after the idle time slot data is selected, and the server generates a clock synchronization instruction according to the clock synchronization request;

[0014] S5, the server sends the idle time slot data and the clock synchronization instruction to the gateway, and the gateway forwards the idle time slot data and the clock synchronization instruction to the terminal;

[0015] S6, after the terminal receives the idle time slot data and the system clock, the terminal performs clock synchronization with the server according to the clock synchronization instruction, and performs subsequent data transmission according to the selected idle time slot data.

[0016] Optionally, the idle time slot data includes a time slot number of the idle time slot, channel data corresponding to the idle time slot, a time slice length of the idle time slot, a spread spectrum factor, a communication period and a basic time.

[0017] Optionally, and according to the selected idle time slot data to perform subsequent data transmission, further comprising:

[0018] S601, calculating a reference time according to the local time of the terminal after synchronization and the basic time;

[0019] S602, calculating the sum of the reference time and the product of the number representing the order of the idle time slot, 100 milliseconds and 8 as the time of the first subsequent data transmission;

[0020] S603, after transmitting the first subsequent data, the remaining subsequent data is periodically transmitted according to the communication period between the terminal and the server.

[0021] Optionally, when the terminal does not receive the idle time slot data and the clock synchronization instruction, repeating steps S1 to S5.

[0022] Optionally, the server checks the use of each time slot in the time slot allocation table according to a preset period, and recycles the time slot when the time slot is occupied and not used.

[0023] Optionally, the terminal selects a channel as the channel for the terminal to send a request at a set time interval, and repeats steps S2 to S6 to reselect a time slot for data transmission.

[0024] Optionally, the gateway listens to the channel for the terminal to send data.

[0025] Optionally, the spread spectrum factor is 4 or 5.

[0026] Optionally, the system clock of the server adopts Coordinated Universal Time.

[0027] The application also provides a time slot allocation system of a LoRa terminal, which is used for implementing the time slot allocation method of the LoRa terminal.

[0028] The terminal is used for selecting a channel as a channel for sending a request by the terminal, and sending a clock synchronization request and a time slot allocation request to the gateway through the selected channel, and after collecting the idle time slot data and the system clock, the terminal performs clock synchronization with the server according to the clock synchronization instruction, and performs subsequent data sending according to the selected idle time slot data.

[0029] The gateway is used for forwarding the collected clock synchronization request and time slot allocation request to the server, and forwarding the idle time slot data and the clock synchronization instruction issued by the server to the terminal.

[0030] The server is used for selecting corresponding idle time slot data from a time slot allocation table according to a corresponding time slot allocation request, setting the idle time slot data as used in the time slot allocation table after the idle time slot data is selected, generating a clock synchronization instruction according to the clock synchronization request, and issuing the idle time slot data and the clock synchronization instruction to the gateway.

[0031] Compared with the prior art, the application has the following beneficial effects:

[0032] The time slot allocation method of the LoRa terminal provided by the application is used for the terminal to obtain the time of the system clock from the server through the gateway for updating the local time of the terminal, so that the implementation of the subsequent time slot allocation scheme is not affected even if the gateway does not have GPS or cannot search for stars, and the sending time of the data of a plurality of terminals is reasonably configured by selecting corresponding time slot data from the time slot table in the server, so that the problem of air collision in the data transmission process does not occur even if the terminals are numerous, and data loss is avoided. BRIEF DESCRIPTION OF DRAWINGS

[0033] Other characteristics, objects and advantages of the application will become more apparent after reading the following detailed description of the non-limiting embodiments with reference to the accompanying drawings:

[0034] Figure 1 The flowchart of the time slot allocation method of the LoRa terminal provided by the first embodiment of the application;

[0035] Figure 2 The sending time calculation flowchart provided by the first embodiment of the application;

[0036] Figure 3 The time slot allocation table provided by the first embodiment of the application;

[0037] Figure 4The downlink data table sent by the server provided in the first embodiment of the present application to the terminal;

[0038] Figure 5 The time slot allocation system of the LoRa terminal provided in the first embodiment of the present application. DETAILED DESCRIPTION

[0039] The present application will be described in detail below with specific embodiments. The following embodiments will help those skilled in the art to further understand the present application, but do not limit the present application in any form. It should be noted that for those skilled in the art, without departing from the concept of the present application, a number of changes and improvements can be made. These are within the scope of the present application.

[0040] Embodiment one

[0041] Please refer to Figure 1 The time slot allocation method of the LoRa terminal in the present application can include the following steps:

[0042] S1, after the terminal is started, each terminal selects a channel as the channel for sending the request, and the terminal can select the channel in a random manner;

[0043] S2, the terminal sends a clock synchronization request and a time slot allocation request to the gateway through the selected channel.

[0044] It can be understood that in the present embodiment, the gateway with 8 channels is selected, and the frequencies between the 8 channels of the gateway will generally try to select frequency bands that do not interfere with each other, wherein the calculation formula of the frequency corresponding to each channel is: (16+n)*0.2+470.3, wherein n is the serial number corresponding to the channel, and the calculation formula of n is: n=index%8, index is the time slot corresponding to the time slot serial number, and the formula is to find the remainder of index divided by 8, for example, when index is 139, the calculation formula is: n=139%8=3, and the value range of n is 0 to 7.

[0045] S3, the gateway forwards the received clock synchronization request and time slot allocation request to the server, and the gateway generally forwards the clock synchronization request and time slot allocation request to the server through a socket (socket), wherein the gateway can generally use SX1301 time, and the local time of the terminal can also be clocked synchronized by sending a clock synchronization request to the gateway;

[0046] S4, the server selects corresponding idle time slot data from the time slot allocation table according to the corresponding time slot allocation request, and sets the idle time slot data as used in the time slot allocation table after the idle time slot data is selected. The server generates a clock synchronization instruction according to the clock synchronization request. It can be understood that the time slot is a time slice in the time division multiplexing mode, so there will be no overlapping condition between the time slots in the same channel in the time axis. The clock synchronization instruction generally includes the time of the system clock of the server and a clock synchronization instruction identifier. The clock synchronization instruction identifier is used to indicate the terminal that needs to perform clock synchronization. The time data of the system clock generally includes a second-level timestamp and a millisecond-level timestamp.

[0047] It can be understood that, as shown in Figure 3 The time slot allocation table can include a time slot index, which is generally a corresponding number. The value range of the time slot index in the embodiment is 0 to 4799. Each time slot index (index) corresponds to channel data corresponding to an idle time slot, a time slice length of the idle time slot, a spreading factor, a communication interval (interval), and a base time (baseMs), and the like. The time slice length of the idle time slot should correspond to the size of the data that needs to be sent by the terminal, that is, the time slice length of the idle time slot cannot be less than the time required for the data of the size to be transmitted on the channel. In the embodiment, on the one hand, in order to reduce the signal-to-noise ratio, on the other hand, the problem of reducing air collision needs to be considered (that is, the transmission rate is fast, and the air collision is relatively reduced), and it is appropriate to set the spreading factor (dr) to 4 or 5. Each spreading factor corresponds to two chip rates, and the specific chip rate to be used can be selected according to actual needs. The communication interval can be set according to the requirements thereof. The communication interval in the embodiment is selected to be 60 seconds, and the base time is a millisecond level time, as shown in Figure 4 The size of the downlink data issued by the server is respectively: the data size of the clock synchronization instruction identifier (CmdID) generally occupies 1 byte, the second-level timestamp (second) of the system clock of the server generally occupies 4 bytes, the millisecond-level timestamp (ms) of the system clock of the server generally occupies 10 bytes, the data of the communication interval (interval) occupies 11 bytes, the time slot data, the channel data corresponding to the time slot, and the spreading factor allocation information data (index) occupy 13 bytes, wherein the spreading factor allocation information data (dr) generally occupies 3 bytes, and the data of the base time (baseMs) generally occupies 19 bytes.

[0048] S5, the server issues the idle time slot data and the time of the system clock to the gateway, and the gateway forwards the idle time slot data and the system clock synchronization instruction to the terminal. It can be understood that the time of the system clock in the clock synchronization instruction of the server in the embodiment adopts UTC (Coordinated Universal Time);

[0049] S6, after the terminal receives the idle time slot data and the system clock time, the terminal synchronizes the clock with the server according to the clock synchronization instruction, and sends the subsequent data according to the selected idle time slot data.

[0050] In this embodiment, the terminal synchronizes the clock with the server according to the clock synchronization instruction, which can be understood as adjusting the local time of the terminal according to the system clock time, so that the local time of the terminal and the system clock time are consistent. Although the server sends the system clock time back to the terminal with a certain time, the time is very short, so although there is a certain clock deviation between the updated local time of the terminal and the system clock time, the deviation is small and can be ignored. Of course, the clock deviation can be calculated to update the local time of the terminal. After updating the clock of the terminal, the time of the terminals using the same channel for transmission will be consistent. In this case, the probability of air conflict during transmission according to the allocated time slot will be reduced.

[0051] As shown in Figure 2 , the above and the subsequent data transmission according to the selected idle time slot data further comprises:

[0052] S601, calculating the reference time according to the updated local time of the terminal and the base time, wherein the calculation method of the reference time is: sending reference time = local time of the terminal + baseMs (base time), wherein baseMs is a millisecond level time, and the value is 0 to 999 milliseconds;

[0053] S602, taking the sum of the reference time and the number representing the idle time slot order multiplied by 100 milliseconds and divided by 8 as the time of the first subsequent data transmission, and the calculation formula is: local time of the terminal + baseMs + (index / 8)*100m, wherein index represents the time slot number of the time slot;

[0054] S603, after sending the first subsequent data, the remaining subsequent data is periodically transmitted according to the communication period between the terminal and the server. It can be understood that the terminal will send the subsequent data every communication period. It can be understood that the total length of all time slots allocated by each channel is less than the length of the communication period, and there can be a corresponding time interval between adjacent time slots in each channel.

[0055] It can be understood that the above terminal also has the case that it cannot collect idle time slot data and system clock. In this case, that is, when the terminal does not receive the idle time slot data and the system clock time, repeat steps S1 to S5 until the terminal receives the idle time slot data and the system clock time.

[0056] In the embodiment, the server checks the use of each time slot in the time slot allocation table according to a preset period, and recycles the time slot when the time slot is in the occupied and unused state. It can be understood that the preset period can be selected according to actual needs, and the time slot is recycled when the time slot is in the occupied and unused state, wherein recycling can be understood as setting the time slot to the unused state.

[0057] Since the local time of the subsequent terminal will deviate during the long-time use of the terminal, in this case, the multiple terminals are prone to air transmission conflict when transmitting data through the unified channel, therefore, the terminal needs to select a channel as the channel for transmitting request according to the set time interval, and repeat steps S2 to S6 to reselect the time slot for transmitting data, thereby further avoiding the problem of air transmission conflict.

[0058] In the embodiment, in order to supervise the working condition of each channel, the gateway can monitor the channel for transmitting data of the terminal, that is, the gateway can monitor the channel of the corresponding frequency.

[0059] Embodiment two

[0060] Please refer to Figure 5 A time slot allocation system of a LoRa terminal, comprising:

[0061] The terminal 1 is used for selecting a channel as the channel for transmitting request of the terminal 1, and transmitting a clock synchronization request and a time slot allocation request to the gateway 2 through the selected channel, after receiving the idle time slot data and the clock synchronization instruction, the terminal performs clock synchronization with the server 3 according to the clock synchronization instruction, and performs subsequent data transmission according to the selected idle time slot data, wherein the terminal adopts an SX1262 radio frequency chip;

[0062] The gateway 2 is used for forwarding the received clock synchronization request and time slot allocation request to the server 3, and forwarding the idle time slot data and the clock synchronization instruction issued by the server 3 to the terminal 1, wherein the gateway adopts an SX1301 radio frequency chip;

[0063] The server 3 is used for selecting corresponding idle time slot data from the time slot allocation table according to the corresponding time slot allocation request, setting the idle time slot data as used in the time slot allocation table after the idle time slot data is selected, generating a clock synchronization instruction according to the clock synchronization request, and issuing the idle time slot data and the clock synchronization instruction to the gateway.

[0064] The specific embodiments of the present application are described above. It needs to be understood that the present application is not limited to the specific embodiments described above, and various changes or modifications can be made by those skilled in the art within the scope of the claims, which does not affect the essential content of the present application. The embodiments of the present application and the features in the embodiments can be combined with each other at will without conflict.

Claims

1. A time slot allocation method for a LoRa terminal, characterized in that, Includes the following steps: S1, Each terminal selects a channel as the channel through which it sends requests; S2, the terminal sends a clock synchronization request and a time slot allocation request to the gateway through the selected channel; S3, the gateway forwards the received clock synchronization request and time slot allocation request to the server; S4, the server selects the corresponding idle time slot data from the time slot allocation table according to the corresponding time slot allocation request, and sets the idle time slot data as used in the time slot allocation table after the idle time slot data is selected. The server generates a clock synchronization command according to the clock synchronization request. S5, the server sends the idle time slot data and clock synchronization command to the gateway, and the gateway forwards the idle time slot data and clock synchronization command to the terminal; S6, after the terminal receives the idle time slot data and the system clock time, the terminal synchronizes its clock with the server according to the clock synchronization instruction, and then sends subsequent data according to the selected idle time slot data; The idle time slot data includes the idle time slot number, the channel data corresponding to the idle time slot, the time slice length of the idle time slot, the spreading factor, the communication period, and the base time; The subsequent data transmission based on the selected idle time slot data further includes: S601, calculate the base time based on the local time and base time after the terminal is synchronized; S602, calculate the base time and the sum of the number representing the idle time slot order multiplied by 100 milliseconds and divided by 8 to get the time of the first subsequent data transmission; S603: After sending the first subsequent data, the remaining subsequent data are sent periodically according to the communication cycle between the terminal and the server. The server checks the usage of each time slot in the time slot allocation table according to a preset period. If a time slot is occupied and not used, the server reclaims the time slot.

2. The time slot allocation method for LoRa terminals according to claim 1, characterized in that, If the terminal does not receive the idle time slot data and clock synchronization command, repeat steps S1 to S5.

3. The time slot allocation method for a LoRa terminal according to claim 1, characterized in that, The terminal selects a channel as the channel for sending requests according to a set time interval, and repeats steps S2 to S6 to reselect a time slot for data transmission.

4. The time slot allocation method for LoRa terminals according to claim 1, characterized in that, The gateway monitors the channel through which the terminal sends data.

5. The time slot allocation method for LoRa terminals according to claim 1, characterized in that: The spreading factor is either 4 or 5.

6. The time slot allocation method for a LoRa terminal according to claim 1, characterized in that: The server's system clock uses Coordinated Universal Time (UTC).

7. A time slot allocation system for a LoRa terminal, used for implementing the time slot allocation method for a LoRa terminal according to any one of claims 1 to 6, characterized in that, include: The terminal is used to select a channel as the channel for sending requests, and send a clock synchronization request and a time slot allocation request to the gateway through the selected channel. After receiving the idle time slot data and the system clock time, the terminal synchronizes its clock with the server according to the clock synchronization instruction, and then sends subsequent data according to the selected idle time slot data. The gateway is used to forward the received clock synchronization request and time slot allocation request to the server, and to forward the idle time slot data and clock synchronization instruction issued by the server to the terminal. The server is used to select the corresponding idle time slot data from the time slot allocation table according to the corresponding time slot allocation request, mark the idle time slot data as used in the time slot allocation table after it is selected, generate a clock synchronization command according to the clock synchronization request, and send the idle time slot data and the clock synchronization command to the gateway.

Citation Information

Patent Citations

  • Data forwarding method and apparatus

    CN107659889A

  • Communication system, first node, gateway, network server and time synchronization method

    CN111641937A