A high-precision ultrasonic distance detection method and system

By using a combination of timers, comparators and analog-to-digital converters in a microcontroller to process ultrasonic echo signals, the problem of low ultrasonic distance detection accuracy in the existing technology is solved, high-precision ranging is achieved and system costs are reduced.

CN115343715BActive Publication Date: 2024-09-13XIAMEN JINGGAN TONGFU TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211022262.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-25
Publication Date
2024-09-13
Estimated Expiration
2042-08-25

AI Technical Summary

Technical Problem

Existing ultrasonic distance detection methods have low measurement accuracy due to differences in equipment consistency and limited number of ADC module digits. Especially when measuring high-frequency ultrasonic signals and long distances, the error is large, and the cost of external high-precision ADCs and hardware are high. The design is complex.

Method used

By combining the timer, comparator and analog-to-digital converter in the microcontroller, the ultrasonic echo signal is collected, the timer is used to capture the pulse square wave, the analog-to-digital converter samples the data, and is stored through the DMA channel, combining the TIM data and ADC data Correspondence relationship, find the high-precision echo starting point, and calculate the echo time and distance.

Benefits of technology

It achieves high-precision ultrasonic ranging results, reduces the cost of high-precision ultrasonic ranging systems, reduces noise interference, and improves measurement accuracy. The resolution can reach 0.02mm, and the comprehensive measurement accuracy can reach 0.3mm.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115343715B
    Figure CN115343715B
Patent Text Reader

Abstract

The present invention discloses a high-precision ultrasonic distance detection method and system. The method combines and applies functional units such as an ADC module, a comparator, and a timer built into a single-chip microcomputer: a high-frequency timer is used to capture TIM data formed by a pulse square wave signal output by the comparator, and ADC data collected by the ADC module. The ADC data can be used for basic judgment and retrieval to obtain a low-precision position of the ultrasonic echo starting point, and then the time correspondence between the TIM data and the ADC data is used to obtain a high-precision ultrasonic echo starting point through the TIM data, thereby obtaining a high-precision ultrasonic distance measurement result while greatly reducing the cost of the high-precision ultrasonic distance measurement system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of ultrasonic distance measurement, and in particular to a high-precision ultrasonic distance detection method and system. Background Art

[0002] Ultrasonic detection is widely used in various fields. Its application principle is similar to that of radar detection. It uses electric pulses to excite ultrasonic signals of a specified frequency, detects ultrasonic echo signals within a specified time, and analyzes the signals to calculate the interval time from excitation to echo. Combined with the ultrasonic speed, the distance to the target position is calculated.

[0003] The basic principle of ultrasonic detection seems simple, but due to the large difference in ultrasonic signal strength under different environments (distance, temperature), the unstable ultrasonic frequency, and the differences in devices and unstable factors in the processing process, the consistency of the equipment cannot be fully guaranteed. Therefore, the design of the acquisition method needs to consider many factors. The more common acquisition methods include comparator pulse capture, ADC raw echo acquisition, etc.

[0004] When using a comparator to capture the pulse square wave generated by the ultrasonic echo signal, it is easy for the measured echo time to differ by one or more cycles due to the change in echo intensity, resulting in a large error, where the error of low-frequency ultrasonic signals is greater than that of high-frequency signals. Due to differences in equipment consistency, there may be large differences in the center line of the ultrasonic echo, resulting in no unified standard for the capture conditions of the pulse square wave of the ultrasonic echo signal.

[0005] Using analog-to-digital converters (ADCs) to capture relatively complete original echoes, and then calculating and identifying them, can effectively avoid errors caused by changes in signal strength. However, the built-in ADC bits on common single-chip microcomputers are limited (such as 12 bits), and the sampling frequency is not high. The accuracy of the original echo data that can be collected is not enough, especially for high-frequency ultrasonic signals. The waveform collected by ADC is distorted, so the measurement accuracy of the ADC solution is not high. As the measurement distance increases, the single-chip microcomputer also needs a larger RAM to store echo data. When the ultrasonic frequency is relatively high and the measurement distance is large, the RAM space consumed is quite amazing. If an external high-precision ADC is to be used, the cost will be greatly increased, and the hardware circuit design will also be more complicated; the large capacity demand of RAM also leads to an increase in the cost of the single-chip microcomputer. Summary of the invention

[0006] In view of the above-mentioned defects of the prior art, the purpose of the present invention is to provide a high-precision ultrasonic distance detection method and system, which can obtain high-precision ultrasonic ranging results by combining the built-in ADC module and comparator resources of the single-chip microcomputer, thereby greatly reducing the cost of the high-precision ultrasonic ranging system.

[0007] To achieve the above object, the present invention provides the following technical solutions:

[0008] A high-precision ultrasonic distance detection method based on a timer, a comparator and an analog-to-digital converter of a single-chip microcomputer comprises:

[0009] Step S1, configure the microcontroller:

[0010] Configure a first timer, where the first timer is a high-frequency timer and operates in a capture mode after being triggered;

[0011] Configure a comparator and an analog-to-digital converter, configure an input of an ultrasonic echo signal, and synchronously send the ultrasonic echo signal to the comparator and the analog-to-digital converter;

[0012] Step S2, perform ranging:

[0013] The ultrasonic echo signal is input, and the first timer is triggered;

[0014] The comparator processes the ultrasonic echo signal and outputs a pulse square wave signal, and the first timer captures the rising edge of the pulse square wave signal and records the count value at the time of capture, which is recorded as TIM data;

[0015] The analog-to-digital converter samples the ultrasonic echo signal and outputs ADC data; the ADC data is stored in the ADC data cache in a sampling order, and the position of the ADC data in the ADC data cache is recorded as the ADC position;

[0016] After completing the acquisition of ADC data and TIM data of the ultrasonic ranging, according to the time correspondence between the ADC positions of the TIM data and the ADC data, the ADC position representing the low-precision ultrasonic echo starting point is searched through the continuous waveform represented by the ADC data cache, and then the high-precision ultrasonic echo starting point is obtained through the corresponding TIM data;

[0017] The echo time is calculated based on the TIM data representing the high-precision ultrasonic echo starting point, and then the ultrasonic echo distance is calculated based on the echo time and the ultrasonic velocity, thereby obtaining the ranging result of the ultrasonic ranging.

[0018] Furthermore, the sampling frequency is greater than or equal to 4 times the ultrasonic frequency and is one Nth of the operating frequency of the first timer, where N is an integer not less than 4.

[0019] Furthermore, in step S1, a first DMA channel is configured to store the ADC data in sequence into the ADC data cache; and a second DMA channel is configured to store the TIM data in sequence into the TIM data cache.

[0020] Further, in step S2, according to the temporal correspondence between the ADC positions of the TIM data and the ADC data, the ADC position representing the starting point of the low-precision ultrasonic echo is searched through the continuous waveform represented by the ADC data cache, specifically including:

[0021] Step S22, searching for the ADC position of the corresponding ADC data in the ADC data cache according to the time point represented by each TIM data, and making a one-to-one correspondence between the TIM data in the TIM data cache and the ADC position;

[0022] Step S24, detecting a true ultrasonic echo signal from the continuous waveform represented by the ADC data buffer, and taking the ADC position corresponding to the first sine wave of the true ultrasonic echo signal as the first ultrasonic echo starting point, that is, the low-precision ultrasonic echo starting point;

[0023] Step S26, reversely search for the corresponding TIM data according to the ADC position indicating the starting point of the first ultrasonic echo, and take the time point indicated by the TIM data as the starting point of the second ultrasonic echo, that is, the high-precision ultrasonic echo starting point.

[0024] Furthermore, the step S24 specifically includes:

[0025] The original ultrasonic waveform is divided into multiple cycles according to the ultrasonic frequency, one or more criteria are set, and the real ultrasonic echo signal is detected from the original ultrasonic waveform. The first sine wave of the ultrasonic echo signal that meets the set criteria is selected, and then the ADC position corresponding to the first sine wave is selected as the low-precision ultrasonic echo starting point, wherein the criteria include: the energy value and amplitude value of the cycle, whether the waveform shape is a sine wave or a limited sine wave, and the period of the cycle.

[0026] Furthermore, before step 22, step 21 is also included: calculating the difference between two adjacent TIM data, dividing the difference by the operating frequency of the first timer, calculating the frequency of the pulse square wave signal, and when the frequency of the pulse square wave signal is less than or equal to the ultrasonic frequency, it is judged to be qualified, otherwise it is noise; if it is judged to be noise, the data to be tested in the two TIM data are eliminated.

[0027] Furthermore, in step S2, the condition for completing the collection of ADC data and TIM data of the current ultrasonic ranging is that the ADC data buffer is full.

[0028] The present invention also provides the following technical solutions:

[0029] A high-precision ultrasonic distance detection system includes a single-chip microcomputer, wherein the single-chip microcomputer includes a comparator, an analog-to-digital converter and a timer. The single-chip microcomputer is connected to an ultrasonic echo signal and executes the high-precision ultrasonic distance detection method described in any of the above schemes.

[0030] Furthermore, the clock frequency of the single chip microcomputer is greater than or equal to 50 MHz.

[0031] Furthermore, the operating frequency of the first timer is equal to or greater than the clock frequency of the single-chip microcomputer.

[0032] The present invention achieves the following technical effects:

[0033] The high-precision ultrasonic distance detection method of the present invention can filter noise and obtain high-precision ultrasonic distance measurement results by combining and applying functional units such as an ADC module, a comparator and a timer built into a single-chip microcomputer, thereby greatly reducing the cost of the high-precision ultrasonic distance measurement system. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 is a functional block diagram of ultrasonic distance detection of the present invention;

[0035] Figure 2 is a flow chart of ultrasonic distance detection of the present invention;

[0036] Figure 3 It is the corresponding waveform diagram of ADC data and TIM data. DETAILED DESCRIPTION

[0037] To further illustrate various embodiments, the present invention provides drawings. These drawings are part of the disclosure of the present invention, which are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these contents, ordinary technicians in this field should be able to understand other possible implementations and advantages of the present invention.

[0038] The present invention will now be further described with reference to the accompanying drawings and specific implementation methods.

[0039] like Figure 1 and Figure 2As shown, the present invention provides a high-precision ultrasonic distance detection method, which utilizes resources such as a timer module, an ADC module, a comparator module, and a DMA transmission controller in a single-chip microcomputer to synchronously process the collected ultrasonic echo signal to form two types of data, namely, ADC data and TIM data, and then obtains a low-precision ultrasonic echo starting point according to the ADC data cache, and then finds TIM data representing a high-precision echo starting point according to the time correspondence between the positions of the TIM data and the ADC data according to the ADC position representing the low-precision ultrasonic echo starting point, and then obtains the echo time through the TIM data, thereby calculating the echo distance according to the echo time to obtain the final measurement result.

[0040] In this embodiment, an ultrasonic detector composed of a single-chip microcomputer of the STM32F302 series (STM32F302 is a mixed-signal single-chip microcomputer MCU using an ARM Cortex-M4 core (with FPU and DSP instructions) running at 72MHz) is used for liquid level detection. The single-chip microcomputer is connected to the sensor to receive ultrasonic echo signals. In the application of this embodiment, the ultrasonic frequency selection range is 200KHz-500KHz.

[0041] First, set the resources of the microcontroller STM32F302 as follows:

[0042] (1) Configure the timer TIM1 as a high-frequency timer. For example, if the input clock of STM32F302 is 72MHz, then configure the operating frequency of the timer TIM1 to be a multiple of the input clock (the highest frequency allowed by this series of microcontrollers), 144MHz. The timer is triggered by the output signal of the comparator and is triggered when the comparator output rises. To achieve higher measurement accuracy, in specific applications, the input clock frequency of the selected microcontroller is not less than 50MHz, and the trigger frequency of the selected high-frequency timer is not less than 50MHz, that is, the operating frequency of at least one timer of the microcontroller is equal to or greater than (achieved by internal frequency multiplication) the clock frequency of the microcontroller.

[0043] (2) configuring the comparator and ADC in the single-chip microcomputer, configuring the input of the ultrasonic echo signal, and synchronously sending the ultrasonic echo signal to the comparator and the analog-to-digital converter.

[0044] (3) Configure the data memory and set the ADC data cache and TIM data cache;

[0045] (3) Configure the DMA1_CH1 channel to directly write the generated ADC data into the ADC data cache; configure the DMA1_CH2 channel to directly write the generated TIM data into the TIM data cache.

[0046] Ultrasonic ranging steps:

[0047] When the single chip microcomputer receives the ultrasonic echo signal, it divides the ultrasonic echo signal into two paths and sends them to the comparator COMP and the analog-to-digital converter ADC respectively. At the same time, the timer TIM1 is triggered to enter the capture mode.

[0048] In the comparator COMP, a pulse square wave signal is generated according to the comparison result of the ultrasonic echo signal and the reference voltage output by the digital-to-analog converter DAC. The timer TIM1 captures the rising edge of the pulse square wave signal. The timer TIM1 enables the DMA transfer controller and writes the count value of the timer TIM1 at the capture moment directly into the TIM data cache through DMA, which is recorded as TIM data.

[0049] At the same time, the output of each sampling of the analog-to-digital converter ADC is directly written into the ADC data cache through DMA mode, recorded as ADC data, and the position of the ADC data in the ADC data cache is recorded as the ADC position. In this embodiment, the sampling frequency of the analog-to-digital converter ADC is set to 3.6MHz, which is 1 / 40 of the operating frequency 144MHz of the timer TIM1. Preferably, the operating frequency of the timer TIM1 is N times the sampling frequency of the ADC, where N is an integer not less than 4. The storage capacity of the ADC data is set to 1650 data points, i.e., 1650 ADC positions, which can record about 0.4583ms of ADC data. In specific applications, the sampling frequency of the analog-to-digital converter ADC can be selected according to the amount of ADC data to be stored and the length of time (or ranging range) of the recording.

[0050] Optionally, when the ADC data buffer is full, the data collection of this ultrasonic ranging is terminated.

[0051] After the total acquisition time is over, the ADC data in the ADC data buffer and the TIM data in the TIM data buffer are processed to obtain a high-precision ultrasonic echo starting point, and the echo time t can be obtained according to the ultrasonic echo starting point, and then the ultrasonic echo stroke is calculated according to the formula s (stroke) = v (speed) * t (time), and then the liquid level h is calculated in this embodiment, h = s (stroke) / 2. Among them, v is the propagation speed of the ultrasonic wave in the conductive medium, and the conductive medium is generally a fluid such as air or water according to the application.

[0052] Through the above steps, a single ultrasonic ranging is completed, waiting for another trigger to perform the next ultrasonic ranging.

[0053] refer to Figure 3 As shown in Table 1, specifically, the method for obtaining the echo time t is based on the following principles:

[0054] The TIM data generated by the pulse square wave signal output by the timer TIM1 capture comparator and the ADC data output by the ADC are collected simultaneously. Although the frequencies are different, there is a corresponding relationship in time. For each TIM data, the ADC position of the corresponding ADC data can be found in the ADC data cache according to the corresponding relationship in time.

[0055] The original ultrasonic waveform collected by the ADC has a certain degree of distortion, but since the sampling frequency of the ADC is still much higher than the ultrasonic frequency, preferably, the sampling frequency of the ADC module is at least 4 times the ultrasonic frequency, so it can be used for basic judgment and retrieval to obtain a low-precision ultrasonic echo starting point.

[0056] Since the timer TIM1 adopts an ultra-high frequency, the collected data has high accuracy. Therefore, the TIM data includes a more accurate ultrasonic echo starting point position, or a high-precision ultrasonic echo starting point.

[0057] Therefore, by combining the advantages of both, a comprehensive judgment is made. According to the one-to-one correspondence between the low-precision ultrasonic echo starting point and the high-precision ultrasonic echo starting point, the high-precision ultrasonic echo starting point can be obtained, thereby accurately calculating the echo time and obtaining the precise liquid height.

[0058] Specifically, the cached ADC data and TIM data are processed, including:

[0059] (1) Check whether the frequency of the pulse square wave signal meets the specified frequency. This method can eliminate the noise in the pulse square wave signal. Specifically, in this step, the difference between two adjacent TIM data (two TIM data, one is the reference data and the other is the data to be tested) can be calculated. The timer frequency used by the TIM is divided by the difference, which is the frequency of the pulse square wave signal. If this frequency is within the normal ultrasonic frequency range (that is, the pulse square wave signal frequency is less than or equal to the ultrasonic frequency), it is judged to be qualified, otherwise it is noise. If it is judged to be noise, the data to be tested in the two TIM data are eliminated.

[0060] (2) The original ultrasonic waveform represented by the ADC data buffer can be divided into a number of cycles according to the ultrasonic cycle or through zero-crossing detection, etc. Each original ultrasonic waveform contains a certain amount of ADC data.

[0061] (3) In the TIM data with qualified frequency (noise excluded), the time point corresponding to each TIM data is converted, and the position of the ADC data in the ADC data cache is located according to the time point, that is, the ADC position. To find the cycle where each ADC position is located, one or more criteria can be set, such as judging the energy value and amplitude of each cycle, whether the waveform shape is a sine wave or a limited sine wave, and judging whether the distance between two adjacent sine waves is within a reasonable range, that is, whether the time interval between adjacent zero crossings and peaks or troughs is one-fourth of the sine wave cycle, whether the time interval between two adjacent zero crossings is one-half of the sine wave cycle, and whether the time interval between two adjacent troughs or between two peaks is equal to the sine wave cycle. One or more criteria (such as energy value, amplitude value, sine wave, etc.) can be set to determine which cycles are real ultrasonic echo signals (that is, detect the real ultrasonic echo signal from the original ultrasonic waveform), and the ADC position corresponding to the first sine wave of the real ultrasonic echo signal is the low-precision ultrasonic echo starting point. According to the ADC position representing the low-precision ultrasonic echo starting point, a reverse query is performed, and the time point represented by the TIM data corresponding to the ADC position is the high-precision ultrasonic echo starting point. For example, the TIM data of sequence number 7 in Table 1 has a value of 7883, and the corresponding ADC position is 197. The cycle of the ADC position is analyzed, and the amplitude value of the cycle where the ADC data is located is 250. Combined with the sine wave determination of the cycle, it can be determined that the cycle is a real ultrasonic echo signal, and it is the first sine wave of the real ultrasonic echo signal. Therefore, according to the reverse query of the ADC position, the time point represented by the TIM data with a value of 7883 is the high-precision ultrasonic echo starting point.

[0062] Table 1: ADC data and TIM data comparison table

[0063] Serial number TIM Data TIM time (ms) stimulus signal ADC Location Waveform Amplitude First wave 1 45 0.3125 yes 1 No need to judge no 2 680 4.722222222 yes 17 No need to judge no 3 1727 11.99305556 yes 43 No need to judge no 4 5361 37.22916667 no 134 143 no 5 6602 45.84722222 no 165 131 no 6 7360 51.11111111 no 184 137 no 7 7883 54.74305556 no 197 250 yes 8 8685 60.3125 no 217 250 no 9 9247 64.21527778 no 231 250 no 10 10243 71.13194444 no 256 98 no 11 11166 77.54166667 no 279 84 no 12 12325 85.59027778 no 308 105 no 13 13760 95.55555556 no 344 156 no 14 15044 104.4722222 no 376 144 no 15 16520 114.7222222 no 413 72 no 16 19289 133.9513889 no 482 80 no

[0064] (4) At this time, the TIM data of sequence number 7 is taken out and converted to obtain the TIM time of 54.74305556 ms, which is then multiplied by the known ultrasonic velocity to finally calculate the true, accurate, and high-precision liquid level height.

[0065] In this embodiment, the resolution of distance measurement can reach 0.02 mm, and the comprehensive measurement accuracy can reach 0.3 mm.

[0066] exist Figure 3 In the figure, curve S1 is the original waveform of the ultrasonic wave, and curve S2 is the high-precision pulse signal formed by the pulse square wave signal output by the timer TIM1 capturing the comparator.

[0067] The high-precision ultrasonic distance detection method of the present invention combines and applies functional units such as an ADC module, a comparator, and a timer built into a single-chip microcomputer, obtains a low-precision ultrasonic echo starting point through ADC data collected by the ADC module, obtains a high-precision ultrasonic echo starting point through TIM data collected by the comparator and the timer, and through the temporal correspondence between the TIM data and the ADC data, the corresponding high-precision ultrasonic echo starting point can be found through the low-precision ultrasonic echo starting point, thereby obtaining a high-precision ultrasonic distance measurement result.

[0068] The present invention also proposes a high-precision ultrasonic distance detection system. Since the system uses the comparator, memory, timer, memory and other resources inside the single-chip microcomputer, the ultrasonic echo signal is processed by the above method to achieve high-precision ultrasonic distance detection. Therefore, the single-chip microcomputer has few peripheral devices, which can greatly reduce the hardware cost of the system.

[0069] Although the present invention has been specifically shown and described in conjunction with the preferred embodiments, it should be understood by those skilled in the art that various changes may be made to the present invention in form and details without departing from the spirit and scope of the present invention as defined by the appended claims, all of which are within the scope of protection of the present invention.

Claims

1. A high-precision ultrasonic distance detection method, It is characterized in that MCU-based timers, comparators, and analog-to-digital converters, including: Step S1, configure the microcontroller: Configure a first timer, where the first timer is a high-frequency timer and operates in a capture mode after being triggered; Configure a comparator and an analog-to-digital converter, configure an input of an ultrasonic echo signal, and synchronously send the ultrasonic echo signal to the comparator and the analog-to-digital converter; Step S2, perform ranging: The ultrasonic echo signal is input, and the first timer is triggered; The comparator processes the ultrasonic echo signal and outputs a pulse square wave signal, and the first timer captures the rising edge of the pulse square wave signal and records the count value at the time of capture, which is recorded as TIM data; The analog-to-digital converter samples the ultrasonic echo signal and outputs ADC data; the ADC data is stored in the ADC data cache in a sampling order, and the position of the ADC data in the ADC data cache is recorded as the ADC position; After completing the acquisition of ADC data and TIM data of the ultrasonic ranging, according to the time correspondence between the ADC positions of the TIM data and the ADC data, the ADC position representing the low-precision ultrasonic echo starting point is searched through the continuous waveform represented by the ADC data cache, and then the high-precision ultrasonic echo starting point is obtained through the corresponding TIM data; The echo time is calculated according to the TIM data indicating the high-precision ultrasonic echo starting point, and then the ultrasonic echo distance is calculated according to the echo time and ultrasonic velocity, thereby obtaining the distance measurement result of the ultrasonic distance measurement. Wherein, in step S2, according to the temporal correspondence between the ADC positions of the TIM data and the ADC data, searching for the ADC position representing the starting point of the low-precision ultrasonic echo through the continuous waveform represented by the ADC data cache specifically includes: Step S22, searching the ADC position of the corresponding ADC data in the ADC data cache according to the time point represented by each TIM data, and making one-to-one correspondence between the TIM data in the TIM data cache and the ADC position; Step S24, detecting a true ultrasonic echo signal from the continuous waveform represented by the ADC data cache, and taking the ADC position corresponding to the first sine wave of the true ultrasonic echo signal as the first ultrasonic echo starting point, that is, the low-precision ultrasonic echo starting point; Step S26, reversely search for the corresponding TIM data according to the ADC position indicating the starting point of the first ultrasonic echo, and take the time point indicated by the TIM data as the starting point of the second ultrasonic echo, that is, the high-precision ultrasonic echo starting point.

2. The high-precision ultrasonic distance detection method according to claim 1, It is characterized in that The sampling frequency of the analog-to-digital converter is greater than or equal to 4 times the ultrasonic frequency and is one-Nth of the operating frequency of the first timer, where N is an integer not less than 4.

3. The high-precision ultrasonic distance detection method according to claim 1, It is characterized in that In step S1, a first DMA channel is configured to store ADC data in sequence into an ADC data buffer; A second DMA channel is configured to store the TIM data in sequence into the TIM data buffer.

4. The high-precision ultrasonic distance detection method according to claim 1, It is characterized in that The step S24 specifically includes: The original ultrasonic waveform is divided into multiple cycles according to the ultrasonic frequency, one or more criteria are set, and the real ultrasonic echo signal is detected from the original ultrasonic waveform. The first sine wave of the ultrasonic echo signal that meets the set criteria is selected, and then the ADC position corresponding to the first sine wave is selected as the low-precision ultrasonic echo starting point, wherein the criteria include: the energy value, amplitude value, whether the waveform shape is a sine wave, and the period of the cycle.

5. The high-precision ultrasonic distance detection method according to claim 1, It is characterized in that Before step 22, the method further includes step 21: calculating a difference between two adjacent TIM data, dividing the difference by the working frequency of the first timer, and calculating the frequency of the pulse square wave signal; when the frequency of the pulse square wave signal is less than or equal to the ultrasonic frequency, it is determined to be qualified, otherwise it is noise; If it is determined to be noise, the data to be tested in the two TIM data are eliminated.

6. The high-precision ultrasonic distance detection method according to claim 1, It is characterized in that In step S2, the condition for completing the collection of ADC data and TIM data of the current ultrasonic ranging is that the ADC data buffer is full.

7. A high-precision ultrasonic distance detection system, It is characterized in that It comprises a single chip microcomputer and an ultrasonic probe; the transmitting end and the receiving end of the ultrasonic probe are connected to the single chip microcomputer; the single chip microcomputer executes the high-precision ultrasonic distance detection method as described in any one of claims 1-6.

8. The high-precision ultrasonic distance detection system according to claim 7, It is characterized in that The clock frequency of the single chip microcomputer is greater than or equal to 50 MHz.

9. The high-precision ultrasonic distance detection system according to claim 7, It is characterized in that The operating frequency of the first timer is equal to or greater than the clock frequency of the single chip microcomputer.