LoRa base station addressing and message sending method in multi-base-station scene
By establishing a data cache queue between the LoRa base station and the server and optimizing the base station selection process, the problem of high failure rate of LoRa message dispatch in multi-base station scenarios is solved, and the success rate of LoRa message dispatch in multi-base station scenarios is improved.
Patent Information
- Application Number
- CN202411387788.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-07
- Publication Date
- 2025-01-07
AI Technical Summary
In the multi-base station scenario, it is difficult for the prior art to quickly and accurately determine the LoRa base station closest or optimal location to the target smart tag, resulting in a high failure rate for message dispatch.
By establishing a data cache queue between the LoRa base station and the server, recording the received data and reception time information of the smart tag, and optimizing the base station selection process on the server side, preferentially selecting the base station with the largest signal strength or the nearest reception time for message dispatch. Combining moving average filtering and numbering filtering mechanisms, improve the success rate of issuance.
It effectively improves the success rate of LoRa messages sent in multi-base station scenarios, ensuring that messages can be quickly and accurately delivered to the target smart tag.
Smart Images

Figure CN119277326A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of wireless communications for the Internet of Things, and in particular to a method for addressing a LoRa base station and sending a message in a multi-base station scenario. Background Art
[0002] LoRa is a widely used IoT communication technology. In real life, many smart terminal devices are based on LoRa for data communication, such as wearable bracelets, smart work cards, etc., which can be collectively referred to as "LoRa smart tags". In some industrial scenarios, it is necessary to use LoRa base stations to achieve one-to-many or many-to-many communication with smart tags.
[0003] In the scenario where the LoRa base station communicates with the smart tag, a text message can be sent to the smart tag through the LoRa base station to achieve information delivery, alarm notification, work dispatch push, etc., but this requires that the base station and the smart tag are close and the signal strength is high, otherwise it is easy to cause the delivery to fail. In addition, in this scenario, multiple base stations are usually deployed on site, but the system does not know which base station the smart tag is closest to, so a LoRa base station addressing method is needed in a multi-base station scenario that can quickly determine the closest or optimal location to the target smart tag, and then send messages by establishing a LoRa connection.
[0004] In order to quickly and accurately send LoRa messages to target smart tags in a multi-base station scenario, the present invention proposes a method for LoRa base station addressing and message sending in a multi-base station scenario. Summary of the invention
[0005] In order to solve the problem of quickly determining the LoRa base station that is closest to or has the best position to a target smart tag when sending messages in a multi-base station scenario, the present invention proposes a method for LoRa base station addressing and message sending in a multi-base station scenario.
[0006] This technical solution is based on a multi-base station scenario. Specifically, multiple smart tags (such as LoRa smart work cards) that can receive LoRa messages are located in a scenario where multiple LoRa base stations are deployed. The smart tags are configured on personnel or movable objects and are in a movable state; the LoRa base station is deployed at a fixed position in the scenario. The smart tags report data to the LoRa base station at T0 intervals, and the LoRa base station can actively establish a connection with the smart tags and send LoRa messages. Multiple LoRa base stations are converged to a network switch through a wired or wireless network, and the network switch is connected to a server, which installs and runs the control software.
[0007] Based on the above scenario of multiple LoRa base stations, the present invention proposes a method for sending LoRa messages in a multi-base station scenario, specifically including:
[0008] The LoRa base station is provided with a data cache area, which contains a queue of all smart tag data received by the LoRa base station, denoted as queue S; the LoRa base station receives the data of the smart tag every second, and caches the data and receiving time information into queue S, and the length of queue S is denoted as Ts seconds, that is, queue S caches the smart tag data and receiving time information received within the last Ts seconds; further, each group of smart tag data includes at least the smart tag number ID and the received LoRa signal strength indicator RSSI (Received Signal Strength Index); the LoRa base station updates queue S every second, and when the latest received smart tag already exists in queue S, the smart tag data and the most recent receiving time in queue S are updated; if there is smart tag data received for the first time, the smart tag data is added to queue S; if a smart tag data is not updated within Ts seconds, the data of the smart tag is removed from queue S.
[0009] The smart tag reports data at intervals of T0, and the LoRa base station uploads all smart tag data in queue S to the server control software at a fixed interval T, where T0 is set to 3s, T<=T0, and T is set to 300ms.
[0010] The server control software is provided with a smart tag data cache area. After the server control software receives all the smart tag data of queue S reported by the LoRa base station at interval T, it sets a cache data queue for each smart tag, which is recorded as the base station data queue Q of the tag; the queue Q is sorted according to the time when the LoRa base station that receives the smart tag reports, and the data length of the queue Q is recorded as Tq; further, the queue Q includes at least the LoRa base station number that receives the smart tag, the RSS I value of the LoRa signal corresponding to the smart tag, and the most recent reception time.
[0011] After receiving the smart tag data reported by the LoRa base station at an interval T, the server control software updates the base station data queue Q of the tag. If there is a duplicate base station, the RSSI value and reception time of the LoRa signal received by the base station in the queue Q will be updated; if there is base station reported data received for the first time, the base station data will be added to the queue Q, and all base station data will be reordered according to the time when the smart tag was received.
[0012] In actual applications, the fluctuation of LoRa signals may cause the RSSI of a distant smart tag received by the LoRa base station to be larger than that of a nearby smart tag at a certain moment, or the uplink channel of the LoRa base station may be full due to the large number of smart tags on site, and some smart tag data cannot be uploaded. Therefore, when the server control software wants to send a LoRa message to a specified smart tag, if it simply selects the LoRa base station with the largest RSS I value of the LoRa signal received by the smart tag in the base station data queue Q of the smart tag, it may cause the sending to fail. Therefore, an optimized LoRa base station addressing method is further provided, and the specific steps are as follows:
[0013] Step 1: For the smart tag that needs to send LoRa messages, the server control software preferentially selects the LoRa base station with the largest LoRa signal RSS I value in the base station data queue Q corresponding to the smart tag to send the message. If the sending is successful, it ends; otherwise, go to step 2.
[0014] Step 2: The server control software selects the LoRa base station with the closest receiving time in the base station data queue Q corresponding to the smart tag to which the message needs to be sent, initiates a connection and sends the message; if the message is sent successfully, the process ends; if the message fails, the process proceeds to step 3;
[0015] Step 3: The server control software selects the LoRa base station with the largest LoRa signal RSS I value in the base station data queue Q corresponding to the smart tag to send the message. If successful, it ends; if failed, it terminates the current sending and returns that the reason for the failure is connection timeout. The LoRa base station with the largest LoRa signal RSS I value in the queue is reselected because the LoRa base station data in the data queue Q of the tag may have been updated during the sending attempt, and a new LoRa base station has entered the queue Q.
[0016] Furthermore, the LoRa base station is provided with at least 8 uplink channels and 1 downlink channel; the spreading factor of the LoRa base station is set to 10.
[0017] Furthermore, the smart tag receives messages in a continuous receiving mode;
[0018] Furthermore, in order to effectively control the cache size of the LoRa base station, the length of the data queue S of all smart tags in the data cache area of the LoRa base station is set to Ts seconds, which is set to be greater than or equal to the fixed interval T at which the LoRa base station uploads smart tag data, that is, Ts>=T.
[0019] Furthermore, a data queue S is set in the data buffer area of the LoRa base station for all received smart tags, and the length of Ts is set to 10 seconds, that is, Ts=10s.
[0020] Furthermore, the server control software sets the length Tq of each smart tag cache data queue Q in the smart tag data cache area, where Tq=20s, that is, the server control software reports the base station data of each smart tag for a maximum of 20s.
[0021] Furthermore, because the fluctuation of the LoRa signal may cause the LoRa base station to receive a larger RSS I of a distant smart tag than the RSS I of a nearby smart tag at a certain moment, it is necessary to perform moving average filtering on the RSS I data in the smart tag data queue S in the LoRa base station. Specifically, the RSS I of the newly received smart tag is averaged with the RSS I of the smart tag with the same number saved in the queue S, and then stored in the queue S as the latest RSSI data.
[0022] Furthermore, in order to reduce the invalid data received, the LoRa base station is set to filter according to the numbering ID of the smart tag. Specifically, only the smart tag data whose last 4 digits of the numbering ID are fixed number values is uploaded, so that only the smart tag data information that complies with the numbering rules is uploaded to the server control software.
[0023] Furthermore, in order to reduce the invalid data received, the LoRa base station sets an RSSI filtering mechanism to only upload the smart tag data with an RSSI value greater than or equal to -92dBm.
[0024] The present invention provides a method for optimizing LoRa message sending in a multi-base station scenario, by which the LoRa base station closest to a smart tag or at an optimal location can be effectively and quickly selected for message sending, thereby greatly improving the sending success rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 A multi-base station scenario of a specific embodiment of the present invention, including a smart tag, a LoRa base station, a network switch, and a server, wherein control software runs on the server;
[0026] Figure 2 A schematic diagram of a smart tag data cache queue S of a LoRa base station according to a specific embodiment of the present invention;
[0027] Figure 3 A schematic diagram of a base station data queue Q of a smart tag M of a server control software according to a specific embodiment of the present invention. DETAILED DESCRIPTION
[0028] The following is a detailed description of an implementation method of a LoRa base station addressing and message sending method in a multi-base station scenario provided by the present invention in conjunction with the accompanying drawings, specifically:
[0029] refer to Figure 1 , providing a scenario where multiple LoRa base stations 2 are deployed, in which multiple smart tags 1 that can receive LoRa messages are in a movable state; the LoRa base station 2 is deployed at a fixed position in the scenario. The smart tag 1 sends LoRa signals at T0 intervals, and the LoRa base station 2 receives and records the data of all smart tags 1. The LoRa base station 2 can actively establish a connection with the received smart tag 1 and send a LoRa message. Multiple LoRa base stations 2 are all converged to a network switch 3 through a wired or wireless network, and the network switch 3 is connected to a server 4 by wire. The server 4 has control software installed and running.
[0030] Based on the above scenario, a method for sending LoRa messages in a multi-base station scenario is provided. Figure 2 As shown, including:
[0031] The LoRa base station 2 is provided with a data cache area, which contains a data queue of all smart tags 1 received by the base station, denoted as queue S; the LoRa base station 2 receives the reported data of the smart tag 1 every second, and caches the received data and receiving time information into queue S, and the length of queue S is denoted as Ts seconds, that is, queue S caches multiple smart tag 1 data and receiving time information received within the last Ts seconds; further, the data of each smart tag 1 includes at least the ID of the smart tag 1 and the strength indication RSSI of the received signal; the LoRa base station 2 updates queue S every second, and when the latest received smart tag 1 already exists in queue S, the data of the smart tag 1 in queue S and the last receiving time are updated; if there is data of a smart tag 1 received for the first time, the data of the smart tag 1 is added to queue S; if the data of a smart tag 1 is not updated within Ts seconds, the data of the smart tag is removed from queue S.
[0032] The smart tag 1 sends data at an interval of T0, and the LoRa base station 2 uploads the data of all smart tags 1 in the queue S to the server 4 running the control software at a fixed interval T, where T<=T0.
[0033] The control software of server 4 is provided with a data cache area for smart tag 1. After receiving all the smart tag 1 data of queue S reported by LoRa base station 2 at interval T, the control software of server 4 sets a cache data queue for each smart tag 1, which is recorded as the base station data queue Q of the smart tag 1; the base station data queue Q is sorted according to the time when the report of the LoRa base station receiving the smart tag 1 is received, and the data length of queue Q is recorded as Tq; further, queue Q includes at least the number of the LoRa base station 2 that receives the smart tag 1, the corresponding RSS I value received by the smart tag 1, the most recent reception time, and the most recent connection status.
[0034] After receiving the smart tag 1 data reported by the LoRa base station 2 at an interval T, the control software of the server 4 updates the base station data queue Q of the tag. If there is a duplicate base station, the RSS I value and the receiving time of the LoRa signal of the smart tag 1 received by the base station in the queue Q are updated; if there is a base station reported data received for the first time, the base station data is added to the queue Q, and all base station data are reordered according to the time when the smart tag is received.
[0035] In actual applications, the fluctuation of LoRa signals may cause the LoRa signal RSS I of the distant smart tag 1 received by the LoRa base station 2 to be larger than the LoRa signal RSS I of the nearby smart tag 1 at a certain moment, or the LoRa base station uplink channel is full due to the large number of smart tags 1 on site, and some smart tag data cannot be uploaded. Therefore, when the server 4 control software wants to send a LoRa message to a specified smart tag 1, if it simply selects the LoRa base station 2 with the largest RSS I value of the smart tag 1 in the base station data queue Q of the smart tag 1, it may cause the sending to fail. Therefore, the following method is provided, and the specific steps are as follows:
[0036] Step 1: For the smart tag 1 that needs to send a LoRa message, the control software of the server 4 preferentially selects the LoRa base station with the largest LoRa signal RSS I value in the base station data queue Q corresponding to the smart tag 1 to send the message. If the sending is successful, the process ends; otherwise, it goes to step 2.
[0037] Step 2: The control software of server 4 selects the LoRa base station 2 with the closest receiving time in the base station data queue Q corresponding to the smart tag to which the message needs to be sent, initiates a connection and sends the message; if the message is sent successfully, the process ends; if the message fails, the process proceeds to step 3;
[0038] Step 3: The control software of server 4 selects LoRa base station 2 with the largest LoRa signal RSSI value from the base station data queue Q corresponding to the smart tag 1 to send the message. If successful, the process ends; if unsuccessful, the sending is terminated and the reason for the failure is returned as connection timeout. The reason for reselecting LoRa base station 2 with the largest LoRa signal RSSI value in the queue is that during the sending attempt, the LoRa base station data in the data queue Q of the tag may have been updated, and a new LoRa base station 2 has entered the queue Q.
[0039] Furthermore, the LoRa base station 2 is provided with at least 8 uplink channels and 1 downlink channel; the spreading factor of the LoRa base station is set to 10.
[0040] Furthermore, the smart tag 1 receives messages in a continuous receiving mode;
[0041] Furthermore, in order to effectively control the cache size of the LoRa base station 2, the length of the data queue S of all smart tags 1 in the data cache area of the LoRa base station 2 is set to Ts seconds, which is set to be greater than or equal to the fixed interval T at which the LoRa base station 2 uploads the smart tag data, that is, Ts>=T.
[0042] Furthermore, a data queue S is set in the data buffer area of the LoRa base station 2 for all received smart tags, and the length of Ts is set to 10 seconds, that is, Ts=10s.
[0043] Furthermore, the control software of server 4 sets the length Tq of each smart tag cache data queue Q in the smart tag data cache area, where Tq=20s, that is, the control software of server 4 reports the base station data of each smart tag for a maximum of 20s.
[0044] Furthermore, because the fluctuation of the LoRa signal may cause the RSS I of a distant smart tag received by LoRa base station 2 to be larger than the RSS I of a nearby smart tag at a certain moment, it is necessary to perform moving average filtering on the RSS I data of the LoRa signal in the smart tag data queue S in the LoRa base station 2. Specifically, the average value of the newly received smart tag RSS I and the RSS I of the smart tag with the same number saved in queue S is calculated, and then stored in queue S as the latest RSSI data.
[0045] Furthermore, in order to reduce the invalid data received, the LoRa base station is set to filter according to the numbering ID of the smart tag. Specifically, only the smart tag data whose last 4 digits of the numbering ID are fixed number values is uploaded, so that only the smart tag data information that complies with the numbering rules is uploaded to the server control software.
[0046] Furthermore, in order to reduce the invalid data received, the LoRa base station sets an RSSI filtering mechanism to only upload the smart tag data with an RSSI value greater than or equal to -92dBm.
[0047] Through the above method, the LoRa base station number closest to the smart tag can be effectively determined in a multi-base station scenario, thereby effectively improving the efficiency and success rate of sending LoRa messages.
[0048] The above is only a preferred embodiment of the present invention. It should be pointed out that ordinary technicians in this technical field can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for LoRa base station addressing and message sending in a multi-base station scenario, characterized in that: include: Provide a scenario in which multiple LoRa base stations are deployed, where the LoRa base stations are deployed at fixed positions in the scenario; A plurality of smart tags capable of receiving LoRa messages are provided, wherein the smart tags are configured on personnel or movable objects and are in a movable state; the smart tags report data to a LoRa base station at a T0 interval, and the LoRa base station receives the LoRa data of the smart tags, and the LoRa base station can actively establish a connection with the smart tags and send LoRa messages; the plurality of LoRa base stations are all converged to a network switch through a wired or wireless network, and the network switch is wired to a server, and the server is installed with and runs control software; The LoRa base station is provided with a data buffer area, and the buffer area contains all smart tag data queues received by the LoRa base station, which are recorded as queue S; The LoRa base station receives the data of the smart tag every second, and caches the data and receiving time information into queue S. The length of queue S is recorded as Ts seconds, that is, the queue S caches the smart tag data and receiving time information received within the last Ts seconds; each group of the smart tag data includes at least the smart tag number ID and the strength indication RSSI of the received LoRa signal; the LoRa base station updates queue S every second, and when the latest received smart tag already exists in queue S, the data of the smart tag in queue S and the last receiving time are updated; if there is smart tag data received for the first time, the smart tag data is added to the queue S; If a smart tag data is not updated within Ts seconds, the data of the smart tag is removed from the queue S; The smart tag broadcasts data at intervals of T0, and the LoRa base station uploads all smart tag data in queue S to the server control software at fixed intervals of T, where T<=T0; The server control software is provided with a smart tag data cache area. After receiving all the smart tag data of the queue S reported by the LoRa base station at interval T, the server control software sets a cache data queue for each smart tag, which is recorded as the base station data queue Q of the tag; the queue Q is sorted according to the time when the LoRa base station reporting the smart tag is received, and the data length of the queue Q is recorded as Tq; further, the queue Q includes at least the LoRa base station number receiving the smart tag, the RSSI value of the LoRa signal corresponding to the smart tag, and the most recent reception time; After receiving the smart tag data reported by the LoRa base station at interval T, the server control software updates the base station data queue Q of the tag. If there is a duplicate base station, the RSSI value and reception time of the base station receiving the smart tag in the queue Q are updated; if there is base station reporting data received for the first time, the base station data is added to the queue Q, and all base station data are reordered according to the time when the smart tag is received; The method for LoRa base station addressing and message sending in a multi-base station scenario also includes the following specific steps: Step 1: The server control software preferentially selects the LoRa base station with the largest LoRa signal RSSI value in the base station data queue Q of the smart tag to send the message to the smart tag that needs to send the LoRa message. If the sending is successful, the process ends; otherwise, it goes to step 2; Step 2: The server control software selects the LoRa base station with the closest receiving time in the base station data queue Q corresponding to the smart tag to which the message needs to be sent, initiates a connection and sends the message; if the message is sent successfully, the process ends; if the message fails, the process proceeds to step 3; Step 3: The server control software selects the LoRa base station with the largest LoRa signal RSSI value in the base station data queue Q corresponding to the smart tag to which the message needs to be sent, connects and sends the message. If successful, the process ends; if unsuccessful, the sending is terminated and the reason for the failure is returned as connection timeout.
2. The method for LoRa base station addressing and message sending in a multi-base station scenario according to claim 1, characterized in that: The LoRa base station is provided with at least 8 uplink channels and 1 downlink channel; the spreading factor of the LoRa base station is set to 10.
3. The method for LoRa base station addressing and message sending in a multi-base station scenario according to claim 2, characterized in that: The smart tag receives messages in a continuous receiving mode.
4. The method for LoRa base station addressing and message sending in a multi-base station scenario according to claim 1, characterized in that: The length of all smart tag data queues S in the LoRa base station data buffer area is Ts seconds, which is set to be greater than or equal to the fixed interval T at which the LoRa base station uploads smart tag data, that is, Ts>=T.
5. A method for LoRa base station addressing and message sending in a multi-base station scenario according to claim 1, characterized in that, The data queue S of all smart tags in the data buffer area of the LoRa base station is set to have a length of Ts of 10 seconds, that is, Ts=10s.
6. A method for LoRa base station addressing and message sending in a multi-base station scenario according to claim 1, characterized in that: The server control software sets the length Tq of each smart tag cache data queue Q in the smart tag data cache area, where Tq=20s, that is, the server control software caches the base station data of the tag for each smart tag for a maximum of 20s.
7. A method for LoRa base station addressing and message sending in a multi-base station scenario according to claim 1, characterized in that: The RSSI data in the smart tag data queue S in the LoRa base station is subjected to moving average filtering. Specifically, the newly received smart tag RSSI is averaged with the RSSI of the smart tag with the same number saved in the queue S, and then stored in the queue S as the latest RSSI data.
8. A method for LoRa base station addressing and message sending in a multi-base station scenario according to claim 1, characterized in that: The LoRa base station is configured to filter according to the serial ID of the smart tag, specifically, only upload the smart tag data whose last 4 digits of the serial ID are fixed serial values.
9. A method for LoRa base station addressing and message sending in a multi-base station scenario according to claim 1, characterized in that: The LoRa base station is provided with an RSSI filtering mechanism, and only uploads the smart tag data received with an RSSI value greater than or equal to -92dBm.