A time node preemptive communication system based on LoRa module with one master and multiple slaves
By designing a one-master, multi-slave time node preemptive communication system based on LoRa module, the communication efficiency problem of the existing system under the requirements of high slave number and data timeliness is solved, and the high data timeliness and low cost, low power consumption and small volume characteristics of the system are achieved.
Patent Information
- Application Number
- CN202411939012.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-08
AI Technical Summary
The existing master-slave acquisition system cannot meet the system acquisition requirements when there are many slaves, high dispersion, high data acquisition and high data timeliness requirements. In addition, the LoRa wireless communication half-duplex causes the channel information to be lost when multiple slaves have data changes at the same time.
A master-multi-slave time node preemptive communication system based on the LoRa module is designed. Through the structural design of the summary unit and the node unit, the host actively sends requests to the slave at normal polling, and allows the slave to actively send changes data in advance at the appropriate time to avoid channel conflicts.
It realizes the high timeliness of data in low cost, low power consumption and small volume, and can correctly receive the slave's active data change request and respond in a timely manner, improving the communication efficiency of the system.
Smart Images

Figure CN119789052A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of wireless communication, and in particular relates to a time node preemptive communication system based on a LoRa module with one master and multiple slaves. Background Art
[0002] In the existing master-slave acquisition systems on the market, the host can only send data request commands to each slave in the system one by one in a polling manner, and only after the slave returns data or the data request command times out, can it continue to send data request commands to the next slave in the system. When each slave in the system is polled by a question-and-answer communication method, the requirements of the entire acquisition system can be met when the number of slaves is small, the slave dispersion is low, the collected data is small, and the data timeliness requirements are low. When the number of slaves is large, the slave dispersion is high, the collected data is large, and the data timeliness requirements are high, this question-and-answer method is still used for polling, which obviously cannot meet the system acquisition requirements. Therefore, it is very necessary to invent a time node preemptive communication system based on the LoRa module with one master and multiple slaves, while keeping the existing system hardware unchanged, at low cost, low power consumption, and small size.
[0003] Since LoRa wireless communication is half-duplex, the host sends a data request command and the slave responds to the data request only when the channel is idle. If other slaves send data directly to the host before being polled, all information in the channel will be lost. Therefore, the difficulty of the balanced communication method lies in designing a method that can avoid multiple slaves from having data changes at the same time, and how to efficiently and timely send all changed data. Summary of the invention
[0004] In view of the above problems, the object of the present invention is to provide a time node preemptive communication system based on a LoRa module with one master and multiple slaves, aiming to solve the above technical problems.
[0005] The present invention adopts the following technical solution:
[0006] The time node preemptive communication system based on the LoRa module with one master and multiple slaves includes a summary unit and multiple node units, wherein the summary unit is the host, and the multiple node units are slaves. The summary unit is used to collect data, and the node unit is used to collect device data. The summary unit is also used to actively send requests to the node unit, and the node unit is also used to send change data to the summary unit before preempting other node units.
[0007] Furthermore, the aggregation unit includes a microprocessor, a LoRa module, an ETH module, a DTU module, and a power module. The microprocessor is connected to the LoRa module, the ETH module, and the DTU module, respectively, and the power module supplies power to the aggregation unit.
[0008] Furthermore, the node unit includes a microprocessor, a LoRa module, a COM module, an ADC module, an IO module, and a power module. The microprocessor is respectively connected to the LoRa module, the COM module, the ADC module, and the IO module, and the power module supplies power to the node unit.
[0009] Furthermore, the host polls each slave one by one, analyzes the data responded by the slave being polled, and simultaneously receives a data change request actively sent by another slave and responds in a timely manner.
[0010] Furthermore, during the normal process of the host polling the slave, when the slave has changed data, the slave selects an appropriate time and actively sends the changed data to the host in advance without affecting the communication process between the host and other slaves.
[0011] Furthermore, during the normal process of the host polling the slaves, when other slaves with changed data actively send the changed data to the host, the slave currently being polled can still choose an appropriate time to send response data to the host.
[0012] The beneficial effect of the present invention is that the present invention provides a time node preemptive communication system based on a LoRa module with one master and multiple slaves. By broadcasting and adding a short delay, the host can correctly receive the data change request actively sent by the slave and respond in time while polling normally, thus realizing a time node preemptive communication system with one master and multiple slaves. It also has high timeliness of data under the conditions of low cost, low power consumption and small size. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 This is an overall structural diagram of a time node preemptive communication system based on a LoRa module with one master and multiple slaves provided by an embodiment of the present invention;
[0014] Figure 2 It is a summary unit structure diagram;
[0015] Figure 3 It is the node unit structure diagram;
[0016] Figure 4 It is the communication timing diagram of the present invention;
[0017] Figure 5 It is a communication logic flow chart of the aggregation unit of the present invention;
[0018] Figure 6 It is a logic flow chart of node unit communication of the present invention. DETAILED DESCRIPTION
[0019] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0020] In order to illustrate the technical solution of the present invention, a specific embodiment is provided below for illustration.
[0021] Figure 1 The connection relationship between each node unit and the summary unit, data server, and each device is shown. Figure 2 and Figure 3 The connection relationship between each module in the summary unit and the node unit is shown respectively. Figure 1-3 As shown, an embodiment of the present invention provides a time node preemptive communication system based on a LoRa module with one master and multiple slaves, and the host is used to process various messages sent from multiple slaves. The communication system includes a summary unit and multiple node units, the summary unit is the host, and the multiple node units are slaves. The summary unit is used to collect data, the node unit is used to collect device data, the summary unit is also used to actively send requests to the node unit, and the node unit is also used to send change data to the summary unit before preempting other node units. The summary unit includes a microprocessor MCU, a LoRa module, an ETH module, a DTU module, and a power supply POWER module. The microprocessor is connected to the LoRa module, the ETH module, and the DTU module respectively, and the power supply module supplies power to the summary unit. The node unit includes a microprocessor MCU, a LoRa module, a COM module, an ADC module, an IO module, and a power supply module. The microprocessor is connected to the LoRa module, the COM module, the ADC module, and the IO module respectively, and the power supply POWER module supplies power to the node unit.
[0022] The node unit is used to collect or control the information of the device, collect the device level signal and output level signal through the IO module, and collect or modify the device data through the COM module (serial port module). After each node unit collects the data, it sends the data to the summary unit through LoRa wireless communication.
[0023] The summary unit (host) includes MCU, LoRa module, ETH module, DTU module and POWER module. MCU is connected to LoRa module, ETH module and DTU module respectively. MCU is a microprocessor, which is the core chip for the summary unit to parse and process data frames. LoRa module is a wireless communication module, which is used for wireless communication with node units. ETH module is a wired network module, DTU module is a wireless network module, and the microprocessor receives data through the wireless communication module. POWER module is a power supply module, which supplies power to the microprocessor and other modules.
[0024] The node unit (slave) includes MCU, LoRa module, COM module, ADC module, IO module and POWER module. MCU is connected to LoRa module, COM module, ADC module and IO module respectively. Among them, MCU is a microprocessor, which is the core chip for parsing and processing command frames of the node unit. LoRa module is a wireless communication module used for wireless communication with the aggregation unit. COM module is a serial communication module, which generally supports RS485 and RS232 interfaces. ADC module is an analog acquisition module used to collect voltage or current values of the device. IO module has input and output functions, which can collect device output level signals and change device input level signals. POWER module is a power supply module that supplies power to the microprocessor and other modules.
[0025] The first consideration of the communication system of the present invention is the communication rate and distance. The communication rate directly affects the communication distance between each node unit and the aggregation unit. The calculation of the wireless transmission distance involves considering several parameters. Although it may vary depending on the specific wireless technology and environment, the commonly used formula for estimating the transmission distance is the Friis transmission equation. The Friis equation calculates the received power (Pr) at a given distance (d) from the transmitter, taking into account the signal of the transmitted power (Pt), frequency (f), antenna gain (Gt and Gr), and wavelength (λ). The formula is as follows:
[0026] Pr=Pt+Gt+Gr-(20log(λ)-20log(4πd))
[0027] In the formula, Pr represents the received power at a distance d, Pt represents the transmitted power, Gt represents the transmitter antenna gain, Gr represents the receiver antenna gain, λ represents the wavelength of the signal, and d represents the distance between the transmitter and the receiver. The Friis equation takes into account the path loss, which explains the attenuation of the signal as it propagates through the medium and the distance it travels. It also contains the antenna gain, which represents the directional characteristics of the antenna and its ability to focus or concentrate the transmitted or received power.
[0028] The Friis equation provides an estimate and assumes ideal conditions. In practice, the transmission distance is affected by many factors, so we mainly use reference values to estimate the direction in which we adjust the parameters. It is crucial to consider other factors that may affect the actual range in a given scenario. Factor one is signal strength and quality. The received signal strength and quality depend on the transmit power, path loss, and signal-to-noise ratio. With high transmit power and low path loss, the signal reception is better and the transmission distance is longer. Factor two is frequency. Different frequencies have different propagation characteristics. Low frequencies propagate far but have low data rates, while high frequencies provide higher data rates but have shorter ranges due to increased path loss. Factor three is antenna characteristics. The gain and radiation pattern of the transmitter and receiver antennas significantly affect the transmission distance. High-gain antennas enable longer-distance communication. Factor four is environmental conditions. Obstacles such as walls, buildings, vegetation, or terrain can attenuate the signal and shorten the transmission distance. In addition, environmental factors such as weather conditions, interference from other devices, and electromagnetic noise can also affect the performance and range of wireless transmission. Since the hardware and the scene are fixed, only by selecting the appropriate communication rate and relatively good antenna placement can the most efficient data acquisition rate be obtained while meeting the scene requirements. It is the basic prerequisite of the present invention to ensure that when a unit sends a broadcast, all other units can receive the broadcast.
[0029] The present invention uses broadcast frames as the communication starting point, and then uses the delays at different times as the communication preemption opportunities, and uses the address size as the priority to ensure that the messages of multiple units will not collide with each other. If the frames collide with each other, the receiver will not receive a complete data frame, resulting in reduced communication efficiency. Different types of communication frames are divided into different delay nodes, and each delay node also has a dead zone to prevent external interference during the communication process from causing a certain delay in receiving the broadcast message, so as to avoid affecting other units in determining the delay node. The communication frame includes a data request frame, a data response frame, a change data frame, and a change data response frame. Among them, the data request frame, the change data frame, and the change data response frame are all broadcast frames. The data request frame and the change data frame are sent by the summary unit. The change data frame and the data response frame are sent by the node unit.
[0030] In the communication system, all node units can actively send communication frames to the summary unit. They mainly use the previous frame as the starting point of the delay timing. The summary unit can receive all communication frames, so the summary unit has one more delay processing message than the node unit. t is the dead zone delay, N is the maximum number of node units, ID is the address of the node unit, and IDask is the address of the current query. The summary unit delay (Tm) is composed of the receiving delay (Tr), the changing data frame delay (Ta), and the data response frame delay (Td). Since its response is broadcast together with the request, there is only one timing cycle, and its relationship is as follows:
[0031] Tm=Tr+t+Ta×N+t+Td×t+t
[0032] The node unit delay (Ts) is composed of the receiving delay (Tr) and the changing data frame delay (Ta), where Ta is the key delay for balanced communication. The two communication frames of the node unit have different delay determination methods. When a data request message is received and it is determined to be the ID of the node unit, the node unit needs to send a data response frame. The node unit delay (Ts) is as follows:
[0033] Ts=Tr+t+Ta×N+t
[0034] When the node unit receives the data request message and determines that it is not the ID of the node unit, and the node unit needs to send a change data frame at this time, the node unit delay (Ts) relationship is as follows:
[0035]
[0036] According to the formula, the previous node unit of the current request has the highest priority, because the next polling needs to wait for each polling to be completed before it can be the next turn, so it has the highest priority to send the change data frame. Basic delay conditions, many other judgments need to be added in the time node preemptive communication system to allow active transmission. Assuming that a device fails, the node unit collecting the device may frequently initiate change data requests, affecting the overall collection efficiency of the system, so it needs to be restricted, so that the wireless channel is busy only within a few seconds of the failure, and then returns to normal, ensuring the smoothness of the wireless channel.
[0037] Figure 4 The wireless communication timing diagram of the present invention is shown, including the data request polling timing, the change data active uploading timing and the command timeout timing, and the core logic of the change data active uploading timing.
[0038] Figure 4 The timing diagram includes the data request polling timing, the change data active upload timing and the command timeout timing. The leftmost column of the timing diagram is the name of each unit module, followed by the channel of the unit module, and the channel has the messages sent and received. Indicates a data request. Indicates that a data request has been received. Indicates sending response data. Indicates that response data has been received, "↑" indicates that change data has been sent, and "↑" indicates that change data has been received. Indicates the response to change data and data request. Indicates receipt of response change data and data request, the number indicates the node unit ID of the request or response, and the dotted line and dotted box indicate waiting.
[0039] Specifically, it can be clearly seen from the timing diagram that the first message sent is the data request from the summary unit to node unit 1. Each node unit receives it, so it is a broadcast frame. When there is no change data uploaded, all node units go through the common change data delay period. After exceeding the first delay period, node unit 1 determines that there is no change data, so it sends a response message. At this time, only the summary unit receives the message, so the summary unit broadcasts the data request of the second node unit after waiting for the reception to end. This is the data request polling timing. After broadcasting the data request of the second node unit, after the change data delay period, no message is received, then continue to wait for the timeout delay period. If no message is received, then broadcast the data request of the third node unit. This is the timeout timing. After broadcasting the data request of the third node unit, when node unit 2 has changed data, it has the highest priority, because the next polling requires a whole cycle, so it will send out a changed data frame at the beginning of the changed data delay period, and all units can receive this frame, so they all wait for a new changed data delay period. When node unit 4 also has changed data, it will be polled immediately, so it has the lowest priority. When other node units have no changed data, that is, it can only send out a changed data frame at the end of the changed data delay period. After receiving it, other units continue to wait for a new changed data delay period. If there is no changed data, then after the changed data segment ends, node unit 3 sends a response data frame, which is only received by the summary unit. The summary unit broadcasts the data request of the fourth node unit after the reception ends the delay. This is the timing for actively sending the changed data.
[0040] Figure 5 and Figure 6 The communication logic flow charts of the summary unit and the node unit are shown respectively.
[0041] like Figure 5As shown, it can be clearly seen from the flow chart that when the aggregation unit (host) sends a broadcast frame, it first enters a delay period, waits for the slave to receive and reply to the corresponding message, and then determines whether it has timed out. There are two situations. Assume that one is to wait until the timeout, then enter the timeout processing, including the marking of some variables for subsequent processing. After the processing is completed, the data request broadcast frame of the next node unit is sent and a new cycle is entered. Assume that the second is to receive data, and then wait until no more data is received, and then start to parse each received message one by one to determine whether there is a changed data frame. If so, write the changed data response frame in the sending buffer area, determine whether there is a response data frame, if so, write the data request frame of the next node unit in the sending buffer area, if there is no data response frame, enter the timeout processing first, and then write the data request frame of the next node unit, and finally broadcast all the data at once to enter a new cycle.
[0042] like Figure 6 As shown, it can be clearly seen from the flow chart that when the node unit (slave) receives the broadcast frame, it first enters a delay period, which is a communication dead zone to avoid the superposition of multiple message errors and cause parsing errors. The first is the change data delay period, and the last is the send data response period. In the change data delay period, the priority is obtained according to the broadcast data request address and the address of this unit, and then the delay is calculated according to the priority. After the delay ends, it is determined whether this unit is allowed to send change data. If other devices do not send change data broadcast frames and the broadcast data request address is not equal to the address of this unit, it means that this unit is allowed to send change data, and then determine whether there is a send data flag and whether there is a change data flag. Assuming that there is a change data flag and no send data flag, the change data frame is broadcast and the send data frame flag is set, so as to ensure that only one change data is sent in each cycle. If there is no change data flag, no processing is performed, and the change data delay period is waited for to end. When the send data response delay period arrives, it means that the response data frame is allowed to be sent. First, it is determined whether the broadcast frame is a change data response frame with the address of this node unit. If it is, the change data flag and the send data flag are cleared. Then determine whether there is a data request frame with the address of this node unit. If so, send the response data first, then clear the change data flag and the send data flag. If it is determined that it is not a data request frame with the address of this node unit, first determine whether the waiting times have exceeded, and if so, clear the send data flag.
[0043] In order to improve the communication efficiency of the system and avoid duplication of data information, the present invention has made other restrictions on the basic logic of the above time node preemptive communication system. Although in the timing diagram, when the data request of node unit 3 is made, node unit 4 also sends change data, in practice we do not allow the next five devices to send change data, because it will soon be their turn to request data, and the number of node units allowed to send change data in a single cycle is limited. The node unit will also autonomously record the frequency of sending change data. If it is too frequent, it is not allowed to send change data. There are more conditions for restricting the node unit according to the application scenario to improve the communication efficiency of the system, which will not be repeated one by one.
[0044] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A time node preemptive communication system based on LoRa module with one master and multiple slaves, characterized in that: The communication system includes a summary unit and multiple node units, the summary unit is the host, and the multiple node units are slaves. The summary unit is used to collect data, and the node unit is used to collect device data. The summary unit is also used to actively send requests to the node unit, and the node unit is also used to send change data to the summary unit before other node units.
2. The time node preemptive communication system based on one master and multiple slaves of LoRa module as claimed in claim 1, characterized in that, The aggregation unit includes a microprocessor, a LoRa module, an ETH module, a DTU module, and a power module. The microprocessor is connected to the LoRa module, the ETH module, and the DTU module respectively, and the power module supplies power to the aggregation unit.
3. The time node preemptive communication system based on one master and multiple slaves of LoRa module as claimed in claim 1, characterized in that, The node unit includes a microprocessor, a LoRa module, a COM module, an ADC module, an IO module, and a power module. The microprocessor is connected to the LoRa module, the COM module, the ADC module, and the IO module respectively, and the power module supplies power to the node unit.
4. A time node preemptive communication system based on a LoRa module with one master and multiple slaves as described in any one of claims 1-3, characterized in that: The host polls each slave one by one, analyzes the data responded by the slave being polled, and at the same time receives a data change request actively sent by another slave and responds in time.
5. The time node preemptive communication system based on LoRa module one master and multiple slaves as claimed in claim 4, characterized in that: During the normal process of the host polling the slave, when the slave has changed data, the slave selects an appropriate time and actively sends the changed data to the host in advance without affecting the communication process between the host and other slaves.
6. The time node preemptive communication system based on LoRa module one master and multiple slaves as claimed in claim 4, characterized in that: During the normal process of the host polling the slaves, when other slaves with changed data actively send the changed data to the host, the slave currently being polled can still choose the appropriate time to send the response data to the host.