A Liquid Level Adaptive Detection Method and System Based on Ultrasonic Pulse Counting Analysis
By using ultrasonic pulse counting analysis and adaptive threshold decision, the problem of false triggering of liquid level detection during the operation of the floor scrubber is solved, and the system is able to resist liquid surface sloshing and electromagnetic interference, thereby improving the accuracy and reliability of liquid level detection.
Patent Information
- Application Number
- CN202611604776.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-16
- Publication Date
- 2026-11-17
AI Technical Summary
Existing ultrasonic liquid level detection solutions cannot effectively resist liquid surface sloshing and electromagnetic interference during the operation of the floor scrubber, leading to false triggering of liquid level detection.
An adaptive liquid level detection method based on ultrasonic pulse counting analysis is adopted. By transmitting and receiving multiple sets of ultrasonic signals, the pulse count value is statistically analyzed, an adaptive threshold is set for judgment, and the liquid level is confirmed by relay feedback, which resists electromagnetic interference and liquid surface sloshing.
It improves the accuracy and reliability of liquid level detection, avoids misjudgments caused by liquid surface sloshing and electromagnetic interference, and ensures the stability and reliability of output results.
Smart Images

Figure CN123111415A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of liquid level detection technology, specifically to an adaptive liquid level detection method and system based on ultrasonic pulse counting analysis. Background Technology
[0002] During the cleaning process of a floor scrubber, the liquid level detection in its wastewater tank is crucial for the normal operation of the equipment. Currently, liquid level detection solutions mainly include float-type, probe-type, and ultrasonic detection. Among them, liquid-penetrating ultrasonic level switches have attracted attention due to their advantage of being unaffected by foam, strong acids, and heavily soiled environments. Existing technologies, such as a contact-type ultrasonic level switch (publication number CN202494495U), determine whether the liquid level has reached a preset position by measuring the change in ultrasonic signal intensity between the transmitting and receiving probes. A floor scrubber with wastewater tank level detection function (publication number CN218356097U) uses the signal continuity between the ultrasonic transmitting and receiving devices to detect the wastewater tank level. However, the above solutions are all based on static liquid level judgment logic and do not consider the special working condition of the floor scrubber being in motion during actual operation.
[0003] During the operation of a floor scrubber, the liquid level in the wastewater tank continuously sloshes, causing the transducer gap between the transmitting and receiving probes of a liquid-penetrating ultrasonic level switch to be briefly filled with liquid. This results in the receiving probe receiving a small amount of ultrasonic signal, which is then misinterpreted as the liquid level reaching the preset position, leading to false triggering. Furthermore, electromagnetic interference generated by internal components such as the motor of the floor scrubber can also couple to the relay drive circuit, causing the relay to malfunction. Existing ultrasonic level detection solutions lack effective anti-interference mechanisms against liquid surface sloshing and electromagnetic interference under these operating conditions. Therefore, there is an urgent need for a level detection method capable of statistically analyzing the received ultrasonic pulses and making adaptive threshold decisions to solve the problem of false triggering caused by liquid surface sloshing and electromagnetic interference during the operation of the floor scrubber.
[0004] The information disclosed in the background section is only intended to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0005] The purpose of this invention is to provide a liquid level adaptive detection method and system based on ultrasonic pulse counting analysis to solve the problems mentioned in the background art.
[0006] To achieve the above objectives, the present invention provides the following technical solution: An adaptive liquid level detection method based on ultrasonic pulse counting analysis includes the following steps: Step 1: Transmit multiple sets of ultrasonic signals. Each set of ultrasonic signals includes several consecutive ultrasonic pulses, and the time interval between two adjacent sets of signals is a preset time length. Step 2: Receive ultrasonic signals and process them, converting them into pulse signals; Step 3: At the beginning of each counting cycle, turn off the pulse counter and clear the counter to zero, then turn on the pulse counter; sequentially acquire the ultrasonic signals of the current group to obtain the corresponding pulse count values; after the transmission and reception of multiple groups of ultrasonic signals are completed, turn off the pulse counter and read the data to obtain multiple pulse count sequences; Step 4: Process the multiple sets of pulse counting sequences to obtain valid count values; determine the range of pulse count values within multiple counting cycles based on the empty liquid reference and the full liquid reference to determine the judgment threshold; compare the valid count values with the judgment threshold to obtain the liquid level judgment result; Step 5: Determine the number of driving pulses based on the liquid level determination result, and output the corresponding number of driving pulses to accumulate charge in the energy storage capacitor of the relay drive circuit; Step 6: After completing the state drive based on the output drive pulse, read the relay feedback terminal level signal to confirm the liquid level judgment result a second time, and finally determine whether the liquid has reached the preset position based on the state of the feedback terminal level.
[0007] Furthermore, the MCU drives the transmitting probe of the liquid-penetrating ultrasonic level switch to emit several sets of ultrasonic signals, each set continuously emitting the same preset number of ultrasonic pulses. The transmitting probe and receiving probe are respectively installed on both sides of the preset liquid level height, and the frequency of each set of ultrasonic pulses is the same as the resonant frequency of the transmitting probe.
[0008] Further, the conversion to a pulse signal includes: The signal conditioning circuit amplifies, bandpass filters, and shapes the ultrasonic signal output by the receiving probe in sequence. It outputs a pulse signal for each ultrasonic signal received, and the number of pulse signals is the same as the number of ultrasonic signals received. The passband center frequency of the bandpass filter is consistent with the frequency of the ultrasonic signal emitted by the transmitting probe. The pulse counter is configured to count the rising or falling edge of the pulse signal.
[0009] Further, obtaining the multiple sets of pulse counting sequences includes: The counting period is one sampling period, and one sampling period includes the transmission and reception of multiple sets of ultrasonic signals; At the beginning of each counting cycle, the MCU first disables the pulse counting function, clears the counter to zero, and then enables the pulse counting function. Subsequently, the MCU controls the transmitting probe to transmit the current group of ultrasonic signals, and during the transmission of the current group of ultrasonic signals and the receiving waiting time after transmission, the pulse counter counts the pulse signals output by the signal conditioning circuit. After the receiving waiting time for the current group of ultrasonic signals ends, the MCU disables the pulse counting function and reads the counter value to obtain the pulse count value of the current group. Repeat the above process until all groups of ultrasonic signals have been transmitted and received, resulting in multiple pulse count sequences composed of multiple pulse count values in sequence.
[0010] Furthermore, the MCU averages the pulse counting sequences after removing abnormal counts to obtain the valid counts. The empty-liquid reference is the range of pulse count values obtained by the MCU through multiple sampling steps 1 to 3 when the liquid level has not reached the preset position. The full liquid reference is the range of pulse count values obtained by the MCU through multiple samplings in steps 1 to 3 when the liquid level reaches the preset position. The MCU determines a first determination threshold and a second determination threshold based on the upper limit of the empty liquid reference and the lower limit of the full liquid reference, wherein the first determination threshold is greater than the second determination threshold. When the effective count value is greater than the first judgment threshold, it is determined that the liquid has reached the preset position; when the effective count value is less than the second judgment threshold, it is determined that the liquid has not reached the preset position; when the effective count value is between the first judgment threshold and the second judgment threshold, the liquid level judgment result of the previous time is maintained.
[0011] Furthermore, the numerical range between the first and second determination thresholds constitutes a hysteresis interval, with the upper limit of the hysteresis interval being the first determination threshold and the lower limit being the second determination threshold. The MCU uses the difference between the maximum and minimum values among the valid count values obtained from multiple consecutive sampling periods as the fluctuation level. The hysteresis interval is adjusted according to the fluctuation level. When the fluctuation level is greater than the preset fluctuation threshold, the hysteresis interval is expanded; when the fluctuation level is not greater than the preset fluctuation threshold, the hysteresis interval is narrowed. During the adjustment of the hysteresis interval, the first determination threshold is kept greater than the second determination threshold.
[0012] Furthermore, the minimum number of drive pulses required for the relay to reliably activate is pre-stored in the MCU; When the liquid level determination result is that the liquid has reached the preset position, the MCU outputs a first number of drive pulses to the relay drive circuit, and the first number is not less than the minimum number of drive pulses. When the liquid level determination result is that the liquid level has not reached the preset position, the MCU outputs a second number of drive pulses to the relay drive circuit or stops outputting drive pulses, where the second number is less than the minimum number of drive pulses. When the liquid level determination result is to maintain the previous liquid level determination result, the MCU outputs the same number of drive pulses as before.
[0013] Furthermore, the energy storage capacitor includes a first capacitor and a second capacitor; the specific steps of accumulating charge in the energy storage capacitor of the relay drive circuit are as follows: The driving pulse is a sequence of pulses. Each driving pulse turns on the first transistor in the relay driving circuit. When the first transistor is turned on, the power supply charges the first capacitor through the first resistor and drives the second transistor to turn on. When the second transistor is turned on, the first capacitor charges the second capacitor. During the interval between drive pulses, the first transistor is turned off, and the first capacitor discharges through the second and third resistors so that the second transistor can be turned on again by the next drive pulse. The capacitance of the first capacitor is smaller than that of the second capacitor. The second capacitor needs to be charged multiple times by a first number of drive pulses to raise its voltage to the voltage required for the relay to be activated. When the liquid level determination result is that the liquid has reached the preset position, the MCU will also compare the effective count value with the full liquid reference. The closer the effective count value falls into the full liquid reference range to the average value of the full liquid reference, the larger the first number output by the MCU, and the first number does not exceed the preset maximum number of drive pulses.
[0014] Furthermore, the final determination of whether the liquid has reached the preset position includes: After the drive pulse output ends, the MCU delays and waits for the relay to act; when the voltage across the energy storage capacitor reaches its pull-in voltage, the relay coil is energized and pulls in, the normally open contact of the relay closes, and the level at the feedback terminal connected to the normally open contact circuit flips. After the delay period ends, the MCU reads the level of the feedback terminal. If the level of the feedback terminal flips, it determines that the liquid has reached the preset position and outputs a full liquid signal; otherwise, it outputs a not full liquid signal. The full liquid signal or incomplete liquid signal is maintained until the next sampling period, until a new liquid level determination result is obtained.
[0015] The present invention also provides a liquid level adaptive detection system based on ultrasonic pulse counting analysis. This system is used to implement the aforementioned liquid level adaptive detection method based on ultrasonic pulse counting analysis, and includes: Multiple ultrasonic transmission control modules are used to transmit multiple ultrasonic signals. Each ultrasonic signal includes several continuous ultrasonic pulses, and the time interval between two adjacent signals is a preset time length. The receiving and conditioning pulse conversion module is used to receive ultrasonic signals, process them, and convert them into pulse signals; The counting cycle pulse acquisition module is used to turn off the pulse counter and clear the counter at the beginning of each counting cycle, and then turn on the pulse counter; sequentially acquire the ultrasonic signals of the current group to obtain the corresponding pulse count value; after the transmission and reception of multiple groups of ultrasonic signals are completed, turn off the pulse counter and read it to obtain multiple pulse count sequences; The effective counting level determination module is used to process the multiple sets of pulse counting sequences to obtain effective count values; determine the range of pulse count values within multiple counting cycles based on empty liquid reference and full liquid reference to determine the determination threshold; and compare the effective count values with the determination threshold to obtain the liquid level determination result. The drive pulse energy storage control module is used to determine the number of drive pulses based on the liquid level determination result and output the corresponding number of drive pulses to accumulate charge in the energy storage capacitor in the relay drive circuit. The relay-activated liquid level determination module is used to perform a secondary confirmation of the liquid level determination result by reading the relay feedback terminal level signal after completing the state drive based on the output drive pulse, and finally determining whether the liquid has reached the preset position based on the state of the feedback terminal level.
[0016] Compared with the prior art, the technical effects and advantages provided by the present invention are as follows: This invention, through statistical analysis of multiple sets of ultrasonic emissions and pulse counting sequences, can distinguish between short-duration, small-volume pulses caused by liquid surface sloshing and continuous, sufficient pulses when the liquid level truly reaches the preset position, thus avoiding misjudgments of the liquid level caused by sloshing of the wastewater tank during the operation of the floor scrubber. This invention also includes abnormal count value rejection and an adaptively adjustable hysteresis decision threshold, ensuring stable detection output at critical liquid levels and suppressing frequent jumps in detection results caused by liquid surface fluctuations.
[0017] This invention employs a sequential drive pulse control relay drive circuit. It relies on the energy storage capacitor to accumulate charge multiple times before driving the relay to engage. A single electromagnetic interference pulse is insufficient to charge the capacitor, thus resisting electromagnetic interference from motors and other sources and preventing false relay activation. Furthermore, after the energy storage capacitor drives the relay, this invention uses a delay and the relay feedback level for secondary confirmation. It outputs a full or incomplete liquid level signal based on the actual state of the feedback level, rather than simply relying on the drive pulse output by the MCU to directly determine the liquid level. Even in the event of a drive circuit malfunction, it avoids erroneous liquid level signal output, further improving the reliability of the liquid level detection output. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the overall method flow of the present invention; Figure 2 This is a schematic diagram illustrating the relationship between the transducer and the liquid level in an embodiment of the present invention; Figure 3 This is a schematic diagram comparing the effective count values under three liquid level conditions in an embodiment of the present invention; Figure 4 This is a statistical diagram illustrating the effective count values, i.e., the baseline range, for empty and full liquid states in an embodiment of the present invention. Figure 5 This is a schematic diagram of the system structure of the present invention. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments.
[0020] It should be noted that, unless otherwise defined, the technical or scientific terms used in this invention should have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0021] Example: Please see Figures 1 to 4 The present invention provides a technical solution: An adaptive liquid level detection method based on ultrasonic pulse counting analysis includes the following steps: Step 1: Transmit multiple sets of ultrasonic signals. Each set of ultrasonic signals includes several continuous ultrasonic pulses, and the time interval between two adjacent sets of signals is a preset time length.
[0022] The preferred group is 5. 20 groups, further optimized to 8 12 groups, for example, 10 groups; too few groups result in large statistical fluctuations, while too many groups increase power consumption and detection time. The preferred number of continuous ultrasonic pulses in each group is 8. 32, further selected 12 24 pulses, for example, 16 pulses; too few pulses result in insufficient received energy, while too many pulses increase aftershocks and crosstalk. The preset timing interval between two adjacent groups is preferably 1ms. 50ms, further optimized to 5ms 20ms, for example, 10ms. If the preset timing is too short, the aftershocks of the previous group will not have decayed yet; if it is too long, the response speed will decrease. The above values can be determined experimentally based on the signal-to-noise ratio, response speed, power consumption, and MCU resources. The preset timing is preferably one that covers the reception waiting time after the current group's transmission and reserves a margin for aftershock attenuation to ensure that the previous group's reception is completed before the next group's transmission.
[0023] In this embodiment, the MCU drives the transmitting probe of the liquid-penetrating ultrasonic level switch to emit several sets of ultrasonic signals, and each set continuously emits the same preset number of ultrasonic pulses.
[0024] The MCU outputs a pulse sequence via a timer or pulse width modulation port, which is amplified by a driving circuit and then applied to the transmitting probe. The driving circuit can employ a push-pull, half-bridge, or field-effect transistor driving structure. Pulses within each group are transmitted continuously, with a preferred pulse duty cycle of 40%. The duty cycle is initially set at 60%, further optimized to 50%. When the duty cycle is 50%, the pulse width equals half a pulse period, i.e., pulse width = 1 / (2 × pulse frequency). A duty cycle that is too small results in insufficient transmission energy, while a duty cycle that is too large increases the risk of overheating in the drive circuit and compromises the probe's tolerance. The specific duty cycle can be determined based on probe specifications and experimental drive circuit design. Using the same preset number for each group facilitates statistical comparison between subsequent pulse counting sequences.
[0025] The transmitting probe and receiving probe are respectively installed on both sides of the preset liquid level height of the wastewater tank of the floor scrubber. The transducer gap between the transmitting probe and the receiving probe is connected to the inside of the wastewater tank. The frequency of each set of ultrasonic pulses is the same as the resonant frequency of the transmitting probe.
[0026] The preset liquid level height is the full or alarm level that the wastewater tank of the floor scrubber needs to detect, preferably 70% of the effective height of the tank. 90%, further preferably 80%; this value allows for overflow prevention space, and the specific value can be determined based on the sewage tank volume, pouring angle, and safety margin. The transmitting and receiving probes are preferably piezoelectric ceramic probes, positioned opposite each other at the same preset liquid level and with their axes aligned; the preferred distance between the transmitting and receiving probes is 5mm. 30mm, further preferred 10mm 20mm; if the spacing is too large, the ultrasonic attenuation will increase, and if it is too small, installation and sealing will be difficult. The specific spacing can be determined according to the probe beam angle, the thickness of the box wall and the installation space.
[0027] The transducer gap can be connected to the interior of the sewage tank by creating a connecting hole or cavity at a preset liquid level. A sound-permeable seal is installed at the hole or cavity to allow liquid to enter and fill the gap when the preset liquid level is reached, while the gap remains empty when the preset liquid level is not reached. The sound-permeable seal can be made of silicone, polyurethane, or a thin stainless steel sheet and is sealed to the tank wall via a sealing ring. The frequency of each ultrasonic pulse is the same as the resonant frequency of the transmitting probe. Manufacturing and temperature drift errors are permissible, with the frequency deviation preferably not exceeding ±5%, and more preferably not exceeding ±2%. This value allows the transmitting probe to operate near the resonant point, achieving higher electroacoustic conversion efficiency and receiving amplitude. The resonant frequency can be determined according to the probe specifications or by sweeping the frequency to determine the point of minimum impedance or maximum receiving amplitude of the transmitting probe. Excessive pulse frequency leads to increased liquid and tank wall attenuation, while excessively low frequency reduces interference resistance and resolution. Therefore, it can be selected based on the tank wall thickness, gap size, liquid acoustic impedance, and probe specifications, for example, 200kHz. 1MHz, preferably 400kHz 1MHz.
[0028] Step 2: Receive the ultrasonic signal and process it to convert it into a pulse signal.
[0029] The receiving probe receives ultrasonic signals; the receiving probe is preferably paired with the transmitting probe. The output of the receiving probe is a weak AC signal with an amplitude typically in the millivolt range to tens of millivolts, which needs to be processed by the signal conditioning circuit. The receiving probe is connected to the input terminal of the signal conditioning circuit, and the output terminal of the signal conditioning circuit is connected to the input terminal of the pulse counter. The pulse counter can be integrated into the MCU or set independently.
[0030] In this embodiment, the conversion to a pulse signal includes: The signal conditioning circuit preferably includes a preamplifier stage, a bandpass filter stage, and a waveform shaping stage, which are connected in sequence. The preamplifier stage is used to improve the signal-to-noise ratio, the bandpass filter stage is used to retain signals near the transmission frequency and suppress noise, and the waveform shaping stage is used to convert the analog signal into a digital pulse signal. Amplitude limiting protection can be set at the input of the signal conditioning circuit, and the connecting lines can be shielded with the shielding layer grounded to prevent damage from large signals and external interference.
[0031] The signal conditioning circuit amplifies, bandpass filters, and shapes the ultrasonic signal output from the receiving probe in sequence. It outputs a pulse signal for each received ultrasonic signal, and the number of pulse signals is the same as the number of received ultrasonic signals.
[0032] The preferred overall gain is 60dB. 100dB, further optimized to 80dB; if the gain is too low, the signal is insufficient to trigger shaping; if it is too high, noise and aftershocks are easily amplified. The specific gain can be determined experimentally based on the received signal amplitude, noise amplitude, and shaping threshold. The bandpass filter is preferably a second- to fourth-order active bandpass filter, with the center frequency consistent with the transmission frequency, allowing a deviation of ±5%, further optimized to ±2%; the quality factor is preferably 3. 10, further optimized 5 8. Passband bandwidth is equal to the ratio of center frequency to quality factor. For example, when the center frequency is 1MHz and the quality factor is 5, the passband bandwidth is 200kHz. If the quality factor is too low, the filter selectivity will be insufficient; if it is too high, temperature drift and component errors will easily cause the signal to deviate from the passband.
[0033] Waveform shaping is preferably achieved using a Schmitt trigger comparator or a Schmitt trigger comparator combined with a monostable circuit. The comparison threshold is preferably 30% of the peak-to-peak value of the signal after bandpass filtering. 70%, further preferably 50%; the hysteresis voltage is preferably 5% of the comparison threshold. 20%. A threshold that is too low is prone to false triggering, while one that is too high is prone to missed counts. For each received ultrasonic pulse, a pulse signal is shaped and output, with the pulse width preferably being 20% of the ultrasonic pulse period. 50%, further optimized to 30% 40%, meaning the pulse width equals the product of the duty cycle and the pulse period; an excessively high duty cycle will cause adjacent pulses to stick together, while an excessively low duty cycle will cause the counter to miss counts. These parameters can be determined experimentally based on the received signal amplitude, noise level, transmission frequency, and counter response speed.
[0034] The passband center frequency of the bandpass filter is consistent with the frequency of the ultrasonic signal emitted by the transmitting probe; the passband center frequency is consistent with the resonant frequency of the transmitting probe, with an allowable deviation of ±5%, further preferably ±2%; the passband bandwidth is preferably 10% of the center frequency. 30%, further optimized to 15% 25%; out-of-band attenuation is preferably greater than 20dB, and more preferably greater than 40dB, to suppress power frequency, switching noise, and spurious ultrasonic interference. The passband center frequency can be determined according to the transmitter probe specifications or by sweeping the frequency to determine the point of maximum received amplitude.
[0035] The pulse counter is configured to count either the rising edge or the falling edge of the pulse signal; preferably, it counts the rising edge, and only one of the rising or falling edges is selected within the same counting period to avoid duplicate counting; the number of bits in the counter is not less than the maximum possible number of pulses, for example, 16 bits; the counting clock frequency is not less than twice the transmission frequency, and more preferably not less than five times, to meet the edge capture requirements; the specific frequency can be determined according to the transmission frequency, the number of pulses per group, and the MCU clock. If falling edge counting is used, each shaped pulse is also counted as 1.
[0036] Step 3: At the beginning of each counting cycle, turn off the pulse counter and clear the counter to zero, then turn on the pulse counter; sequentially acquire the ultrasonic signals of the current group to obtain the corresponding pulse count values; after the transmission and reception of multiple groups of ultrasonic signals are completed, turn off the pulse counter and read the data to obtain multiple pulse count sequences.
[0037] The counting period is one sampling period, which includes the transmission and reception of all groups of ultrasonic signals described in step 1; the counting period is preferably 20ms. 200ms, further optimized to 50ms 150ms, for example, 100ms; if the counting cycle is too short, the aftershocks of the previous group have not yet decayed and the MCU processing time is insufficient; if it is too long, the liquid level response speed will decrease; the specific value can be determined according to the number of groups, the total duration of pulses in the group, the preset timing length and the system's allowed response time.
[0038] In this embodiment, obtaining the multiple sets of pulse counting sequences includes: The counting period is one sampling period, which includes the transmission and reception of multiple sets of ultrasonic signals. The number of sets in one sampling period follows the number of sets in step 1, preferably 5. 20 groups, further optimized to 8 12 groups, for example, 10 groups; the sampling period can be determined by the following formula: Sampling period ≥ number of groups × (total pulse duration within a group + preset timing duration), where the total pulse duration within a group = number of pulses per group ÷ pulse frequency; for example, when the number of groups is 10, the number of pulses per group is 16, and the pulse frequency is 1MHz, the total pulse duration within a group is 16. With a preset timing duration of 10ms, the sampling period is approximately 100.16ms. The calculated value can be used as the minimum value of the counting period. In practice, the MCU processing margin can be increased based on this value. The specific value can be determined experimentally based on the response speed, power consumption, and MCU resources.
[0039] At the beginning of each counting cycle, the MCU first disables the pulse counting function, clears the counter to zero, and then enables the pulse counting function. Subsequently, the MCU controls the transmitting probe to transmit the current group of ultrasonic signals, and during the transmission of the current group of ultrasonic signals and the receiving waiting time after transmission, the pulse counter counts the pulse signals output by the signal conditioning circuit.
[0040] Specifically, disabling the pulse counting function before resetting it can avoid miscounting caused by the resetting operation or counter flipping; the optimal interval between disabling and enabling the function is... Further optimization If the interval is too short, the counter may not be stable; if it is too long, it will occupy the sampling time. The specific interval can be determined based on the MCU clock and the counter response speed.
[0041] Once the counting function is activated, the current group of ultrasonic signals can be transmitted. The count value obtained during transmission includes a fixed component of transmission crosstalk and aftershocks. This fixed component is approximately the same in both empty and full liquid states and can be eliminated in subsequent step 4 by using the difference between the empty and full liquid references. The preferred receiving waiting time is... Further optimization If the reception waiting time is too short, the latest arriving ultrasonic signal may not be included; if it is too long, subsequent noise may be introduced and the response speed may be reduced.
[0042] The receiving waiting time can be determined by the following formula: in, To receive the waiting time, This refers to the transducer gap distance. The speed of sound in air. This refers to the aftershock decay time. To account for the time delay, the speed of sound in air can be taken as 340 m / s, and the speed of sound in liquid can be taken as 1500 m / s. Since the speed of sound in air is slower, the calculation based on air can cover the case where the propagation time is the longest before the liquid level is reached; the transducer gap distance is 5 mm. At 30mm, the propagation time is approximately Optimal aftershock decay time Optimal handling of latency Therefore, the receiving waiting time is taken as... This is reasonable. Specifically, it can be achieved by experimentally measuring the latest time the received pulse appears and then increasing that time by 20%. A 50% margin has been determined.
[0043] After the reception waiting time for the current group of ultrasonic signals ends, the MCU disables the pulse counting function and reads the counter value to obtain the pulse count value for the current group. Disabling the pulse counting function before reading the count value prevents new pulses from causing count changes during the reading process. The total time for disabling and reading is preferably less than 10% of the preset timing length, and more preferably less than 5%, to avoid affecting the next group's transmission. The read pulse count values for the current group are stored in the MCU's memory area or array in group order.
[0044] Repeat the above process until all groups of ultrasonic signals have been transmitted and received, resulting in multiple pulse counting sequences composed of multiple pulse count values in sequence. These multiple pulse counting sequences are arranged in a group order and can be represented as: Group 1 pulse count value, Group 2 pulse count value, ..., Group M pulse count value, where M is the group number described in step 1. Each group of pulse count values is obtained using the rising edge or falling edge counting method selected in step 2, and the counting method is consistent across groups. These multiple pulse counting sequences are used in step 4 to remove abnormal count values and calculate the average to obtain the valid count value.
[0045] Step 4: Process the multiple sets of pulse counting sequences to obtain valid count values; determine the range of pulse count values within multiple counting cycles based on the empty liquid reference and the full liquid reference to determine the judgment threshold; compare the valid count values with the judgment threshold to obtain the liquid level judgment result.
[0046] In each counting cycle, a set of multiple pulse counting sequences is obtained according to step 3, and the effective count value corresponding to the counting cycle is obtained according to this step; the multiple effective count values corresponding to multiple counting cycles constitute the statistical samples of the subsequent empty liquid reference and full liquid reference.
[0047] In this embodiment, the MCU averages the pulse counting sequences after removing abnormal counts to obtain the effective count value. Let the first pulse count be... Group pulse count value , , The number of the multiple sets of ultrasonic signals. This is the index of the pulse count value. Anomaly removal can be performed using the median absolute deviation method: first calculate the median: in These represent the pulse count values for groups 1, 2, and M, respectively. like Then remove ; The anomaly removal factor is set at 2.5. 3.5, preferred 3. If the value is too small, normal values may be mistakenly rejected; if it is too large, outliers will be retained. The specific value can be determined based on noise distribution experiments. The remaining values after rejection... Each count value is calculated using the following formula: in, The first one to be retained after removal One count value, This represents the index of the count values retained after removal. Alternatively, the extreme value removal averaging method can be used. For example, when M=10, the maximum and minimum values are removed and the average is calculated. Alternatively, with M=10, one maximum and one minimum value are removed, and the average of the remaining eight values is calculated, balancing anti-interference and statistical stability.
[0048] The air-liquid reference is the range of pulse count values obtained by the MCU through multiple sampling steps 1 to 3 when the liquid level in the wastewater tank of the floor scrubber has not reached the preset position. Preferably, the air-liquid reference uses the effective count values of multiple counting cycles as the statistical object.
[0049] Sampling under empty and liquid conditions After one counting cycle, the valid count value is obtained. ,in, Indicates a counting cycle index. ; Take 20 100, preferred 50. The mean, standard deviation, lower limit, and upper limit of the reference range are as follows: in, In the empty liquid state, the first Valid count value for each counting cycle; The average value is the air-liquid ratio. The standard deviation of air and liquid; The air-liquid range coefficient is taken as 2. 3, preferred option 3; This is the lower limit of the air-liquid reference; This is the upper limit of the air-liquid reference. The larger the range, the wider the range and the stronger the ability to resist misjudgment, but the margin for distinguishing between empty and full states decreases; the specific range can be determined based on the distribution of multiple samples under empty and liquid conditions.
[0050] The full liquid reference is the range of pulse count values obtained by the MCU through multiple sampling steps 1 to 3 when the liquid level in the wastewater tank of the floor scrubber reaches a preset position. Assume a total of [number] samples are taken under full liquid conditions. Second-rate, Take 20 100, with 50 preferred; the first The effective count value obtained from the second sampling is , , Indicates the sampling index. Mean value at full volume. Standard deviation of full liquid Lower limit of full liquid level Full liquid reference upper limit They are respectively: in, To determine the multiple of the full liquid range, take 2. 3, preferred option 3. It should generally satisfy... ;like This indicates insufficient differentiation between empty and full states. The solution could be to resample, increase the transmission energy, or adjust the probe's installation position.
[0051] Please see Figure 2 In this embodiment, three liquid level conditions are set to correspond to the following: empty liquid state, where the liquid level is lower than the preset position, the transducer gap is filled with air, the received pulses are mainly crosstalk and aftershock components, and the effective count value is low; short-term liquid surface swaying state, where the equipment movement causes the liquid surface to briefly enter the transducer gap, the received pulses increase, but are short-term and intermittent; and full liquid state, where the liquid level reaches and remains higher than the preset position, the transducer gap is filled with liquid, the ultrasonic waves penetrate fully, and the effective count value increases significantly.
[0052] In this embodiment, 30 sets of effective count values were obtained from sampling under three different liquid level conditions. Each set of sampling corresponds to one counting cycle. Within the cycle, 10 sets of ultrasonic signals were transmitted and received, and each set yielded one integer pulse count value. Subsequently, the extreme value averaging method was used to remove one maximum value and one minimum value. The arithmetic mean of the remaining 8 count values was calculated and rounded to two decimal places to obtain the effective count value of this sampling. The transmitting probe (TX) and receiving probe (RX) were set relative to each other at the same preset liquid level height and their axes were aligned. The transducer gap was connected to the inside of the sewage tank. The specific effective count values in Table 1 are as follows: Table 1. Example data of effective count values under different liquid level conditions: Please refer to Table 1. Figure 3 as well as Figure 4This embodiment, through statistical analysis of multiple sets of ultrasonic transmission and pulse counting sequences, can distinguish between short-term, small-volume pulses caused by liquid surface sloshing and continuous, sufficient pulses when the liquid level truly reaches the preset position. This avoids misjudgment of the liquid level caused by sloshing of the wastewater tank during the operation of the floor scrubber. The data in Table 1 provides direct and quantitative support for the above-mentioned technical effects. In the empty liquid state, the 30 sets of effective count values are distributed between 0.63 and 3.25, with an average of 1.95, reflecting that when the transducer gap is filled with air, there are only fixed components such as transmission crosstalk and aftershocks, and the number of received pulses is at a low level. In the state of short-term liquid surface sloshing, the 30 sets of effective count values increase to 4.25 to 7.63, with an average of 5.76, indicating that after the liquid surface briefly enters the transducer gap, the receiving probe can indeed receive more ultrasonic signals and generate more pulse counts, but the number is significantly lower than that of the full liquid state. In the state of full liquid, the 30 sets of effective count values further increase to 12.00 to 14.50, with an average of 13.28, corresponding to sufficient penetration when the gap is continuously filled with liquid.
[0053] From the perspective of interval separation, there is a significant gap of approximately 4.37 effective counts between the maximum value of 7.63 in the swaying state and the minimum value of 12.00 in the full liquid state. The numerical intervals of the three groups of samples are separated from each other and do not overlap. This separation was obtained after 10 sets of transmissions per cycle, group counting, and extreme value removal averaging. This indicates that a small number of pulses that suddenly or briefly enter the system are effectively suppressed during the statistical averaging process, and will not raise the effective count value to the level of full liquid. Even if the movement of the floor scrubber causes the liquid surface of the sewage tank to briefly enter the transducer gap, and the number of received pulses increases, its statistical characteristics are still short-term and small, which is fundamentally different from the continuous and sufficient pulse level when the liquid level truly reaches the preset position. Liquid level determination based on the effective count value can fundamentally distinguish between liquid surface swaying interference and true full liquid at the data level, solving the problem of false triggering caused by liquid surface swaying in existing solutions under moving conditions, and improving the accuracy of liquid level detection.
[0054] Furthermore, by setting abnormal count rejection and an adaptively adjustable hysteresis decision threshold, the detection output remains stable at the critical liquid level, suppressing frequent jumps in detection results caused by liquid level fluctuations. (Table 1 and...) Figure 4 This indicates that, after obtaining the upper limit of the empty liquid benchmark as 3.70 and the lower limit of the full liquid benchmark as 10.50 from the above sample statistics, the second judgment threshold determined by the allocation coefficient is 5.06 and the first judgment threshold is 9.14, which can reasonably classify the three working conditions into different judgment areas.
[0055] In the empty liquid state, all 30 valid count values were below the second judgment threshold, and the "no liquid" output was given for each sampling, with stable judgment results and no jumps. In the full liquid state, all 30 valid count values were above the first judgment threshold, and the "liquid" output was given for each sampling, maintaining stability.
[0056] The hysteresis mechanism works as follows: when the effective count value is between the second and first judgment thresholds, the system maintains the previous liquid level judgment result instead of switching back and forth between the two thresholds. Under shaking conditions, more than two-thirds of the samples fall into this maintenance zone, which precisely shows that the count fluctuations caused by liquid level fluctuations mostly occur within the hysteresis band and will not drive the relay to frequently engage and disengage; the judgment result is only updated when the effective count value clearly exceeds the first judgment threshold or is clearly lower than the second judgment threshold.
[0057] The MCU determines a first judgment threshold and a second judgment threshold based on the upper limit of the empty liquid reference and the lower limit of the full liquid reference, where the first judgment threshold is greater than the second judgment threshold. Let the empty / full distance... .when At that time, the first judgment threshold Second determination threshold for: in, Assign coefficients to the first threshold. Assign coefficients to the second threshold, satisfying , ,and Preferred .at this time: Therefore . , The larger the threshold, the closer the dual thresholds shrink to the middle of the interval, which enhances the ability to resist fluctuations but reduces the sensitivity. The specific value can be determined based on the spacing between empty and full distributions, the cost of misjudgment, and the noise level.
[0058] When the valid count value is greater than the first judgment threshold, the liquid is determined to have reached the preset position; when the valid count value is less than the second judgment threshold, the liquid is determined not to have reached the preset position; when the valid count value is between the first and second judgment thresholds, the previous liquid level judgment result is maintained. That is: if Determine if the liquid has reached the preset position; If the liquid has not reached the preset position; The system will maintain the previous liquid level determination result. If there is no previous result on the first power-on, it can either output a "not full" signal by default or maintain the initial state until... Exceeding the hysteresis range.
[0059] In this embodiment, the numerical range between the first determination threshold and the second determination threshold constitutes a hysteresis interval, with the upper limit of the hysteresis interval being the first determination threshold and the lower limit being the second determination threshold. The MCU uses the difference between the maximum and minimum values among the valid count values obtained from multiple consecutive sampling periods as the fluctuation level. The hysteresis interval is adjusted according to the fluctuation level. When the fluctuation level is greater than a preset fluctuation threshold, the hysteresis interval is expanded; when the fluctuation level is not greater than the preset fluctuation threshold, the hysteresis interval is narrowed. During the adjustment of the hysteresis interval, the first determination threshold is kept greater than the second determination threshold.
[0060] Assume continuous The effective count value for each sampling period is , Take 3 10, preferred 5; the first The effective count value for each sampling period is denoted as , For sampling period index, Fluctuation level for: Preset fluctuation threshold Pick 5% 20%, with a preferred ratio of 10%, that is: Too small a value will lead to frequent adjustments, while too large a value will result in a sluggish adaptive response. This can be determined by statistical analysis when the liquid level is stable. The distribution is such that it covers 95%. Values that fluctuate within 99% of normal range.
[0061] Hysteresis interval width for: Let the width before adjustment be The adjusted width is The adjustment factor is , Take 0.05 0.2, preferably 0.1; minimum width Pick Maximum width Pick .when hour: when hour: Maintain the center of the hysteresis interval during adjustment. constant: The adjusted first judgment threshold Second determination threshold for: because Therefore . Too large a threshold can easily cause a jump in the threshold, while too small a threshold will result in slow adjustment. and This is used to prevent the hysteresis range from being too narrow or too wide, and the specific range can be determined based on the degree of system jitter and the allowable response speed.
[0062] Step 5: Determine the number of driving pulses based on the liquid level determination result, and output the corresponding number of driving pulses to accumulate charge in the energy storage capacitor in the relay drive circuit.
[0063] The drive pulses are sequential pulses. The MCU selects to output a first number, a second number, or the same number of drive pulses as the previous one based on the liquid level determination result; the minimum number of drive pulses is denoted as... The first quantity is The second quantity is The preset maximum number of drive pulses is The previous output quantity was .
[0064] In this embodiment, the MCU pre-stores the minimum number of drive pulses required for the relay to reliably activate. The minimum number of drive pulses... The preferred method is experimental calibration: starting from zero, gradually increase the number of drive pulses, record the minimum number of pulses required for the relay to reliably engage, and then increase this minimum number of pulses by 20%. 50% margin as . Take 5 as a reference. 20, preferably 10; too small a value may cause the relay to engage unreliably, while too large a value will increase power consumption and heat generation. The specific value can be determined experimentally based on the relay engagement voltage, the capacitance of the second capacitor, the drive pulse frequency, and the power supply voltage.
[0065] When the liquid level determination result indicates that the liquid has reached a preset position, the MCU outputs a first number of drive pulses to the relay drive circuit, wherein the first number is not less than the minimum number of drive pulses. First quantity The range of values is ,in, To preset the maximum number of drive pulses, refer to the following: Preferred ,For example hour . A value that is too small may reduce the reliability of the pull-in, while a value that is too large will increase power consumption and heat generation. The specific value can be determined based on the relay's reliable pull-in test and the system's power consumption requirements.
[0066] When the liquid level determination result indicates that the liquid level has not reached the preset position, the MCU outputs a second number of drive pulses to the relay drive circuit or stops outputting drive pulses. The second number is less than the minimum number of drive pulses. Preferred Further optimization This means stopping the output of drive pulses. The second quantity should be chosen to ensure that the voltage across the second capacitor does not rise to the relay's pull-in voltage, thus keeping the relay released. Specifically, the maximum number of pulses insufficient to pull the relay can be determined experimentally, and a value below this maximum number of pulses should be taken as the [value]. .
[0067] When the liquid level determination result is to maintain the previous liquid level determination result, the MCU outputs the same number of drive pulses as before.
[0068] In this embodiment, the energy storage capacitor includes a first capacitor and a second capacitor; the specific steps of accumulating charge in the energy storage capacitor of the relay drive circuit are as follows: The driving pulses are sequential pulses. Each driving pulse turns on the first transistor in the relay driving circuit. When the first transistor turns on, the power supply charges the first capacitor through the first resistor and drives the second transistor to turn on. When the second transistor turns on, the first capacitor charges the second capacitor. Specifically, the base of the first transistor receives the driving pulses output by the MCU, the emitter is grounded, and the collector is connected to the power supply through the first resistor. The first capacitor is connected between the collector of the first transistor and the base of the second transistor. The collector of the second transistor is connected to the power supply, the emitter is connected to one end of the second capacitor, and the other end of the second capacitor is grounded. The first resistor is referenced... Preferred If the value is too small, it will easily lead to excessive current; if it is too large, the first capacitor will charge slowly. The specific value can be determined experimentally based on the power supply voltage, the transistor's driving capability, and the first capacitor's capacitance.
[0069] During the interval between drive pulses, the first transistor is turned off, and the first capacitor discharges through the second and third resistors so that the second transistor can be turned on again by the next drive pulse. The second and third resistors can be connected in series or parallel to form the discharge circuit of the first capacitor, preferably in series; the second and third resistors are respectively referenced to... Preferred A value that is too small will cause the first capacitor to discharge too quickly and the second transistor to have insufficient conduction time; a value that is too large will result in slow discharge and affect the next drive pulse. The specific value can be determined based on the drive pulse interval and the capacitance of the first capacitor. The drive pulse frequency is denoted as... Reference frequency is 1kHz. 20kHz, preferably 5kHz 10kHz; the duty cycle of the driving pulse is denoted as... Take 10% as a reference. 50%, with 20% preferred 30%. Too low a frequency will cause the capacitor charging waiting time to be too long, while too high a frequency will increase the switching loss; too low a duty cycle will result in insufficient charging, while too high a duty cycle will result in insufficient discharging time. The specific values can be determined experimentally based on the charging time constant of the first capacitor and the response speed of the second transistor.
[0070] The capacitance of the first capacitor is smaller than that of the second capacitor. A first number of drive pulses are needed to charge the second capacitor multiple times until its voltage rises to the voltage required for the relay to activate. Preferably, the capacitance of the first capacitor is [missing information - likely a fraction of the second capacitor's capacitance]. Further optimization The second capacitor's capacitance is taken as a reference. Preferred The first capacitor has a smaller capacitance and is used for rapid charging and discharging to drive the second transistor; the second capacitor has a larger capacitance and is used to accumulate charge and store the energy required for the relay to engage. If the first capacitor has too large a capacitance, the discharge will be slow, affecting pulse accumulation; if the second capacitor has too small a capacitance, the energy storage will be insufficient, and the relay engagement will be unreliable. The specific capacitance can be determined experimentally based on the relay engagement energy and the number of driving pulses.
[0071] When the liquid level determination result is that the liquid has reached the preset position, the MCU will also compare the effective count value with the full liquid reference. The closer the effective count value falls into the full liquid reference range to the average value of the full liquid reference, the larger the first number output by the MCU, and the first number does not exceed the preset maximum number of drive pulses.
[0072] Among them, the full liquid reference range is The average value of the full liquid reference is The effective count value is The full liquid reference half width is: like Then take For example, take a positive number. Or take 1. Define the centering degree. : and First quantity Determine by the following formula: in, This indicates rounding to the nearest integer. If Then take ;like Then take From the above formula, we can see that when hour, , ;when When located at the boundary of the full liquid reference range, , When it is determined to be full of liquid but If the liquid level does not fall within the full liquid reference range, take Output It still ensures that the number of drive pulses is not less than the minimum number of drive pulses. The rationale for this value method is that the closer the effective count value is to the average value of the full liquid reference, the higher the confidence level of the full liquid determination, and increasing the number of drive pulses can improve the reliability of relay engagement; at the same time, it is subject to Limit and avoid over-driving, which can lead to increased power consumption and heat generation. The appropriate value can be determined based on relay engagement reliability tests and system power consumption requirements.
[0073] Step 6: After completing the state drive based on the output drive pulse, read the relay feedback terminal level signal to confirm the liquid level judgment result a second time, and finally determine whether the liquid has reached the preset position based on the state of the feedback terminal level.
[0074] In this embodiment, the final determination of whether the liquid has reached the preset position includes: After the drive pulse output ends, the MCU delays and waits for the relay to act; when the voltage across the energy storage capacitor reaches its pull-in voltage, the relay coil is energized and pulls in, the normally open contact of the relay closes, and the level of the feedback terminal connected to the normally open contact circuit flips.
[0075] The relay coil is preferably connected across the two ends of the second capacitor or via a relay drive circuit. When the voltage across the second capacitor reaches the relay's pull-in voltage, the relay coil is energized and pulls in. One end of the normally open contact of the relay is connected to the power supply, and the other end is connected to the MCU feedback terminal and grounded through a pull-down resistor. Alternatively, one end of the normally open contact is grounded, and the other end is connected to the MCU feedback terminal and connected to the power supply through a pull-up resistor. In this embodiment, it is preferred that one end of the normally open contact is grounded, and the other end is connected to the MCU feedback terminal and connected to the power supply through a pull-up resistor. When the normally open contact is not closed, the feedback terminal is pulled high by the pull-up resistor, and the feedback terminal is at the first level. After the normally open contact is closed, the feedback terminal is grounded, and the feedback terminal is at the second level, i.e., a flip occurs. The reference value for the pull-up resistor is... , 47 preferred If the value is too small, it will increase the current when the normally open contact is closed; if it is too large, the anti-interference ability will decrease. The specific value can be determined according to the MCU input level requirements and power consumption.
[0076] The duration of the delay is denoted as The preferred method is determined by the following formula: in, The maximum operating time given in the relay datasheet is taken as 5ms. 20ms, preferably 10ms; The time required for the normally open contact to close stably is taken as 1ms. 5ms, preferably 2ms; This is the delay margin coefficient, with a reference value of 0.2. 0.5, preferably 0.3; This is a delay margin. Therefore, Reference value: 8ms 30ms, preferably 15ms. A value that is too short may cause the feedback terminal to be read before the contacts are stably closed, leading to misjudgment; a value that is too long will decrease the response speed. The specific value can be determined based on the relay specifications and experimentally measured time from the last drive pulse to the feedback terminal level transition, with an additional 20% to 50% margin added to that time.
[0077] After the delay period, the MCU reads the feedback terminal level. If the feedback terminal level toggles, it determines that the liquid has reached the preset position and outputs a full-liquid signal; otherwise, it outputs a not-full-liquid signal. The MCU can read the feedback terminal level multiple times for debouncing confirmation. Let the number of consecutive reads be... For reference, take 3. 5, preferably 3; the interval between two adjacent reads is For reference 500 preferred If continuous If all reads are at the second level, then the feedback level has been confirmed to have flipped; if consecutive reads are at the second level... If all reads are at the first level, it confirms that the feedback level has not toggled; if the read results are inconsistent, continue reading until the total reading time reaches the preset reading timeout. , Reference Preferred If the flipping is not confirmed after the timeout, an incomplete liquid signal will be output. If the value is too small, it is easily affected by contact bounce and interference; if it is too large, the response will be slow. The specific value can be determined based on the relay contact bounce time and MCU resources.
[0078] The full or incomplete liquid level signal is maintained until the next sampling cycle, until a new liquid level determination result is obtained. The MCU stores the final determination result in a status variable or status register. Before obtaining a new liquid level determination result in step 4 and completing steps 5 and 6 in the next sampling cycle, the full or incomplete liquid level signal remains unchanged. After obtaining a new final determination result in the next sampling cycle, the full or incomplete liquid level signal is updated. If the liquid level determination result in step 4 of the next sampling cycle is to maintain the previous liquid level determination result, then step 6 will still output according to the previous final determination result. If there is no previous final determination result on the first power-on, the incomplete liquid level signal can be output by default until steps 1 to 6 are completed for the first time and then updated.
[0079] When the liquid level determination result in step 5 is that the liquid has reached the preset position and the first number of drive pulses are output, and when step 6 reads that the feedback terminal level has not flipped, the MCU can record one confirmation failure; when the number of consecutive confirmation failures reaches a preset failure count threshold, an alarm signal is output. The preset failure count threshold is taken as 2. 5. Preferably 3; a value that is too small is prone to false alarms due to accidental interference, while a value that is too large will delay fault detection. The specific value can be determined based on system reliability and alarm tolerance. The alarm signal can be an audible and visual alarm signal, a displayed fault code, or a fault signal uploaded to the overall controller. When the liquid level determination result in step 5 is that the liquid has not reached the preset position and the second number of drive pulses are output or the drive pulse output is stopped, and when step 6 reads that the feedback terminal level has flipped, the MCU can output a full liquid signal according to the actual state of the feedback terminal and record the abnormal relay status; this abnormal record can be used for subsequent fault diagnosis, but does not change the final determination result.
[0080] Please see Figure 5 The present invention also provides a liquid level adaptive detection system based on ultrasonic pulse counting analysis. This system is used to implement the aforementioned liquid level adaptive detection method based on ultrasonic pulse counting analysis, and includes: Multiple ultrasonic transmission control modules are used to transmit multiple ultrasonic signals. Each ultrasonic signal includes several continuous ultrasonic pulses, and the time interval between two adjacent signals is a preset time length. The receiving and conditioning pulse conversion module is used to receive ultrasonic signals, process them, and convert them into pulse signals; The counting cycle pulse acquisition module is used to turn off the pulse counter and clear the counter at the beginning of each counting cycle, and then turn on the pulse counter; sequentially acquire the ultrasonic signals of the current group to obtain the corresponding pulse count value; after the transmission and reception of multiple groups of ultrasonic signals are completed, turn off the pulse counter and read it to obtain multiple pulse count sequences; The effective counting level determination module is used to process the multiple sets of pulse counting sequences to obtain effective count values; determine the range of pulse count values within multiple counting cycles based on empty liquid reference and full liquid reference to determine the determination threshold; and compare the effective count values with the determination threshold to obtain the liquid level determination result. The drive pulse energy storage control module is used to determine the number of drive pulses based on the liquid level determination result and output the corresponding number of drive pulses to accumulate charge in the energy storage capacitor in the relay drive circuit. The relay-activated liquid level determination module is used to perform a secondary confirmation of the liquid level determination result by reading the relay feedback terminal level signal after completing the state drive based on the output drive pulse, and finally determining whether the liquid has reached the preset position based on the state of the feedback terminal level.
[0081] The above formulas are all dimensionless calculations. The formulas are derived from software simulations using a large amount of collected data, and are the closest to the real situation. The preset parameters in the formulas are set by those skilled in the art according to the actual situation.
[0082] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented in software, the above embodiments can be implemented, in whole or in part, as a computer program product. Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution.
[0083] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0084] The above description is merely a specific embodiment of this application, but the scope of protection of this application 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 this application should be included within the scope of protection of this application.
Claims
1. A liquid level adaptive detection method based on ultrasonic pulse count analysis, characterized in that, The specific steps include: Step 1: Transmit multiple sets of ultrasonic signals. Each set of ultrasonic signals includes several consecutive ultrasonic pulses, and the time interval between two adjacent sets of signals is a preset time length. Step 2: Receive ultrasonic signals and process them, converting them into pulse signals; Step 3: At the beginning of each counting cycle, turn off the pulse counter and clear the counter to zero, then turn on the pulse counter; sequentially acquire the ultrasonic signals of the current group to obtain the corresponding pulse count values; after the transmission and reception of multiple groups of ultrasonic signals are completed, turn off the pulse counter and read the data to obtain multiple pulse count sequences; Step 4: Process the multiple sets of pulse counting sequences to obtain valid count values; determine the range of pulse count values within multiple counting cycles based on the empty liquid reference and the full liquid reference to determine the judgment threshold; compare the valid count values with the judgment threshold to obtain the liquid level judgment result; Step 5: Determine the number of driving pulses based on the liquid level determination result, and output the corresponding number of driving pulses to accumulate charge in the energy storage capacitor of the relay drive circuit; Step 6: After completing the state drive based on the output drive pulse, read the relay feedback terminal level signal to confirm the liquid level judgment result a second time, and finally determine whether the liquid has reached the preset position based on the state of the feedback terminal level.
2. The liquid level adaptive detection method based on ultrasonic pulse count analysis according to claim 1, characterized in that, The MCU drives the transmitting probe of the liquid-penetrating ultrasonic level switch to emit several sets of ultrasonic signals, each set continuously emitting the same preset number of ultrasonic pulses. The transmitting probe and receiving probe are respectively installed on both sides of the preset liquid level height, and the frequency of each set of ultrasonic pulses is the same as the resonant frequency of the transmitting probe.
3. The liquid level adaptive detection method based on ultrasonic pulse count analysis according to claim 1, characterized in that, The conversion to a pulse signal includes: The signal conditioning circuit amplifies, bandpass filters, and shapes the ultrasonic signal output by the receiving probe in sequence. It outputs a pulse signal for each ultrasonic signal received, and the number of pulse signals is the same as the number of ultrasonic signals received. The passband center frequency of the bandpass filter is consistent with the frequency of the ultrasonic signal emitted by the transmitting probe. The pulse counter is configured to count the rising or falling edge of the pulse signal.
4. The liquid level adaptive detection method based on ultrasonic pulse count analysis according to claim 1, characterized in that, Obtaining the multiple sets of pulse counting sequences includes: The counting period is one sampling period, and one sampling period includes the transmission and reception of multiple sets of ultrasonic signals; At the beginning of each counting cycle, the MCU first disables the pulse counting function, clears the counter to zero, and then enables the pulse counting function. Subsequently, the MCU controls the transmitting probe to transmit the current group of ultrasonic signals, and during the transmission of the current group of ultrasonic signals and the receiving waiting time after transmission, the pulse counter counts the pulse signals output by the signal conditioning circuit. After the receiving waiting time for the current group of ultrasonic signals ends, the MCU disables the pulse counting function and reads the counter value to obtain the pulse count value of the current group. Repeat the above process until all groups of ultrasonic signals have been transmitted and received, resulting in multiple pulse count sequences composed of multiple pulse count values in sequence.
5. The liquid level adaptive detection method based on ultrasonic pulse count analysis according to claim 4, characterized in that, The MCU removes abnormal count values from multiple pulse counting sequences and then averages them to obtain the effective count value. The empty-liquid reference is the range of pulse count values obtained by the MCU through multiple sampling steps 1 to 3 when the liquid level has not reached the preset position. The full liquid reference is the range of pulse count values obtained by the MCU through multiple samplings in steps 1 to 3 when the liquid level reaches the preset position. The MCU determines a first determination threshold and a second determination threshold based on the upper limit of the empty liquid reference and the lower limit of the full liquid reference, wherein the first determination threshold is greater than the second determination threshold. When the effective count value is greater than the first judgment threshold, it is determined that the liquid has reached the preset position; when the effective count value is less than the second judgment threshold, it is determined that the liquid has not reached the preset position; when the effective count value is between the first judgment threshold and the second judgment threshold, the liquid level judgment result of the previous time is maintained.
6. The liquid level adaptive detection method based on ultrasonic pulse count analysis according to claim 5, characterized in that, The numerical range between the first and second judgment thresholds constitutes the hysteresis interval, with the upper limit of the hysteresis interval being the first judgment threshold and the lower limit being the second judgment threshold; the MCU uses the difference between the maximum and minimum values among the valid count values obtained from multiple consecutive sampling periods as the degree of fluctuation. The hysteresis interval is adjusted according to the degree of volatility. When the degree of volatility exceeds the preset volatility threshold, the hysteresis interval is expanded. When the fluctuation level is not greater than the preset fluctuation threshold, the hysteresis interval is reduced; During the adjustment of the hysteresis interval, the first judgment threshold is kept greater than the second judgment threshold.
7. The liquid level adaptive detection method based on ultrasonic pulse count analysis according to claim 5, characterized in that, The minimum number of drive pulses required for a relay to reliably activate is pre-stored in the MCU; When the liquid level determination result is that the liquid has reached the preset position, the MCU outputs a first number of drive pulses to the relay drive circuit, and the first number is not less than the minimum number of drive pulses. When the liquid level determination result is that the liquid level has not reached the preset position, the MCU outputs a second number of drive pulses to the relay drive circuit or stops outputting drive pulses, where the second number is less than the minimum number of drive pulses. When the liquid level determination result is to maintain the previous liquid level determination result, the MCU outputs the same number of drive pulses as before.
8. The liquid level adaptive detection method based on ultrasonic pulse count analysis according to claim 1, characterized in that, The energy storage capacitor includes a first capacitor and a second capacitor; the specific steps of accumulating charge in the energy storage capacitor of the relay drive circuit are as follows: The driving pulse is a sequence of pulses. Each driving pulse turns on the first transistor in the relay driving circuit. When the first transistor is turned on, the power supply charges the first capacitor through the first resistor and drives the second transistor to turn on. When the second transistor is turned on, the first capacitor charges the second capacitor. During the interval between drive pulses, the first transistor is turned off, and the first capacitor discharges through the second and third resistors so that the second transistor can be turned on again by the next drive pulse. The capacitance of the first capacitor is smaller than that of the second capacitor. The second capacitor needs to be charged multiple times by a first number of drive pulses to raise its voltage to the voltage required for the relay to be activated. When the liquid level determination result is that the liquid has reached the preset position, the MCU will also compare the effective count value with the full liquid reference. The closer the effective count value falls into the full liquid reference range to the average value of the full liquid reference, the larger the first number output by the MCU, and the first number does not exceed the preset maximum number of drive pulses.
9. The liquid level adaptive detection method based on ultrasonic pulse count analysis according to claim 5, characterized in that, The final determination of whether the liquid has reached the preset position includes: After the drive pulse output ends, the MCU delays and waits for the relay to act; when the voltage across the energy storage capacitor reaches its pull-in voltage, the relay coil is energized and pulls in, the normally open contact of the relay closes, and the level at the feedback terminal connected to the normally open contact circuit flips. After the delay period ends, the MCU reads the level of the feedback terminal. If the level of the feedback terminal flips, it determines that the liquid has reached the preset position and outputs a full liquid signal; otherwise, it outputs a not full liquid signal. The full liquid signal or incomplete liquid signal is maintained until the next sampling period, until a new liquid level determination result is obtained.
10. A liquid level adaptive detection system based on ultrasonic pulse counting analysis, characterized in that, The liquid level adaptive detection system based on ultrasonic pulse counting analysis is used to implement the liquid level adaptive detection method based on ultrasonic pulse counting analysis as described in any one of claims 1-9, including: Multiple ultrasonic transmission control modules are used to transmit multiple ultrasonic signals. Each ultrasonic signal includes several continuous ultrasonic pulses, and the time interval between two adjacent signals is a preset time length. The receiving and conditioning pulse conversion module is used to receive ultrasonic signals, process them, and convert them into pulse signals; The counting cycle pulse acquisition module is used to turn off the pulse counter and clear the counter at the beginning of each counting cycle, and then turn on the pulse counter; sequentially acquire the ultrasonic signals of the current group to obtain the corresponding pulse count value; after the transmission and reception of multiple groups of ultrasonic signals are completed, turn off the pulse counter and read it to obtain multiple pulse count sequences; The effective counting level determination module is used to process the multiple sets of pulse counting sequences to obtain effective count values; determine the range of pulse count values within multiple counting cycles based on empty liquid reference and full liquid reference to determine the determination threshold; and compare the effective count values with the determination threshold to obtain the liquid level determination result. The drive pulse energy storage control module is used to determine the number of drive pulses based on the liquid level determination result and output the corresponding number of drive pulses to accumulate charge in the energy storage capacitor in the relay drive circuit. The relay-activated liquid level determination module is used to perform a secondary confirmation of the liquid level determination result by reading the relay feedback terminal level signal after completing the state drive based on the output drive pulse, and finally determining whether the liquid has reached the preset position based on the state of the feedback terminal level.
Citation Information
Patent Citations
Contact-type ultrasonic liquid level switch
CN202494495U
