Electronic device and method for distinguishing ultrasonic echoes

The ultrasonic echo discrimination method using zero-crossing synchronous timing and multi-threshold judgment solves the problem of traditional methods being susceptible to noise interference, achieving high-precision and high-reliability echo detection, and is suitable for low-cost and low-power systems.

CN122017815APending Publication Date: 2026-05-12ZHEJIANG WEIXING INTELLIGENT METER STOCK
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHEJIANG WEIXING INTELLIGENT METER STOCK
Filing Date
2026-03-19
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Traditional ultrasonic echo detection methods are susceptible to interference from environmental and circuit noise, resulting in unreliable measurement results. The success rate drops, especially when the echo signal is weak. Furthermore, existing improved solutions such as dynamic thresholding and DSP algorithms are costly and have poor real-time performance, making them unsuitable for low-cost, low-power embedded systems.

Method used

A combination of zero-crossing comparators, multi-threshold comparators, and time window control units is used. The zero-crossing point of the echo signal is used as the timing reference. Combined with multi-threshold judgment and pulse counting, the flight time and echo status are calculated by logic gate units and microcontroller units.

Benefits of technology

It achieves high-precision time-of-flight measurement, effectively distinguishes between real echoes and noise interference, improves detection reliability, provides echo energy information, and enhances the system's environmental adaptability and measurement stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122017815A_ABST
    Figure CN122017815A_ABST
Patent Text Reader

Abstract

The invention discloses an ultrasonic echo discrimination electronic device and method, and the electronic device comprises a zero-crossing comparator, a first threshold comparator, a second threshold comparator and a third threshold comparator, and the input ends of the zero-crossing comparator, the first threshold comparator, the second threshold comparator and the third threshold comparator are all connected to an echo signal input end, and are used for receiving an echo signal; the output ends of the zero-crossing comparator, the first threshold comparator and the time window control unit are connected to the first part of the logic gate unit, and the first part of the logic gate unit outputs a first zero-crossing point trigger signal; the output end of the second threshold comparator is connected to the second part of the logic gate unit through the trigger unit, and the second part of the logic gate unit outputs a second zero crossing point trigger signal; the output end of the third threshold comparator outputs a pulse count value to the micro-control unit through the counter; the micro-control unit receives the first zero-crossing trigger signal, the second zero-crossing trigger signal and the pulse count value, comprehensively calculates the flight time and discriminates the echo state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electronic measurement technology, and in particular to an electronic device and method for ultrasonic echo discrimination. Background Technology

[0002] Ultrasonic testing technology is widely used in industrial ranging, liquid level measurement, material flaw detection, and medical imaging due to its advantages such as non-contact operation, high precision, and moderate cost. Its basic principle is to emit ultrasonic pulses into the medium under test and receive the echo signals reflected back from the target. Distance is calculated or medium properties are analyzed by measuring the time difference between transmission and reception (i.e., time of flight, ToF).

[0003] In practical applications, accurately detecting the arrival time of echo signals is crucial for achieving high-precision measurements. Traditional ultrasonic echo detection methods typically employ a fixed threshold comparison method, where an echo is considered to have arrived when the voltage amplitude of the echo signal exceeds a preset fixed threshold, triggering a timer to stop. Using a single threshold comparison method is highly susceptible to interference from environmental noise, circuit noise, or residual vibrations from the transmission, leading to false triggers and unreliable measurement results. Especially when the echo signal is weak and the signal-to-noise ratio is low, the success rate of traditional methods drops sharply.

[0004] To overcome the aforementioned problems, several improvements have emerged in existing technologies, such as using dynamic thresholding and digital signal processing (DSP) algorithms to analyze waveform envelopes. While dynamic thresholding can adapt to signal amplitude variations to some extent, the algorithm is complex, has poor real-time performance, and remains sensitive to rapidly changing noise. DSP algorithms require high-performance processors and analog-to-digital converters, resulting in high costs and power consumption, making them unsuitable for low-cost, low-power embedded systems.

[0005] Therefore, in view of the above-mentioned technical problems, the present invention proposes an electronic device and method for ultrasonic echo discrimination. Summary of the Invention

[0006] The purpose of this invention is to address the shortcomings of existing technologies by providing an electronic device and method for ultrasonic echo discrimination.

[0007] To achieve the above objectives, the present invention adopts the following technical solution: An ultrasonic echo discrimination electronic device includes a zero-crossing comparator, a first threshold comparator, a second threshold comparator, a third threshold comparator, a time window control unit, a trigger unit, a logic gate unit, and a counter. The input terminals of the zero-crossing comparator, the first threshold comparator, the second threshold comparator, and the third threshold comparator are all connected to the echo signal input terminal for receiving echo signals. The output of the zero-crossing comparator, the output of the first threshold comparator, and the output of the time window control unit are connected to the first part of the logic gate unit, and the first part of the logic gate unit outputs a first zero-crossing trigger signal. The output of the second threshold comparator is connected to the second part of the logic gate unit through a flip-flop unit, and the second part of the logic gate unit outputs a second zero-crossing trigger signal; The output of the third threshold comparator outputs a pulse count value to the microcontroller via a counter. The microcontroller receives a first zero-crossing trigger signal, a second zero-crossing trigger signal, and a pulse count value, and calculates the flight time and determines the echo status.

[0008] Furthermore, the first part of the logic gate unit includes a first AND gate and a second AND gate; the time window control unit includes a programmable time masking window unit and a fixed time window trigger; The output of the first threshold comparator and the output of the programmable time masking window unit are connected to the input of the first AND gate; The output of the first AND gate is connected to the input of a fixed-time-window trigger, and the output of the fixed-time-window trigger is connected to the first input of the second AND gate. The output of the zero-crossing comparator is connected to the second input of the second AND gate; The output of the second AND gate outputs the first zero-crossing trigger signal.

[0009] Furthermore, the programmable time shielding window unit is controlled to open and close by a microcontroller unit to shield interference for a predetermined time after ultrasonic wave emission; the fixed time window trigger is used to generate a fixed time window.

[0010] Furthermore, the trigger unit includes a trigger, the input of which is connected to the output of the second threshold comparator, and the output of which is connected to the second part of the logic gate unit.

[0011] Furthermore, the second part of the logic gate unit includes a third AND gate; The output of the trigger is connected to the first input of the third AND gate; The output of the zero-crossing comparator is connected to the second input of the third AND gate; The output of the third AND gate outputs a second zero-crossing trigger signal.

[0012] Furthermore, the logic gate unit also includes a fourth AND gate, the input of which is connected to the output of the third threshold comparator, and the output of which is connected to the clock input of the counter.

[0013] Furthermore, the reference voltage of the first threshold comparator is set to a first low threshold for detecting the start edge of the echo signal; the reference voltage of the second threshold comparator is set to a second high threshold, and the second high threshold is greater than the first low threshold.

[0014] Furthermore, the reference voltage of the third threshold comparator is set to 2.5V.

[0015] Furthermore, it also includes a time-to-digital converter, the input of which is connected to the output of the logic gate unit, and the output of which is connected to the microcontroller unit. It is used to convert the first zero-crossing trigger signal and the second zero-crossing trigger signal output by the logic gate unit into flight time data and output it to the microcontroller unit.

[0016] Correspondingly, an ultrasonic echo discrimination method is also provided, including: Acquire echo signal; The zero-crossing square wave signal of the echo signal is generated by a zero-crossing comparator; A first enable signal is generated by a first threshold comparator when the echo signal exceeds a first low threshold. Within a fixed time window, the first enable signal and the zero-crossing square wave signal are logically ANDed to generate the first zero-crossing trigger signal. The second threshold comparator triggers latching when the echo signal exceeds the second high threshold, and performs a logical AND operation between the latched signal and the zero-crossing square wave signal to generate the second zero-crossing trigger signal. A pulse is generated when the echo signal exceeds a preset threshold using a third threshold comparator, and the pulses are counted to obtain the pulse count value. Based on the first zero-crossing trigger signal, the second zero-crossing trigger signal, and the pulse count value, the flight time is calculated and the echo status is determined.

[0017] Compared with the prior art, the present invention has the following beneficial effects: 1. This invention uses zero-crossing synchronous timing, taking the zero-crossing point of the echo signal as the timing reference. Since the position of the zero-crossing point is less affected by amplitude changes, time wandering error is eliminated, and high-precision flight time measurement is achieved.

[0018] 2. This invention employs three comparators with different threshold values. The first low-threshold comparator is used to capture weak echoes, ensuring no signal is missed; the second high-threshold comparator is used to confirm strong echoes, preventing false noise detection; and the third threshold comparator is used for pulse counting, reflecting the echo energy. By comprehensively judging these three pieces of information, it is possible to effectively distinguish between real echoes and noise interference, significantly improving detection reliability.

[0019] 3. This invention not only outputs the flight time of the echo but also obtains the energy information of the echo through pulse counting, which is used to determine the amplitude and state of the echo. This allows the system to not only measure distance but also assist in judging the characteristics of the target, providing more valuable information for upper-level applications.

[0020] 4. This invention sets up a programmable time shielding window controlled by an MCU and a fixed-width time window, which limits the echo detection to an effective time range, effectively filters out the residual vibration of the transmission and out-of-band noise, and further enhances the environmental adaptability of the system. Attached Figure Description

[0021] Figure 1 This is a circuit diagram of the first threshold path, the second threshold path, and the zero-crossing detection path provided in Embodiment 1; Figure 2 This is the pulse counting circuit diagram provided in Embodiment 1; Figure 3 This is a schematic diagram of the echo signal waveform provided in Embodiment 1; Figure 4 This is a schematic diagram of the echo state discrimination logic provided in Embodiment 1; Figure 5 The test data obtained using this solution is provided in Example 2; Figure 6 The data provided in Example 2 is obtained using an existing solution. Detailed Implementation

[0022] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.

[0023] The purpose of this invention is to address the shortcomings of existing technologies by providing an electronic device and method for ultrasonic echo discrimination.

[0024] Example 1

[0025] This embodiment provides an electronic device for ultrasonic echo discrimination, such as... Figures 1-2 As shown, it includes a signal input conditioning circuit (not shown in the figure), a zero-crossing comparator D, a first threshold comparator A, a second threshold comparator U61, a third threshold comparator U51, a time window control unit, a trigger unit, a logic gate unit, a time-to-digital converter TDC (not shown in the figure), a counter U50, and a microcontroller unit MCU (not shown in the figure).

[0026] The signal input conditioning circuit is used to amplify and filter the received ultrasonic transducer signal and output the echo signal SIN_OUT.

[0027] The input terminals of zero-crossing comparator D, first threshold comparator A, second threshold comparator U61, and third threshold comparator U51 are all connected to the echo signal input terminal to receive the echo signal SIN_OUT from the ultrasonic receiving transducer.

[0028] The logic gate unit includes a first AND gate U57, a second AND gate U58, a third AND gate U60, and a fourth AND gate U52; wherein the first AND gate U57 is model SN74AHC1G08DBVRG4; the second AND gate U58 and the third AND gate U60 are both model SN74AUP1G00DCKR; and the fourth AND gate U52 is model SN74AHC1G08DBVR. The time window control unit includes a programmable time masking window unit C1 and a fixed time window trigger U56. The trigger unit includes a trigger U62.

[0029] This embodiment uses three independent REF3325 voltage reference chips to generate three reference voltages respectively.

[0030] like Figure 1 As shown, the input of the first REF3325 reference voltage U54 is connected to a 3V operating voltage, and the output is filtered by capacitors C146 and C147 to output a stable 2.5V reference voltage. This reference voltage passes through a first voltage divider network composed of resistors R123, R125, etc., to generate a first low threshold voltage, which is connected to the inverting input of the first threshold comparator A. The first low threshold voltage is set to a low value (e.g., 200mV) to detect the start edge of weak echo signals.

[0031] The input of the second REF3325 reference voltage U59 is connected to a 3V operating voltage, and the output is filtered by capacitors C155 and C156 to output a stable 2.5V reference voltage. This reference voltage passes through a second voltage divider network composed of resistors R128, R131, etc., to generate a second high threshold voltage, which is connected to the inverting input of the second threshold comparator U61. The second high threshold voltage is set to a relatively high value (e.g., 1V) and is greater than the first low threshold voltage, used to confirm the arrival of strong echo signals.

[0032] like Figure 3As shown, the input of the third REF3325 reference voltage U49 is connected to a 3V operating voltage, and the output is filtered by capacitors C140 and C141 to output a stable 2.5V reference voltage. This reference voltage is directly connected to the inverting input of the third threshold comparator U51 as a fixed 2.5V threshold voltage, used for pulse counting of the portion of the echo signal exceeding 2.5V. Figure 3 In the equation, S1 is the excitation signal start time, E1 is the echo arrival time, and T is the excitation signal start time. AB T is the flight time of the ultrasonic echo, and T is the actual zero-crossing time received by the TDC (MS1030). FEA This is the time difference that needs to be compensated.

[0033] This embodiment uses three independent reference sources to ensure the accuracy and independence of each threshold voltage, avoid interference between channels, and improve the stability and reliability of the entire device.

[0034] The zero-crossing comparator D is implemented using a high-speed comparator U55B, model MAX9142EKA+T. Its inverting input is grounded, and its non-inverting input receives the echo signal SIN_OUT through a coupling capacitor. When the signal at the non-inverting input of the zero-crossing comparator D changes from negative to positive and crosses the zero point, a rising edge is generated at its output; when the signal changes from positive to negative and crosses the zero point, a falling edge is generated at its output. Therefore, the zero-crossing comparator D outputs a square wave signal synchronized with the zero-crossing point of the echo signal, with each edge of this square wave corresponding to a true zero-crossing moment. Because the position of the zero-crossing point on the time axis is highly stable and largely unaffected by amplitude attenuation, using the zero-crossing point as a timing reference can effectively eliminate the inherent error of the traditional fixed threshold method.

[0035] The non-inverting input of the first threshold comparator A receives the echo signal SIN_OUT, and the inverting input receives the first low threshold voltage obtained by voltage division from the U54 reference source. When the amplitude of the echo signal SIN_OUT exceeds the first low threshold voltage, the output of the first threshold comparator A changes from low to high, outputting the signal LOW_TH, which indicates that the start edge of the echo has been detected.

[0036] The output of the first threshold comparator A is connected to one input of the first AND gate U57, and the other input of the first AND gate U57 is connected to the output MCU_CTRL of the programmable time masking window unit C1. The programmable time masking window unit C1 is implemented by a general-purpose input / output pin of the microcontroller unit (MCU). After the ultrasonic wave is emitted, the MCU sets the MCU_CTRL pin to a high level after a certain delay (e.g., 130µs) and opens the detection window. This delay time corresponds to the time required to reach the nearest detection distance or avoid the aftershocks of the emission. The output signal of the first AND gate U57 becomes high when both LOW_TH and MCU_CTRL are high.

[0037] The output of the first AND gate U57 is connected to the input of the fixed-time-window trigger U56. When the output signal of the first AND gate U57 has a rising edge, U56 is triggered, and its output Q generates a fixed time window. This time window is set according to the actual application requirements; in this embodiment, it is set to 20µs. This 20µs window is used to limit the output of the zero-crossing comparator D, ensuring that zero-crossing detection is only performed within a reasonable time after the echo arrives, preventing noise from triggering the timing during invalid time periods. The fixed-time-window trigger U56 is model 74LVC1G123DP.

[0038] The first input of the second AND gate U58 is connected to the output of the fixed-time window trigger U56, and the second input of the second AND gate U58 is connected to the output of the zero-crossing comparator D. The output of the second AND gate U58 is the first zero-crossing trigger signal STOP1 (e.g., ...). Figure 3 Points D2, D3, D4, and D5 in the diagram. This signal is only valid at the output of U56 and generates a narrow pulse when an edge appears at the output of the zero-crossing comparator D, which is then sent to the STOP1 input of the time-to-digital converter TDC. TDC records the time interval T1 from the transmission time to STOP1.

[0039] The non-inverting input of the second threshold comparator U61 receives the echo signal SIN_OUT, and the inverting input receives the second high threshold voltage obtained by voltage division from the reference source U59. When the amplitude of the echo signal SIN_OUT exceeds the second high threshold voltage, the output of the second threshold comparator U61 changes from low to high.

[0040] The output of the second threshold comparator U61 is connected to the input of the flip-flop U62. The reset pin of the flip-flop U62 is connected to the reset control pin of the MCU. When the second threshold comparator U61 outputs a high level, the flip-flop U62 is set, and its output Q outputs a high level HIGH_TH_LATCH, maintaining this state until the MCU resets it before the start of the next measurement cycle. This latching function ensures that high threshold events are not missed, even if the echo signal duration is very short; the flip-flop U62 is model SN74LVC1G74DCUR.

[0041] The first input of the third AND gate U60 is connected to the output of the flip-flop U62, and the second input is connected to the output of the zero-crossing comparator D. The output of the third AND gate U60 is the second zero-crossing trigger signal STOP2. This signal generates a narrow pulse when the output of U62 is high and an edge appears at the output of the zero-crossing comparator D, and is sent to the STOP2 input of the time-to-digital converter TDC. TDC records the time interval T2 from the transmission time to STOP2.

[0042] The non-inverting input of the third threshold comparator U51 receives the echo signal SIN_OUT, and the inverting input receives a precise 2.5V reference voltage from the reference source U49. When the amplitude of the echo signal SIN_OUT exceeds 2.5V, the output of the third threshold comparator U51 generates a high-level pulse, outputting the signal MID_TH. The echo signal may exceed 2.5V multiple times within one cycle; therefore, the MID_TH signal is a series of pulses, the number of which reflects the amplitude and duration of the echo.

[0043] One input of the fourth AND gate U52 is connected to the output MID_TH of the third threshold comparator U51, and the other input is connected to the counting enable signal COUNT_EN provided by the MCU. The time window of the counting enable signal COUNT_EN is slightly wider than the possible duration of the echo, ensuring that the entire echo signal is covered and avoiding miscounting during invalid time periods.

[0044] The output of the fourth AND gate U52 is connected to the clock input of the counter U50. Counter U50 is a 14-stage binary counter 74HC4040, and its output selects a portion of the bits as the pulse count value, which is connected to the input pin of the MCU. The reset pin of counter U50 is connected to the reset control pin of the MCU, and is reset to zero by the MCU before the start of each measurement cycle.

[0045] When the amplitude of the echo signal SIN_OUT exceeds 2.5V multiple times, the third threshold comparator U51 outputs multiple pulses. These pulses are enabled by the fourth AND gate U52 and then input to the counter U50 for counting. After the measurement cycle ends, the MCU reads the output value of the counter U50 to obtain the number C of pulses where the echo signal exceeds 2.5V. This count value is positively correlated with the echo amplitude and duration, providing a basis for judging the echo intensity and target characteristics.

[0046] The Time-to-Digital Converter (TDC) is implemented using a high-precision time measurement chip, model MS1030. Its START pin is connected to the synchronization output signal of the ultrasonic transmitter drive circuit to start timing. The STOP1 and STOP2 pins receive the first zero-crossing trigger signal STOP1 and the second zero-crossing trigger signal STOP2, respectively, to stop timing. The TDC accurately measures the time interval T1 from START to STOP1 and the time interval T2 from START to STOP2. The TDC connects to the MCU via an SPI interface to transmit the measured time data to the MCU.

[0047] The microcontroller unit (MCU) is model STM32L451VET6. Its functions include: controlling the opening and closing of the programmable time mask window MCU_CTRL; controlling the reset of trigger U62 and counter U50; providing the counting enable signal COUNT_EN; reading the time data T1 and T2 obtained from TDC measurement; reading the pulse count value output by counter U50; and comprehensively calculating the flight time and determining the echo status based on the flight time T1 corresponding to the first zero-crossing trigger signal STOP1, the flight time T2 corresponding to the second zero-crossing trigger signal STOP2, and the pulse count value.

[0048] The MCU's comprehensive judgment logic is as follows: When both STOP1 and STOP2 are valid and the time difference between T1 and T2 is less than a preset value, it indicates the existence of an echo with sufficient strength and high reliability, which is judged as a strong echo, and the flight time can be calculated by combining the two signals; when only STOP1 is valid, it indicates the existence of a weak echo, the flight time is calculated based on T1, and the reliability of the echo is evaluated by combining the pulse count value C; when the logical relationship or time relationship between STOP1 and STOP2 exceeds the preset range, or the pulse count value C is abnormal, it is judged as noise or interference and the data is discarded to prevent erroneous output.

[0049] like Figure 4In the diagram, A represents the first zero-crossing trigger signal STOP1 output by the first threshold comparator and its subsequent circuits, corresponding to the first low threshold detection path; B represents the second zero-crossing trigger signal STOP2 output by the second threshold comparator and its subsequent circuits, corresponding to the second high threshold detection path; and C represents the pulse count value output by the third threshold comparator and its counter, corresponding to the 2.5V fixed threshold detection path.

[0050] Channels A and B are used to detect the zero-crossing point of the first cycle (i.e., the first wave) of the echo signal, while channel C is used to detect the number of pulses in the echo signal that exceed the 2.5V threshold.

[0051] The STOP1 and STOP2 signals are output to the time-to-digital converter (TDC) to calculate the flight times of A and B. The echo waveform size is preset to be between 200mV and 1V for the first wave, which is considered a normal waveform. When the waveform changes due to environmental factors, the size of the first wave of the echo will also change. Since the preset threshold voltage remains constant, the zero-crossing times of A and B will change accordingly. Furthermore, by combining the pulse quantity of the comparator preset at the 2.5V threshold point output by the counter U50 within the time window, the current state of the echo waveform size can be determined, which is used by the microcontroller as a basis for adjusting the echo size.

[0052] Table 1 below shows the comparison table of three threshold output characteristics under different intensity echoes, including normal intensity echo, high intensity echo, ultra-high intensity echo, low intensity echo, excessively low intensity echo in case 1, and excessively low intensity echo in case 2. When the echo signal strength is normal, both the first threshold channel A and the second threshold channel B are triggered within the first cycle of the echo, and the zero-crossing points detected by both are at the same time, that is, the timing of the first zero-crossing trigger signal STOP1 and the second zero-crossing trigger signal STOP2 are basically the same. At the same time, the echo signal amplitude just exceeds the 2.5V threshold once, so the pulse count value of the third threshold channel C is 1.

[0053] When the echo signal strength is high, the first threshold channel A and the second threshold channel B are still triggered within the first cycle of the echo, and their zero-crossing times are the same. However, due to the increased echo amplitude, the signal exceeds the 2.5V threshold twice during the oscillation process, so the pulse count value of the third threshold channel C is 2.

[0054] When the echo signal strength is extremely high, the first threshold channel A and the second threshold channel B are still triggered within the first cycle of the echo, and their zero-crossing times are the same. Because the echo amplitude is very large, the signal exceeds the 2.5V threshold multiple times, so the pulse count value of the third threshold channel C is 3 or more.

[0055] When the echo signal strength is low, the first threshold channel A, due to its low threshold setting, can be triggered within the first cycle of the echo, outputting the STOP1 signal. However, the second threshold channel B, due to its high threshold setting, has insufficient amplitude within the first cycle and cannot be triggered. It is not until the second cycle of the echo, when the signal amplitude has accumulated and increased, that the trigger condition is met, outputting the STOP2 signal. Therefore, the second threshold channel B is one full ultrasonic cycle later than the first threshold channel A, meaning that the zero-crossing times of STOP2 and STOP1 are different, with a time difference approximately equal to one ultrasonic cycle. Simultaneously, the echo signal amplitude may just exceed 2.5V once, or it may never reach 2.5V; therefore, the pulse count value of the third threshold channel C is either 1 or 0.

[0056] When the echo signal strength is too low and the threshold settings of the first threshold channel A and the second threshold channel B are relatively close, both are still triggered within the same cycle, with the same zero-crossing time. However, since the echo amplitude never reaches 2.5V, the pulse count value of the third threshold channel C is 0.

[0057] When the echo signal strength is too low and the waveform is distorted, the triggering periods of the first threshold channel A and the second threshold channel B are inconsistent, and their zero-crossing times are different. Simultaneously, the echo amplitude never reaches 2.5V, and the pulse count value of the third threshold channel C is 0.

[0058] Table 1. Comparison of Three-Threshold Output Characteristics under Echoes of Different Intensities normal A: B has the same zero-crossing point. C pulse number 1 big A: B has the same zero-crossing point. C pulse number 2 extra large A: B has the same zero-crossing point. C pulse number 3 Small A: B has different zero-crossing points. B+1 cycle C pulse number 1 or 0 Too small case 1* A: B has the same zero-crossing point. C pulse count 0 Too small case 2* A: B has different zero-crossing points. C pulse count 0 Compared with the prior art, this embodiment has the following beneficial effects: 1. This invention uses zero-crossing synchronous timing, taking the zero-crossing point of the echo signal as the timing reference. Since the position of the zero-crossing point is less affected by amplitude changes, time wandering error is eliminated, and high-precision flight time measurement is achieved.

[0059] 2. This invention employs three comparators with different threshold values. The first low-threshold comparator is used to capture weak echoes, ensuring no signal is missed; the second high-threshold comparator is used to confirm strong echoes, preventing false noise detection; and the third threshold comparator is used for pulse counting, reflecting the echo energy. By comprehensively judging these three pieces of information, it is possible to effectively distinguish between real echoes and noise interference, significantly improving detection reliability.

[0060] 3. This invention not only outputs the flight time of the echo but also obtains the energy information of the echo through pulse counting, which is used to determine the amplitude and state of the echo. This allows the system to not only measure distance but also assist in judging the characteristics of the target, providing more valuable information for upper-level applications.

[0061] 4. This invention sets up a programmable time shielding window controlled by an MCU and a fixed-width time window, which limits the echo detection to an effective time range, effectively filters out the residual vibration of the transmission and out-of-band noise, and further enhances the environmental adaptability of the system.

[0062] Example 2

[0063] This embodiment provides an ultrasonic echo discrimination method. This discrimination method is based on an ultrasonic echo discrimination electronic device as described in Embodiment 1. The discrimination method includes: S1. Acquire the echo signal; S2. Generate a zero-crossing square wave signal for the echo signal using a zero-crossing comparator; S3. A first enable signal is generated by the first threshold comparator when the echo signal exceeds a first low threshold. S4. Within a fixed time window, perform a logical AND operation between the first enable signal and the zero-crossing square wave signal to generate the first zero-crossing trigger signal; S5. When the echo signal exceeds the second high threshold, the second threshold comparator triggers latching, and the latched signal is logically ANDed with the zero-crossing square wave signal to generate the second zero-crossing trigger signal. S6. When the echo signal exceeds the preset threshold, a pulse is generated by the third threshold comparator, and the pulses are counted to obtain the pulse count value; S7. Based on the first zero-crossing trigger signal, the second zero-crossing trigger signal, and the pulse count value, calculate the flight time and determine the echo status.

[0064] At the moment of ultrasonic wave transmission, the MCU synchronously starts the time-to-digital converter (TDC) to begin timing via the START signal, while simultaneously resetting the trigger U62 and the counter U50, and disabling the output terminal MCU_CTRL and the counting enable signal COUNT_EN of the programmable time masking window unit C1.

[0065] After a preset delay time, the MCU sets MCU_CTRL to high level to open the detection window, and at the same time sets the counting enable signal COUNT_EN to high level to enable the pulse counting channel.

[0066] When the echo signal SIN_OUT arrives, it enters three processing paths simultaneously: In the low-threshold path, when the echo signal amplitude exceeds the first low-threshold voltage, the first threshold comparator A outputs a high level (LOW_TH). If MCU_CTRL is enabled at this time, the output of the first AND gate U57 is high, triggering the fixed-time window trigger U56 to generate a fixed window of 20µs. Within this window, when the echo signal crosses zero, an edge appears at the output of the zero-crossing comparator D, and the second AND gate U58 outputs the first zero-crossing trigger signal STOP1. TDC records this moment as T1.

[0067] In the high-threshold path, when the echo signal amplitude exceeds the second high-threshold voltage, the second threshold comparator U61 outputs a high level, setting the trigger U62 and locking its output to a high level. Subsequently, when the echo signal crosses zero, the third AND gate U60 outputs the second zero-crossing trigger signal STOP2, and TDC records this moment as T2.

[0068] In the pulse counting path, when the echo signal amplitude exceeds 2.5V, the third threshold comparator U51 outputs a pulse, which is then enabled by the fourth AND gate U52 and input to the counter U50 for counting. After the measurement cycle ends, the MCU reads the output value of the counter U50 to obtain the pulse count value C.

[0069] After the measurement cycle ends, the MCU reads the T1 and T2 data of TDC and the pulse count value C of counter U50. Based on this information, it judges the echo status and calculates the final flight time.

[0070] like Figure 5 The test data obtained using this method, Figure 6 To use data obtained from other existing methods, Figure 5 , Figure 6 The measurement results of this solution and existing technical solutions were compared under the same test conditions.

[0071] from Figure 5 As can be seen, the test data obtained using this scheme are generally smooth with small fluctuations, demonstrating good measurement stability. This indicates that the scheme effectively suppresses noise interference and obtains high-quality measurement data through three-threshold discrimination and zero-crossing synchronous timing technology. Furthermore, the data consistency is high, with natural transitions between measurement points and no abrupt jumps, indicating that the measurement results of this scheme have good continuity at different flow rates. Finally, the high measurement accuracy indicates good repeatability of the measurement results, which is attributed to the zero-crossing synchronous timing technology used in this scheme, which fundamentally eliminates the inherent time-walking error of the traditional fixed threshold method.

[0072] from Figure 6As can be seen, the test data obtained using the existing technical solution exhibits significant fluctuations, especially near certain measurement points where the fluctuation amplitude increases markedly, indicating poor measurement stability. Furthermore, abrupt jumps are observed at certain locations, suggesting poor consistency in the measurement results. This may be due to time-walking errors caused by signal amplitude variations in the traditional fixed threshold method. Finally, significant noise interference indicates that the existing technical solution is insufficient in its anti-interference capabilities and is easily affected by environmental noise.

[0073] Therefore, this solution uses three threshold discrimination and zero-crossing synchronous timing technology to achieve multi-dimensional information extraction and intelligent discrimination of echo signals, effectively solving the problems of time wandering error and poor anti-interference ability of traditional fixed threshold method, and obtaining higher quality test data in ultrasonic flowmeter calibration.

[0074] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.

Claims

1. An ultrasonic echo discrimination electronic device, characterized in that, It includes a zero-crossing comparator, a first threshold comparator, a second threshold comparator, a third threshold comparator, a time window control unit, a flip-flop unit, a logic gate unit, and a counter; The input terminals of the zero-crossing comparator, the first threshold comparator, the second threshold comparator, and the third threshold comparator are all connected to the echo signal input terminal for receiving echo signals. The output of the zero-crossing comparator, the output of the first threshold comparator, and the output of the time window control unit are connected to the first part of the logic gate unit, and the first part of the logic gate unit outputs a first zero-crossing trigger signal. The output of the second threshold comparator is connected to the second part of the logic gate unit through a flip-flop unit, and the second part of the logic gate unit outputs a second zero-crossing trigger signal; The output of the third threshold comparator outputs a pulse count value to the microcontroller via a counter. The microcontroller receives a first zero-crossing trigger signal, a second zero-crossing trigger signal, and a pulse count value, and calculates the flight time and determines the echo status.

2. The ultrasonic echo discrimination electronic device according to claim 1, characterized in that, The first part of the logic gate unit includes a first AND gate and a second AND gate; the time window control unit includes a programmable time masking window unit and a fixed time window trigger. The output of the first threshold comparator and the output of the programmable time masking window unit are connected to the input of the first AND gate; The output of the first AND gate is connected to the input of a fixed-time-window trigger, and the output of the fixed-time-window trigger is connected to the first input of the second AND gate. The output of the zero-crossing comparator is connected to the second input of the second AND gate; The output of the second AND gate outputs the first zero-crossing trigger signal.

3. The ultrasonic echo discrimination electronic device according to claim 2, characterized in that, The programmable time shielding window unit is controlled by a microcontroller unit to open and close, and is used to shield interference for a predetermined time after ultrasonic wave emission; the fixed time window trigger is used to generate a fixed time window.

4. The ultrasonic echo discrimination electronic device according to claim 1, characterized in that, The trigger unit includes a trigger, the input of which is connected to the output of a second threshold comparator, and the output of which is connected to the second part of a logic gate unit.

5. The ultrasonic echo discrimination electronic device according to claim 4, characterized in that, The second part of the logic gate unit includes a third AND gate; The output of the trigger is connected to the first input of the third AND gate; The output of the zero-crossing comparator is connected to the second input of the third AND gate; The output of the third AND gate outputs a second zero-crossing trigger signal.

6. The ultrasonic echo discrimination electronic device according to claim 1, characterized in that, The logic gate unit also includes a fourth AND gate, the input of which is connected to the output of the third threshold comparator, and the output of which is connected to the clock input of the counter.

7. The ultrasonic echo discrimination electronic device according to claim 1, characterized in that, The reference voltage of the first threshold comparator is set to a first low threshold to detect the start edge of the echo signal; the reference voltage of the second threshold comparator is set to a second high threshold, and the second high threshold is greater than the first low threshold.

8. The ultrasonic echo discrimination electronic device according to claim 1, characterized in that, The reference voltage of the third threshold comparator is set to 2.5V.

9. The ultrasonic echo discrimination electronic device according to claim 1, characterized in that, It also includes a time-to-digital converter, whose input is connected to the output of a logic gate unit and whose output is connected to a microcontroller unit. The time-to-digital converter is used to convert the first zero-crossing trigger signal and the second zero-crossing trigger signal output by the logic gate unit into flight time data and output it to the microcontroller unit.

10. A discrimination method based on an ultrasonic echo discrimination electronic device according to any one of claims 1-9, characterized in that, include: Acquire echo signal; The zero-crossing square wave signal of the echo signal is generated by a zero-crossing comparator; A first enable signal is generated by a first threshold comparator when the echo signal exceeds a first low threshold. Within a fixed time window, the first enable signal and the zero-crossing square wave signal are logically ANDed to generate the first zero-crossing trigger signal. The second threshold comparator triggers latching when the echo signal exceeds the second high threshold, and performs a logical AND operation between the latched signal and the zero-crossing square wave signal to generate the second zero-crossing trigger signal. A pulse is generated when the echo signal exceeds a preset threshold using a third threshold comparator, and the pulses are counted to obtain the pulse count value. Based on the first zero-crossing trigger signal, the second zero-crossing trigger signal, and the pulse count value, the flight time is calculated and the echo status is determined.