Data transmission method and apparatus, device, and storage medium
By introducing a time slice insertion algorithm and response mechanism into the LoRa ad hoc network, adjusting the time gap between node data upload and switching carrier frequency when necessary, the data collision problem in the LoRa network is solved, and data transmission efficiency and reliability are improved.
Patent Information
- Application Number
- PCT/CN2024/104743
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-22
- Filing Date
- 2024-07-10
- Publication Date
- 2025-08-28
AI Technical Summary
When there are many nodes in the LoRa self-organized network, the gateway polling cycle is too long and the active reporting mode is likely to cause data collisions, affecting the real-time and reliability of data transmission.
A time slice insertion algorithm and response mechanism are introduced, the data upload time gap of the collision node is adjusted, and an adaptive frequency hopping algorithm is performed when necessary to optimize data transmission.
Reduce data node transmission conflicts, reduce node power consumption, improve data transmission efficiency and reliability, and enhance the stability and anti-interference ability of LoRa's ad hoc network.
Smart Images

Figure CN2024104743_28082025_PF_FP_ABST
Abstract
Description
Data transmission method, device, equipment and storage medium Technical Field
[0001] The present invention relates to the field of wireless communication technology, and in particular to a data transmission method, device, equipment and storage medium. Background Art
[0002] Traditional Zigbee networks suffer from limited coverage, high deployment costs, and poor anti-interference capabilities. LoRa (Long Range, Low Power Wireless Communication) wireless communication technology, with its long transmission range and low power consumption, is widely used in sensor data collection and real-time data transmission systems in harsh environments, such as modern IoT applications like smart metering, smart cities, and smart agriculture. The data link layer protocol is a crucial component of the LoRa self-organizing network. In a LoRa system, there are two main methods for uplink transmission of node data: active reporting and gateway polling. The gateway polling method results in a long polling cycle when there are a large number of nodes, making it difficult to achieve real-time node data reporting. In the active reporting mode, the gateway is in a listening state. When sensor data exceeds a threshold, it actively sends an alert to the gateway. After the transmission is complete, the sensor node enters a low-power mode. However, the active reporting mode is prone to node data collisions and data loss when there are a large number of nodes. Therefore, how to reduce data node transmission conflicts when sensor nodes report data and improve the reliability of the LoRa self-organizing network remains an unresolved issue in this field.
[0003] Summary of the Invention
[0004] In view of this, the present invention aims to provide a data transmission method, apparatus, device, and storage medium. By introducing a time-slicing insertion algorithm and a response mechanism, when a data collision occurs, the time interval between active reports from the collision node is adjusted based on the node's data transmission rate, thereby improving data transmission efficiency and reliability. The specific solution is as follows:
[0005] In a first aspect, the present application provides a data transmission method, applied to any terminal node, comprising:
[0006] It uses its own sensors to collect current environmental data, and actively uploads the collected data to be transmitted to the corresponding gateway through a pre-built ad hoc network using long-distance radio according to the preset data upload time interval, and waits to receive the response message returned by the gateway;
[0007] determining a first number of times the response message from the gateway is not received, and determining that a data collision occurs at the current terminal node if the first number of times the response message is not received is greater than a preset number;
[0008] Based on the time slice insertion algorithm, the preset data upload time interval of the current terminal node where the data collision occurs is adjusted, and the data to be transmitted is continued to be uploaded to the gateway according to the adjusted time interval, so that the gateway uploads the received data to the cloud server for visual display through the message queue telemetry transmission protocol.
[0009] Optionally, the process of collecting current environmental data using its own sensors further includes:
[0010] Detecting the data volume of the currently collected data to be transmitted, and actively sending an alarm message to the gateway if the data volume exceeds a preset data volume threshold.
[0011] Optionally, after actively uploading the collected data to be transmitted to the corresponding gateway via a pre-built ad hoc network using a long-distance radio according to a preset data upload time interval, the method further includes:
[0012] Switch the current data sending state to the data receiving state to wait for receiving the response message returned by the gateway;
[0013] If the response message from the gateway is not received within a preset time period, the state is switched back to the data sending state to upload the data to be transmitted again, and the first number of times the response message is not received is increased by one.
[0014] Optionally, after switching back to the data sending state and uploading the message to be transmitted again, the method further includes:
[0015] If the response message from the gateway is successfully received, it is determined that the data to be transmitted is uploaded successfully, and the first number of times the response message is not received is cleared to zero.
[0016] Optionally, the adjusting the preset data upload time interval of the current terminal node where the data collision occurs based on the time slice insertion algorithm includes:
[0017] A random number is generated based on the time slice insertion algorithm, and a data upload delay duration is determined based on the random number, so as to adjust the preset data upload time interval of the current terminal node where the data collision occurs according to the data upload delay duration.
[0018] Optionally, after continuing to upload the data to be transmitted to the gateway according to the adjusted time interval, the method further includes:
[0019] If the response message from the gateway is received, the currently collected data is actively uploaded again according to the preset data upload time interval.
[0020] Optionally, after adjusting the preset data upload time interval of the current terminal node where the data collision occurs based on the time slice insertion algorithm, the method further includes:
[0021] Recording a second number of data collisions occurring at the current terminal node;
[0022] If the second number meets the preset frequency hopping condition, an adaptive frequency hopping algorithm is executed according to a preset frequency hopping table to switch the carrier frequency band currently used for data transmission to the target transmission frequency band; the frequency hopping table divides the carrier frequency into multiple frequency bands and is prepared according to a preset order and time interval.
[0023] In a second aspect, the present application provides a data transmission device, applied to any terminal node, comprising:
[0024] A first data uploading module is used to collect current environmental data using its own sensors, and actively upload the collected data to be transmitted to the corresponding gateway through a pre-built ad hoc network using long-distance radio according to a preset data upload time interval, and wait for a response message returned by the gateway;
[0025] a number determination module, configured to determine a first number of times the response message from the gateway has not been received, and if the first number of times the response message has not been received is greater than a preset number, determine that a data collision has occurred at the current terminal node;
[0026] The second data upload module is used to adjust the preset data upload time interval of the current terminal node where data collision occurs based on the time slice insertion algorithm, and continue to upload the data to be transmitted to the gateway according to the adjusted time interval, so that the gateway can upload the received data to the cloud server for visual display through the message queue telemetry transmission protocol.
[0027] In a third aspect, the present application provides an electronic device, characterized in that the electronic device includes a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the aforementioned data transmission method.
[0028] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program, which implements the aforementioned data transmission method when executed by a processor.
[0029] The present application first uses its own sensors to collect current environmental data, and then actively uploads the collected data to be transmitted to the corresponding gateway through a pre-built self-organizing network using long-distance radio according to a preset data upload time interval, waiting to receive a response message returned by the gateway; in this process, the first number of times the response message from the gateway has not been received is determined. If the first number of times the response message has not been received is greater than the preset number, it is determined that a data collision has occurred at the current terminal node; then, based on a time slice insertion algorithm, the preset data upload time interval of the current terminal node where the data collision occurred is adjusted, and the data to be transmitted is continued to be uploaded to the gateway according to the adjusted time interval, so that the gateway can upload the received data to the cloud server for visual display via the message queue telemetry transmission protocol. In this way, in order to solve the data collision problem when the node actively reports during the data collection process, a time slice insertion algorithm and a response mechanism are introduced. When a data collision occurs, the time interval of the active reporting of the collision node is adjusted according to the node data transmission rate, thereby reducing data node transmission conflicts, reducing node power consumption, and improving data transmission efficiency and reliability. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0031] FIG1 is a flow chart of a data transmission method provided by the present application;
[0032] FIG2 is a LoRa-based data transmission framework diagram provided by this application;
[0033] FIG3 is a flow chart of a data transmission method based on a time slicing algorithm provided by the present application;
[0034] FIG4 is a flowchart of a specific data transmission method provided by this application;
[0035] FIG5 is a flow chart of a data transmission method based on a frequency hopping algorithm provided by the present application;
[0036] FIG6 is a schematic structural diagram of a data transmission device provided by the present application;
[0037] FIG7 is a structural diagram of an electronic device provided in this application. DETAILED DESCRIPTION
[0038] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0039] At present, LoRa wireless communication technology is mostly used in sensor data collection and real-time data transmission systems in harsh environments. There are two main methods of uplink transmission of node data in the LoRa system: active reporting and gateway polling. However, the gateway polling method causes the polling cycle to be too long when the number of nodes is large, and it is impossible to achieve the real-time effect of node data reporting. The active reporting mode is prone to node data collision and data loss when the number of nodes is large. This application aims to solve the data collision problem when the node actively reports during the data collection process, introduces a time slicing insertion algorithm and a response mechanism, and adjusts the time interval of the active reporting of the colliding node according to the node data transmission rate when a data collision occurs, thereby reducing data node transmission conflicts and improving data transmission efficiency and reliability.
[0040] 1 , an embodiment of the present invention discloses a data transmission method, which is applied to any terminal node and includes:
[0041] Step S11: Use its own sensors to collect current environmental data, and actively upload the collected data to be transmitted to the corresponding gateway through a pre-built ad hoc network using long-distance radio according to a preset data upload time interval, and wait to receive a response message returned by the gateway.
[0042] This embodiment involves technologies such as LoRa wireless communication technology, wireless node self-organizing networks, active reporting of large amounts of node data, a time-slicing insertion algorithm, and an adaptive frequency hopping algorithm. It optimizes traditional LoRa data transmission technology at the data link layer. This is primarily to address the problem of long node data polling cycles and the inability to achieve high real-time performance in LoRa wireless self-organizing networks with a large number of nodes. Therefore, active node reporting is used for uplink data transmission.
[0043] As shown in Figure 2, the data transmission system in this embodiment consists of a large number of LoRa terminal nodes, a LoRa gateway, and a cloud server. The LoRa terminal nodes are sensors used to collect on-site environmental data; the LoRa gateway serves as the control center for the entire device, aggregating and managing data from each node and sending overall data to the cloud; and the cloud server is used for data visualization and remote monitoring. The LoRa sensor data collection nodes use an ad hoc network to transmit data to the gateway. After receiving data from each node, the gateway sends the data to the cloud server via the MQTT protocol (Message Queuing Telemetry Transport) for real-time visualization and storage. Therefore, the system first uses its own sensors to collect current environmental data. The collected data to be transmitted is then actively uploaded to the corresponding gateway via a pre-built ad hoc network using long-range radio at a preset data upload interval, awaiting a response message from the gateway. It is also understood that while using its own sensors to collect current environmental data, the LoRa sensor data collection node can detect the amount of data currently collected for transmission. If the data volume exceeds a preset data volume threshold, it actively sends an alarm message to the gateway. In this embodiment, the LoRa sensor data acquisition node uses a self-organizing network to transmit data with the gateway. After the gateway receives the data from each node, it sends the data to the cloud server for real-time visualization and storage. The sensor node uses an active reporting method to regularly send the sensor's real-time data to the gateway; when the sensor node detects that the data exceeds the threshold, it can actively send an alarm message to the gateway.
[0044] Step S12: determining a first number of times the response message from the gateway is not received; if the first number of times the response message is not received is greater than a preset number, determining that a data collision occurs at the current terminal node.
[0045] It should be noted that due to the inherent nature of the LoRa communication method, when there are a large number of nodes, nodes actively reporting at the same time can cause data collisions and data loss. When data collisions occur among multiple nodes, because the nodes' active reporting cycles are the same, the data collision problem will recur and cannot be resolved. To address this problem, this embodiment uses time slicing to dynamically adjust the time intervals between nodes' own data transmissions. In combination with the gateway response mechanism, it determines whether data transmission is complete and automatically adjusts the time of the next uplink data.
[0046] Therefore, after the collected data to be transmitted is actively uploaded to the corresponding gateway through a pre-built ad hoc network using long-distance radio according to a preset data upload time interval, this embodiment needs to switch the current data sending state to the data receiving state to wait for receiving the response message returned by the gateway; if no response message from the gateway is received within the preset time period, it is switched back to the data sending state to upload the message to be transmitted again, and the first number of times the response message is not received is increased by one.
[0047] That is, in this embodiment, after uploading the current data to be transmitted, it is necessary to determine the first number of times that a response message from the gateway has not been received. If the first number of times that a response message has not been received is greater than a preset number, it is determined that a data collision has occurred at the current terminal node. As shown in Figure 3, during the process of actively reporting node data, after the node actively reports and transmits the data, it enters the receiving state and waits for the gateway's confirmation message. If a certain time interval (the specific time interval is determined by the data length, protocol airspeed, and transmission frequency, and can be adjusted according to actual conditions, and is not specifically limited here) is not received according to actual conditions, it is actively reported again. If no confirmation message is received after reporting three times, that is, if the number of times that the current data to be transmitted has not received a response has reached three times, it is determined that a data collision has occurred at the current node. It is also understandable that after switching back to the data sending state and uploading the data to be transmitted again, if a response message from the gateway is successfully received, it is determined that the data to be transmitted has been uploaded successfully, and the first number of times that a response message has not been received can be reset to zero.
[0048] Step S13: adjusting the preset data upload time interval of the current terminal node where the data collision occurs based on the time slice insertion algorithm, and continuing to upload the data to be transmitted to the gateway according to the adjusted time interval, so that the gateway uploads the received data to the cloud server for visual display through the message queue telemetry transmission protocol.
[0049] In this embodiment, the preset data upload time interval of the current terminal node where the data collision occurs can be adjusted based on the time slice insertion algorithm, and the data to be transmitted can be continued to be uploaded to the gateway according to the adjusted time interval, as shown in Figure 2, so that the gateway can upload the received data to the cloud server for visual display through the message queue telemetry transmission protocol. As shown in Figure 3, during the process of active reporting of node data, when a data collision occurs, the node end automatically runs the time slice insertion algorithm to adjust the active reporting time interval. The time slice insertion algorithm takes a random number and delays the transmission until the confirmation information from the gateway is received, and the node resumes the scheduled active reporting mode. Therefore, after continuing to upload the data to be transmitted to the gateway according to the adjusted time interval, if a response message from the gateway is received, the currently collected data is actively uploaded again according to the preset data upload time interval. In this way, the data transmission gaps of a large number of nodes are discretized by adding time slices to the reporting time of the conflicting nodes, thereby reducing the probability of node collisions.
[0050] In this embodiment, the sensor data collection node first uses its own sensors to collect current environmental data. The collected data to be transmitted is then actively uploaded to the corresponding gateway via a pre-established ad hoc network using long-range radio at a preset data upload interval, awaiting a response message from the gateway. During this process, the sensor data collection node can detect the amount of data currently collected for transmission and, if it exceeds a preset data volume threshold, proactively sends an alert to the gateway. It then switches from the current data transmission state to the data reception state, awaiting a response message from the gateway. If no response message is received from the gateway within a preset time period, it switches back to the data transmission state and re-uploads the data to be transmitted. The number of times a response message has not been received is incremented by one. If no response message is received from the gateway within a certain time interval, the node proactively reports again. After three times of no response, the node determines that a data collision has occurred. When a data collision occurs, the node automatically runs a time slice insertion algorithm to adjust the proactive reporting interval. The time slice insertion algorithm uses a random number to delay transmission until a response message is received from the gateway, at which point the node resumes scheduled proactive reporting. Through the above technical solution, this embodiment proposes a time-sliced L o The Ra dynamic data transmission method aims to solve the data collision problem when nodes actively report during data collection. It introduces a time slicing insertion algorithm and a response mechanism. When a data collision occurs, the time interval for the active reporting of the colliding node is adjusted according to the node data transmission rate. This reduces data node transmission conflicts and node power consumption at the data link layer, thereby improving the reliability and stability of the LoRa self-organizing network.
[0051] Based on the previous embodiment, it can be seen that this application can introduce a time slice insertion algorithm and a response mechanism to address the data collision problem when the node actively reports during the data collection process. Next, this embodiment will explain the adaptive frequency hopping algorithm in detail. Referring to Figure 4, this embodiment of the application discloses a specific data transmission method, which is applied to any terminal node, including:
[0052] Step S21: If a data collision occurs at the current terminal node, a random number is generated based on a time slice insertion algorithm, and a data upload delay duration is determined based on the random number, so as to adjust the preset data upload time interval of the current terminal node where the data collision occurs according to the data upload delay duration.
[0053] In this embodiment, based on the previous embodiment, if a data collision occurs at the current terminal node, a random number can be generated based on a time slice insertion algorithm. This random number can then be used to determine the data upload delay duration. This can then adjust the preset data upload interval for the current terminal node experiencing the data collision based on the data upload delay duration. During the node's active data reporting process, when a data collision occurs, the node automatically runs the time slice insertion algorithm to adjust the active reporting time interval. The node then uses the time slice insertion algorithm to generate a random number and delay transmission until it receives confirmation from the gateway, at which point it resumes scheduled active reporting mode.
[0054] Step S22, recording the second number of data collisions occurring at the current terminal node; if the second number meets the preset frequency hopping condition, executing the adaptive frequency hopping algorithm according to the preset frequency hopping table to switch the carrier frequency band currently used for data transmission to the target transmission frequency band; the frequency hopping table divides the carrier frequency into multiple frequency bands and is prepared in a preset order and time interval.
[0055] In this embodiment, as shown in FIG5 , the number of data collisions occurring at the current terminal node is recorded. If the preset frequency hopping condition is met, an adaptive frequency hopping algorithm is executed according to a preset frequency hopping table to switch the carrier frequency band currently used for data transmission to the target transmission frequency band. The frequency hopping table is a table that divides the carrier frequency into multiple frequency bands and is prepared in a preset order and time interval. It can be understood that L oLoRa frequency hopping refers to a technique in which the transmitting and receiving ends dynamically change the data carrier frequency through a frequency hopping algorithm during the communication process. By continuously changing the communication frequency, the stability and anti-interference capability of the communication can be effectively improved. Therefore, this embodiment divides the carrier frequency into multiple frequency bands and creates a frequency hopping table in sequence and time intervals. When a node records a large number of data collisions in the current frequency band, it executes an adaptive frequency hopping algorithm and switches the current transmission frequency band to achieve the effect of unblocking the data flow of the current carrier frequency. The design of the adaptive frequency hopping algorithm and the frequency hopping table can improve the overall anti-interference capability and communication channel utilization of the LoRa data acquisition device while ensuring the synchronization of communication between the transmitting and receiving ends. In this way, the probability of repeated node data collisions is continuously reduced through time slicing insertion. The carrier frequency is switched according to established rules by the adaptive frequency hopping algorithm. While actively reporting to reduce node power consumption, the probability of data collisions is reduced, improving data reliability, and the adaptive frequency hopping algorithm can effectively improve the overall anti-interference capability and channel utilization.
[0056] Step S23: Continue uploading the data to be transmitted to the gateway according to the adjusted time interval and the target transmission frequency band, so that the gateway uploads the received data to the cloud server for visual display through the message queue telemetry transmission protocol.
[0057] In this embodiment, the current data to be transmitted can continue to be uploaded to the gateway according to the adjusted time interval and target transmission frequency band, so that the gateway can upload the received data to the cloud server for visual display through the message queue telemetry transmission protocol.
[0058] In this embodiment, if a data collision occurs at the current terminal node, a random number can be generated based on a time slicing insertion algorithm, and the data upload delay duration can be determined based on the random number, so as to adjust the preset data upload time interval of the current terminal node where the data collision occurs according to the data upload delay duration, and the number of data collisions that occur at the current terminal node is recorded. If the preset frequency hopping condition is met, an adaptive frequency hopping algorithm is executed according to a preset frequency hopping table, and the carrier frequency band currently used for data transmission is switched to the target transmission frequency band. Then, according to the adjusted time interval and target transmission frequency band, the current data to be transmitted can continue to be uploaded to the gateway, so that the gateway can upload the received data to the cloud server for visual display through the message queue telemetry transmission protocol. Through the above technical solution, the LoRa dynamic data transmission method adopts an adaptive frequency hopping algorithm to improve the data throughput of the node self-organizing network. By adjusting the carrier frequency of data transmission between the node and the gateway, the data collision node is diverted, the node data reporting cycle is reduced, and the utilization rate of the network channel is increased. In addition, due to the response mechanism between the gateway and the node, combined with the time slicing insertion algorithm and the adaptive frequency hopping algorithm, the data throughput of the LoRa self-organizing network is improved, ensuring the orderly transmission of data under conditions of multiple nodes and long distances, further enhancing the stability and reliability of LoRa data acquisition.
[0059] As shown in FIG6 , an embodiment of the present application further discloses a data transmission device, which is applied to any terminal node and includes:
[0060] The first data uploading module 11 is used to collect current environmental data using its own sensors, and actively upload the collected data to be transmitted to the corresponding gateway through a pre-built ad hoc network using long-distance radio according to a preset data upload time interval, and wait for a response message returned by the gateway;
[0061] A times determination module 12 is configured to determine a first number of times that the response message from the gateway is not received, and if the first number of times that the response message is not received is greater than a preset number, determine that a data collision occurs at the current terminal node;
[0062] The second data upload module 13 is used to adjust the preset data upload time interval of the current terminal node where the data collision occurs based on the time slice insertion algorithm, and continue to upload the data to be transmitted to the gateway according to the adjusted time interval, so that the gateway can upload the received data to the cloud server for visual display through the message queue telemetry transmission protocol.
[0063] This embodiment first uses its own sensors to collect current environmental data, and actively uploads the collected data to be transmitted to the corresponding gateway through a pre-built self-organizing network using long-distance radio according to the preset data upload time interval, waiting for the response message returned by the gateway. In this process, the first number of times the response message from the gateway has not been received is determined. If the number of times the response message has not been received is greater than the preset number, it is determined that a data collision has occurred at the current terminal node. Then, based on the time slice insertion algorithm, the preset data upload time interval of the current terminal node where the data collision occurred is adjusted, and the data to be transmitted is continued to be uploaded to the gateway according to the adjusted time interval, so that the gateway can upload the received data to the cloud server for visual display through the message queue telemetry transmission protocol. Through the above technical solution, this embodiment addresses the data collision problem when the node actively reports during the data collection process, introduces a time slice insertion algorithm and a response mechanism, and when a data collision occurs, adjusts the time interval of the active reporting of the collision node according to the node data transmission rate, reduces data node transmission conflicts, reduces node power consumption, and improves data transmission efficiency and reliability.
[0064] In some specific embodiments, the first data uploading module 11 further includes:
[0065] The data detection unit is used to detect the data volume of the currently collected data to be transmitted, and if the data volume exceeds a preset data volume threshold, actively send an alarm message to the gateway.
[0066] In some specific embodiments, the first data uploading module 11 further includes:
[0067] A state switching unit, configured to switch the current data sending state to a data receiving state, so as to wait for receiving the response message returned by the gateway;
[0068] The first data uploading unit is configured to switch back to the data sending state to upload the data to be transmitted again if the response message from the gateway is not received within a preset time period, and increase the first number of times the response message is not received by one.
[0069] In some specific embodiments, the first data uploading module 11 further includes:
[0070] The number clearing unit is used to determine that the data to be transmitted is uploaded successfully if the response message from the gateway is successfully received, and clear the first number of times that the response message is not received.
[0071] In some specific embodiments, the second data uploading module 13 specifically includes:
[0072] An interval adjustment unit is used to generate a random number based on the time slice insertion algorithm, and determine the data upload delay duration based on the random number, so as to adjust the preset data upload time interval of the current terminal node where the data collision occurs according to the data upload delay duration.
[0073] In some specific embodiments, the second data uploading module 13 further includes:
[0074] The second data uploading unit is configured to actively upload the currently collected data again according to the preset data uploading time interval if the response message from the gateway is received.
[0075] In some specific embodiments, the second data uploading module 13 further includes:
[0076] a number recording unit, configured to record a second number of data collisions occurring at the current terminal node;
[0077] A frequency band switching unit is configured to execute an adaptive frequency hopping algorithm according to a preset frequency hopping table to switch the carrier frequency band currently used for data transmission to a target transmission frequency band if the second number satisfies a preset frequency hopping condition; the frequency hopping table divides the carrier frequency into a plurality of frequency bands and is prepared in a preset order and time interval.
[0078] Furthermore, an embodiment of the present application also discloses an electronic device. FIG7 is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be considered as any limitation on the scope of use of the present application.
[0079] Figure 7 is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps of the data transmission method disclosed in any of the aforementioned embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0080] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0081] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0082] The operating system 221 is used to manage and control the hardware devices on the electronic device 20 and the computer program 222, and can be Windows Server, Netware, Unix, Linux, etc. In addition to including computer programs that can be used to implement the data transmission method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include computer programs that can be used to perform other specific tasks.
[0083] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned data transmission method is implemented. The specific steps of this method can be referred to the corresponding contents disclosed in the aforementioned embodiments and will not be repeated here.
[0084] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.
[0085] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0086] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0087] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further limitations, an element defined by the statement "comprises a..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0088] The above is a detailed introduction to the technical solution provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data transmission method, characterized in that: Applicable to any terminal node, including: It uses its own sensors to collect current environmental data, and actively uploads the collected data to be transmitted to the corresponding gateway through a pre-built ad hoc network using long-distance radio according to the preset data upload time interval, and waits to receive the response message returned by the gateway; determining a first number of times the response message from the gateway is not received, and determining that a data collision occurs at the current terminal node if the first number of times the response message is not received is greater than a preset number; Based on the time slice insertion algorithm, the preset data upload time interval of the current terminal node where the data collision occurs is adjusted, and the data to be transmitted is continued to be uploaded to the gateway according to the adjusted time interval, so that the gateway uploads the received data to the cloud server for visual display through the message queue telemetry transmission protocol.
2. The data transmission method according to claim 1, wherein: The process of collecting current environmental data using its own sensors also includes: Detecting the data volume of the currently collected data to be transmitted, and actively sending an alarm message to the gateway if the data volume exceeds a preset data volume threshold.
3. The data transmission method according to claim 1, wherein: After actively uploading the collected data to be transmitted to the corresponding gateway through the pre-built ad hoc network using long-distance radio according to the preset data upload time interval, the method further includes: Switch the current data sending state to the data receiving state to wait for receiving the response message returned by the gateway; If the response message from the gateway is not received within a preset time period, the state is switched back to the data sending state to upload the data to be transmitted again, and the first number of times the response message is not received is increased by one.
4. The data transmission method according to claim 3, wherein: After switching back to the data sending state and uploading the message to be transmitted again, the method further includes: If the response message from the gateway is successfully received, it is determined that the data to be transmitted is uploaded successfully, and the first number of times the response message is not received is cleared to zero.
5. The data transmission method according to claim 1, wherein: The adjusting the preset data upload time interval of the current terminal node where data collision occurs based on the time slice insertion algorithm includes: A random number is generated based on the time slice insertion algorithm, and a data upload delay duration is determined based on the random number, so as to adjust the preset data upload time interval of the current terminal node where the data collision occurs according to the data upload delay duration.
6. The data transmission method according to claim 1, wherein: After continuing to upload the data to be transmitted to the gateway according to the adjusted time interval, the method further includes: If the response message from the gateway is received, the currently collected data is actively uploaded again according to the preset data upload time interval.
7. The data transmission method according to any one of claims 1 to 6, characterized in that: After adjusting the preset data upload time interval of the current terminal node where data collision occurs based on the time slice insertion algorithm, the method further includes: Recording a second number of data collisions occurring at the current terminal node; If the second number meets the preset frequency hopping condition, an adaptive frequency hopping algorithm is executed according to a preset frequency hopping table to switch the carrier frequency band currently used for data transmission to the target transmission frequency band; the frequency hopping table divides the carrier frequency into multiple frequency bands and is prepared according to a preset order and time interval.
8. A data transmission device, characterized in that: Applicable to any terminal node, including: A first data uploading module is used to collect current environmental data using its own sensors, and actively upload the collected data to be transmitted to the corresponding gateway through a pre-built ad hoc network using long-distance radio according to a preset data upload time interval, and wait for a response message returned by the gateway; a number determination module, configured to determine a first number of times the response message from the gateway has not been received, and if the first number of times the response message has not been received is greater than a preset number, determine that a data collision has occurred at the current terminal node; The second data upload module is used to adjust the preset data upload time interval of the current terminal node where data collision occurs based on the time slice insertion algorithm, and continue to upload the data to be transmitted to the gateway according to the adjusted time interval, so that the gateway can upload the received data to the cloud server for visual display through the message queue telemetry transmission protocol.
9. An electronic device, characterized in that: The electronic device includes a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the data transmission method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that Used to store a computer program, which, when executed by a processor, implements the data transmission method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Data sending method and system, LoRa node and storage medium
CN115361709A
Ad-hoc network communication method and device based on LoRa autonomous regulation and control, and medium
CN116017759A
Lora networking conflict avoidance method and device, electronic equipment and storage medium
CN116193622A
Self-adaptive conflict back-off method and system suitable for Lora-Mesh network
CN116489813A
Data transmission method and device, equipment and storage medium
CN118102249A
Cited By
Data reporting method and device of NB meter
CN120881422A
Real-time monitoring system of long-distance blind area detection sensor for complex environment
CN121165087A