A method, system, device, and medium for bi-directional wireless communication frequency hopping

By introducing dual baseband channels and an adaptive spreading factor algorithm into wireless communication, the problem of communication interference in densely populated frequency bands is solved, enabling fast and reliable communication reconnection and stable data transmission.

CN120897276BActive Publication Date: 2025-12-12HUNAN DINGLI ELECTRIC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511427480.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-30
Publication Date
2025-12-12
Estimated Expiration
2045-09-30

AI Technical Summary

Technical Problem

In frequency bands with high user density, when multiple communication devices are working simultaneously, frequency hopping technology is prone to interference within the same frequency band due to the randomness or repetition of the frequency hopping sequence. This can lead to communication link interruptions, prolonged reconnection time, reduced reconnection success rate, increased system power consumption, and exacerbated communication instability, thus affecting user experience.

Method used

A dual baseband channel mechanism is introduced, with multiple channels between the master and slave terminals having fixed intervals and arranged in ascending order of frequency. Through channel self-testing and adaptive spreading factor algorithms, the system ensures automatic switching to the backup channel when the baseband channel is not idle or is subject to interference. Signal connection frames and ACK confirmation frames are used to maintain synchronous frequency hopping data transmission.

Benefits of technology

It improves the reliability and stability of wireless communication, shortens the communication reconnection time, increases the reconnection success rate, reduces power consumption, and ensures the quality of synchronous frequency hopping data transmission between master and slave ends.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120897276B_ABST
    Figure CN120897276B_ABST
Patent Text Reader

Abstract

The application relates to a bidirectional wireless communication frequency hopping method, system, device and medium. The method comprises the following steps: introducing a frequency hopping mechanism based on a double-base frequency channel and a plurality of wireless communication channels in a bidirectional wireless communication connection between a master and a slave, when the master and the slave are disconnected, the channel is hopped and self-checked one by one, the master and the slave can be automatically switched to an idle and interference-free channel to reconnect, when the master and the slave are in a normal communication connection state, the master and the slave are initialized as a synchronous frequency hopping sequence, an adaptive spreading factor algorithm is used to calculate the optimal spreading factor of the wireless communication channel of the synchronous jump of the master and the slave, and the synchronous frequency hopping data transmission between the master and the slave is kept based on the optimal spreading factor. The method can improve the speed and success rate of the master and the slave after the communication is disconnected, and the reliability and stability of wireless communication data transmission are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of wireless communication, in particular to a bidirectional wireless communication frequency hopping method, system, device and medium. BACKGROUND

[0002] Frequency hopping technology is a widely used spread spectrum method in the field of wireless communication. Its basic principle is to control the carrier frequency to switch between multiple frequency points quickly through a specific code sequence, thereby expanding the frequency spectrum and improving the anti-interference ability of the signal. In traditional frequency hopping systems, the sending end and the receiving end switch the frequency synchronously according to the predetermined frequency hopping pattern, so as to reduce narrowband interference, improve communication security, and allow multiple users to share the same frequency band resources.

[0003] However, with the popularity of wireless communication devices and the increasing scarcity of frequency spectrum resources, frequency hopping technology has exposed several problems in practical application. In particular, in a user-intensive frequency band, when multiple communication devices work simultaneously, the randomness or repeatability of the frequency hopping sequence can easily cause same-frequency band interference. Once a frequency conflict occurs, the communication link will be forced to interrupt, and the device needs to be reconnected. This process not only prolongs the reconnection time, but also reduces the reconnection success rate, and increases the power consumption of the system, which is not conducive to the efficient use of energy. In addition, frequent reconnection and signal competition can further exacerbate communication instability, and even cause complete communication interruption, seriously affecting user experience. SUMMARY

[0004] Therefore, it is necessary to provide a bidirectional wireless communication frequency hopping method, system, device and medium to solve the above technical problems.

[0005] A bidirectional wireless communication frequency hopping method, the method is applied to the bidirectional wireless communication connection between at least one master and at least one slave, and the method comprises:

[0006] presetting a plurality of wireless communication channels arranged in a fixed channel interval between the master and the slave, and arranged in a frequency-sequential increasing order, and presetting a base frequency channel and at least one standby base frequency channel between the master and the slave;

[0007] When the master-slave communication is disconnected, the master jumps from the base frequency channel to any wireless communication channel in turn and sends a signal connection frame for channel self-checking. Only when the wireless communication channel is idle and there is no interference, the selected wireless communication channel is selected as the current available wireless communication channel. The master jumps from the selected wireless communication channel back to the base frequency channel and sends a signal connection frame for channel self-checking. If the base frequency channel is idle and there is no interference, the master jumps from the base frequency channel back to the selected wireless communication channel and enters the normal communication connection state by sending a communication connection frame. If the base frequency channel is not idle or there is interference, the master jumps from the base frequency channel to any standby base frequency channel in turn and sends a signal connection frame for channel self-checking. Only when the standby base frequency channel is idle and there is no interference, the master jumps from the standby base frequency channel back to the selected wireless communication channel and enters the normal communication connection state by sending a communication connection frame.

[0008] When the master-slave communication is disconnected, the slave jumps between the base frequency channel and the standby base frequency channel at a fixed interval and works in a receiving state. When the slave receives the signal connection frame sent by the master, the slave enters a sending state, sends a signal ACK confirmation frame to the master, and jumps to the wireless communication channel selected by the master and reenters the receiving state after the signal ACK confirmation frame is sent. The slave enters the normal communication connection state by receiving the communication connection frame sent by the master.

[0009] When the master-slave communication is disconnected, the slave jumps between the base frequency channel and the standby base frequency channel at a fixed interval and works in a receiving state. When the slave receives the signal connection frame sent by the master, the slave enters a sending state, sends a signal ACK confirmation frame to the master, and jumps to the wireless communication channel selected by the master and reenters the receiving state after the signal ACK confirmation frame is sent. The slave enters the normal communication connection state by receiving the communication connection frame sent by the master.

[0010] In one embodiment, the master jumps from the base frequency channel to any wireless communication channel in turn and sends a signal connection frame for channel self-checking, comprising:

[0011] For a plurality of wireless communication channels arranged in order of frequency in turn, the master first jumps to the wireless communication channel with the lowest frequency from the base frequency channel and sends a signal connection frame for channel self-checking. If the wireless communication channel with the lowest frequency is not idle or there is interference, the master jumps to the next wireless communication channel in sequence and sends a signal connection frame for channel self-checking until the wireless communication channel jumped to is idle and there is no interference. If all the wireless communication channels are jumped to for one round and the master enters the normal communication connection state, the master starts frequency hopping from the wireless communication channel with the lowest frequency again.

[0012] In one embodiment, the master jumps from the base frequency channel to any wireless communication channel in turn and sends a signal connection frame for channel self-checking, comprising:

[0013] The master end continuously sends a plurality of signal connection frames to the slave end in the current channel, and enters a receiving state after the signal connection frame is sent, waiting to receive a plurality of signal ACK confirmation frames continuously sent by the slave end; wherein the number of signal connection frames sent by the master end is consistent with the number of signal ACK confirmation frames sent by the slave end;

[0014] If the master end does not receive the signal ACK confirmation frame sent by the slave end within a preset time, it indicates that the current channel is not idle or there is interference; if the master end receives the signal ACK confirmation frame sent by the slave end within a preset time, it indicates that the current channel is idle and there is no interference.

[0015] In one embodiment, the master end jumps back to the selected wireless communication channel from the base frequency channel or the standby base frequency channel, and enters a normal communication connection state by sending a communication connection frame, including:

[0016] The master end jumps back to the selected wireless communication channel from the base frequency channel or the standby base frequency channel, and continuously sends a plurality of communication connection frames to the slave end in the selected wireless communication channel, and enters a receiving state after the communication connection frame is sent, waiting to receive a plurality of communication ACK confirmation frames continuously sent by the slave end; wherein the number of communication connection frames sent by the master end is consistent with the number of communication ACK confirmation frames sent by the slave end.

[0017] If the master end does not receive the communication ACK confirmation frame sent by the slave end within a preset time, the master end jumps to any wireless communication channel from the selected wireless communication channel in turn, and sends a signal connection frame for channel self-checking one by one, until a new available wireless communication channel is selected, and the normal communication connection state is reattempted; if the master end receives the communication ACK confirmation frame sent by the slave end within a preset time, the master end enters the normal communication connection state.

[0018] In one embodiment, the slave end jumps to the wireless communication channel selected by the master end and reenters a receiving state, and enters a normal communication connection state by receiving the communication connection frame sent by the master end, including:

[0019] The slave end jumps to the wireless communication channel selected by the master end and reenters a receiving state, and waits to receive a plurality of communication connection frames continuously sent by the master end.

[0020] If the slave end does not receive the communication connection frame sent by the master end within a preset time, the slave end jumps back to the base frequency channel or the standby base frequency channel from the selected wireless communication channel, and continues to jump back and forth between the base frequency channel and the standby base frequency channel at a fixed interval period; if the slave end receives the communication connection frame sent by the master end within a preset time, the slave end enters a sending state and continuously sends a plurality of communication ACK confirmation frames to the master end, and enters a normal communication connection state.

[0021] In one of the embodiments, the master and the slave are initialized to be in a synchronous frequency hopping sequence, and an adaptive spreading factor algorithm is used to calculate the optimal spreading factor of the wireless communication channel to which the master and the slave hop synchronously, and the synchronous frequency hopping data transmission between the master and the slave is maintained based on the optimal spreading factor, including:

[0022] The master and the slave are initialized to be in a synchronous frequency hopping sequence.

[0023] The master uses an adaptive spreading factor algorithm to calculate the optimal spreading factor of the current wireless communication channel, configures the physical layer parameters based on the optimal spreading factor, and sends a data packet to trigger the slave receiving process; wherein the adaptive spreading factor algorithm includes: measuring the SNR / RSSI of the channel, setting the value of the optimal spreading factor by comparing the size of the SNR value with the preset threshold, or calculating the value of the optimal spreading factor by dynamically balancing the size of the transmission reliability and the transmission energy consumption of the channel through RSSI; wherein the value of the optimal spreading factor ranges from 7 to 12 integers; the data packet is composed of a packet header and a data payload, and the packet header includes a preamble and an indicated optimal spreading factor indication.

[0024] The slave hops to the wireless communication channel consistent with the master and performs preamble detection, after successful preamble detection, parses the data packet header to obtain the optimal spreading factor, reconfigures the receiver spreading factor based on the optimal spreading factor, and after receiving the data payload, measures the received SNR / RSSI, sends ACK or NACK, and the master receives the response.

[0025] When the master receives NACK, a retransmission mechanism is triggered, and after increasing the value of the optimal spreading factor of the current wireless communication channel of the master and the slave, the data packet is re-sent to maintain the synchronous frequency hopping data transmission between the master and the slave; when the master receives ACK, the channel quality database is updated and it is judged whether the current wireless communication channel of the master and the slave meets the preset frequency hopping condition, if yes, the master hops to the next wireless communication channel, continues to calculate the optimal spreading factor of the next wireless communication channel, and re-sends the data packet to maintain the synchronous frequency hopping data transmission between the master and the slave; if not, the master continues to send the data packet in the current wireless communication channel and maintains the synchronous frequency hopping data transmission between the master and the slave.

[0026] The calculation of the optimal spreading factor also includes an anti-oscillation mechanism, including: detecting whether the latest calculated optimal spreading factor is consistent with the current spreading factor of the channel; if not, further detecting whether the time difference between the time when the latest data packet sending in the channel is successfully completed and the current time is greater than a preset minimum holding time, if yes, updating the current spreading factor of the channel to the latest calculated optimal spreading factor; if consistent or if the time difference is less than or equal to the minimum holding time, keeping the current spreading factor of the channel unchanged.

[0027] In one of the embodiments, the optimal spreading factor is calculated by balancing the transmission reliability and the size of transmission energy consumption of the RSSI, including:

[0028] A set of RSSI samples of the channel is collected for sliding average filtering, and the standard deviation of the RSSI samples is calculated The filtering result is compared with the preset threshold value The coefficient of variation of the RSSI of the channel is obtained as:

[0029] ;

[0030] ;

[0031] Wherein, is the number of samples, is the i-th RSSI sample; i

[0032] The stability of the current channel communication environment is marked by comparing the coefficient of variation with the size of the preset threshold value; wherein, when the coefficient of variation is greater than the preset threshold value, it is marked as an unstable environment; otherwise, it is marked as a stable environment; According to the environment marking result, the environment noise reference of the current channel is calibrated and the effective RSSI value is calculated as:

[0033]

[0034] ;

[0035] ;

[0036] Wherein, is the calibrated environment noise reference; is a set of noise signals, represents the percentile;

[0037] It is further judged whether the decision tree model is available based on If available, the decision tree model is used to predict the initial spreading factor of the channel, denoted as , wherein, represents the current battery voltage of the master end; if not available, a segmented linear approximation is used to select the initial spreading factor according to the preset RSSI and spreading factor mapping table; wherein, the value range of the initial spreading factor is an integer within 7 to 12;

[0038] ​​Further according to the initial spreading factor, a test packet is sent, and transmission reliability of the channel is verified by measuring the packet loss rate. If the packet loss rate is greater than a preset value, the value of the initial spreading factor is increased, and the test packet is re-sent for transmission reliability verification. Otherwise, the transmission energy consumption of the channel is optimized by measuring the current battery voltage of the master and calculating the expected transmission time of the test packet. If the battery voltage is less than a preset voltage and the expected transmission time is greater than a preset time, the value of the initial spreading factor is reduced, and the reduced value is output as the optimal spreading factor. Otherwise, the initial spreading factor is directly output as the optimal spreading factor. The expected transmission time is expressed as ; wherein, is the channel bandwidth, is the number of bits of the test packet payload.

[0039] A bidirectional wireless communication frequency hopping system, which is applied to bidirectional wireless communication connection between at least one master and at least one slave, and comprises:

[0040] A channel preset module, which is used to preset a plurality of wireless communication channels arranged in order of increasing frequency with fixed channel spacing between the master and the slave, and preset a primary frequency channel and at least one backup frequency channel between the master and the slave;

[0041] A master frequency hopping module, which is used to, when the communication between the master and the slave is disconnected, make the master jump from the primary frequency channel to any wireless communication channel in order and send a signal connection frame for channel self-checking. Only when the wireless communication channel is idle and there is no interference, the selected wireless communication channel is selected as the current available wireless communication channel. The master jumps from the selected wireless communication channel back to the primary frequency channel and sends a signal connection frame for channel self-checking. If the primary frequency channel is idle and there is no interference, the master jumps from the primary frequency channel back to the selected wireless communication channel and enters a normal communication connection state by sending a communication connection frame. If the primary frequency channel is not idle or there is interference, the master jumps from the primary frequency channel to any backup frequency channel in order and sends a signal connection frame for channel self-checking. Only when the backup frequency channel is idle and there is no interference, the master jumps from the backup frequency channel back to the selected wireless communication channel and enters a normal communication connection state by sending a communication connection frame.

[0042] A slave frequency hopping module, which is used to, when the communication between the master and the slave is disconnected, make the slave jump back and forth between the primary frequency channel and the backup frequency channel in a fixed interval period and work in a receiving state. When the slave receives a signal connection frame sent by the master, the slave enters a sending state, sends a signal ACK confirmation frame to the master, and after the signal ACK confirmation frame is sent, the slave jumps into the selected wireless communication channel of the master and re-enters a receiving state, and enters a normal communication connection state by receiving a communication connection frame sent by the master.

[0043] The synchronous frequency hopping data transmission module is used for initializing the master and the slave to the synchronous frequency hopping sequence when the master and the slave enter the normal communication connection state, and calculating the optimal spreading factor of the wireless communication channel of the synchronous frequency hopping of the master and the slave by using the adaptive spreading factor algorithm, and keeping the synchronous frequency hopping data transmission between the master and the slave based on the optimal spreading factor.

[0044] A computer device comprises a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0045] A plurality of wireless communication channels between the master and the slave are arranged in a fixed interval and sequentially increasing order according to frequency, and a base frequency channel and at least one standby base frequency channel between the master and the slave are preset;

[0046] When the master and the slave are disconnected, the master jumps from the base frequency channel to any wireless communication channel in sequence and sends a signal connection frame for channel self-checking, only when the wireless communication channel is idle and there is no interference, the selected wireless communication channel is selected as the current available wireless communication channel, the master jumps from the selected wireless communication channel back to the base frequency channel and sends a signal connection frame for channel self-checking, if the base frequency channel is idle and there is no interference, the master jumps from the base frequency channel back to the selected wireless communication channel and enters the normal communication connection state by sending a communication connection frame; if the base frequency channel is not idle or there is interference, the master jumps from the base frequency channel to any standby base frequency channel in sequence and sends a signal connection frame for channel self-checking, only when the standby base frequency channel is idle and there is no interference, the master jumps from the standby base frequency channel back to the selected wireless communication channel and enters the normal communication connection state by sending a communication connection frame;

[0047] When the master and the slave are disconnected, the slave jumps back and forth between the base frequency channel and the standby base frequency channel at a fixed interval period and works in a receiving state, when the slave receives the signal connection frame sent by the master, the slave enters a sending state, sends a signal ACK confirmation frame to the master, and after the signal ACK confirmation frame is sent, the slave jumps into the selected wireless communication channel of the master and re-enters the receiving state, and enters the normal communication connection state by receiving the communication connection frame sent by the master;

[0048] When the master and the slave enter the normal communication connection state, the master and the slave are initialized to the synchronous frequency hopping sequence, and the optimal spreading factor of the wireless communication channel of the synchronous frequency hopping of the master and the slave is calculated by using the adaptive spreading factor algorithm, and the synchronous frequency hopping data transmission between the master and the slave is kept based on the optimal spreading factor.

[0049] A computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the following steps:

[0050] The wireless communication channels are arranged in a sequence of fixed intervals and increasing frequencies, and a base frequency channel and at least one backup base frequency channel are preset between the master and slave terminals;

[0051] When the master-slave terminal communication is disconnected, the master terminal jumps from the base frequency channel to any wireless communication channel in sequence and sends a signal connection frame for channel self-checking. Only when the wireless communication channel is idle and there is no interference, the selected wireless communication channel is selected as the current available wireless communication channel. The master terminal jumps from the selected wireless communication channel back to the base frequency channel and sends a signal connection frame for channel self-checking. If the base frequency channel is idle and there is no interference, the master terminal jumps from the base frequency channel back to the selected wireless communication channel and enters a normal communication connection state by sending a communication connection frame. If the base frequency channel is not idle or there is interference, the master terminal jumps from the base frequency channel to any backup base frequency channel in sequence and sends a signal connection frame for channel self-checking. Only when the backup base frequency channel is idle and there is no interference, the master terminal jumps from the backup base frequency channel back to the selected wireless communication channel and enters a normal communication connection state by sending a communication connection frame.

[0052] When the master-slave terminal communication is disconnected, the slave terminal jumps between the base frequency channel and the backup base frequency channel in a fixed interval cycle and works in a receiving state. When the slave terminal receives a signal connection frame sent by the master terminal, the slave terminal enters a sending state, sends a signal ACK confirmation frame to the master terminal, and after the signal ACK confirmation frame is sent, the slave terminal jumps to the selected wireless communication channel of the master terminal and re-enters a receiving state, and enters a normal communication connection state by receiving a communication connection frame sent by the master terminal.

[0053] When the master-slave terminal enters a normal communication connection state, the master-slave terminal is initialized to a synchronous frequency hopping sequence, and an adaptive spreading factor algorithm is used to calculate the optimal spreading factor of the synchronous hopping wireless communication channel of the master-slave terminal, and based on the optimal spreading factor, the synchronous frequency hopping data transmission between the master-slave terminal is maintained.

[0054] Compared with the prior art, the above-mentioned bidirectional wireless communication frequency hopping method, system, device and medium have the following beneficial effects:

[0055] 1. The double base frequency channels are introduced in the bidirectional wireless communication connection between the master-slave terminals and channel self-checking is performed. The double base frequency channels can form a redundant link, and when the base frequency channel is not idle or there is interference, the backup base frequency channel which is idle and has no interference can be automatically switched to, thereby enhancing the reliability and stability of wireless communication data transmission and improving the speed and success rate of reconnection after the master-slave terminal communication is disconnected.

[0056] 2、Through presetting multiple wireless communication channels and sending signal connection frames one by one for channel self-checking, when a single wireless communication channel is not idle or interference exists, frequency hopping to other idle and interference-free wireless communication channels can avoid the situation that frequency conflict occurs when multiple devices hop frequency, and further causes the communication link to be forced to interrupt, improves the stability when frequency hopping reconnects, and multiple wireless communication channels are load balanced, which is beneficial to improve the utilization rate of spectrum resources and reduce frequency hopping power consumption. And by sending a communication connection frame to enter a normal communication connection state, the frequency hopping of the master and slave ends can be ensured to be synchronized, and the fast and accurate reconnection of the master and slave ends is ensured.

[0057] 3、When the master and slave ends enter a normal communication connection state, the best spreading factor calculated based on the adaptive spreading factor algorithm is used to keep the synchronous frequency hopping data transmission between the master and slave ends, which can ensure that both sides always use the same spreading factor value during frequency hopping, avoid the problem of synchronization loss caused by parameter mismatch, and greatly improve the synchronization reliability between the master and slave ends and the quality of data transmission. BRIEF DESCRIPTION OF DRAWINGS

[0058] Figure 1 It is a flowchart of a bidirectional wireless communication frequency hopping method in an embodiment;

[0059] Figure 2 It is a working flowchart of the master and slave ends after communication disconnection in an embodiment;

[0060] Figure 3 It is a flowchart of synchronous frequency hopping data transmission between the master and slave ends in an embodiment;

[0061] Figure 4 It is a flowchart of calculating the best spreading factor based on RSSI in an embodiment;

[0062] Figure 5 It is an internal structure diagram of a computer device in an embodiment. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.

[0064] In an embodiment, as shown in Figure 1As shown, a bidirectional wireless communication frequency hopping method is provided for reestablishing connection after communication disconnection and maintaining synchronized frequency hopping data transmission between master and slave ends after communication reconnection. The method is applied to bidirectional wireless communication connection between at least one master end and at least one slave end, i.e. for one master end and one slave end, one master end and multiple slave ends, multiple master ends and one slave end, and multiple master ends and multiple slave ends, the method is applicable. The method comprises the following steps:

[0065] Step S1, preset multiple wireless communication channels between master and slave ends are arranged in a fixed order according to frequency in ascending order, and a base frequency channel and at least one backup base frequency channel between master and slave ends are preset.

[0066] Among them, the preset multiple wireless communication channels are staggered with existing wireless communication channels (such as existing Bluetooth and WIFI, etc.).

[0067] It should be understood that by presetting multiple wireless communication channels to be staggered with existing wireless communication channels, it is beneficial to avoid crowded frequency bands and mutual interference of Bluetooth, WIFI and other systems, and to improve the channel signal-to-noise ratio. At the same time, double base frequency channels are introduced in the bidirectional wireless communication connection between master and slave ends and channel self-checking is performed. The double base frequency channels can form a redundant link, and when the base frequency channel is not idle or there is interference, it can automatically switch to an idle and interference-free backup base frequency channel, enhancing the reliability and stability of wireless communication data transmission and improving the speed and success rate of reconnection after communication disconnection between master and slave ends.

[0068] Step S2, when the master and slave ends are disconnected, the master end jumps from the base frequency channel to any wireless communication channel in sequence and sends a signal connection frame for channel self-checking. Only when the wireless communication channel is idle and there is no interference, it is selected as the current available wireless communication channel. The master end jumps from the selected wireless communication channel back to the base frequency channel and sends a signal connection frame for channel self-checking. If the base frequency channel is idle and there is no interference, the master end jumps from the base frequency channel back to the selected wireless communication channel and enters the normal communication connection state by sending a communication connection frame. If the base frequency channel is not idle or there is interference, the master end jumps from the base frequency channel to any backup base frequency channel in sequence and sends a signal connection frame for channel self-checking. Only when the backup base frequency channel is idle and there is no interference, the master end jumps from the backup base frequency channel back to the selected wireless communication channel and enters the normal communication connection state by sending a communication connection frame.

[0069] Among them, the master end jumps from the base frequency channel to any wireless communication channel in sequence and sends a signal connection frame for channel self-checking, including:

[0070] For the plurality of wireless communication channels arranged in order of increasing frequency, the master end first jumps to the wireless communication channel with the lowest frequency from the base frequency channel and sends a signal connection frame for channel self-checking. If the wireless communication channel with the lowest frequency is not idle or has interference, the master end jumps to the next wireless communication channel in order and sends a signal connection frame for channel self-checking, until the jumped wireless communication channel is idle and has no interference. If all wireless communication channels are jumped for one round and the master end enters a normal communication connection state, the master end starts frequency hopping from the wireless communication channel with the lowest frequency. Specifically, the frequency hopping is implemented based on LORA (Long Range Radio) communication technology. In this way, the signal can be transmitted at a low power over a long distance while maintaining high reliability.

[0071] It should be understood that the wireless communication channels are sequentially jumped and self-checked according to the order, the frequency hopping order is simple and can effectively cover all wireless communication channels, avoiding the possibility of missing some channels by pseudo-random frequency hopping, further improving the success rate of communication reconnection, and the channel self-checking is performed after each jump, which can real-time monitor the channel idle and interference conditions, improving the stability and reliability of the communication.

[0072] The specific steps of sending a signal connection frame for channel self-checking are as follows: the master end continuously sends a plurality of signal connection frames to the slave end in the current channel, and enters a receiving state after the signal connection frame is sent, and waits to receive a plurality of signal ACK confirmation frames continuously sent by the slave end. The number of signal connection frames sent by the master end is consistent with the number of signal ACK confirmation frames sent by the slave end. If the master end does not receive the signal ACK confirmation frame sent by the slave end within a predetermined time, it indicates that the current channel is not idle or has interference. If the master end receives the signal ACK confirmation frame sent by the slave end within a predetermined time, it indicates that the current channel is idle and has no interference.

[0073] It should be noted that the signal ACK confirmation frame sent by the slave end as referred to in the present application means that one signal ACK confirmation frame is received.

[0074] It should be understood that the signal connection frame is a carrier-activated detection (CAD) carrier sensing mechanism, and the purpose is to let the wireless device (such as a Wi-Fi card, a ZigBee device, a LORA device, etc.) first listen whether the wireless channel is idle before attempting to send data. The principle of signal self-checking is that the device detects the radio frequency energy or a specific signal (such as the preamble of Wi-Fi) on the channel through its radio receiver. If the detected energy exceeds a certain threshold or a valid signal is identified, the device considers that the channel is "busy" (other devices are transmitting); otherwise, it considers that the channel is "idle". By presetting multiple wireless communication channels and sending signal connection frames one by one for channel self-checking, when a single wireless communication channel is not idle or there is interference, the frequency hopping to other idle and interference-free wireless communication channels can avoid the situation that frequency conflict occurs when multiple devices hop frequency, and further causes the communication link to be forced to interrupt, thereby improving the stability of frequency hopping and reconnection, and balancing the load of multiple wireless communication channels, which is beneficial to improve the utilization rate of spectrum resources and reduce the frequency hopping power consumption.

[0075] When there are multiple backup base frequency channels, the multiple backup base frequency channels are arranged in order of frequency increasing, and when the master end jumps from the base frequency channel to the backup base frequency channel, it jumps to the backup base frequency channel in order of frequency increasing and sends the signal connection frame one by one for channel self-checking.

[0076] The master end jumps back to the selected wireless communication channel from the base frequency channel or the backup base frequency channel, and enters a normal communication connection state by sending a communication connection frame, including:

[0077] The master end jumps back to the selected wireless communication channel from the base frequency channel or the backup base frequency channel, and continuously sends a plurality of communication connection frames to the slave end in the selected wireless communication channel, and enters a receiving state after the communication connection frame is sent, and waits to receive a plurality of communication ACK confirmation frames continuously sent by the slave end; wherein the number of communication connection frames sent by the master end is consistent with the number of communication ACK confirmation frames sent by the slave end; if the master end does not receive the communication ACK confirmation frame sent by the slave end within a preset time, the master end jumps to any wireless communication channel one by one from the selected wireless communication channel, and sends the signal connection frame one by one for channel self-checking, until a new available wireless communication channel is selected, and a normal communication connection state is reattempted; if the master end receives the communication ACK confirmation frame sent by the slave end within a preset time, the master end enters a normal communication connection state.

[0078] It should be noted that the communication ACK confirmation frame sent by the slave end referred to in the present application means that one communication ACK confirmation frame is received.

[0079] It should be understood that by sending the communication connection frame into the normal communication connection state, the frequency hopping synchronization of the master and slave ends can be ensured, and the fast and accurate reconnection of the master and slave ends is ensured.

[0080] In step S3, when the master and slave ends are disconnected, the slave end hops back and forth between the base frequency channel and the standby base frequency channel at a fixed interval period and works in a receiving state. When the slave end receives the signal connection frame sent by the master end, the slave end enters a sending state, sends a signal ACK confirmation frame to the master end, and after the signal ACK confirmation frame is sent, the slave end hops into the wireless communication channel selected by the master end and reenters the receiving state, and enters the normal communication connection state by receiving the communication connection frame sent by the master end.

[0081] In step S3, when the master and slave ends are disconnected, the slave end hops back and forth between the base frequency channel and the standby base frequency channel at a fixed interval period and works in a receiving state. When the slave end receives the signal connection frame sent by the master end, the slave end enters a sending state, sends a signal ACK confirmation frame to the master end, and after the signal ACK confirmation frame is sent, the slave end hops into the wireless communication channel selected by the master end and reenters the receiving state, and enters the normal communication connection state by receiving the communication connection frame sent by the master end.

[0082] The slave end hops into the wireless communication channel selected by the master end and reenters the receiving state, waits to receive the communication connection frame sent by the master end, and enters the normal communication connection state by receiving the communication connection frame sent by the master end.

[0083] It should be noted that the communication connection frame sent by the master end referred to in the present application refers to one communication connection frame.

[0084] It should be understood that when the slave end communicates data, the slave end hops frequency according to the control of the master end, so that the frequency hopping synchronization of the master and slave ends is maintained, and the slave end actively hops to the standby base frequency channel only in the case that the base frequency channel is disturbed.

[0085] For example, when the method is applied to a scene with one master end and one slave end, the working process of the master and slave ends after the master and slave ends are disconnected is as shown in Figure 2 Figure 2 The dashed arrows in the figure represent the transmission of the signal connection frame and the communication connection frame between the master and slave ends, and the specific application steps include:

[0086] 1. A base frequency channel of 433.0 MHz and a standby base frequency channel of 433.5 MHz are preset, and 6 wireless communication channels are preset ​The six wireless communication channels all belong to the 433M frequency band, and the 433M frequency band has the advantages of low power consumption and strong wireless signal penetration. Each wireless communication channel is spaced by a fixed 0.5MHz, and the six wireless communication channels are arranged in order of increasing frequency, and the specific arrangement order is: 434.0MHz, 434.5MHz, 435.0MHz, 435.5MHz, 436.0MHz and 436.5MHz.

[0087] 2. When the master-slave communication is disconnected, the master starts frequency hopping from the base frequency channel, first jumps to the channel 434.0MHz, and then the master starts channel self-checking at 434.0MHz to check whether the channel is disturbed or idle.

[0088] At this time, the channel self-checking mode is that the master continuously sends 8 signal connection frames to the slave in the channel, and after the sending is completed, the receiving state is performed, and the reception of the slave's continuous sending of 8 signal ACK confirmation frames is waited. If the master does not receive the signal ACK confirmation frame sent by the slave within the preset time 1.8ms, it indicates that the current channel is not idle or disturbed. If the master receives the signal ACK confirmation frame sent by the slave within the preset time 1.8ms, it indicates that the current channel is idle and there is no disturbance.

[0089] If the channel 434.0MHz is not idle or disturbed, the master jumps to the next 434.5MHz in order and performs channel self-checking, and keeps jumping and checking one by one until a wireless communication channel is idle and there is no disturbance, and is selected as the current available wireless communication channel.

[0090] If the channel 434.0MHz is idle and there is no disturbance, the channel 434.0MHz is directly selected as the current available wireless communication channel, and the master jumps from the channel 434.0MHz back to the base frequency channel to check whether the base frequency channel is disturbed or idle.

[0091] If the base frequency channel is not idle or disturbed, the master jumps to the standby base frequency channel 433.5MHz and performs channel self-checking. If the standby base frequency channel 433.5MHz is not idle or disturbed, other standby base frequency channels are added and checked one by one until the standby base frequency channel is idle and there is no disturbance, and jumps back to the selected wireless communication channel from the standby base frequency channel. If the base frequency channel is idle and there is no disturbance, the master jumps back to the selected wireless communication channel from the base frequency channel.

[0092] After the master end jumps back to the selected wireless communication channel, it continuously sends 8 communication connection frames to the slave end, and enters a receiving state after the communication connection frame transmission is completed, waiting to receive the 8 communication ACK confirmation frames continuously sent by the slave end. If the master end does not receive the communication ACK confirmation frames sent by the slave end within a preset time of 1.8 milliseconds, the master end jumps from the selected wireless communication channel to the channel 434.0 MHz, and sequentially jumps to perform channel self-checking one by one until a new available wireless communication channel is selected, and a normal communication connection state is reattempted; if the master end receives the communication ACK confirmation frames sent by the slave end within the preset time of 1.8 milliseconds, the master end enters a normal communication connection state.

[0093] 3. When the master-slave end communication is disconnected, the slave end jumps back and forth between the base frequency channel and the standby base frequency channel at a fixed interval period (5 milliseconds) and works in a receiving state. When the slave end receives the signal connection frame sent by the master end, the slave end enters a sending state, continuously sends 8 signal ACK confirmation frames to the master end, and after the signal ACK confirmation frame transmission is completed, the slave end jumps to the wireless communication channel selected by the master end and reenters a receiving state, waiting to receive the 8 communication connection frames continuously sent by the master end.

[0094] If the slave end does not receive the communication connection frame sent by the master end within a preset time of 1.8 milliseconds, the slave end jumps back from the selected wireless communication channel to the base frequency channel or the standby base frequency channel, and continues to jump back and forth between the base frequency channel and the standby base frequency channel at a fixed interval period (5 milliseconds); if the slave end receives the communication connection frame sent by the master end within the preset time of 1.8 milliseconds, the slave end enters a sending state and continuously sends 8 communication ACK confirmation frames to the master end, and the slave end enters a normal communication connection state.

[0095] Step S4, when the master-slave end both enter a normal communication connection state, the master-slave end is initialized to a synchronous frequency hopping sequence, and an adaptive spreading factor algorithm is used to calculate the optimal spreading factor of the wireless communication channel to which the master-slave end synchronously jumps, and the synchronous frequency hopping data transmission between the master-slave end is maintained based on the optimal spreading factor.

[0096] Specifically, step S4, as shown in Figure 3 , includes:

[0097] First, the master-slave end is initialized to a synchronous frequency hopping sequence.

[0098] Second, the master end uses an adaptive spreading factor algorithm to calculate the optimal spreading factor of the current wireless communication channel, configures the physical layer parameters based on the optimal spreading factor, and sends a data packet, triggering the slave end receiving process. The optimal spreading factor has a value range of an integer within 7 to 12, and the data packet is composed of a packet header and a data payload, and the packet header includes a preamble and an indicated optimal spreading factor indication. The adaptive spreading factor algorithm includes:

[0099] The SNR (Signal to Noise Ratio) / RSSI (Received Signal Strength Indicator) of the channel is measured, and the value of the optimal spreading factor is set by comparing the SNR value with the size of a preset threshold. Specifically, two thresholds are set, which are threshold H and threshold M. Threshold H is a higher SNR threshold value. When the channel quality is very good (SNR≥H), the system can tolerate using a smaller spreading factor (SF) to exchange for a higher data rate, because the link margin is sufficient at this time. Threshold M is a lower SNR threshold value. When the channel quality is poor (SNR<M), in order to ensure the basic communication reliability, a larger spreading factor (SF) must be used to improve the processing gain and anti-interference ability. The two thresholds divide the SNR range into three intervals: SNR≥H: "good channel" interval, set the optimal spreading factor to 7 or 8 to maximize the data rate. M≤SNR<H: "moderate channel" interval, set the optimal spreading factor to 9 or 10. SNR<M: "poor channel" interval, set the optimal spreading factor to 11 or 12 to maximize the link robustness.

[0100] Alternatively, the size of the transmission reliability and the transmission energy consumption of the channel is dynamically balanced through RSSI, and the value of the optimal spreading factor is calculated, as shown in Figure 4 , including the following steps:

[0101] A set of RSSI samples of the channel is collected for sliding average filtering, and the standard deviation of the RSSI samples is calculated based on the filtered results The coefficient of variation of the channel RSSI is obtained as:

[0102] ;

[0103] ;

[0104] wherein, n is the sample number, is the nth RSSI sample; i The stability of the current channel communication environment is marked by comparing the coefficient of variation

[0105] with the size of a preset threshold; wherein, when the coefficient of variation is greater than the preset threshold (such as 0.3), it is marked as an unstable environment; otherwise, it is marked as a stable environment.

[0106] According to the environment marking result, the environmental noise reference of the current channel is calibrated and the effective RSSI value is calculated as:

[0107] ;

[0108] ; ​​​​

[0109] wherein, is the calibrated ambient noise reference; is the set of noise signals, represents the percentile;

[0110] based on further determines whether the decision tree model is available, if available, adopts the decision tree model to predict the initial spreading factor of the channel, denoted as wherein, represents the current battery voltage of the master end; if not available, adopts piecewise linear approximation, and selects the initial spreading factor according to the preset RSSI and spreading factor mapping table; wherein the value range of the initial spreading factor is an integer within 7 to 12;

[0111] further sends a test packet according to the initial spreading factor, and verifies the transmission reliability of the channel by measuring the packet loss rate, if the packet loss rate is greater than a preset value (such as 10%), the value of the initial spreading factor is increased and the test packet is re-sent for transmission reliability verification; otherwise, the current battery voltage of the master end is measured and the expected transmission time of the test packet is calculated for transmission energy optimization of the channel, if the battery voltage is less than a preset voltage (such as 3.3V) and the expected transmission time is greater than a preset time (such as 50ms), the value of the initial spreading factor is reduced, and the reduced value is output as the best spreading factor; otherwise, the initial spreading factor is directly output as the best spreading factor; wherein the expected transmission time is denoted as ; wherein, is the channel bandwidth, is the number of bits of the test packet payload.

[0112] After triggering the receiving process of the slave end, the slave end synchronously jumps to the same wireless communication channel as the master end and performs preamble detection, after successful preamble detection, parses the data packet header to obtain the best spreading factor, reconfigures the receiver spreading factor based on the best spreading factor, and after receiving the data payload, measures the received SNR / RSSI, sends ACK or NACK, and the master end receives the response. The condition for sending ACK is that the slave end successfully receives the data payload and satisfies the CRC check, that is, the data packet itself has no error in transmission, and ACK can be sent. The condition for sending NACK is that the CRC check fails or the data payload cannot be successfully demodulated (for example, the preamble or header detection is successful, but the payload demodulation fails), which explicitly informs the master end that the data packet is lost or damaged and needs to be retransmitted.

[0113] When the master end receives the NACK, the retransmission mechanism is triggered, and after the value of the optimal spreading factor of the current wireless communication channel where the master and slave ends are located is improved, the data packet is retransmitted to maintain the synchronous frequency hopping data transmission between the master and slave ends; when the master end receives the ACK, the channel quality database is updated, and it is judged whether the current wireless communication channel where the master and slave ends are located meets the preset frequency hopping condition (such as lower link quality). If it meets, the master end jumps to the next wireless communication channel, continues to calculate the optimal spreading factor of the next wireless communication channel, and retransmits the data packet to maintain the synchronous frequency hopping data transmission between the master and slave ends; if it does not meet, the master end continues to transmit the data packet in the current wireless communication channel, and maintains the synchronous frequency hopping data transmission between the master and slave ends. Specifically, the update of the channel quality database is a sliding average to ensure the stability of RSSI, the packet loss rate based on the time window is used to reflect the real-time quality, and the aging mechanism is used to forcibly refresh the closed loop update strategy formed by the channel evaluation.

[0114] The calculation of the optimal spreading factor further includes an anti-oscillation mechanism, which includes: detecting whether the latest calculated optimal spreading factor is consistent with the current spreading factor of the channel; if not, further detecting whether the time difference between the time when the latest data packet transmission in the channel is successfully completed and the current time is greater than a preset minimum maintenance time; if greater, updating the current spreading factor of the channel to the latest calculated optimal spreading factor; if consistent or if the time difference is less than or equal to the minimum maintenance time, keeping the current spreading factor of the channel unchanged.

[0115] It should be understood that the above adaptive spreading factor algorithm dynamically adjusts the spreading factor by monitoring the channel quality in real time, automatically switches to high SF to improve signal fault tolerance when interference is enhanced, and switches to low SF to improve transmission rate when interference is reduced, so that the dynamic anti-interference ability of the master and slave end communication is improved, and the master and slave end continuously maintain the optimal spreading factor for synchronous frequency hopping, which can avoid the problem of synchronization loss caused by parameter mismatch, and improve the reliability of data transmission between the master and slave end. And when calculating the optimal spreading factor, the anti-oscillation mechanism is introduced, which can avoid the extra energy consumption caused by frequent switching, and further improve the performance of the synchronous frequency hopping data transmission between the master and slave end.

[0116] In the above-mentioned two-way wireless communication frequency hopping method, the utilization rate of frequency spectrum resources is expanded by introducing multiple wireless communication channels and double base frequency channels, the frequency hopping power consumption is reduced, and when the communication line is disconnected and reconnected, the channel is self-checked to hop to other idle channels without interference, which can avoid channel collision when frequency hopping, improve the speed and success rate of reconnection after the master and slave end communication line is disconnected, and maintain the synchronous frequency hopping data transmission between the master and slave end based on the optimal spreading factor during normal communication, which greatly improves the synchronous reliability between the master and slave end and the quality of data transmission. This method is efficient, convenient and has higher reliability.

[0117] In one embodiment, a bidirectional wireless communication frequency hopping system is provided, which is applied to a bidirectional wireless communication connection between at least one master and at least one slave, comprising:

[0118] a channel presetting module, configured to preset a plurality of wireless communication channels arranged in a sequence of fixed channel intervals and increasing frequencies between the master and the slave, and preset a base frequency channel and at least one backup base frequency channel between the master and the slave;

[0119] a master frequency hopping module, configured to, when the communication between the master and the slave is disconnected, make the master hop from the base frequency channel to any wireless communication channel in sequence and send a signal connection frame for channel self-checking, and only when the wireless communication channel is idle and no interference exists, select the wireless communication channel as a current available wireless communication channel, make the master hop from the selected wireless communication channel back to the base frequency channel and send a signal connection frame for channel self-checking, if the base frequency channel is idle and no interference exists, make the master hop from the base frequency channel back to the selected wireless communication channel and enter a normal communication connection state by sending a communication connection frame, if the base frequency channel is not idle or interference exists, make the master hop from the base frequency channel to any backup base frequency channel in sequence and send a signal connection frame for channel self-checking, and only when the backup base frequency channel is idle and no interference exists, make the master hop from the backup base frequency channel back to the selected wireless communication channel and enter the normal communication connection state by sending a communication connection frame;

[0120] a slave frequency hopping module, configured to, when the communication between the master and the slave is disconnected, make the slave hop back and forth between the base frequency channel and the backup base frequency channel in a fixed interval period and work in a receiving state, when the slave receives the signal connection frame sent by the master, make the slave enter a sending state, send a signal ACK confirmation frame to the master, and after the signal ACK confirmation frame is sent, make the slave hop into the selected wireless communication channel of the master and re-enter the receiving state, and enter the normal communication connection state by receiving the communication connection frame sent by the master;

[0121] a synchronous frequency hopping data transmission module, configured to, when the master and the slave both enter the normal communication connection state, initialize the master and the slave to a synchronous frequency hopping sequence, calculate an optimal spreading factor of the wireless communication channel to which the master and the slave hop synchronously by using an adaptive spreading factor algorithm, and keep the synchronous frequency hopping data transmission between the master and the slave based on the optimal spreading factor.

[0122] The specific limitations of the bidirectional wireless communication frequency hopping system can be referred to the limitations of the bidirectional wireless communication frequency hopping method in the above, which will not be repeated here. The modules in the bidirectional wireless communication frequency hopping system can be realized by software, hardware and combinations thereof, in whole or in part. The modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory in the computer device in software form, so as to be called and executed by the processor to perform the operations corresponding to the modules.

[0123] In one embodiment, a computer device is provided, which can be a terminal, and its internal structure diagram can be as shown in Figure 5 The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is configured to communicate with external terminals through network connection. The computer program is executed by the processor to implement a bidirectional wireless communication frequency hopping method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball or touchpad arranged on the shell of the computer device, or an external keyboard, touchpad or mouse, etc.

[0124] Those skilled in the art can understand that Figure 5 the structure shown in the above embodiment is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.

[0125] In one embodiment, a computer device is provided, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the following steps:

[0126] a plurality of wireless communication channels arranged in a fixed manner between the master and the slave, and arranged in an order of increasing frequency in sequence, and a base frequency channel and at least one standby base frequency channel between the master and the slave are preset;

[0127] When the master-slave communication is disconnected, the master jumps from the base frequency channel to any wireless communication channel in turn and sends a signal connection frame to perform channel self-checking. Only when the wireless communication channel is idle and there is no interference, the selected wireless communication channel is selected as the current available wireless communication channel. The master jumps from the selected wireless communication channel back to the base frequency channel and sends a signal connection frame to perform channel self-checking. If the base frequency channel is idle and there is no interference, the master jumps from the base frequency channel back to the selected wireless communication channel and enters a normal communication connection state by sending a communication connection frame. If the base frequency channel is not idle or there is interference, the master jumps from the base frequency channel to any standby base frequency channel in turn and sends a signal connection frame to perform channel self-checking. Only when the standby base frequency channel is idle and there is no interference, the master jumps from the standby base frequency channel back to the selected wireless communication channel and enters a normal communication connection state by sending a communication connection frame.

[0128] When the master-slave communication is disconnected, the slave jumps between the base frequency channel and the standby base frequency channel at a fixed interval and works in a receiving state. When the slave receives a signal connection frame sent by the master, the slave enters a sending state, sends a signal ACK confirmation frame to the master, and jumps to the wireless communication channel selected by the master and reenters a receiving state after the signal ACK confirmation frame is sent. The slave enters a normal communication connection state by receiving a communication connection frame sent by the master.

[0129] When the master-slave communication is disconnected, the slave jumps between the base frequency channel and the standby base frequency channel at a fixed interval and works in a receiving state. When the slave receives a signal connection frame sent by the master, the slave enters a sending state, sends a signal ACK confirmation frame to the master, and jumps to the wireless communication channel selected by the master and reenters a receiving state after the signal ACK confirmation frame is sent. The slave enters a normal communication connection state by receiving a communication connection frame sent by the master.

[0130] In one embodiment, a computer readable storage medium is provided, and a computer program is stored on the computer readable storage medium. The computer program is executed by a processor to implement the following steps:

[0131] A plurality of wireless communication channels between the master and the slave are arranged in a fixed order according to frequency in ascending order, and a base frequency channel and at least one standby base frequency channel between the master and the slave are preset.

[0132] When the master-slave communication is disconnected, the master jumps from the base frequency channel to any wireless communication channel in turn and sends a signal connection frame to perform channel self-checking. Only when the wireless communication channel is idle and there is no interference, the selected wireless communication channel is selected as the current available wireless communication channel. The master jumps from the selected wireless communication channel back to the base frequency channel and sends a signal connection frame to perform channel self-checking. If the base frequency channel is idle and there is no interference, the master jumps from the base frequency channel back to the selected wireless communication channel and enters a normal communication connection state by sending a communication connection frame. If the base frequency channel is not idle or there is interference, the master jumps from the base frequency channel to any standby base frequency channel in turn and sends a signal connection frame to perform channel self-checking. Only when the standby base frequency channel is idle and there is no interference, the master jumps from the standby base frequency channel back to the selected wireless communication channel and enters a normal communication connection state by sending a communication connection frame.

[0133] When the master-slave communication is disconnected, the slave jumps between the base frequency channel and the standby base frequency channel at a fixed interval period and works in a receiving state. When the slave receives a signal connection frame sent by the master, the slave enters a sending state, sends a signal ACK confirmation frame to the master, and jumps to the wireless communication channel selected by the master and reenters a receiving state after the signal ACK confirmation frame is sent. The slave enters a normal communication connection state by receiving a communication connection frame sent by the master.

[0134] When the master-slave communication is disconnected, the slave jumps between the base frequency channel and the standby base frequency channel at a fixed interval period and works in a receiving state. When the slave receives a signal connection frame sent by the master, the slave enters a sending state, sends a signal ACK confirmation frame to the master, and jumps to the wireless communication channel selected by the master and reenters a receiving state after the signal ACK confirmation frame is sent. The slave enters a normal communication connection state by receiving a communication connection frame sent by the master.

[0135] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above-mentioned embodiment methods. Any reference to memory, storage, database or other medium used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct RAMbus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.

[0136] The technical features of the above embodiments can be combined in any way. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, but as long as the combinations of the technical features do not exist, they should be considered as the scope of the present application.

[0137] The above embodiments only express several implementation manners of the present application, and the description is specific and detailed, but it should not be understood as a limitation on the scope of the present application. It should be pointed out that for those skilled in the art, without departing from the concept of the present application, some modifications and improvements can be made, which are all within the protection scope of the present application.

Claims

1. A method for frequency hopping for two-way wireless communication, characterized by, The method is applied to a bidirectional wireless communication connection between at least one master terminal and at least one slave terminal, and the method comprises: presetting wireless communication channels arranged in order of increasing frequency with fixed channel intervals between the master terminal and the slave terminal, and presetting a base frequency channel and at least one backup base frequency channel between the master terminal and the slave terminal; when the master terminal and the slave terminal are disconnected, the master terminal jumps from the base frequency channel to any wireless communication channel in order and sends a signal connection frame to perform channel self-checking, only when the wireless communication channel is idle and there is no interference, the selected wireless communication channel is selected as a currently available wireless communication channel, the master terminal jumps from the selected wireless communication channel back to the base frequency channel and sends a signal connection frame to perform channel self-checking, if the base frequency channel is idle and there is no interference, the master terminal jumps from the base frequency channel back to the selected wireless communication channel and enters a normal communication connection state by sending a communication connection frame; if the base frequency channel is not idle or there is interference, the master terminal jumps from the base frequency channel to any backup base frequency channel in order and sends a signal connection frame to perform channel self-checking, only when the backup base frequency channel is idle and there is no interference, the master terminal jumps from the backup base frequency channel back to the selected wireless communication channel and enters a normal communication connection state by sending a communication connection frame; when the master terminal and the slave terminal are disconnected, the slave terminal jumps back and forth between the base frequency channel and the backup base frequency channel in a fixed interval period and works in a receiving state, when the slave terminal receives the signal connection frame sent by the master terminal, the slave terminal enters a sending state, sends a signal ACK confirmation frame to the master terminal, and after the signal ACK confirmation frame is sent, the slave terminal jumps into the selected wireless communication channel of the master terminal and reenters the receiving state, and enters a normal communication connection state by receiving the communication connection frame sent by the master terminal; when the master terminal and the slave terminal both enter a normal communication connection state, the master terminal and the slave terminal are initialized to a synchronous frequency hopping sequence, and an adaptive spreading factor algorithm is used to calculate the optimal spreading factor of the wireless communication channel to which the master terminal and the slave terminal synchronously jump, and based on the optimal spreading factor, synchronous frequency hopping data transmission between the master terminal and the slave terminal is maintained.

2. The method of claim 1, wherein, the master terminal jumps from the base frequency channel to any wireless communication channel in order and sends a signal connection frame to perform channel self-checking, comprising: for the plurality of wireless communication channels arranged in order of increasing frequency, the master terminal first jumps from the base frequency channel to the wireless communication channel with the lowest frequency and sends a signal connection frame to perform channel self-checking, if the wireless communication channel with the lowest frequency is not idle or there is interference, the master terminal jumps to the next wireless communication channel in order and sends a signal connection frame to perform channel self-checking, until the wireless communication channel to which the master terminal jumps is idle and there is no interference; if all the wireless communication channels are jumped in a round and the master terminal enters a normal communication connection state, the master terminal starts frequency hopping from the wireless communication channel with the lowest frequency again.

3. The method according to claim 1 or 2, characterized in that, the master terminal sends a plurality of signal connection frames to the slave terminal in the current channel, and after the signal connection frames are sent, the master terminal enters a receiving state and waits to receive a plurality of signal ACK confirmation frames sent by the slave terminal in succession; wherein the number of the signal connection frames sent by the master terminal is consistent with the number of the signal ACK confirmation frames sent by the slave terminal. ​ If the master end does not receive the signal ACK confirmation frame sent by the slave end within the preset time, it indicates that the current channel is not idle or there is interference; if the master end receives the signal ACK confirmation frame sent by the slave end within the preset time, it indicates that the current channel is idle and there is no interference.

4. The method of claim 1, wherein, The master end jumps back to the selected wireless communication channel from the base frequency channel or the standby base frequency channel, and enters the normal communication connection state by sending a communication connection frame, including: The master end jumps back to the selected wireless communication channel from the base frequency channel or the standby base frequency channel, and continuously sends a plurality of communication connection frames to the slave end in the selected wireless communication channel, and enters a receiving state after the communication connection frame is sent, waiting to receive a plurality of communication ACK confirmation frames continuously sent by the slave end; wherein the number of communication connection frames sent by the master end is consistent with the number of communication ACK confirmation frames sent by the slave end; If the master end does not receive the communication ACK confirmation frame sent by the slave end within the preset time, the master end jumps to any wireless communication channel from the selected wireless communication channel in turn, and sends a signal connection frame one by one for channel self-checking, until a new available wireless communication channel is selected, and the normal communication connection state is reattempted; if the master end receives the communication ACK confirmation frame sent by the slave end within the preset time, the master end enters the normal communication connection state.

5. The method of claim 4, wherein, The slave end jumps to the wireless communication channel selected by the master end and reenters the receiving state, and enters the normal communication connection state by receiving the communication connection frame sent by the master end, including: The slave end jumps to the wireless communication channel selected by the master end and reenters the receiving state, and waits to receive a plurality of communication connection frames continuously sent by the master end; If the slave end does not receive the communication connection frame sent by the master end within the preset time, the slave end jumps back to the base frequency channel or the standby base frequency channel from the selected wireless communication channel, and continues to jump back and forth between the base frequency channel and the standby base frequency channel at a fixed interval; if the slave end receives the communication connection frame sent by the master end within the preset time, the slave end enters a sending state and continuously sends a plurality of communication ACK confirmation frames to the master end, and the slave end enters the normal communication connection state.

6. The method of claim 1, wherein, The master and slave ends are initialized to a synchronous frequency hopping sequence, and an adaptive spreading factor algorithm is used to calculate the optimal spreading factor of the wireless communication channel of the synchronous hopping of the master and slave ends, and the synchronous hopping data transmission between the master and slave ends is maintained based on the optimal spreading factor, including: The master and slave ends are initialized to a synchronous frequency hopping sequence; The master end uses an adaptive spreading factor algorithm to calculate the optimal spreading factor of the current wireless communication channel, configures the physical layer parameters based on the optimal spreading factor, and sends a data packet to trigger the receiving process of the slave end; wherein the adaptive spreading factor algorithm includes: measuring the SNR / RSSI of the channel, setting the value of the optimal spreading factor by comparing the size of the SNR value with the preset threshold, or calculating the value of the optimal spreading factor by dynamically balancing the size of the transmission reliability and the transmission energy of the channel through RSSI; wherein the value of the optimal spreading factor ranges from 7 to 12; the data packet is composed of a packet header and a data payload, and the packet header includes a preamble and an indicated optimal spreading factor indication; From the end of the synchronization jump to the wireless communication channel consistent with the master and do preamble detection, after the preamble detection success, parse the data packet header to get the best spreading factor, based on the best spreading factor reconfiguration receiver spreading factor, and after receiving the data payload, by measuring the received SNR / RSSI, send ACK or NACK, received by the master response; When the master receives NACK, trigger retransmission mechanism, after the master and slave current wireless communication channel of the best spreading factor value is improved, resend the data packet to keep the synchronization between the master and slave frequency hopping data transmission; When the master receives ACK, update the channel quality database and determine whether the master and slave current wireless communication channel meets the preset frequency hopping condition, if yes, the master jumps to the next wireless communication channel, continue to calculate the best spreading factor of the next wireless communication channel, and resend the data packet to keep the synchronization between the master and slave frequency hopping data transmission; If not, the master continues to send data packets in the current wireless communication channel, and keeps the synchronization between the master and slave frequency hopping data transmission; The calculation of the best spreading factor also contains anti-oscillation mechanism, including: detecting whether the latest calculated best spreading factor is consistent with the current spreading factor of the channel; If not, further detect whether the time difference between the time when the latest data packet is successfully sent in the channel and the current time is greater than the preset minimum holding time, if yes, update the current spreading factor of the channel to the latest calculated best spreading factor; If consistent or if the time difference is less than or equal to the minimum holding time, keep the current spreading factor of the channel unchanged.

7. The method of claim 6, wherein, The best spreading factor value is calculated by dynamically balancing the transmission reliability and transmission energy consumption of the channel through RSSI, including: A set of RSSI samples of the channel is collected for a sliding average filter, and based on the standard deviation of the RSSI samples with the filtered result The coefficient of variation of the channel RSSI is obtained as: ; ; in, For the sample size, For the first i One RSSI sample; By comparing the coefficient of variation with the size of the preset threshold, the stability of the current channel communication environment is marked; wherein, when greater than the preset threshold, it is marked as an unstable environment; otherwise, it is marked as a stable environment; According to the environmental marker result, the environmental noise reference of the current channel is calibrated and the effective RSSI value is calculated as: ; ; wherein, is the calibrated ambient noise reference; is the set of noise signals, denotes the percentile; Based on Further determine whether the decision tree model is available, if available, adopt the decision tree model to predict the initial spreading factor of the channel, expressed as Wherein, Indicates the current battery voltage of the main end; if not available, adopt piecewise linear approximation, select the initial spreading factor according to the preset RSSI and spreading factor mapping table; wherein, the value range of the initial spreading factor is an integer within 7 to 12; Further according to the initial spreading factor, a test packet is sent, and transmission reliability of the channel is verified by measuring the packet loss rate, if the packet loss rate is greater than a preset value, the value of the initial spreading factor is increased, and the test packet is re-sent for transmission reliability verification; otherwise, the current battery voltage of the primary end is measured, and the expected transmission time of the test packet is calculated for transmission energy consumption optimization of the channel, if the battery voltage is less than a preset voltage and the expected transmission time is greater than a preset time, the value of the initial spreading factor is reduced, and the reduced value is output as the optimal spreading factor; otherwise, the initial spreading factor is directly output as the optimal spreading factor; wherein the expected transmission time is represented as ; wherein, is the channel bandwidth, is the number of bits of the test packet payload.

8. A bidirectional wireless communication frequency hopping system, characterized by The system is applied to bidirectional wireless communication connection between at least one master and at least one slave, and the system comprises: A channel preset module is used to preset a plurality of wireless communication channels arranged in order of increasing frequency with fixed channel spacing between the master and slave, and preset one base frequency channel and at least one standby base frequency channel between the master and slave; A channel quality database is used to record the quality of each channel between the master and slave, and the quality of each channel is calculated by measuring the RSSI value of each channel between the master and slave. The master end frequency hopping module is used for, when the master-slave end communication is disconnected, the master end hops from the base frequency channel to any wireless communication channel in turn and sends a signal connection frame to perform channel self-checking. Only when the wireless communication channel is idle and no interference exists, the selected wireless communication channel is selected as the current available wireless communication channel. The master end hops from the selected wireless communication channel back to the base frequency channel and sends a signal connection frame to perform channel self-checking. If the base frequency channel is idle and no interference exists, the master end hops from the base frequency channel back to the selected wireless communication channel again and enters a normal communication connection state by sending a communication connection frame. If the base frequency channel is not idle or interference exists, the master end hops from the base frequency channel to any standby base frequency channel in turn and sends a signal connection frame to perform channel self-checking. Only when the standby base frequency channel is idle and no interference exists, the master end hops from the standby base frequency channel back to the selected wireless communication channel and enters a normal communication connection state by sending a communication connection frame. The slave end frequency hopping module is used for, when the master-slave end communication is disconnected, the slave end hops between the base frequency channel and the standby base frequency channel in a fixed interval period and works in a receiving state. When the slave end receives a signal connection frame sent by the master end, the slave end enters a sending state, sends a signal ACK confirmation frame to the master end, and after the signal ACK confirmation frame is sent, the slave end hops into the selected wireless communication channel of the master end and reenters the receiving state to enter a normal communication connection state by receiving a communication connection frame sent by the master end. The synchronous frequency hopping data transmission module is used for, when the master-slave end both enter a normal communication connection state, initializing the master-slave end to be a synchronous frequency hopping sequence, and calculating an optimal spreading factor of the wireless communication channel of the master-slave end synchronous hopping by using an adaptive spreading factor algorithm. The synchronous frequency hopping data transmission between the master-slave end is maintained based on the optimal spreading factor. 9.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-8 when the computer program is executed by the processor. The processor executes the computer program to realize the steps of the method in any one of claims 1 to 7.

10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the steps of the method in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method of single receiver receiving different spreading factor sequences at low communication frequency

    CN106817148A

  • Adaptive adjustment frequency hopping communication method and device, equipment and storage medium

    CN119483636A