BLE CS-based distance measurement method, electronic equipment and storage medium

By simplifying the BLE CS ranging algorithm and converting the channel phase difference into a frequency difference, the channel readout and calculation are optimized, thus solving the problem of high complexity in the BLE CS ranging algorithm and achieving efficient and accurate distance measurement.

CN121056808APending Publication Date: 2025-12-02BEIJING HUAHONG INTEGRATED CIRCUIT DESIGN +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410646915.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-23
Publication Date
2025-12-02

AI Technical Summary

Technical Problem

Existing BLE CS ranging algorithms are highly complex and computationally intensive, making them unsuitable for widespread application.

Method used

By simplifying the BLE CS ranging algorithm, the channel phase difference is equivalent to the channel frequency difference. By utilizing the relationship between the center channel wavelength, channel spacing, and wavelength difference between adjacent channels, the channel readout strategy and calculation method are optimized, reducing algorithm complexity and computational load.

Benefits of technology

This greatly reduces the complexity and computational load of the BLE CS ranging algorithm, ensuring the accuracy and efficiency of the ranging results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121056808A_ABST
    Figure CN121056808A_ABST
Patent Text Reader

Abstract

The invention relates to a range finding method based on BLE CS, an electronic device and a storage medium, and belongs to the technical field of communication, the method comprises the following steps: establishing a connection with an anchor point based on a BLE terminal, simplifying a BLE CS range algorithm to obtain an optimized range finding algorithm, reading a corresponding channel phase angle based on a channel interval corresponding to a previous range finding distance to calculate a phase difference, and determining the phase difference based on the previous range finding distance; the first distance of the distance measurement is calculated according to the calculated phase difference, the first sentence is judged and the distance measurement result is optimized based on the first maximum distance measurement distance of the theoretical maximum channel interval, and the circuit delay of the phase difference used for distance measurement is removed to obtain better distance measurement precision. According to the invention, the problems of high complexity and large operand of the BLE CS ranging algorithm in the prior art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and in particular to a ranging method, electronic device, and storage medium based on BLECS. Background Technology

[0002] Bluetooth ranging technology is a distance measurement method based on Bluetooth communication technology. It mainly estimates distance by receiving a Radio Signal Strength Indicator (RSSI) and phase measurement. Traditional Bluetooth ranging primarily relies on RSSI technology, which estimates the distance between devices by measuring the energy attenuation of the signal during propagation. RSSI technology is simple to implement, but it is easily affected by environmental factors such as multipath propagation and signal attenuation, which limits the ranging accuracy.

[0003] With the continuous development of Bluetooth technology, Bluetooth ranging technology (BLE HADM: Bluetooth Low Energy High Accuracy Distance Measurement) that uses Bluetooth Channel Sounding (CS) to achieve high-precision ranging has been proposed to improve ranging accuracy and applicability.

[0004] Currently, high-precision distance measurement based on BLE CS mainly relies on reading the relationship between the phase delay and channel frequency of the communication channel connected to the Bluetooth device, establishing an algorithm based on frequency modulation phase measurement and difference estimation. Although BLE CS claims to be compatible with traditional BLE hardware, its high algorithm complexity and large computational load limit its widespread application. Summary of the Invention

[0005] Based on the above analysis, the present invention aims to provide a ranging method based on BLE CS to solve the problems of high complexity and large computational load of existing BLE CS ranging algorithms.

[0006] On one hand, embodiments of the present invention provide a ranging method based on BLE CS, the method specifically including the following steps:

[0007] S1, BLE terminal establishes connection with anchor point;

[0008] S2. Obtain the initial channel spacing based on the preset maximum communication distance;

[0009] S3. Use the initial channel interval as the current channel interval; use the preset maximum communication distance as the previous ranging result;

[0010] S4: The BLE terminal reads the phase angles of the two channels that satisfy the current channel interval and obtains the phase difference. Based on the phase difference and the previous ranging result, it calculates the first distance.

[0011] Read the phase angles of the two channels corresponding to the maximum channel spacing and calculate the maximum phase difference;

[0012] Determine whether the first distance is less than the first maximum ranging distance, where the first maximum ranging distance is the ranging distance when using the maximum channel spacing;

[0013] If so, the ranging result is obtained based on the maximum phase difference and the first maximum ranging distance, the maximum channel interval is used as the current channel interval, and the process returns to step S4 for the next ranging.

[0014] Otherwise, the first distance is optimized based on the maximum phase difference and the first maximum ranging distance to obtain the optimized distance, and the optimized distance is used as the ranging result for this time; the channel interval is calculated based on the optimized distance as the current channel interval, and the process returns to S4 for the next ranging.

[0015] Based on the further improvement of the above method, the following relationship is used when obtaining the initial channel interval based on the preset maximum communication distance and when calculating the channel interval based on the optimized distance:

[0016] ΔCH=(λ×(λ / Δλ))÷D, where ΔCH is the channel spacing, λ is the wavelength of the center channel, Δλ is the average wavelength difference between adjacent channels, and D is the distance. When solving for the initial channel spacing, D is taken as the preset maximum communication distance. When solving for the channel spacing calculated based on the optimized distance, D is taken as the optimized distance.

[0017] Based on a further improvement of the above method, the BLE terminal reads the phase angles of two channels that satisfy the current channel interval and obtains the phase difference, including:

[0018] Determine whether the channel interval is set to a fixed channel interval;

[0019] If so, the BLE terminal reads the phase angle of the lowest numbered channel and the channel numbered with an interval of the channel interval between the lowest numbered channel and the channel numbered with the channel interval between the two channels, and calculates the difference between the phase angles of the two channels to obtain the phase difference;

[0020] Otherwise, the BLE terminal reads all channel phase angles, randomly selects two channel phase angles with an interval equal to the channel interval, and calculates the difference between the two channel phase angles as the phase difference.

[0021] Based on a further improvement of the above method, the calculation of the first distance based on the phase difference and the previous ranging result, and the calculation of the current ranging result based on the maximum channel interval phase difference and the first maximum ranging distance, are both obtained through the following relationship:

[0022] d=(Δθ / 2π)×D p In the formula, d is the distance measured, and D p The distance corresponding to the previous ranging result or the first maximum ranging distance is Δθ, and the phase difference or the maximum channel interval phase difference is Δθ.

[0023] Based on the further improvement of the above method, when calculating the first distance and the current ranging result, the phase difference and the maximum phase difference are first corrected based on the error phase difference, and the first distance and the current ranging result are calculated using the corrected phase difference and the maximum phase difference.

[0024] Based on a further improvement of the above method, the error phase difference is the maximum phase difference when the BLE terminal and the anchor point are attached.

[0025] To further eliminate phase testing errors caused by BLE terminal circuit delay, the phase error due to circuit delay needs to be removed from the phase difference when calculating the ranging distance based on the phase difference and the previous ranging distance. This phase error is the maximum phase difference calculated when the BLE terminal is in contact with the anchor point, i.e., the phase angles of the two channels with the smallest and largest BLE CS numbers are read by the BLE terminal and the corresponding phase difference is calculated. The above process is an error removal process before ranging, which only needs to be performed once to affect all subsequent ranging results.

[0026] A further improvement to the above method, specifically, involves optimizing the first distance based on the maximum channel spacing phase difference and the first maximum ranging distance to obtain the optimized distance, as follows:

[0027] In the formula, d is the first distance, and D c D is the optimized distance. 1max It is the first maximum ranging distance. To round down, Δd is the relative distance, where Δd = (Δθ) max / 2π)×D 1max , Δθ max The maximum channel spacing phase difference is denoted as .

[0028] Based on a further improvement of the above method, the first maximum ranging distance is calculated using the following method:

[0029] The second maximum ranging distance is obtained based on the center channel wavelength, the minimum channel spacing, and the average wavelength difference between adjacent channels.

[0030] The first maximum ranging distance is obtained by dividing the second maximum ranging distance by the maximum channel spacing.

[0031] On the other hand, embodiments of the present invention provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of a BLE CS-based ranging method as described in any one of claims 1 to 8.

[0032] In another aspect, embodiments of the present invention provide a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a BLE CS-based ranging method as described in any one of claims 1 to 8.

[0033] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:

[0034] 1. The complex calculation of BLE CS using only phase difference is simplified to a simple conversion based on the relationship between phase difference and distance, and the relationship between the center channel wavelength, channel spacing and the average wavelength difference between adjacent channels, which greatly reduces the algorithm complexity;

[0035] 2. The ranging channel reading strategy and calculation method are optimized based on the maximum ranging distance of the maximum channel spacing, which greatly reduces the frequency and amount of calculation of channel reading, while ensuring that the ranging results meet the application requirements.

[0036] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description

[0037] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.

[0038] Figure 1 This is a flowchart of the ranging method according to an embodiment of the present invention. Detailed Implementation

[0039] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.

[0040] Example 1:

[0041] A specific embodiment of the present invention discloses a ranging method based on BLE CS, such as... Figure 1 As shown.

[0042] The method specifically includes the following steps:

[0043] S1, BLE terminal establishes connection with anchor point;

[0044] S2. Obtain the initial channel spacing based on the preset maximum communication distance;

[0045] S3. Use the initial channel interval as the current channel interval; use the preset maximum communication distance as the previous ranging result;

[0046] S4: The BLE terminal reads the phase angles of the two channels that satisfy the current channel interval and obtains the phase difference. Based on the phase difference and the previous ranging result, it calculates the first distance.

[0047] Read the phase angles of the two channels corresponding to the maximum channel spacing and calculate the maximum phase difference; determine whether the first distance is less than the first maximum ranging distance, where the first maximum ranging distance is the ranging distance when the maximum channel spacing is used;

[0048] If so, the ranging result is obtained based on the maximum phase difference and the first maximum ranging distance, the maximum channel interval is used as the current channel interval, and the process returns to step S4 for the next ranging.

[0049] Otherwise, the first distance is optimized based on the maximum phase difference and the first maximum ranging distance to obtain the optimized distance, and the optimized distance is used as the ranging result for this time; the channel interval is calculated based on the optimized distance as the current channel interval, and the process returns to S4 for the next ranging.

[0050] Specifically, in this embodiment of the invention, the BLE terminal and the anchor point are two terminals for distance measurement. They need to establish and maintain a Bluetooth communication connection, and the BLE terminal reads the communication connection channel to measure the distance.

[0051] BLECS distance measurement involves reading the BLE channel phase angle and calculating the phase difference using a complex algorithm, then calculating the distance based on the relationship between the channel phase difference and the channel frequency. Because the BLECS phase difference calculation algorithm is complex, the algorithm in this embodiment is an optimization of the BLECS ranging algorithm. To simplify the calculation, the channel phase difference is equated to the corresponding channel frequency difference, i.e., the channel interval, and the corresponding channel frequency difference is equated to the wavelength difference. Therefore, ranging between the two ends of a BLE connection can be understood as measuring the number of channel wavelengths included in the distance between the two ends of the BLE connection. The ranging algorithm is optimized based on this idea.

[0052] Based on the BLE communication principle, there are a total of 79 channels in the BLE connection. Among them, 75 channels, numbered from 2 to 76, can be used for BLECS ranging. Table 1 shows the correspondence and values ​​of BLE channels, frequencies, wavelengths, and wavelength differences that can be used for CS ranging.

[0053] Table 1: BLE Channel Numbers and Corresponding Frequency, Wavelength, and Wavelength Difference Values ​​for CS Ranging

[0054]

[0055]

[0056] As shown in Table 1, the wavelength difference between BLE connection channels is proportional to the channel spacing. Therefore, the wavelength difference between any two channels can be estimated as the product of the channel spacing and the wavelength difference between adjacent channels. From this, the relationship between the distance of a BLE connection and the channels and the channel spacing can be derived as follows:

[0057] D=λ i ×λ i / (Δλ×ΔCH), where ΔCH is the channel spacing, Δλ is the wavelength difference between adjacent channels, and λ is the wavelength difference between adjacent channels. i Let λ be the wavelength of the shorter channel among any two channels, and D be the distance.

[0058] In Table 1, the wavelength differences between adjacent BLE channels are all within a very small range, around 0.005 com. The maximum wavelength difference between channels used for BLECS ranging is only 0.37 com. Based on the propagation distance of BLE electromagnetic waves and practical applications, the error of the wavelength difference between adjacent BLE channels is almost negligible compared to the ranging error. Therefore, the wavelength difference between adjacent channels is simplified to 0.005 com, and the shorter wavelength of any two channels is λ. i The central channel wavelength, denoted as λ, is uniformly used for ranging.

[0059] Based on the above optimization scheme, the optimized distance formula is obtained as follows: ΔCH=(λ×(λ / Δλ))÷D, where ΔCH is the channel spacing, λ is the wavelength of the center channel, Δλ is the average wavelength difference between adjacent channels, and D is the distance.

[0060] In theory, the larger the BLECS channel spacing, the shorter the ranging distance and the higher the ranging accuracy; conversely, the smaller the channel spacing, the longer the ranging distance and the lower the ranging accuracy. To achieve higher ranging accuracy, when the distance between the BLE terminal and the anchor point reaches a certain level, the maximum channel spacing can be used for ranging. This distance is the first maximum ranging distance, which is the maximum ranging distance under the maximum channel spacing. Conversely, the maximum ranging distance under the minimum channel spacing is the second maximum ranging distance.

[0061] Furthermore, the first maximum ranging distance is calculated using the following method:

[0062] The second maximum ranging distance is obtained based on the center channel wavelength, the minimum channel spacing, and the average wavelength difference between adjacent channels.

[0063] The first maximum ranging distance is obtained by dividing the second maximum ranging distance by the maximum channel spacing.

[0064] Specifically, based on the optimized distance formula, the theoretical distance of the maximum ranging distance between adjacent channels can be calculated, which is the second maximum ranging distance. Based on different BLE PHY rates, the second maximum ranging distance corresponding to BLE 1M PHY is approximately 150 meters. Then, according to the conversion relationship between the maximum channel spacing and distance in BLE CS and the second maximum ranging distance, the first maximum ranging distance can be calculated, which is approximately 2 meters at the maximum channel spacing.

[0065] Before ranging begins, due to the differences in wireless performance among different BLE terminals, the specific value of the channel interval connecting the BLE terminal and the anchor point cannot be determined; both distance and channel interval are unknown. Therefore, in step S2, this embodiment of the invention calculates the initial channel interval based on the preset maximum communication distance of the BLE terminal, i.e., the theoretical maximum transmission distance corresponding to the BLE terminal, by substituting it into the optimized distance formula. The preset maximum communication distance is generally a verified and reliable theoretical value. The advantage of this is that, before ranging, the initial channel interval is calculated based on the preset maximum communication distance and the optimized distance formula.

[0066] Use the initial channel spacing as the current channel spacing; use the preset maximum communication distance as the result of the last ranging measurement.

[0067] The BLE terminal reads the phase angles of two channels that satisfy the current channel interval and obtains the phase difference. Based on the phase difference and the previous ranging result, it calculates the first distance.

[0068] Read the phase angles of the two channels corresponding to the maximum channel spacing and calculate the maximum phase difference;

[0069] Next, a ranging operation can be performed based on the initial channel interval.

[0070] Specifically, the BLE terminal selects the channel for ranging based on the initial channel interval, reads the phase angle of the corresponding channel, and then calculates the phase difference.

[0071] Furthermore, the BLE terminal reads the phase angles of two channels that satisfy the current channel interval and obtains the phase difference, including:

[0072] Determine whether the channel interval is set to a fixed channel interval;

[0073] If so, the BLE terminal reads the phase angle of the lowest numbered channel and the channel numbered with an interval of the channel interval between the lowest numbered channel and the channel numbered with the channel interval between the two channels, and calculates the difference between the phase angles of the two channels to obtain the phase difference;

[0074] Otherwise, the BLE terminal reads all channel phase angles, randomly selects two channel phase angles with an interval equal to the channel interval, and calculates the difference between the two channel phase angles as the phase difference.

[0075] Existing BLECS algorithms require complex comparison operations when selecting the BLE channel for ranging, resulting in a large computational burden for each ranging measurement. Therefore, this invention optimizes the BLECS channel selection algorithm based on the initial channel interval, using the initial channel interval as a coefficient to provide the following two channel selection methods, specifically including:

[0076] If the initial channel interval is set to a fixed channel interval, the BLE terminal will only read the phase angle of the lowest numbered channel and the channel whose interval with the lowest numbered channel is the channel interval.

[0077] If no fixed channel interval is set, the BLE terminal randomly reads two predetermined phase angles of the channel interval as the initial channel interval.

[0078] Through the above processing, without complex calculations, the channel interval obtained from the previous ranging can be used as a coefficient to simplify the channel selection process for the current ranging. Setting a fixed channel interval is even simpler, as it eliminates the need to read the phase angle of channels other than the lowest-numbered channel and the channel with an interval equal to the channel interval, further reducing the power consumption of the BLE terminal.

[0079] Furthermore, based on the phase difference and the previous ranging result, the first distance is calculated using the following formula:

[0080] d=(Δθ / 2π) / D p In the formula, d is the distance measured, and D p Δθ represents the distance corresponding to the previous ranging result, and Δθ represents the phase difference.

[0081] When the phase difference is 2π, the distance between the BLE terminal and the anchor point is the first maximum ranging distance. However, the phase difference between the two channels obtained by the BLE terminal is always a value less than 2π, which cannot reflect the number of cycles of the actual interval between the BLE terminal and the anchor point. This is determined by the characteristics of BLECS technology, but it also shows that the distance between the BLE terminal and the anchor point may include 0-n first maximum ranging distances.

[0082] Furthermore, it is determined whether the first distance is less than the first maximum ranging distance, where the first maximum ranging distance is the ranging distance when the maximum channel spacing is used;

[0083] If so, the ranging result is obtained based on the maximum phase difference and the first maximum ranging distance, the maximum channel interval is used as the current channel interval, and the process returns to step S4 for the next ranging.

[0084] Specifically, when the first distance is less than the first maximum ranging distance, the actual phase difference of the first distance is less than 360 degrees and is proportional to the phase difference. Therefore, substituting the maximum channel spacing phase difference Δθ and the first maximum ranging distance Dp into d=(Δθ / 2π)×D p Then, the distance d measured in this step can be obtained. Since this ranging is based on the maximum channel spacing, the ranging accuracy is very high. After this ranging is completed, return to step S4 to perform the next ranging.

[0085] Otherwise, the first distance is optimized based on the maximum phase difference and the first maximum ranging distance to obtain the optimized distance, and the optimized distance is used as the ranging result for this time;

[0086] Furthermore, the optimized distance is obtained by optimizing the first distance based on the maximum phase difference and the first maximum ranging distance, specifically as follows:

[0087] In the formula, d is the first distance, and D c D is the optimized distance. 1max It is the first maximum ranging distance. To round down, Δd is the relative distance, where Δd = (Δθ) max / 2π)×D 1max , Δθ max The maximum channel spacing phase difference is denoted as .

[0088] When the first distance is greater than the first maximum ranging distance, the result of dividing the first distance by the first maximum ranging distance is rounded down, and then the phase difference and the first maximum ranging distance are substituted into d=(Δθ / 2π)×D p The relative distance is calculated, and the sum of the two is the optimized distance.

[0089] The channel interval is calculated based on the optimized distance and used as the current channel interval. Then, return to S4 for the next ranging measurement.

[0090] Furthermore, when calculating the first distance and the current ranging result, the phase difference and the maximum phase difference are first corrected based on the error phase difference, and the first distance and the current ranging result are calculated using the corrected phase difference and the maximum phase difference.

[0091] Furthermore, the error phase difference is the maximum phase difference when the BLE terminal and the anchor point are attached.

[0092] To further eliminate phase testing errors caused by BLE terminal circuit delay, the phase error due to circuit delay needs to be removed from the phase difference when calculating the ranging distance based on the phase difference and the previous ranging distance. This phase error is the maximum phase difference calculated when the BLE terminal is in contact with the anchor point. The above process is an error removal process before ranging, and it only needs to be performed once to affect all subsequent ranging results.

[0093] The optimized ranging distance obtained in this embodiment of the invention is the ranging result obtained after a complete ranging process. Compared with the algorithm of the existing BLE CS technology, the optimized ranging algorithm of this embodiment of the invention is greatly simplified, the complexity is reduced, and the amount of computation is reduced. The first distance calculated by reading the phase difference obtained by reading the channel phase angle and then processing it for error removal results in a very ideal optimized distance.

[0094] Example 2:

[0095] A second embodiment of the present invention discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps of a BLE CS-based ranging method as described in Embodiment 1.

[0096] Example 3:

[0097] A third embodiment of the present invention discloses a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a BLE CS-based ranging method as described in Embodiment 1.

[0098] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.

[0099] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A ranging method based on BLE CS, characterized in that, The method specifically includes the following steps: S1, BLE terminal establishes connection with anchor point; S2. Obtain the initial channel spacing based on the preset maximum communication distance; S3. Use the initial channel interval as the current channel interval; use the preset maximum communication distance as the previous ranging result; S4: The BLE terminal reads the phase angles of the two channels that satisfy the current channel interval and obtains the phase difference. Based on the phase difference and the previous ranging result, it calculates the first distance. Read the phase angles of the two channels corresponding to the maximum channel spacing and calculate the maximum phase difference; Determine whether the first distance is less than the first maximum ranging distance, where the first maximum ranging distance is the ranging distance when using the maximum channel spacing; If so, the ranging result is obtained based on the maximum phase difference and the first maximum ranging distance, the maximum channel interval is used as the current channel interval, and the process returns to step S4 for the next ranging. Otherwise, the first distance is optimized based on the maximum phase difference and the first maximum ranging distance to obtain the optimized distance, and the optimized distance is used as the ranging result for this time; the channel interval is calculated based on the optimized distance as the current channel interval, and the process returns to S4 for the next ranging.

2. The ranging method based on BLE CS according to claim 1, characterized in that, The following relationship is used when obtaining the initial channel interval based on the preset maximum communication distance and when calculating the channel interval based on the optimized distance: ΔCH=(λ×(λ / Δλ))÷D, where ΔCH is the channel spacing, λ is the wavelength of the center channel, Δλ is the average wavelength difference between adjacent channels, and D is the distance. When solving for the initial channel spacing, D is taken as the preset maximum communication distance. When solving for the channel spacing calculated based on the optimized distance, D is taken as the optimized distance.

3. The ranging method based on BLE CS according to claim 2, characterized in that, The BLE terminal reads the phase angles of two channels that satisfy the current channel interval and obtains the phase difference, including: Determine whether the channel interval is set to a fixed channel interval; If so, the BLE terminal reads the phase angle of the lowest numbered channel and the channel numbered with an interval of the channel interval between the lowest numbered channel and the channel numbered with the channel interval between the two channels, and calculates the difference between the phase angles of the two channels to obtain the phase difference; Otherwise, the BLE terminal reads all channel phase angles, randomly selects two channel phase angles with an interval equal to the channel interval, and calculates the difference between the two channel phase angles as the phase difference.

4. The ranging method based on BLE CS according to claim 3, characterized in that, The first distance is calculated based on the phase difference and the previous ranging result, and the current ranging result is obtained based on the maximum channel interval phase difference and the first maximum ranging distance. The corresponding ranging distances are obtained using the following formulas: d=(Δθ / 2π)×D p In the formula, d is the distance measured, and D p The distance corresponding to the previous ranging result or the first maximum ranging distance is Δθ, and the phase difference or the maximum channel interval phase difference is Δθ.

5. The ranging method based on BLE CS according to claim 4, characterized in that, When calculating the first distance and the current distance measurement result, the phase difference and the maximum phase difference are first corrected based on the error phase difference, and the first distance and the current distance measurement result are calculated using the corrected phase difference and the maximum phase difference.

6. The ranging method based on BLE CS according to claim 5, characterized in that, The error phase difference is the maximum phase difference when the BLE terminal and the anchor point are attached.

7. The ranging method based on BLE CS according to claim 6, characterized in that, The optimized distance is obtained by optimizing the first distance based on the maximum phase difference and the first maximum ranging distance, specifically as follows: In the formula, d is the first distance, and D c D is the optimized distance. 1max It is the first maximum ranging distance. To round down, Δd is the relative distance, where Δd = (Δθ) max / 2π)×D 1max , Δθ max The maximum channel spacing phase difference is denoted as .

8. The ranging method based on BLE CS according to claim 7, characterized in that, The first maximum ranging distance is calculated using the following method: The second maximum ranging distance is obtained based on the center channel wavelength, the minimum channel spacing, and the average wavelength difference between adjacent channels. The first maximum ranging distance is obtained by dividing the second maximum ranging distance by the maximum channel spacing.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of a BLE CS-based ranging method as described in any one of claims 1 to 8.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of a BLE CS-based ranging method as described in any one of claims 1 to 8.