Implementation method of novel single-module gateway

Through the design of a new single-module gateway, the heartbeat time adaptive algorithm and multiple restart mechanism are adopted, network congestion and multi-module interference problems of the intelligent communication system are solved, millisecond-level response and efficient communication are achieved, and hardware costs are reduced.

CN120389931APending Publication Date: 2025-07-29SHANGHAI UNIV OF FINANCE & ECONOMICS ZHEJIANG COLLEGE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510589482.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-08
Publication Date
2025-07-29

AI Technical Summary

Technical Problem

In the intelligent IoT applications, existing intelligent communication systems have problems such as weak wall penetration capabilities, short effective transmission distance, and high network delay. The gateway of the LoRaWAN protocol has high communication loop delays and is prone to cause channel congestion, lacks intelligent operation strategies and terminal type analysis mechanisms, resulting in low channel resource utilization, and problems such as multi-module interference and high hardware costs.

Method used

It adopts a new single-module gateway, which has a new adaptive algorithm for heartbeat time, multiple restart mechanism strategies, terminal types and power supply mode recognition capabilities, and adopts zero-fire, single-fire and battery communication logic to achieve millisecond-level response, and corrects the LoRaWAN protocol to improve communication efficiency.

Benefits of technology

It solves the problem of network congestion during multi-gateway communication, reduces hardware costs, realizes millisecond response and efficient and stable communication between the gateway and the terminal, and improves channel resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120389931A_ABST
    Figure CN120389931A_ABST
Patent Text Reader

Abstract

The invention discloses an implementation method of a novel single-module gateway, which is characterized in that the gateway adopts single-module communication, mutual interference of multiple modules can be prevented, and the hardware cost is greatly reduced; the gateway adopts a new heartbeat time adaptive algorithm, and solves the problem of network congestion when multiple gateways communicate at the same time; the gateway adopts various restart mechanism strategies including an application layer restart mechanism, an OpenWRT whole system restart mechanism and an automatic power-off and power-on restart mechanism, and the problems that the gateway is quickly restarted and manual power-on and power-off restart is needed under abnormal conditions are solved; the gateway can automatically identify the type of the intelligent terminal, and the unicast mode and the multicast mode of the gateway can adopt special communication strategies according to different types of terminals; the gateway can automatically identify power supply modes of the intelligent terminal, including single-fire power supply, zero-fire power supply and battery power supply, and can adopt special communication strategies according to different types of power supply modes of the intelligent terminal; the gateway immediately responds to the ACK of the terminal instruction, so that the millisecond response problem between the gateway and the terminal is realized; according to the gateway, the LoRaWAN protocol is corrected, and the speed of responding to the terminal is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent communication, and more specifically, to a method for implementing a single-module new gateway. Background Art

[0002] Currently, there are certain limitations in the application of intelligent communication systems in intelligent IoT. Communication architectures based on protocols such as ZigBee, Bluetooth, and WiFi generally have problems such as weak wall penetration ability, short effective transmission distance, and high network latency. Although relay transmission can expand the coverage range, it will exacerbate signal delay and is difficult to meet the performance requirements of real-time communication for IoT devices. In the field of low-power wide-area networks, the gateways of traditional LoRaWAN protocols have a technical bottleneck that the communication loop delay is as high as seconds, and they cannot adapt to the millisecond-level low-latency communication standards required by scenarios such as smart homes and smart buildings. Its fixed-cycle heartbeat signal interaction mechanism is prone to cause channel congestion during multi-gateway concurrent communication, resulting in a decline in communication reliability. At the system operation and maintenance level, the gateway devices of existing technologies lack intelligent operation strategies, fail to build a terminal type parsing mechanism and thus continuously stay in the transparent transmission mode, and also fail to establish a power supply mode recognition module to formulate differentiated communication strategies, resulting in low utilization rate of channel resources. In addition, the current restart mechanism only acts on the application layer and lacks environmental adaptability. The multi-module parallel architecture not only has the hidden danger of co-frequency interference, but also significantly increases the production cost due to hardware redundancy. Summary of the Invention

[0003] In view of the above problems, the purpose of the present invention is to provide a method for implementing a single-module new gateway, which can prevent mutual interference between multi-modules, adopt a new self-adaptive heartbeat time algorithm, has multiple restart mechanism strategies, can automatically identify the types of intelligent terminals and the power supply modes of intelligent terminals, and accordingly adopt dedicated communication strategies, and can achieve millisecond-level response between the gateway and the terminal, significantly improving the speed of responding to terminals.

[0004] The present invention provides a method for implementing a single-module new gateway, and the gateway repeater includes a power input interface and a power conversion circuit, a single-chip microcomputer processor core board, an Ethernet physical layer chip, a LoRa radio frequency chip, an LED indicator light, and an Ethernet port; The input end of the power input interface is used to connect to an external power supply, and the output end is connected to the input end of the power conversion circuit; the output end of the power conversion circuit is connected to the single-chip microcomputer processor core board; the single-chip microcomputer processor core board is connected to the Ethernet physical layer chip, the LoRa radio frequency chip, and the LED indicator light; the Ethernet physical layer chip is connected to the Ethernet port; the gateway is also connected to a server and terminal devices.

[0005] The present invention provides a method for implementing a single-module new gateway, and the method is specifically as follows: After the gateway is powered on and running, it will enter two states. One is to maintain a heartbeat with the server, and the other is to communicate with the terminal or the server. When the gateway maintains a heartbeat with the server, if the heartbeat fails to receive a response continuously for N times, the gateway judges the busy state of the server and needs to adjust the heartbeat period. If the heartbeat interval is greater than the maximum heartbeat period yT at this time, the heartbeat interval returns to the initial T. Otherwise, different adjustment strategies are executed according to the "regular mode", "random mode" and "mixed mode" in the heartbeat mode. In the "regular mode", the heartbeat will increment by ∆t. In the "random mode", the heartbeat will randomly select a heartbeat value between the minimum heartbeat T and the maximum heartbeat yT. In the "mixed mode", the heartbeat will randomly increase several irrelevant heartbeat values on the basis of the "regular mode". When the heartbeat fails continuously for a certain number of times, the gateway will judge whether the restart requirement is met. If the restart requirement is met, the restart method to be taken is judged by calculating the current cumulative number of failures, including three strategies: "application layer restart", "OpenWRT restart" and "hardware self-power-off restart". When the gateway needs to communicate, it will judge whether it is in the "unicast" or "multicast" mode according to the received data, and at the same time judge the terminal communication type, and perform three types of processing: "single-fire communication logic", "zero-fire communication logic" and "battery communication logic" according to the situation.

[0006] In this solution, the gateway modifies the LoRaWAN protocol, which includes three communication modes: zero-fire communication logic, single-fire communication logic and battery communication logic. For different power supply methods and scenarios of the terminal, the corresponding communication logic is adopted respectively, so as to communicate efficiently and stably and reduce power consumption.

[0007] In this solution, when the gateway is in the zero-fire communication logic, the terminal device is in a continuous receiving state and can directly turn on transmission (TX) and reception (RX). When the terminal sends data to the gateway, it immediately opens the receiving window to wait for the gateway to reply with an ACK confirmation message. If an ACK is received, the terminal closes the retransmission. If not, up to three retransmission attempts are made. At the same time, the gateway reports the data to the server, receives the data sent by the server, and then forwards it to the terminal to achieve efficient and stable real-time communication.

[0008] In this solution, when the gateway uses the single - fire communication logic, after the terminal sends data, it enters the receiving state. When the gateway receives the data, it immediately sends an ACK confirmation and a DATA data reply to the terminal. After the terminal confirms receiving the ACK or DATA, it enters the sleep state. If the terminal is still in the sending state when it is about to enter the sleep state, it will be extended by 50 ms to complete the sending, and then enter the sleep state immediately after the sending is completed. If the sending is not completed within 50 ms, it will be forced to enter the sleep state to save power. Subsequently, the gateway reports the received data to the server to ensure data integrity and timeliness. When the gateway needs to send data to the single - fire powered terminal, it will send a packet of data every 15 ms, up to 20 consecutive times. If within the 15 - ms receiving time of any of these 20 transmissions, the gateway can receive an ACK reply from the terminal, it will not re - send.

[0009] In this solution, when the gateway uses the battery communication logic, to minimize power consumption, the terminal device communicates in a periodic wake - up manner only when it needs to send data. After each wake - up, the terminal continuously sends data to the gateway and opens a 100 - millisecond receiving window after each sending to wait for the gateway to reply with an ACK confirmation message, and the gateway replies with an ACK message for each piece of data from the terminal. After the communication is completed, the terminal quickly enters the sleep state, while the gateway reports the complete data to the server. If the gateway receives downlink data from the server, it will send it to the battery - powered terminal and, after receiving the data reported by this terminal, send an instruction of ACK + data content to the terminal in the corresponding receiving window.

[0010] In this solution, the gateway has a terminal communication mode self - recognition mechanism, that is, two communication modes: unicast mode and multicast mode. The gateway accurately and automatically completes the judgment and recognition of the communication mode through device list matching and real - time communication fields. The gateway maintains a device list, which is updated regularly by synchronizing with the server and contains the ID information of the terminal devices. When data transmission occurs, the gateway identifies the ID of the terminal device in communication and matches it with the local device list to determine whether the device should use the unicast mode or the multicast mode. The gateway can also dynamically adjust and confirm the most appropriate communication mode through the field recognition method of real - time communication with the server to ensure communication efficiency and accuracy.

[0011] In this solution, the gateway can automatically identify the power supply method of the terminal device and select the corresponding communication logic accordingly. The gateway accurately determines whether the terminal device uses single-phase power supply, zero-phase power supply, or battery power supply mode through two methods: maintaining the terminal device list and real-time communication fields with the server. After identifying the specific power supply mode used by the terminal device, it can automatically select the corresponding communication logic, that is, the single-phase power supply mode corresponds to the single-phase communication logic, the zero-phase power supply mode corresponds to the zero-phase communication logic, and the battery power supply mode corresponds to the battery communication logic, ensuring the adaptability and stability of communication and improving the efficiency and accuracy of data interaction between the gateway and the terminal device.

[0012] In this solution, the gateway can adjust the heartbeat time interval algorithm with the server, which has four modes: normal mode, random mode, hybrid mode, and automatic mode. It can be set through the serial port and the server's issued instructions. When in the normal mode, if the gateway fails to receive the server's heartbeat response continuously for N times, it is assumed that the server is too busy. The gateway will try in the way of increasing ∆t successively until the heartbeat time interval reaches yT. If it still fails to receive the server's heartbeat response continuously for N times, it will return to the heartbeat time interval of T, where y and N can be set through the serial port and the server's issued instructions. When in the random mode, the gateway will calculate the next heartbeat time interval according to the built-in random algorithm. Whether it receives the server's heartbeat response or not, the next heartbeat time will be randomly generated. The hybrid mode is that several heartbeat time intervals generated by the random mode will randomly appear in the normal mode, and the positions where they appear are also randomly generated. The automatic mode is the default mode, which includes the mechanisms of the normal mode, random mode, and hybrid mode. The gateway will judge the current load status of the server according to the specific situation of the server's heartbeat response, and then adopt the most suitable heartbeat mechanism mode according to the current load status of the server. Through the above four heartbeat modes, the server load can be maximized, the server resource preemption situation can be reduced, and thus the best economic benefit ratio can be obtained.

[0013] In this solution, the gateway has a restart policy self-judgment mechanism, which is divided into three progressive levels: application layer restart, OpenWRT restart, and hardware self-power-off restart: The first-level application layer restart will trigger a millisecond-level rapid restart when the heartbeat connection between the gateway and the server fails continuously for n times. The second-level OpenWRT restart will trigger a second-level OpenWRT system restart when the application layer restart is continuously triggered for m times, indicating that the application layer restart fails to return to normal. After the OpenWRT restart is completed, the system will return to the monitoring state of the application layer restart mechanism. The third-level hardware self-power-off and restart. If the OpenWRT restart is continuously triggered p times, it indicates that the problem cannot be solved by the system-level restart. At this time, the hardware self-power-off restart at the minute level is triggered to achieve a complete power reset. After the hardware restart is completed, the system will also re-enter the application layer restart mechanism for a new round of status monitoring and judgment; The parameters n, m, and p of the above three restart mechanisms can all be set. The setting methods are serial port setting or server command setting. Through the gradually upgraded restart method and the monitoring of the return-to-initial mechanism after restart, the high reliability and stability of the gateway system operation are ensured.

[0014] The present invention discloses a method for implementing a single-module new gateway. By using single-module communication, it can prevent mutual interference among multiple modules and greatly reduce the hardware cost; The gateway adopts a new heartbeat time adaptive algorithm to solve the problem of network congestion when multiple gateways communicate simultaneously; The gateway adopts a variety of restart mechanism strategies, including the application layer restart mechanism, the OpenWRT entire system restart mechanism, and the self-power-off and power-on restart mechanism, which solves the problems of quick restart of the gateway and the need for manual power-on and power-off restart in abnormal situations; The gateway can automatically identify the type of intelligent terminal, and its unicast mode and multicast mode will adopt dedicated communication strategies according to different types of terminals; The gateway can automatically identify the power supply mode of intelligent terminals, including single-phase live wire power supply, zero-phase live wire power supply, and battery power supply, and will adopt dedicated communication strategies according to different types of intelligent terminal power supply modes; The gateway will immediately respond with an ACK to the terminal instruction, achieving the millisecond-level response problem between the gateway and the terminal; The gateway modifies the LoRaWAN protocol, significantly improving the speed of responding to terminals. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 Shows a product schematic diagram of a single-module new gateway of the present application.

[0016] Figure 2 Shows the embedded software architecture diagram of the single-module new gateway of the present invention.

[0017] Figure 3 Shows a schematic diagram of the LoRaWAN protocol modified by the gateway.

[0018] Figure 4 Shows a schematic diagram of automatic identification of communication modes.

[0019] Figure 5 Shows a schematic diagram of the self-identification mechanism for terminal power supply methods.

[0020] Figure 6 Shows the schematic diagram of the self - adjustment algorithm for the heartbeat time interval between the gateway and the server.

[0021] Figure 7 Shows the schematic diagram of the self - judgment mechanism for the restart strategy.

[0022] Figure 8 Shows the schematic flow diagram of the implementation method of the single - module new gateway. Detailed implementation manners

[0023] In order to more clearly understand the above - mentioned objects, features and advantages of the present invention, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners. It should be noted that, without conflict, the embodiments of the present application and the features in the embodiments can be combined with each other.

[0024] Many specific details are set forth in the following description in order to fully understand the present invention. However, the present invention can also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited by the specific embodiments disclosed below.

[0025] Figure 1 Shows the product schematic diagram of a single - module new gateway of the present application.

[0026] As Figure 1 shown, the present application discloses a product schematic diagram of a single - module new gateway. The gateway 1 includes a power input interface 11, a power conversion circuit 12, a single - chip microcomputer processor core board 13, an LED indicator 14, an Ethernet physical layer chip 15, a LoRa radio frequency chip 16, and an Ethernet port 17. The input end of the power input interface 11 is used to connect to an external power supply, and the output end is connected to the input end of the power conversion circuit 12; the output end of the power conversion circuit 12 is connected to the single - chip microcomputer processor core board 13; the single - chip microcomputer processor core board 13 is connected to the Ethernet physical layer chip 15, the LoRa radio frequency chip 16, and the LED indicator 14; the Ethernet physical layer chip 15 is connected to the Ethernet port 17; the gateway is also connected to a server and terminal devices.

[0027] It should be noted that, as a specific embodiment, the power conversion circuit 12 in this embodiment is a 12V - to - 3.3V circuit, and the MCU in the gateway uses STM32L151C8T6 and LoRa SoC chip LLCC68.

[0028] According to the embodiment of the present invention, as Figure 2 shown, Figure 2This is the embedded software architecture diagram of the single-module new gateway. As can be seen from the figure, the embedded software architecture includes peripheral drivers such as the hardware MTK7688 core board, LoRa module SX1278, Ethernet (ETH), LED indicator, and serial port. The embedded software is developed based on OpenWRT-linux, and the communication protocol adopts the modified LoRaWAN protocol to ensure better communication with the terminal. The embedded system includes four main threads, namely the uplink processing thread Thread_up for receiving uplink data packets from terminal devices, the downlink processing thread Thread_down for receiving downlink instructions from the server, the thread Thread_jit for sending downlink data packets to the terminal, and the thread insert_queue_thread for inserting downlink data into the queue. At the same time, it provides a self-identification mechanism for terminal mode and power supply method, a self-adjustment algorithm for heartbeat time interval, and a self-judgment mechanism for restart strategy.

[0029] According to an embodiment of the present invention, as Figure 3 shown, Figure 3 This is the schematic diagram of the modified LoRaWAN protocol. As can be seen from the figure, the gateway has three communication modes, namely zero-fire communication logic, single-fire communication logic, and battery communication logic. For different power supply methods and scenarios of the terminal, the corresponding communication logic is adopted respectively, so as to achieve efficient and stable communication and reduce power consumption.

[0030] When in zero-fire communication logic, the terminal device is in a continuous receiving state and can directly turn on transmission (TX) and reception (RX). When the terminal sends data to the gateway, it immediately opens the receiving window to wait for the gateway to reply with an ACK confirmation message. If an ACK is received, the terminal closes the retransmission. If not, it will make at most three retransmission attempts. At the same time, the gateway reports the data to the server and receives the data sent by the server, and then forwards it to the terminal to achieve efficient and stable real-time communication.

[0031] When in single-fire communication logic, the terminal enters the receiving state after sending data. After receiving the data, the gateway immediately sends an ACK confirmation and DATA data reply to the terminal. The terminal enters the sleep state after confirming the receipt of ACK or DATA. If the terminal is still in the sending state when it is about to enter the sleep state, it will be extended by 50 ms to complete the sending, and then enter the sleep state immediately after the sending is completed. If the sending is not completed within 50 ms, it will be forced to enter the sleep state to save power. The gateway then reports the received data to the server to ensure data integrity and timeliness. When the gateway needs to send data to a single-fire powered terminal, it will send a packet of data every 15 ms, up to 20 consecutive times. If the gateway can receive the terminal's reply ACK within 15 ms of any of these 20 transmissions, it will not retransmit.

[0032] When in battery communication logic, to minimize power consumption, the terminal device communicates in a periodic wake-up manner only when it needs to send data; after each wake-up, the terminal continuously sends data to the gateway and opens a 100-millisecond receiving window after each transmission to wait for the gateway to reply with an ACK confirmation message, and the gateway separately replies with an ACK message for each piece of data from the terminal; after communication is completed, the terminal quickly enters the sleep state, while the gateway reports the complete data to the server; if the gateway receives downlink data from the server, it will send it to the battery-powered terminal, and after receiving the data reported by this terminal, it will send an instruction of ACK + data content to the terminal in the corresponding receiving window.

[0033] According to an embodiment of the present invention, as Figure 4 shown, Figure 4 is a schematic diagram of automatic communication mode recognition. As can be seen from the figure, the gateway has a terminal communication mode self-recognition mechanism, that is, two communication modes: unicast mode and multicast mode. The gateway accurately and automatically completes the judgment and recognition of the communication mode through device list matching and real-time communication fields; the gateway maintains a device list, which is updated regularly by synchronizing with the server and contains the ID information of the terminal device. When data transmission occurs, the gateway identifies the ID of the terminal device in communication and matches it with the local device list to determine whether the device should use the unicast mode or the multicast mode; the gateway can also dynamically adjust and confirm the most suitable communication mode through the field recognition method of real-time communication with the server to ensure communication efficiency and accuracy.

[0034] According to an embodiment of the present invention, as Figure 5 shown, Figure 5 is a schematic diagram of the self-recognition mechanism for the terminal power supply method. As can be seen from the figure, the gateway can automatically recognize the power supply method of the terminal device and select the corresponding communication logic accordingly; the gateway accurately judges whether the terminal device uses single-phase live wire power supply, zero-phase live wire power supply or battery power supply mode through two methods: maintaining the terminal device list and real-time communication field recognition with the server. After identifying the specific power supply mode adopted by the terminal device, it can automatically select the corresponding communication logic, that is, the single-phase live wire power supply mode corresponds to the single-phase live wire communication logic, the zero-phase live wire power supply mode corresponds to the zero-phase live wire communication logic, and the battery power supply mode corresponds to the battery communication logic, ensuring the adaptability and stability of communication and improving the efficiency and accuracy of data interaction between the gateway and the terminal device.

[0035] According to an embodiment of the present invention, as Figure 6 shown, Figure 6Schematic diagram of the self-adjusting algorithm for the heartbeat time interval between the gateway and the server. As can be seen from the figure, the self-adjusting algorithm for the heartbeat time interval between the gateway and the server has four modes: normal mode, random mode, hybrid mode, and automatic mode. It can be set through the serial port and the instructions sent by the server. When in the normal mode, if the gateway fails to receive the heartbeat response from the server for N consecutive times, it is assumed that the server is too busy. The gateway will try in the way of increasing ∆t successively until the heartbeat time interval reaches yT. If it still fails to receive the heartbeat response from the server for N consecutive times, it will return to the heartbeat time interval of T. Here, y and N can be set through the serial port and the instructions sent by the server. When in the random mode, the gateway will calculate the next heartbeat time interval according to the built-in random algorithm. Whether it receives the heartbeat response from the server or not, the next heartbeat time will be randomly generated. The hybrid mode is that several heartbeat time intervals generated in the random mode will randomly appear in the normal mode, and the positions where they appear are also randomly generated. The automatic mode is the default mode, which includes the mechanisms of the normal mode, random mode, and hybrid mode. The gateway will judge the current load status of the server according to the specific situation of the server's heartbeat response, and then adopt the most suitable heartbeat mechanism mode according to the current load status of the server. Through the above four heartbeat modes, the server load is maximized, the situation of server resource preemption is reduced, and thus the best economic benefit ratio is obtained.

[0036] According to an embodiment of the present invention, as Figure 7 shown, Figure 7 Schematic diagram of the self-judging mechanism for the restart strategy. As can be seen from the figure, the gateway has a self-judging mechanism for the restart strategy, which is divided into three progressive levels: application layer restart, OpenWRT restart, and hardware self-power-off restart: The first-level application layer restart. When the heartbeat connection between the gateway and the server fails continuously for n times, a millisecond-level quick restart will be triggered. The second-level OpenWRT restart. When the application layer restart is continuously triggered for m times, it indicates that the application layer restart fails to restore normal. At this time, a second-level OpenWRT system restart will be triggered. After the OpenWRT restart is completed, the system will return to the monitoring state of the application layer restart mechanism. The third-level hardware self-power-off restart. If the OpenWRT restart is continuously triggered for p times, it means that the problem cannot be solved through the system-level restart. At this time, a minute-level hardware self-power-off restart is triggered to achieve a complete power reset. After the hardware restart is completed, the system will also re-enter the application layer restart mechanism to perform a new round of status monitoring and judgment. The parameters n, m, and p of the above three restart mechanisms can all be set, and the setting methods are serial port setting or server command setting. Through the step-by-step upgrade restart method and the monitoring of the return-to-initial mechanism after restart, the high reliability and stability of the gateway system operation are ensured.

[0037] According to an embodiment of the present invention, as Figure 8 shown, Figure 8 is a schematic flow diagram of the implementation method of the single-module new gateway. It can be seen from the figure that the present invention provides an implementation method of a single-module new gateway, and the method is specifically as follows: After the gateway is powered on and runs, it will enter two states. One is to maintain a heartbeat with the server, and the other is to communicate with the terminal or the server; When the gateway maintains a heartbeat with the server, if the heartbeat fails to receive a response continuously for N times, the gateway judges the busy state of the server and needs to adjust the heartbeat period; if the heartbeat time interval is greater than the maximum heartbeat period yT at this time, the heartbeat time interval returns to the initial T, otherwise different adjustment strategies are executed according to the "regular mode", "random mode", and "mixed mode" in the heartbeat mode. In the "regular mode", the heartbeat will increment by ∆t, in the "random mode", the heartbeat will randomly select a heartbeat value between the minimum heartbeat T and the maximum heartbeat yT, and in the "mixed mode", the heartbeat will randomly increase several irrelevant heartbeat values on the basis of the "regular mode"; When the heartbeat fails continuously to a certain number of times, the gateway will judge whether the restart requirement is met; if the restart requirement is met, the restart method to be adopted is judged by calculating the current cumulative number of failures, including three strategies: "application layer restart", "OpenWRT restart", and "hardware self-power-off restart"; When the gateway needs to communicate, it will judge whether it is in the "unicast" or "multicast" mode according to the received data, and at the same time judge the terminal communication type, and perform three types of processing: "single-fire communication logic", "zero-fire communication logic", and "battery communication logic" according to the situation.

[0038] The present invention discloses an implementation method of a single-module new gateway, which adopts single-module communication, can prevent mutual interference between multiple modules, and greatly reduces the hardware cost; The gateway adopts a new self-adaptive algorithm for heartbeat time, which solves the problem of network congestion during simultaneous communication of multiple gateways; The gateway adopts a variety of restart mechanism strategies, including application layer restart mechanism, OpenWRT entire system restart mechanism, and self-power-off and power-on restart mechanism, which solves the problems of quick restart of the gateway and the need for manual power-on and power-off restart in abnormal situations; The gateway can automatically identify the type of intelligent terminal, and its unicast mode and multicast mode will adopt dedicated communication strategies according to different types of terminals; The gateway can automatically identify the power supply modes of intelligent terminals, including single-phase power supply, zero-phase power supply, and battery power supply, and adopt dedicated communication strategies according to different types of intelligent terminal power supply modes; The gateway will immediately respond with an ACK to the terminal instruction, achieving millisecond-level response between the gateway and the terminal; The gateway modifies the LoRaWAN protocol, significantly improving the speed of responding to the terminal.

[0039] In several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the couplings between the various components shown or discussed, or direct couplings, or communication connections can be through some interfaces, and the indirect couplings or communication connections of devices or units can be electrical, mechanical, or other forms.

[0040] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units; they can be located in one place or distributed to multiple network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0041] In addition, in each embodiment of the present invention, the various functional units can all be integrated in one processing unit, or each unit can be separately regarded as a unit, or two or more units can be integrated in one unit; the above-mentioned integrated units can be implemented in the form of hardware, or in the form of a combination of hardware and software functional units.

[0042] Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above method embodiments; and the foregoing storage medium includes: removable storage devices, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disks, or optical disks and other various media that can store program codes.

[0043] Alternatively, if the above integrated units of the present invention are implemented in the form of software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of the present invention, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as removable storage devices, ROM, RAM, magnetic disks, or optical discs.

Claims

1. A new type of single-module gateway, characterized in that, The gateway includes a power input interface and a power conversion circuit, a single-chip microcomputer processor core board, an Ethernet physical layer chip, a LoRa radio frequency chip, an LED indicator, and an Ethernet port; The input end of the power input interface is used to connect to an external power supply, and the output end is connected to the input end of the power conversion circuit; the output end of the power conversion circuit is connected to the single-chip microcomputer processor core board; the single-chip microcomputer processor core board is connected to the Ethernet physical layer chip, the LoRa radio frequency chip, and the LED indicator; the Ethernet physical layer chip is connected to the Ethernet port; the gateway is also connected to a server and terminal devices; The single-module new gateway adopts the following implementation method, including the following steps: After the gateway is powered on and running, it will enter two states, one is to maintain a heartbeat with the server, and the other is to communicate with the terminal or the server; When the gateway maintains a heartbeat with the server, if the heartbeat is not responded to continuously for N times, the gateway judges the busy state of the server and needs to adjust the heartbeat period; if the heartbeat time interval is greater than the maximum heartbeat period yT at this time, the heartbeat time interval returns to the initial T, otherwise different adjustment strategies are executed according to the "regular mode", "random mode", and "hybrid mode" in the heartbeat mode. In the "regular mode", the heartbeat will increase by ∆t, in the "random mode", the heartbeat will be a random value between the minimum heartbeat T and the maximum heartbeat yT, and in the "hybrid mode", the heartbeat will randomly increase several irrelevant heartbeat values on the basis of the "regular mode"; When the heartbeat fails continuously for a certain number of times, the gateway will judge whether the restart requirement is met; if the restart requirement is met, the restart method to be adopted is judged by calculating the current cumulative number of failures, including three strategies: "application layer restart", "OpenWRT restart", and "hardware self-power-off restart"; When the gateway needs to communicate, it will judge whether it is in the "unicast" or "multicast" mode according to the received data, and at the same time judge the terminal communication type, and perform three types of processing: "single-fire communication logic", "zero-fire communication logic", and "battery communication logic" according to the situation.

2. The single-module new gateway is characterized by: The gateway modifies the LoRaWAN protocol, including three communication modes: zero-fire communication logic, single-fire communication logic, and battery communication logic. For different power supply methods and scenarios of the terminal, the corresponding communication logic is adopted respectively, so as to communicate efficiently and stably and reduce power consumption.

3. The novel single-module gateway according to claim 2, characterized in that, When the gateway is in the zero-fire communication logic, the terminal device is in a continuous receiving state, and can directly turn on transmission (TX) and reception (RX). When the terminal sends data to the gateway, it immediately opens a receiving window to wait for the gateway to reply with an ACK confirmation message; if an ACK is received, the terminal closes the retransmission; if not, it will make at most three retransmission attempts. At the same time, the gateway reports the data to the server, receives the data sent by the server, and then forwards it to the terminal to achieve efficient and stable real-time communication.

4. The single-module new gateway according to claim 2, characterized in that, When the gateway uses single-fire communication logic, the terminal enters the receiving state after sending data, and the gateway immediately sends ACK confirmation and DATA data reply to the terminal after receiving the data. The terminal enters the sleep state after confirming the receipt of ACK or DATA; if the terminal is still in the sending state when it is about to enter the sleep state, it will be extended by 50ms to allow the sending to complete, and then immediately go to sleep after the sending is completed; if the sending is not completed within 50ms, it will be forced to enter the sleep state to save power consumption; The gateway then reports the received data to the server to ensure data integrity and timeliness; When the gateway needs to send data to a single-fire power supply terminal, it will send a packet of data every 15ms, up to 20 times in a row; if the gateway can receive the terminal's reply ACK within 15ms of any of the 20 transmissions, it will not resend.

5. The single-module new gateway according to claim 2, characterized in that, When the gateway uses battery communication logic, to minimize power consumption, the terminal device only communicates in a periodic wake-up mode when data needs to be sent. After each wake-up, the terminal continuously sends data to the gateway and opens a 100-millisecond receive window after each transmission to wait for the gateway to reply with an ACK confirmation message. The gateway replies with an ACK message for each piece of data from the terminal. After the communication is completed, the terminal quickly enters the sleep state, and the gateway reports the complete data to the server; if the gateway receives data downlinked from the server, it will send it to the battery-powered terminal, and after receiving the data reported by the terminal, it will send an ACK+data content instruction to the terminal in the corresponding receiving window.

6. The single-module new gateway is characterized by: The gateway has a terminal communication mode self-identification mechanism, namely two communication modes: unicast mode and multicast mode. The gateway accurately and automatically completes the judgment and identification of the communication mode through device list matching and real-time communication fields; the gateway will maintain a device list, which is regularly updated through synchronization with the server and contains the ID information of the terminal device. When data transmission occurs, the gateway identifies the terminal device ID in the communication and matches it with the local device list to determine whether the device should adopt unicast mode or multicast mode; the gateway can also dynamically adjust and confirm the most appropriate communication mode through field identification in real-time communication with the server to ensure communication efficiency and accuracy.

7. The single-module new gateway is characterized by: The gateway can automatically identify the power supply mode of the terminal device and select the corresponding communication logic accordingly; the gateway accurately determines whether the terminal device adopts single-fire power supply, zero-fire power supply or battery power supply mode by maintaining a terminal device list and real-time communication field identification with the server. After identifying the specific power supply mode adopted by the terminal device, it can automatically select the corresponding communication logic, that is, the single-fire power supply mode corresponds to the single-fire communication logic, the zero-fire power supply mode corresponds to the zero-fire communication logic, and the battery power supply mode corresponds to the battery communication logic, which ensures the adaptability and stability of the communication and improves the efficiency and accuracy of data interaction between the gateway and the terminal device.

8. The single-module new gateway is characterized in that, The gateway can be set with a self-adjusting algorithm for the heartbeat time interval with the server, which has four modes: normal mode, random mode, hybrid mode, and automatic mode. It can be set through the serial port and commands sent by the server. In normal mode, if the gateway does not receive a heartbeat response from the server for N consecutive times, it is assumed that the server is too busy. The gateway will try by increasing ∆t successively until the heartbeat time interval reaches yT. If it still does not receive a heartbeat response from the server for N consecutive times, it will return to the heartbeat time interval of T. Here, y and N can be set through the serial port and commands sent by the server. In random mode, the gateway will calculate the next heartbeat time interval according to the built-in random algorithm. Regardless of whether it receives a heartbeat response from the server, the next heartbeat time will be randomly generated. The hybrid mode randomly appears several heartbeat time intervals generated in the random mode during the normal mode, and the positions where they appear are also randomly generated. The automatic mode is the default mode, which includes the mechanisms of the normal mode, random mode, and hybrid mode. The gateway will judge the current load status of the server based on the specific situation of the server's heartbeat response, and then adopt the most suitable heartbeat mechanism mode according to the current load status of the server. Through the above four heartbeat modes, the server load is maximized, the situation of server resource preemption is reduced, and thus the best economic benefit ratio is obtained.

9. The single-module new gateway is characterized in that: The gateway has a self-judging mechanism for the restart strategy, which is divided into three progressive levels: application layer restart, OpenWRT restart, and hardware self-power-off restart. The first-level application layer restart: when the heartbeat connection between the gateway and the server fails continuously for n times, a millisecond-level rapid restart will be triggered. The second-level OpenWRT restart: when the application layer restart is continuously triggered for m times, it indicates that the application layer restart fails to return to normal. At this time, a second-level OpenWRT system restart will be triggered. After the OpenWRT restart is completed, the system will return to the monitoring state of the application layer restart mechanism. The third-level hardware self-power-off restart: if the OpenWRT restart is continuously triggered for p times, it means that the problem cannot be solved through the system-level restart. At this time, a minute-level hardware self-power-off restart will be triggered to achieve a complete power reset. After the hardware restart is completed, the system will also re-enter the application layer restart mechanism to perform a new round of status monitoring and judgment. The parameters n, m, and p of the above three restart mechanisms can be set. The setting method is through the serial port or commands sent by the server. Through the gradually upgraded restart method and the return to the initial mechanism monitoring after restart, the high reliability and stability of the gateway system operation are ensured.