Wireless communication method, device, electronic device and storage medium based on frequency hopping
By receiving the available frequency array and random number information from the gateway device, the terminal device determines the frequency hopping sequence on its own, solving the problem of congestion in the 2.4GHz frequency band in the local area network protocol, realizing frequency hopping communication without the need for additional hardware, and improving communication security and efficiency.
Patent Information
- Application Number
- CN202511028714.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-25
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2045-07-25
AI Technical Summary
The 2.4GHz frequency band in existing LAN protocols is crowded, single-channel communication has poor anti-interference performance, and terminal devices need to increase hardware costs to achieve frequency hopping communication.
By receiving the available frequency array and random number information sent by the gateway device, the terminal device determines the frequency hopping sequence by itself and uses the system time to dynamically select the frequency to achieve frequency hopping communication without the need for additional hardware.
It saves the manufacturing cost of terminal equipment, ensures communication security, improves system reliability and communication efficiency, and reduces energy consumption and the probability of multi-node conflicts.
Smart Images

Figure CN120546727B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of wireless communication networks of the Internet, and in particular to a wireless communication method, device, electronic equipment and storage medium based on frequency hopping. Background Art
[0002] The 2.4GHz frequency band used primarily in local area network protocols such as Bluetooth Mesh, Zigbee, Thread, and Zwave is very crowded. Using a single channel for communication based on this has poor anti-interference performance and consumes a lot of power for active downlink communication of nodes. If frequency modulation communication is used in which the carrier frequency of the transmitted signals of the sender and receiver changes discretely according to a predetermined rule, the terminal device needs to have hardware such as a built-in field programmable gate array (FPGA) to perform tasks related to frequency hopping communication, such as calculating the frequency hopping sequence, thereby increasing the manufacturing cost of the communication equipment. Summary of the Invention
[0003] To address the above problems, the embodiments of the present application provide a wireless communication method, device, electronic device and storage medium based on frequency hopping. The solution of the present application can achieve frequency hopping communication without adding additional hardware, saving the manufacturing cost of communication equipment.
[0004] In a first aspect, an embodiment of the present application provides a wireless communication method based on frequency hopping, which is applied to a terminal device in a communication system, and the communication system also includes a gateway device. The method includes: receiving an available frequency array and random number information sent by the gateway device, the available frequency array including multiple available channel frequencies; determining the order of the multiple available channel frequencies according to the random number information, and forming a frequency hopping sequence according to the order of the multiple available channel frequencies; obtaining a first system time in real time, and determining a first frequency from the frequency hopping sequence according to the first system time; and executing a target communication task based on the first frequency, the target communication task including a sending task or a receiving task.
[0005] It can be seen that in the embodiment of the present application, the terminal device can determine the frequency hopping sequence based on the available frequency array and random number information sent by the gateway device to realize frequency hopping communication. Frequency hopping communication can be realized without the need to configure additional hardware for the terminal device, thereby saving the manufacturing cost of the terminal device.
[0006] In combination with the first aspect, in a possible embodiment, the order of multiple available channel frequency points is determined based on random number information, and a frequency hopping sequence is formed based on the order of the multiple available channel frequency points, including: S1: determining n=1, and determining that the array length of the available frequency point array is L; S2: calculating the remainder i of the random number divided by the array length, where the random number is determined based on the random number information; S3: determining the i-th frequency point in the available frequency point array as the n-th frequency point in the frequency hopping sequence; S4: deleting the i-th frequency point in the available frequency point array from the available frequency point array, and updating n to n+1 and L to L-1; repeating steps S2-S4 until L is 0.
[0007] It can be seen that in the embodiment of the present application, the frequency hopping sequence of multiple available channel frequencies is determined by calculating the remainder of the random number divided by the array length. The frequency hopping sequence will not be leaked during the transmission process, which ensures the security of communication. At the same time, there is no need to perform complex calculations to determine the order of the frequency hopping sequence, and there is no need to configure related computing hardware for the terminal device, which saves manufacturing costs.
[0008] In combination with the first aspect, in a possible embodiment, before executing the target communication task based on the first frequency point, the method also includes: connecting to the gateway device based on the channel corresponding to the first frequency point; receiving a broadcast message sent by the gateway device, the broadcast message is used to indicate the time slot type of multiple future communication time slots; wherein each time slot corresponds to an available frequency point, and the time slot type includes a broadcast time slot, a contention time slot, a designated time slot, a heartbeat communication time slot or a frequency hopping time slot; obtaining the second system time in real time, and determining the time slot type of the current communication time slot based on the broadcast message and the second system time.
[0009] It can be seen that in the embodiment of the present application, the mapping relationship between time slot types and frequencies is centrally managed through broadcast messages, and the communication window is accurately controlled in combination with system time, which not only meets the gateway's real-time downlink control requirements for the terminal, but also reduces the probability of multi-node conflicts through time division multiplexing. At the same time, the frequency hopping time slot is used to eliminate the timing deviation during channel switching, which significantly improves the system reliability and communication efficiency.
[0010] In combination with the first aspect, in a possible embodiment, if the time slot type of the current communication time slot is a contention time slot and the target communication task is a sending task, the target communication task is executed based on the first frequency point, including: encapsulating and encrypting the data to be sent of the target communication task according to a preset protocol format and writing it into a buffer; monitoring the channel corresponding to the first frequency point to obtain a first signal strength value of the channel corresponding to the first frequency point; if the first signal strength value is less than a first threshold; or the first signal strength value is less than a second threshold and no valid preamble code is detected in the channel corresponding to the first frequency point, then sending the data to be sent in the buffer to the gateway device; the first threshold is less than the second threshold; if the first signal strength value is not less than the second threshold; or is less than the second threshold but not less than the first threshold and a valid preamble code is detected in the channel corresponding to the first frequency point, then calculating the delayed sending time based on the first signal strength value and the frequency hopping time, the frequency hopping time being the interval time of the terminal device frequency hopping; after the delayed sending time, executing the target communication task based on the second frequency point, the second frequency point being the available channel frequency point corresponding to the next contention time slot in the frequency hopping sequence.
[0011] It can be seen that in the embodiment of the present application, by combining the quantified channel interference intensity and the existence of the preamble code, the immediate preemption or retreat frequency hopping strategy is dynamically selected, which not only avoids blind transmission in the strong interference channel, but also utilizes the frequency hopping time to achieve automatic avoidance of the interference channel; combined with the first-come, first-served characteristics of the competitive time slot, the channel utilization efficiency is significantly improved and energy consumption is reduced.
[0012] In combination with the first aspect, in a possible embodiment, the terminal device also includes multiple communication antennas, and the data to be sent in the buffer is sent to the gateway device, including: sending the data to be sent in the buffer to the gateway device based on the first communication antenna, the first communication antenna being a communication antenna among the multiple communication antennas whose transmission signal strength is not recorded; recording the transmission signal strength of the first communication antenna; if the number of recorded transmission signal strengths is the same as the number of multiple communication antennas, determining the optimal transmission antenna based on the transmission signal strengths of the multiple communication antennas; after the frequency hopping time, deleting the recorded transmission signal strength and canceling the record of the optimal transmitting antenna.
[0013] It can be seen that in the embodiment of the present application, the transmission performance of each communication antenna is fairly tested through a polling mechanism, and the antenna selection is dynamically optimized based on the objective signal strength feedback from the gateway device; combined with the mechanism of resetting the record of the frequency hopping cycle, the signal fluctuation problem caused by indoor multipath fading is effectively solved, while avoiding the communication blind spots caused by the polarization directionality of the antenna, and significantly improving the data transmission success rate.
[0014] In combination with the first aspect, in a possible embodiment, if the time slot type of the current communication time slot is a contention time slot and the target communication task is a receiving task, the target communication task is executed based on the first frequency point, including: determining the channel switching time limit according to the preamble code processing time and the channel switching time of the terminal device; detecting the valid preamble code corresponding to the target communication task in the channel or backup channel corresponding to the first frequency point, and switching the channel according to the channel switching time limit; when the valid preamble code corresponding to the target communication task is detected, stop switching the channel and receive the to-be-received data corresponding to the target communication task based on the current channel.
[0015] It can be seen that in the embodiment of the present application, the monitoring rhythm is dynamically controlled through preamble code processing and channel switching, and efficient collaborative monitoring of the two channels is achieved within the contention time slot; this design not only avoids the missed detection of effective preamble codes due to frequent switching, but also reduces the fragmentation of the receiving window through time limit constraints, significantly improving the success rate of message capture in an interference environment.
[0016] In combination with the first aspect, in a possible embodiment, the terminal device also includes multiple communication antennas. When a valid preamble code corresponding to the target communication task is detected, before stopping channel switching and receiving the data to be received corresponding to the target communication task based on the current channel, the method also includes: determining the antenna switching time limit based on the channel switching time limit, and the antenna switching time limit is greater than twice the channel switching time limit; connecting the channel or the backup channel corresponding to the first frequency point based on one of the multiple communication antennas, and switching the communication antenna according to the antenna switching time limit; when a valid preamble code corresponding to the target communication task is detected, stopping channel switching and receiving the data to be received corresponding to the target communication task based on the current channel, the method also includes: stopping switching the communication antenna and obtaining the background noise value of the current communication antenna; obtaining the preamble code reception time for receiving the valid preamble code corresponding to the target communication task; determining the signal strength compensation value based on the preamble code reception time, and the preamble code reception time is positively correlated with the signal strength compensation value; determining the received signal strength value of the current communication antenna based on the background noise value and the signal strength compensation value; if the received signal strength is greater than the preset signal strength, receiving the data to be received corresponding to the target communication task based on the current communication antenna.
[0017] It can be seen that in the embodiment of the present application, the integrity of the preamble code capture is ensured by time limit hierarchical control, and the signal measurement deviation introduced by antenna switching is eliminated by combining the delay compensation algorithm; this design significantly improves the accuracy of signal strength evaluation in multipath fading environment, avoids misjudgment caused by antenna polarization directionality, and enhances the robustness of data reception in weak signal scenarios.
[0018] In a second aspect, an embodiment of the present application provides a frequency hopping-based wireless communication device, which is a terminal device in a communication system. The communication system also includes a gateway device. The device includes:
[0019] A receiving unit, configured to receive an available frequency array and random number information sent by a gateway device, wherein the available frequency array includes a plurality of available channel frequencies;
[0020] a determining unit, configured to determine the order of a plurality of available channel frequencies according to the random number information, and form a frequency hopping sequence according to the order of the plurality of available channel frequencies;
[0021] an acquiring unit, configured to acquire a first system time in real time, and determine a first frequency point from a frequency hopping sequence according to the first system time;
[0022] The execution unit is configured to execute a target communication task based on the first frequency point, where the target communication task includes a sending task or a receiving task.
[0023] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and one or more instructions are suitable for being loaded by the processor and executing part or all of the methods of the first aspect and / or the second aspect.
[0024] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium that stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the method of the first aspect and / or the second aspect.
[0025] In a fifth aspect, the present application provides a computer program product, which, when read and executed by a computer, enables the computer to execute part or all of the method of the first aspect and / or the second aspect.
[0026] It can be understood that the beneficial effects of the embodiments of the second to fifth aspects can refer to the beneficial effects of the method of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0028] Figure 1 A schematic diagram of an application scenario of a frequency hopping-based wireless communication method provided in an embodiment of the present application;
[0029] Figure 2 A flowchart of a frequency hopping-based wireless communication method provided in an embodiment of the present application;
[0030] Figure 3 A schematic diagram of a synchronization message sending time node provided in an embodiment of the present application;
[0031] Figure 4 A schematic diagram of a communication time slot provided in an embodiment of the present application;
[0032] Figure 5 A flowchart of another frequency hopping-based wireless communication method provided in an embodiment of the present application;
[0033] Figure 6 A flowchart of another frequency hopping-based wireless communication method provided in an embodiment of the present application;
[0034] Figure 7 A schematic structural diagram of a frequency hopping-based wireless communication device provided in an embodiment of the present application;
[0035] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0036] Description of the accompanying figures: application scenario: 100; terminal device: 101; gateway device: 102; wireless communication device based on frequency hopping: 700; receiving unit: 701; determining unit: 702; acquiring unit: 703; executing unit: 704; electronic device: 800; memory: 801; processor: 802; communication interface: 803; bus: 804. DETAILED DESCRIPTION
[0037] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0038] The terms "first," "second," and the like in the specification and claims of this application and the accompanying drawings are used to distinguish between different objects, not to describe a particular order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.
[0039] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0040] The embodiments of the present application are described below with reference to the accompanying drawings.
[0041] Example 1: Please see Figure 1 , Figure 1 This is a schematic diagram of an application scenario for a frequency hopping-based wireless communication method provided in an embodiment of the present application. Application scenario 100 includes a terminal device 101 and a gateway device 102. Terminal device 101 may be an IoT device or a wireless communication device, more specifically a security device (e.g., a camera, access control device, or sensor device). Gateway device 102 is used to interconnect local area networks in application scenario 100 and also to interconnect local terminal device 101 with a wide area network.
[0042] In the subsequent description Figure 1 The example of any one of the multiple terminal devices 101 is used for explanation. In addition, in actual applications, a gateway device 102 may need to communicate with a large number of terminal devices 101 at the same time. The gateway device 102 and the terminal device 101 may also be connected through a repeater. The repeater here is also regarded as a terminal device 101 in Figure 1 Communication is performed in the application scenario 100 shown.
[0043] In the embodiment of the present application, the terminal device 101 receives an available frequency array and random number information sent by the gateway device 102, where the available frequency array includes multiple available channel frequencies.
[0044] The available frequency array is an array including multiple available channel frequencies, such as 2412 MHz (channel 1), 2417 MHz (channel 2), and 2422 MHz (channel 3). The random number information is used to refer to a random number, which is used to subsequently generate a frequency hopping sequence. The random number information can specifically be a random number seed and has a one-to-one correspondence with the random number, so that each terminal device 101 can determine the same random number based on the same random number information.
[0045] In addition, during subsequent communications, the background noise of the channel is sampled at a preset frequency to determine the signal strength of the channel corresponding to each available frequency point, thereby excluding the available frequency points corresponding to channels with lower signal strength from the frequency hopping sequence in real time or periodically.
[0046] The terminal device 101 determines the order of multiple available channel frequencies according to the random number information, and the order of the multiple available channel frequencies constitutes a frequency hopping sequence.
[0047] In this step, the terminal device 101 determines the order of multiple available channel frequencies according to the random number information. Specifically, the terminal device 101 can determine the corresponding random number through the random number information, and determine the frequency hopping sequence according to the random number.
[0048] For example, if the random number is "2", the terminal device 101 uses the "2nd" available channel frequency point in the original order of the available frequency point array as the first available channel frequency point in the frequency hopping sequence, and the third available channel frequency point in the original order of the available frequency point array as the second available channel frequency point in the frequency hopping sequence, and so on to obtain the frequency hopping sequence.
[0049] If the random number is "3124", the terminal device 101 arranges the available channel frequencies originally sorted as "3rd", "1st", "2nd", and "4th" in the available frequency array in order to obtain a frequency hopping sequence.
[0050] The terminal device 101 obtains the first system time in real time, and determines the first frequency point from the frequency hopping sequence according to the first system time.
[0051] After determining the frequency hopping sequence, the terminal device 101 obtains the first system time in real time, that is, the time when the entire communication system starts to operate, so that the first frequency point can be determined from the frequency hopping sequence according to the first system time, that is, the channel frequency point currently used by the entire communication system.
[0052] The terminal device 101 performs a target communication task based on the first frequency point, where the target communication task includes a sending task or a receiving task.
[0053] After determining the first frequency point, the terminal device 101 communicates with the gateway device 102 based on the first frequency point, thereby performing the target communication task.
[0054] It can be seen that in the embodiment of the present application, the terminal device can determine the frequency hopping sequence based on the available frequency array and random number information sent by the gateway device to realize frequency hopping communication. Frequency hopping communication can be realized without the need to configure additional hardware for the terminal device, thereby saving the manufacturing cost of the terminal device.
[0055] Figure 2 A flow chart of a wireless communication method based on frequency hopping provided in an embodiment of the present application is shown as follows: Figure 2 As shown, steps S201-S204 are included.
[0056] S201: The terminal device receives an available frequency array and random number information sent by a gateway device, where the available frequency array includes multiple available channel frequencies.
[0057] The terminal device receives the available frequency array and random number information sent by the gateway device, where the available frequency array is determined based on the frequency band used for communication, and the random number information is used to arrange multiple available channel frequencies included in the available frequency array to obtain a frequency hopping sequence.
[0058] S202: The terminal device determines the order of multiple available channel frequencies according to the random number information, and forms a frequency hopping sequence according to the order of the multiple available channel frequencies.
[0059] In a possible embodiment, the order of multiple available channel frequencies is determined based on random number information, and a frequency hopping sequence is formed based on the order of the multiple available channel frequencies, including: S1: determining n=1, and determining that the array length of the available frequency array is L; S2: calculating the remainder i of dividing the random number by the array length, where the random number is determined based on the random number information; S3: determining the i-th frequency in the available frequency array as the n-th frequency in the frequency hopping sequence; S4: deleting the i-th frequency in the available frequency array from the available frequency array, and updating n to n+1 and L to L-1; and repeating steps S2-S4 until the array length L is 0.
[0060] Specifically, in this example, the frequency hopping sequence is determined through steps S1 to S4. Here, the detailed steps of determining the first frequency point in the frequency hopping sequence are taken as an example for description.
[0061] First, the length of the available frequency array is determined to be L. The value of L is determined according to the number of available frequency points in the available frequency array and can be 11, 5, 7, etc.
[0062] Calculate the remainder i of the random number divided by the array length L; for example, if the random number is 20 and the length is 7, the remainder of 20 divided by 7 is 6, then the value of i is 6.
[0063] After the value of i is determined, the i-th frequency in the available frequency array is determined as the first frequency in the frequency hopping sequence. It should be noted that the value of i here is the remainder of the random number divided by the array length L. This ensures that the value of i is less than L, thus preventing the i-th frequency from not existing in the array.
[0064] After the first frequency point is determined, n is updated to n+1, which means that the next repetition of steps S1-S4 is to determine the second frequency point; L is updated to L-1, which means that after the i-th frequency point in the available frequency point array is deleted from the available frequency point array, the array length is reduced by 1.
[0065] Furthermore, if the value of L is 1 (i.e., there is only the last available channel frequency point left in the available frequency point array), there is no need to repeat steps S2-S4, and the last available channel frequency point in the available frequency point array can be directly determined as the last frequency point in the frequency hopping sequence.
[0066] It can be seen that in the embodiment of the present application, the frequency hopping sequence of multiple available channel frequencies is determined by calculating the remainder of the random number divided by the array length. The frequency hopping sequence will not be leaked during the transmission process, which ensures the security of communication. At the same time, there is no need to perform complex calculations to determine the order of the frequency hopping sequence, and there is no need to configure related computing hardware for the terminal device, which saves manufacturing costs.
[0067] In a possible embodiment, the terminal device includes a clock module, and the first system time is generated by the clock module; before obtaining the first system time, the method also includes: sending a time synchronization request to the gateway device based on a backup frequency point; receiving a synchronization message sent by the gateway device in response to the time synchronization request, the synchronization message including a sending timestamp; calculating the sending delay and receiving delay of the synchronization message based on the message length of the synchronization message; determining the standard time when the synchronization message is received based on the sending timestamp, the sending delay and the receiving delay; determining the local time when the synchronization message is received; and calibrating the clock module according to the standard time and the local time.
[0068] Specifically, in an embodiment of the present application, when a terminal device is first powered on or detects a time deviation, it sends a time synchronization request to the gateway device via the channel corresponding to the backup frequency. The gateway device responds with a synchronization message containing a send timestamp, which is the instantaneous value read from its internal clock module when the gateway device calls the send interface.
[0069] To synchronize time, the terminal device needs to calculate the following delays based on the message length and content of the synchronization message: Transmission delay: determined by the pre-calibrated terminal device processing delay and RF front-end delay.
[0070] Receive delay: records the difference between the time when the RF chip is interrupted and the time when the software processing is completed.
[0071] Message transmission delay: Calculated based on the message length and communication rate of the synchronization message (message transmission delay is short and therefore usually negligible).
[0072] The terminal device reconstructs the precise time reference using the formula "standard time = sending timestamp + sending delay + message transmission delay + receiving delay" and calibrates it by comparing it with the time recorded by the terminal device's clock module.
[0073] See Figure 3 , Figure 3A schematic diagram of the sending time nodes of a synchronization message provided in an embodiment of the present application, first, the gateway device records the sending timestamp of the synchronization message, and sends the synchronization message to the terminal device, wherein the time required for message processing and sending is the sending delay, which the terminal device can calculate based on the message length and communication rate of the synchronization message.
[0074] After the synchronization message is sent to the terminal device, the terminal device needs to process the message and read the data in the message. The time required is the reception delay. At the local time point, the terminal device confirms that the synchronization message has been received and records the local time. At the same time, based on the sending timestamp + sending delay + receiving delay, the standard time at the time of receiving the synchronization message is obtained. Then, time synchronization is performed based on the difference between the local time and the standard time. The local time is calibrated to the standard time.
[0075] In addition, during time synchronization, the terminal device also calibrates the frequency offset of the clock module (Real-Time Clock, RTC). The frequency offset of the clock module is the remainder of the difference between the standard time and the local time, divided by the time interval since the last synchronization.
[0076] After calculating the frequency deviation of the clock module, a capacitor matching tuning mechanism is used to compensate for it. When the calculated frequency deviation is positive, the capacitor value is reduced; when it is negative, the capacitor value is increased, with each step adjusting the capacitance by one unit.
[0077] In addition, it should be noted that the backup channel here is the channel corresponding to the fixed backup channel frequency. The frequency hopping communication between the terminal device and the gateway device changes the frequency of the main channel (that is, the first frequency, second frequency, etc. described in this article in the frequency hopping sequence). The frequency of the backup channel is not in the frequency hopping sequence. The terminal device will use the backup channel to communicate with the gateway device in special communication tasks such as time synchronization.
[0078] Furthermore, the terminal device can also operate in a backup channel communication mode, by waking up according to a preset period, communicating with the gateway device based on the backup channel after each wakeup, and sleeping for the rest of the time to achieve the effect of reducing energy consumption.
[0079] It can be seen that in the embodiment of the present application, high-precision time synchronization between the terminal device and the gateway device is achieved by accurately quantifying the delay of each stage of synchronization message transmission, combining timestamp capture and dynamic compensation of the clock module.
[0080] S203: The terminal device obtains the first system time in real time, and determines the first frequency point from the frequency hopping sequence according to the first system time.
[0081] The terminal device here obtains the first system time in real time in order to determine which frequency point in the frequency hopping sequence should be used for communication (i.e., the first frequency point) under the first system time. For example, the frequency hopping sequence includes three frequency points, and the frequency hopping time is 400ms (i.e., frequency hopping is performed every 400ms). If the system time indicates that the current communication time is the 200ms after the start of communication, then the communication is based on the first frequency point in the frequency hopping sequence. If the system time indicates that the current communication time is the 600ms after the start of communication, then the communication is based on the second frequency point in the frequency hopping sequence.
[0082] In a possible embodiment, before executing the target communication task based on the first frequency point, the method also includes: connecting to the gateway device based on the channel corresponding to the first frequency point; receiving a broadcast message sent by the gateway device, the broadcast message is used to indicate the time slot type of multiple future communication time slots; wherein each time slot corresponds to an available frequency point, and the time slot type includes a broadcast time slot, a contention time slot, a designated time slot, a heartbeat communication time slot or a frequency hopping time slot; obtaining the second system time in real time, and determining the time slot type of the current communication time slot based on the broadcast message and the second system time.
[0083] Specifically, in an embodiment of the present application, after the terminal device hops to the first frequency point, it needs to first establish a connection with the gateway device and receive the broadcast message sent by the gateway device (the broadcast message is sent through the broadcast time slot, which will be explained in detail later).
[0084] Each time slot corresponds to an available frequency. Since the available frequencies hop according to a preset fixed hopping time, for multiple adjacent time slots, if the total duration does not exceed one hopping time, they correspond to the same available frequency; if the total duration exceeds one hopping time, they correspond to two or more available frequencies.
[0085] The time slot types include broadcast time slot, contention time slot, designated time slot, heartbeat communication time slot or frequency hopping time slot.
[0086] The broadcast time slot is used by the terminal device to receive the broadcast message sent by the gateway device, so as to obtain information such as the division rules and duration of multiple time slots in the subsequent communication process.
[0087] The contention time slot is used for multiple terminal devices to communicate with the gateway device in a competitive manner. The terminal device that establishes communication first has priority in uploading or sending information to the gateway device.
[0088] Designated time slots are used to send or receive periodic or large amounts of data. Such time slots need to be specified in advance by the gateway device. In the designated time slots, the gateway device will communicate with the designated terminal device, and the designated terminal device does not need to compete with other terminal devices.
[0089] The heartbeat communication time slot is used for periodic heartbeat communication between terminal devices and gateway devices in the wireless system. The heartbeat time slots between terminals will be staggered to avoid conflicts.
[0090] Frequency hopping time slots are used to perform frequency hopping operations between terminal device channel switching. No communication is allowed at this time. This is used to improve robustness by immunizing against the impact of time deviation between the two parties.
[0091] For example, see Figure 4 , Figure 4 A schematic diagram of a communication time slot provided in an embodiment of the present application.
[0092] exist Figure 4 In the communication slot sequence shown, frequency hopping occurs every 400ms. Unmarked slots along the way are frequency hopping slots (e.g., the slot between F1 and H2). Slot B is a broadcast slot, slots H1-H4 are heartbeat communication slots, and slots F1-F5 are either contention slots or designated slots. The specific types of F1-F5 are determined by the gateway device.
[0093] Frequency hopping is performed every 400ms, which means that the time slots between 0-400ms are all based on the channel corresponding to the same frequency for communication.
[0094] The terminal device matches the start time offset of each time slot in the message based on the second system time to determine the current time slot type. If the target communication task needs to be executed, it needs to wait until the corresponding communication time slot arrives.
[0095] It can be seen that in the embodiment of the present application, the mapping relationship between time slot types and frequencies is centrally managed through broadcast messages, and the communication window is accurately controlled in combination with system time, which not only meets the gateway's real-time downlink control requirements for the terminal, but also reduces the probability of multi-node conflicts through time division multiplexing. At the same time, the frequency hopping time slot is used to eliminate the timing deviation during channel switching, which significantly improves the system reliability and communication efficiency.
[0096] S204: The terminal device performs a target communication task based on the first frequency point, where the target communication task includes a sending task or a receiving task.
[0097] Example 2: In Example 1, a wireless communication method that does not distinguish between communication task categories is described. Based on this, and taking into account the specific category of the target communication task, this embodiment of the present application also provides a more detailed wireless communication method based on frequency hopping. In this embodiment, the time slot type of the communication time slot is a contention time slot, and the target communication task is a sending task.
[0098] See Figure 5 , Figure 5This is a flow chart of another frequency hopping-based wireless communication method provided in an embodiment of the present application, including steps S501-S509.
[0099] S501: The terminal device receives an available frequency array and random number information sent by a gateway device, where the available frequency array includes multiple available channel frequencies.
[0100] S502: The terminal device determines the order of multiple available channel frequencies according to the random number information, and forms a frequency hopping sequence according to the order of the multiple available channel frequencies.
[0101] S503: The terminal device obtains the first system time in real time, and determines the first frequency point from the frequency hopping sequence according to the first system time.
[0102] S504: The terminal device performs a target communication task based on the first frequency point, where the target communication task includes a sending task or a receiving task.
[0103] For detailed descriptions of steps S501-S504, please refer to the relevant descriptions of steps S201-S204, which will not be repeated here.
[0104] S505: The terminal device encapsulates and encrypts the data to be sent of the target communication task according to a preset protocol format and writes the data into the buffer.
[0105] In an embodiment of the present application, when a terminal device needs to send data in a contention time slot, the data is first encapsulated and encrypted and stored in a FIFO buffer so that the data can be sent at any time.
[0106] S506: The terminal device monitors the channel corresponding to the first frequency point and obtains a first signal strength value of the channel corresponding to the first frequency point.
[0107] S507: If the first signal strength value is less than the first threshold; or the first signal strength value is less than the second threshold and no valid preamble code is detected in the channel corresponding to the first frequency point, the terminal device sends the data to be sent in the buffer to the gateway device; the first threshold is less than the second threshold.
[0108] Specifically, when sending data to be sent in the buffer to the gateway device, it is also necessary to set the initial transmission power, where the default value of the transmission power is (maximum value, median value or minimum value), and wait for the object to respond and echo the received signal strength.
[0109] If a response is successfully received, when the echoed signal strength is less than the preset signal strength, the initial transmit power is increased step by step (for example, by 0.5dBm); if it is not less than the preset signal strength, the initial transmit power is decreased step by step (for example, by 0.5dBm); if no response is received, the initial transmit power is restored to the default maximum value.
[0110] S508: If the first signal strength value is not less than the second threshold; or is less than the second threshold but not less than the first threshold and a valid preamble code is detected in the channel corresponding to the first frequency point, the terminal device calculates the delayed sending time based on the first signal strength value and the frequency hopping time, where the frequency hopping time is the interval time of the terminal device's frequency hopping.
[0111] It should be noted that dual detection is performed during the channel monitoring phase, including signal strength detection: reading the real-time first signal strength value of the channel corresponding to the first frequency point, which includes the sum of background noise and interference signals; and preamble code detection: scanning the channel for a valid preamble code.
[0112] The following describes the send decision logic. Immediate send conditions (either of which is met): The first signal strength value is less than the first threshold; The first signal strength value is less than the second threshold and no valid preamble is detected. Delay backoff conditions (either of which is met): The first signal strength value is not less than the second threshold; The first signal strength value is less than the second threshold but not less than the first threshold and a valid preamble is detected.
[0113] Delayed transmission time = preset basic time × (120 + first signal strength value) + frequency hopping time. It should be noted that the frequency hopping time is fixed and the first signal strength value is a negative number. After the delay ends, the terminal device and gateway device have switched to the second frequency corresponding to the next contention time slot in the frequency hopping sequence.
[0114] S509: The terminal device performs the target communication task based on the second frequency point after the delayed transmission time, and the second frequency point is the available channel frequency point corresponding to the next contention time slot in the frequency hopping sequence.
[0115] It can be seen that in the embodiment of the present application, by combining the quantified channel interference intensity and the existence of the preamble code, the immediate preemption or retreat frequency hopping strategy is dynamically selected, which not only avoids blind transmission in the strong interference channel, but also utilizes the frequency hopping time to achieve automatic avoidance of the interference channel; combined with the first-come, first-served characteristics of the competitive time slot, the channel utilization efficiency is significantly improved and energy consumption is reduced.
[0116] In a possible embodiment, the terminal device also includes multiple communication antennas, and sending the data to be sent in the buffer to the gateway device includes: sending the data to be sent in the buffer to the gateway device based on the first communication antenna, the first communication antenna being a communication antenna among the multiple communication antennas whose transmission signal strength is not recorded; recording the transmission signal strength of the first communication antenna; if the number of recorded transmission signal strengths is the same as the number of multiple communication antennas, determining the optimal transmission antenna based on the transmission signal strengths of the multiple communication antennas; after the frequency hopping time, deleting the recorded transmission signal strength and canceling the record of the optimal transmitting antenna.
[0117] Specifically, in this embodiment of the present application, when a terminal device transmits for the first time, it automatically selects a communication antenna for which no transmit signal strength has been recorded. After the transmission is complete, the transmit signal strength of that antenna is recorded, and this strength value is obtained by parsing the response message from the gateway device. When all communication antennas have completed signal strength recording, the optimal transmit antenna is determined: invalid records for which no response has been received are excluded (if no response packet is received, the signal is considered invalid). The transmit signal strength values of valid records are compared, and the communication antenna with the maximum value is selected as the optimal transmit antenna (the optimal value is selected based on comprehensive comparison).
[0118] After the frequency hopping time (400ms cycle) ends, the terminal device automatically clears the transmit signal strength records of all antennas and the optimal transmit antenna mark to ensure that the channel conditions are re-evaluated after the next frequency hopping.
[0119] Furthermore, if the optimal transmitting antenna has been determined, all transmitting tasks of the terminal device will be executed based on the optimal transmitting antenna before the next frequency hopping. In addition, if the optimal transmitting antenna retransmits more than a preset number of times during the execution of the transmitting task, the optimal transmitting antenna mark will be cancelled and the optimal transmitting antenna will be re-determined based on the signing step.
[0120] It can be seen that in the embodiment of the present application, the transmission performance of each communication antenna is fairly tested through a polling mechanism, and the antenna selection is dynamically optimized based on the objective signal strength feedback from the gateway device; combined with the mechanism of resetting the record of the frequency hopping cycle, the signal fluctuation problem caused by indoor multipath fading is effectively solved, while avoiding the communication blind spots caused by the polarization directionality of the antenna, and significantly improving the data transmission success rate.
[0121] Example 3: In Example 2, a wireless communication method is described in which the time slot type of the communication time slot is a contention time slot and the target communication task is a transmission task. This embodiment of the present application also provides a more detailed wireless communication method based on frequency hopping. In this embodiment, the time slot type of the communication time slot is a contention time slot and the target communication task is a reception task.
[0122] See Figure 6 , Figure 6 This is a flow chart of another frequency hopping-based wireless communication method provided in an embodiment of the present application, including steps S601-S607.
[0123] S601: The terminal device receives an available frequency array and random number information sent by a gateway device, where the available frequency array includes multiple available channel frequencies.
[0124] S602: The terminal device determines the order of multiple available channel frequencies according to the random number information, and forms a frequency hopping sequence according to the order of the multiple available channel frequencies.
[0125] S603: The terminal device obtains the first system time in real time, and determines the first frequency point from the frequency hopping sequence according to the first system time.
[0126] S604: The terminal device performs a target communication task based on the first frequency point, where the target communication task includes a sending task or a receiving task.
[0127] For detailed descriptions of steps S601-S604, please refer to the relevant descriptions of steps S201-S204, which will not be repeated here.
[0128] S605: Determine the channel switching time limit according to the preamble processing time and the channel switching time of the terminal device.
[0129] Specifically, it should be noted that the preamble processing time includes the hardware delay of the radio frequency chip used for communication in the terminal device detecting a valid preamble and the delay of the software processing interrupt.
[0130] The channel switching time limit here refers to the execution delay of the channel switching instruction. The channel switching time is determined by the sum of the preamble processing time and the channel switching time. This is to ensure that the preamble detection time in each channel is not less than the sum of the preamble processing time and the channel switching time. This prevents the terminal device from failing to recognize the preamble in time when detecting the preamble in each channel and requiring a channel switch.
[0131] S606: The terminal device detects a valid preamble code corresponding to the target communication task in the channel corresponding to the first frequency point or the backup channel, and switches the channel according to the channel switching time limit.
[0132] Specifically, the terminal device switches between the primary channel and the backup channel corresponding to the first frequency point based on the channel switching time limit, thereby attempting to detect the valid preamble code corresponding to the target communication task on the primary channel and the backup channel respectively. This achieves time-division detection of the primary channel and the backup channel.
[0133] S607: When a valid preamble code corresponding to the target communication task is detected, the terminal device stops switching channels and receives the to-be-received data corresponding to the target communication task based on the current channel.
[0134] It can be seen that in the embodiment of the present application, the monitoring rhythm is dynamically controlled through preamble code processing and channel switching, and efficient collaborative monitoring of the two channels is achieved within the contention time slot; this design not only avoids the missed detection of effective preamble codes due to frequent switching, but also reduces the fragmentation of the receiving window through time limit constraints, significantly improving the success rate of message capture in an interference environment.
[0135] In a possible embodiment, the terminal device also includes multiple communication antennas. When a valid preamble code corresponding to the target communication task is detected, before stopping channel switching and receiving the data to be received corresponding to the target communication task based on the current channel, the method also includes: determining the antenna switching time limit based on the channel switching time limit, the antenna switching time limit is greater than twice the channel switching time limit; connecting the channel or the backup channel corresponding to the first frequency point based on one of the multiple communication antennas, and switching the communication antenna according to the antenna switching time limit; when a valid preamble code corresponding to the target communication task is detected, after stopping channel switching and receiving the data to be received corresponding to the target communication task based on the current channel, the method also includes: stopping switching the communication antenna and obtaining the background noise value of the current communication antenna; obtaining the preamble code reception time for receiving the valid preamble code corresponding to the target communication task; determining the signal strength compensation value based on the preamble code reception time, the preamble code reception time is positively correlated with the signal strength compensation value; determining the received signal strength value of the current communication antenna based on the background noise value and the signal strength compensation value; if the received signal strength is greater than the preset signal strength, receiving the data to be received corresponding to the target communication task based on the current communication antenna.
[0136] Specifically, in an embodiment of the present application, the terminal device performs a dual-antenna optimization process during the preamble code reception stage, thereby selecting the optimal antenna to perform the sending task.
[0137] First, before detecting a valid preamble and locking the communication channel, the antenna switching time limit needs to be determined based on the channel switching time limit. The antenna switching time limit needs to be greater than twice the channel switching time limit to ensure that each communication antenna is used and detects the primary channel at least once and the backup channel at least once.
[0138] Furthermore, the antenna switching time limit is also shorter than the minimum duration of a valid preamble code, thereby preventing the preamble code from being missed due to the switching.
[0139] After determining the antenna switching time limit, the terminal device will cyclically switch the communication antenna on the channel corresponding to the first frequency or the backup channel according to the antenna switching time limit. Antenna switching will be frozen until a valid preamble is detected. The preamble reception time (i.e., the interval between antenna switching and successful detection) is recorded. The received signal strength value of the currently used communication antenna is then calculated.
[0140] First, the current signal strength compensation value is calculated: the signal strength compensation value is the product of the preamble code reception time and the preset linear coefficient, which compensates for the signal attenuation caused by the antenna switching delay.
[0141] The final received signal strength value = the original measurement value + the signal strength compensation value - the current background noise value. Only when the compensated received signal strength is greater than the preset signal strength will the current communication antenna continue to receive payload data; otherwise, the antenna will be switched and the process will be retried.
[0142] It can be seen that in the embodiment of the present application, the integrity of the preamble code capture is ensured by time limit hierarchical control, and the signal measurement deviation introduced by antenna switching is eliminated by combining the delay compensation algorithm; this design significantly improves the accuracy of signal strength evaluation in multipath fading environment, avoids misjudgment caused by antenna polarization directionality, and enhances the robustness of data reception in weak signal scenarios.
[0143] By implementing the method in the above-mentioned application embodiment, it can be seen that the frequency hopping sequence can be determined based on the available frequency array and random number information sent by the gateway device, frequency hopping communication is realized, and the manufacturing cost of the terminal device is saved; the time slot type and frequency mapping relationship is centrally managed by broadcasting messages, and the communication window is accurately controlled in combination with the system time, thereby improving the reliability and communication efficiency of the system; by quantifying the combination of channel interference intensity and the existence of the preamble code, the channel utilization efficiency is improved and energy consumption is reduced; by dynamically controlling the monitoring rhythm through preamble code processing and channel switching, the message capture success rate in an interference environment is improved; through multiple communication antennas, the data transmission success rate is significantly improved, and the data reception robustness in weak signal scenarios is enhanced.
[0144] Based on the description of the above configuration method embodiment, the present application also provides a frequency hopping based wireless communication device 700, which can be a wireless communication device running on Figure 1 A computer program (including program code) in the terminal device 101 shown, and used to execute Figure 2 、 Figure 5 and Figure 6 See the method shown in . Figure 7 , Figure 7 This is a schematic structural diagram of a frequency hopping-based wireless communication device provided in an embodiment of the present application. The frequency hopping-based wireless communication device 700 includes:
[0145] The receiving unit 701 is configured to receive an available frequency array and random number information sent by a gateway device, where the available frequency array includes multiple available channel frequencies;
[0146] a determining unit 702, configured to determine an order of multiple available channel frequencies according to the random number information, and form a frequency hopping sequence according to the order of the multiple available channel frequencies;
[0147] An acquiring unit 703 is configured to acquire a first system time in real time and determine a first frequency point from a frequency hopping sequence according to the first system time;
[0148] The execution unit 704 is configured to execute a target communication task based on the first frequency point, where the target communication task includes a sending task or a receiving task.
[0149] In a possible embodiment, in terms of determining the order of multiple available channel frequency points based on random number information and forming a frequency hopping sequence based on the order of the multiple available channel frequency points, the determination unit 702 is further specifically used to: S1: determine n=1, and determine that the array length of the available frequency point array is L; S2: calculate the remainder i of the random number divided by the array length, where the random number is determined based on the random number information; S3: determine the i-th frequency point in the available frequency point array as the n-th frequency point in the frequency hopping sequence; S4: delete the i-th frequency point in the available frequency point array from the available frequency point array, and update n to n+1 and L to L-1; and repeat steps S2-S4 until the array length L is 0.
[0150] In a possible embodiment, before executing the target communication task based on the first frequency point, the receiving unit 701 is further specifically used to: connect to the gateway device based on the channel corresponding to the first frequency point; receive a broadcast message sent by the gateway device, the broadcast message is used to indicate the time slot type of multiple future communication time slots; wherein each time slot corresponds to an available frequency point, and the time slot type includes a broadcast time slot, a contention time slot, a designated time slot, a heartbeat communication time slot or a frequency hopping time slot; obtain the second system time in real time, and determine the time slot type of the current communication time slot based on the broadcast message and the second system time.
[0151] In a possible embodiment, if the time slot type of the current communication time slot is a contention time slot and the target communication task is a sending task, in terms of executing the target communication task based on the first frequency point, the execution unit 704 is further specifically used to: encapsulate and encrypt the data to be sent of the target communication task in a preset protocol format and write it into the buffer; monitor the channel corresponding to the first frequency point to obtain a first signal strength value of the channel corresponding to the first frequency point; if the first signal strength value is less than a first threshold; or the first signal strength value is less than a second threshold and no valid preamble code is detected in the channel corresponding to the first frequency point, then send the data to be sent in the buffer to the gateway device; the first threshold is less than the second threshold; if the first signal strength value is not less than the second threshold; or is less than the second threshold but not less than the first threshold and a valid preamble code is detected in the channel corresponding to the first frequency point, then calculate the delayed sending time according to the first signal strength value and the frequency hopping time, where the frequency hopping time is the interval time of the terminal device frequency hopping; after the delayed sending time, execute the target communication task based on the second frequency point, where the second frequency point is the available channel frequency point corresponding to the next contention time slot in the frequency hopping sequence.
[0152] In a possible embodiment, the terminal device also includes multiple communication antennas. In terms of sending the data to be sent in the buffer to the gateway device, the execution unit 704 is also specifically used to: send the data to be sent in the buffer to the gateway device based on the first communication antenna, the first communication antenna is a communication antenna among the multiple communication antennas whose transmission signal strength is not recorded; record the transmission signal strength of the first communication antenna; if the number of recorded transmission signal strengths is the same as the number of multiple communication antennas, determine the optimal transmission antenna based on the transmission signal strengths of the multiple communication antennas; after the frequency hopping time, delete the recorded transmission signal strength and cancel the record of the optimal transmitting antenna.
[0153] In a possible embodiment, if the time slot type of the current communication time slot is a contention time slot and the target communication task is a receiving task, in terms of executing the target communication task based on the first frequency point, the execution unit 704 is also specifically used to: determine the channel switching time limit according to the preamble code processing time and the channel switching time of the terminal device; detect the valid preamble code corresponding to the target communication task in the channel or spare channel corresponding to the first frequency point, and switch the channel according to the channel switching time limit; when the valid preamble code corresponding to the target communication task is detected, stop switching the channel and receive the to-be-received data corresponding to the target communication task based on the current channel.
[0154] In a possible embodiment, the terminal device further includes multiple communication antennas. Before stopping channel switching and receiving the to-be-received data corresponding to the target communication task based on the current channel when a valid preamble corresponding to the target communication task is detected, the execution unit 704 is further specifically configured to: determine an antenna switching time limit based on the channel switching time limit, wherein the antenna switching time limit is greater than twice the channel switching time limit; connect a channel corresponding to the first frequency point or a backup channel based on one of the multiple communication antennas, and switch the communication antenna according to the antenna switching time limit; after stopping channel switching and receiving the to-be-received data corresponding to the target communication task based on the current channel when a valid preamble corresponding to the target communication task is detected, the execution unit 704 is further specifically configured to: stop switching the communication antenna and obtain a background noise value of the current communication antenna; obtain a preamble reception time for receiving the valid preamble corresponding to the target communication task; determine a signal strength compensation value based on the preamble reception time, wherein the preamble reception time is positively correlated with the signal strength compensation value; determine a received signal strength value of the current communication antenna based on the background noise value and the signal strength compensation value; and receive the to-be-received data corresponding to the target communication task based on the current communication antenna if the received signal strength is greater than a preset signal strength.
[0155] Based on the description of the above method embodiment and device embodiment, please refer to Figure 8 , Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 8The electronic device 800 shown (the electronic device 800 may be a computer device, Figure 1 The terminal device 101 shown includes a memory 801 , a processor 802 , a communication interface 803 , and a bus 804 . The memory 801 , the processor 802 , and the communication interface 803 are communicatively connected to each other via the bus 804 .
[0156] The memory 801 may be a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM).
[0157] The memory 801 can store program codes. When the program codes stored in the memory 801 are executed by the processor 802, the processor 802 and the communication interface 803 are used to perform the various steps of the frequency hopping-based wireless communication method of the embodiment of the present application.
[0158] The processor 802 can adopt a general-purpose central processing unit (CPU), a microcontroller, an application-specific integrated circuit (ASIC), a graphics processing unit (GPU) or one or more integrated circuits to execute relevant programs to implement the functions required to be performed by the units in the electronic device 800 in the embodiment of the present application, or to execute the frequency hopping-based wireless communication method in the method embodiment of the present application.
[0159] Processor 802 may also be an integrated circuit chip with signal processing capabilities. During implementation, each step of the frequency hopping-based wireless communication method of the present application may be completed by hardware integrated logic circuits or software instructions within processor 802. The aforementioned processor 802 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. It may implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microcontroller or any conventional processor. The steps of the methods disclosed in the embodiments of the present application may be directly executed by a hardware decoding processor, or by a combination of hardware and software modules within the decoding processor. The software modules may be located in storage media well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or the like. The storage medium is located in the memory 801, and the processor 802 reads the information in the memory 801 and combines its hardware to complete the functions required to be performed by the units included in the electronic device 800 of the embodiment of the present application, or executes the frequency hopping-based wireless communication method of the method embodiment of the present application.
[0160] The communication interface 803 uses a transceiver device such as, but not limited to, a transceiver to implement communication between the electronic device 800 and other devices or a communication network. For example, data can be obtained through the communication interface 803.
[0161] The bus 804 may include a path for transmitting information between various components of the electronic device 800 (eg, the memory 801 , the processor 802 , and the communication interface 803 ).
[0162] It should be noted that although Figure 8 The electronic device 800 shown only shows a memory 801, a processor 802, and a communication interface 803. However, in the specific implementation process, those skilled in the art should understand that the electronic device 800 also includes other devices necessary for normal operation. At the same time, according to specific needs, those skilled in the art should understand that the electronic device 800 may also include hardware devices that implement other additional functions. In addition, those skilled in the art should understand that the electronic device 800 may also include only the devices necessary to implement the embodiments of the present application, and does not necessarily include Figure 8 All devices shown in .
[0163] An embodiment of the present application further provides a chip, which includes a processor and a data interface. The processor reads instructions stored in a memory through the data interface to implement the frequency hopping-based wireless communication method.
[0164] Optionally, as an implementation method, the chip may further include a memory, in which instructions are stored, and the processor is used to execute the instructions stored in the memory. When the instructions are executed, the processor is used to execute the frequency hopping-based wireless communication method.
[0165] An embodiment of the present application also provides a computer-readable storage medium, which stores instructions. When the computer-readable storage medium is executed on a computer or a processor, the computer or processor executes one or more steps in any of the above methods.
[0166] The present application also provides a computer program product comprising instructions, which, when executed on a computer or processor, causes the computer or processor to execute one or more steps in any of the above methods.
[0167] Those skilled in the art will appreciate that the functions described in conjunction with the various illustrative logic blocks, modules, and algorithm steps disclosed herein can be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions described in the various illustrative logic blocks, modules, and steps can be stored or transmitted as one or more instructions or codes on a computer-readable medium and executed by a hardware-based processing unit. Computer-readable media may include computer-readable storage media, which corresponds to tangible media, such as data storage media, or communication media including any media that facilitates the transfer of computer programs from one place to another (e.g., based on a communication protocol). In this manner, computer-readable media can generally correspond to (1) non-transitory tangible computer-readable storage media, or (2) communication media, such as signals or carrier waves. Data storage media can be any available media that can be accessed by one or more computers or one or more processors to retrieve instructions, codes, and / or data structures for implementing the techniques described in this application. A computer program product may include computer-readable media.
[0168] By way of example, and not limitation, such computer-readable storage media may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage, flash memory, or any other medium that can be used to store desired program code in the form of instructions or data structures and that can be accessed by a computer. Furthermore, any connection is properly referred to as a computer-readable medium. For example, if instructions are transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwaves, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwaves are included in the definition of medium. However, it should be understood that computer-readable storage media and data storage media do not include connections, carrier waves, signals, or other transient media, but are actually directed to non-transitory tangible storage media. As used herein, disk and disc include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), and Blu-ray disc, where disks typically reproduce data magnetically, while discs reproduce data optically using lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0169] Instructions may be executed by one or more processors, such as one or more digital signal processors (DSPs), general-purpose microcontrollers, application-specific integrated circuits (ASICs), field-programmable logic arrays (FPGAs), or other equivalent integrated or discrete logic circuits. Thus, the term "processor," as used herein, may refer to any of the aforementioned structures or any other structure suitable for implementing the techniques described herein. Additionally, in some aspects, the functionality described by the various illustrative logical blocks, modules, and steps described herein may be provided within dedicated hardware and / or software modules configured for encoding and decoding, or incorporated into a combined codec. Furthermore, the techniques may be fully implemented in one or more circuits or logic elements.
[0170] The techniques of this application can be implemented in a variety of devices or apparatuses, including wireless handsets, integrated circuits (ICs), or a set of ICs (e.g., a chipset). Various components, modules, or units are described herein to emphasize functional aspects of devices for performing the disclosed techniques, but they do not necessarily require implementation by different hardware units. In fact, as described above, the various units can be combined in coded hardware units in conjunction with appropriate software and / or firmware, or provided by interoperating hardware units (including one or more processors as described above).
[0171] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, devices and units can refer to the specific descriptions of the corresponding steps in the aforementioned method embodiments and will not be repeated here.
[0172] It should be understood that, in the description of this application, unless otherwise specified, " / " indicates an "or" relationship between the preceding and following objects. For example, A / B can mean A or B, where A and B can be singular or plural. Furthermore, in the description of this application, unless otherwise specified, "plurality" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, "at least one of a, b, or c" can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or plural. Furthermore, to facilitate the description of the technical solutions of the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish between identical or similar items with substantially the same function and effect. Those skilled in the art will understand that terms such as "first" and "second" do not limit the quantity or order of execution, and do not necessarily imply differences. At the same time, in the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner to facilitate understanding.
[0173] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The mutual coupling, direct coupling, or communication connection shown or discussed can be through some interface, indirect coupling or communication connection of devices or units, and can be electrical, mechanical or other forms.
[0174] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0175] In the above embodiments, all or part of the embodiments may be implemented using software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to the embodiments of the present application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted via the computer-readable storage medium. The computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium accessible by a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic medium such as a floppy disk, a hard disk, a magnetic tape, a magnetic disk, or an optical medium such as a digital versatile disc (DVD), or a semiconductor medium such as a solid state disk (SSD).
[0176] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
[0177] The device embodiments described above are merely illustrative, wherein the units and modules described as separate components may or may not be physically separate. Furthermore, some or all of the units and modules may be selected based on actual needs to achieve the objectives of the present embodiment. Those skilled in the art can understand and implement the present invention without inventive effort.
[0178] The above is only a specific implementation method of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A wireless communication method based on frequency hopping, characterized in that: The method is applied to a terminal device in a communication system, wherein the communication system further includes a gateway device, and the method includes: Receiving an available frequency array and random number information sent by the gateway device, wherein the available frequency array includes multiple available channel frequencies; Determining the order of the multiple available channel frequencies according to random number information, and forming a frequency hopping sequence according to the order of the multiple available channel frequencies, specifically comprising: S1: determining n=1, and determining the array length of the available frequency array to be L; S2: calculating a remainder i of a random number divided by the array length, wherein the random number is determined according to the random number information; S3: determining the i-th frequency in the available frequency array as the n-th frequency in the frequency hopping sequence; S4: deleting the i-th frequency in the available frequency array from the available frequency array, and updating n to n+1 and L to L-1; and repeating steps S2-S4 until L is 0; Acquire a first system time in real time, and determine a first frequency point from the frequency hopping sequence according to the first system time; A target communication task is performed based on the first frequency point, where the target communication task includes a sending task or a receiving task.
2. The method according to claim 1, characterized in that Before performing the target communication task based on the first frequency point, the method further includes: Connecting to the gateway device based on the channel corresponding to the first frequency point; Receiving a broadcast message sent by the gateway device, the broadcast message is used to indicate the time slot type of multiple future communication time slots; wherein each time slot corresponds to an available frequency point, and the time slot type includes a broadcast time slot, a contention time slot, a designated time slot, a heartbeat communication time slot, or a frequency hopping time slot; The second system time is acquired in real time, and the time slot type of the current communication time slot is determined according to the broadcast message and the second system time.
3. The method according to claim 2, characterized in that If the time slot type of the current communication time slot is a contention time slot, and the target communication task is a sending task, executing the target communication task based on the first frequency point includes: Encapsulating and encrypting the data to be sent of the target communication task in a preset protocol format and then writing it into a buffer; monitoring a channel corresponding to the first frequency point, and obtaining a first signal strength value of the channel corresponding to the first frequency point; If the first signal strength value is less than a first threshold; or if the first signal strength value is less than a second threshold and no valid preamble code is detected in the channel corresponding to the first frequency point, sending the data to be sent in the buffer to the gateway device; and the first threshold is less than the second threshold; If the first signal strength value is not less than the second threshold; or is less than the second threshold but not less than the first threshold and a valid preamble code is detected in the channel corresponding to the first frequency point, then the delayed transmission time is calculated according to the first signal strength value and the frequency hopping time, where the frequency hopping time is the interval time of the frequency hopping of the terminal device; The target communication task is performed based on a second frequency point after the delayed sending time, where the second frequency point is an available channel frequency point corresponding to a next contention time slot in the frequency hopping sequence.
4. The method according to claim 3, characterized in that The terminal device further includes multiple communication antennas, and the sending of the data to be sent in the buffer to the gateway device includes: sending the data to be sent in the buffer to the gateway device based on a first communication antenna, where the first communication antenna is a communication antenna among the multiple communication antennas for which no transmission signal strength is recorded; Recording the transmit signal strength of the first communication antenna; If the number of recorded transmission signal strengths is the same as the number of the plurality of communication antennas, determining an optimal transmission antenna according to the transmission signal strengths of the plurality of communication antennas; After the frequency hopping time, the recorded transmission signal strength is deleted and the record of the optimal transmitting antenna is cancelled.
5. The method according to claim 2, characterized in that If the time slot type of the current communication time slot is a contention time slot, and the target communication task is a receiving task, executing the target communication task based on the first frequency point includes: Determining a channel switching time limit according to a preamble processing time and a channel switching time of the terminal device; Detecting a valid preamble corresponding to the target communication task in a channel corresponding to the first frequency point or a backup channel, and switching the channel according to the channel switching time limit; When a valid preamble corresponding to the target communication task is detected, channel switching is stopped and to-be-received data corresponding to the target communication task is received based on the current channel.
6. The method according to claim 5, characterized in that The terminal device further includes a plurality of communication antennas. Before the valid preamble code corresponding to the target communication task is detected, the method further includes: Determining an antenna switching time limit according to the channel switching time limit, wherein the antenna switching time limit is greater than twice the channel switching time limit; connecting the channel corresponding to the first frequency point or the backup channel based on one of the multiple communication antennas, and switching the communication antenna according to the antenna switching time limit; After stopping channel switching and receiving the to-be-received data corresponding to the target communication task based on the current channel when a valid preamble corresponding to the target communication task is detected, the method further includes: Stop switching the communication antenna and obtain the background noise value of the current communication antenna; Obtaining a preamble code reception time of a valid preamble code corresponding to the target communication task; determining a signal strength compensation value according to the preamble code reception time, wherein the preamble code reception time is positively correlated with the signal strength compensation value; Determine the received signal strength value of the current communication antenna according to the background noise value and the signal strength compensation value; If the received signal strength is greater than the preset signal strength, the to-be-received data corresponding to the target communication task is received based on the current communication antenna.
7. A wireless communication device based on frequency hopping, characterized in that: The apparatus is a terminal device in a communication system, the communication system further includes a gateway device, and the apparatus includes: A receiving unit, configured to receive an available frequency array and random number information sent by the gateway device, wherein the available frequency array includes a plurality of available channel frequencies; A determining unit, configured to determine an order of the plurality of available channel frequencies based on random number information, and to form a frequency hopping sequence based on the order of the plurality of available channel frequencies, specifically comprising: S1: determining n=1, and determining the array length of the available frequency array to be L; S2: calculating a remainder i of a random number divided by the array length, wherein the random number is determined based on the random number information; S3: determining the i-th frequency in the available frequency array as the n-th frequency in the frequency hopping sequence; S4: deleting the i-th frequency in the available frequency array from the available frequency array, and updating n to n+1 and L to L-1; and repeating steps S2-S4 until L is 0; an acquiring unit, configured to acquire a first system time in real time, and determine a first frequency point from the frequency hopping sequence according to the first system time; An execution unit is configured to execute a target communication task based on the first frequency point, where the target communication task includes a sending task or a receiving task.
8. An electronic device, characterized in that: The method comprises a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for executing the steps in the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Random frequency hopping method, communication device and random frequency hopping system
CN106454981A
Frequency hopping synchronization method and device for variable-period frequency hopping communication and medium
CN115378463A