Anti-overflow liquid level detection method based on multi-target tracking algorithm and water dispenser
By employing a multi-target tracking algorithm, the ultrasonic probe array learns the static physical boundary and combines it with a priori motion model, thus solving the misjudgment problem of ultrasonic ranging modules in complex liquid surface environments and improving the accuracy of liquid level measurement and the reliability of spill prevention.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHENGDU INTELLIGENT SENSOR & SYST TECH RES CO LTD
- Filing Date
- 2026-03-20
- Publication Date
- 2026-04-17
AI Technical Summary
In existing technologies, ultrasonic ranging modules cannot accurately distinguish between the liquid surface and splashing water in complex dynamic liquid environments, leading to inaccurate liquid level measurement and misjudgment that results in water overflow.
A multi-target tracking algorithm is adopted, which uses an ultrasonic probe array to learn the static physical boundary when the target container is not detected, establishes a measurement reference surface, and performs signal correlation and state recursion through a priori motion model to distinguish between liquid surface and splash water, and generates accurate drive and stop control commands.
It improves the accuracy of liquid level measurement and the reliability of overflow prevention, and can accurately identify the real liquid level in complex and dynamic liquid surface environments, avoiding misjudgment.
Smart Images

Figure CN121877148A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of liquid level measurement technology, and in particular to an anti-overflow liquid level detection method based on a multi-target tracking algorithm and a water dispenser. Background Technology
[0002] Fully automatic intelligent water dispensers, with their convenience and hygiene features, have become key devices for improving users' quality of life.
[0003] Automatic sensor-operated water dispensers typically incorporate ultrasonic ranging modules. During operation, the internal processor drives an ultrasonic transducer to emit high-frequency pulse beams vertically downwards. These sound waves propagate through the air and reflect off obstacles below (such as the drip tray or the liquid surface in the cup), with the echo signal being received by the probe. Once the amplitude of the echo signal exceeds a preset fixed voltage threshold, the hardware locks the arrival time of the echo. The processor, using the speed of sound formula, calculates the instantaneous distance to the top surface of the obstacle based on the time of the first echo exceeding the threshold and compares this distance with the user-preset target water stop height to prevent overflow.
[0004] However, the flow of water from the outlet into the container is a fluid disturbance process accompanied by the release of kinetic energy. The interior space of the container not only contains a steadily rising actual liquid level, but also is filled with randomly splashing discrete water droplets, bursting and tumbling bubbles, and residual liquid clinging to the container walls. Because the control logic of related technologies assumes that the first strong reflection point on the ultrasonic path is the liquid surface, it cannot physically distinguish whether the captured signal source is a steadily accumulating liquid column due to gravity or a suspended droplet jumping high into the air. This causes the momentary echo generated by the splashing water to be misinterpreted as a full water level, incorrectly triggering a valve-closing command and resulting in inaccurate liquid level measurement. Summary of the Invention
[0005] This application provides a method for detecting overflow level based on a multi-target tracking algorithm and a water dispenser, which can improve measurement accuracy and reliability of overflow prevention in complex dynamic liquid surface environments.
[0006] Firstly, this application provides a method for preventing overflow liquid level detection based on a multi-target tracking algorithm, comprising: when no target container is detected, obtaining a measurement reference plane by learning the static physical boundary through an ultrasonic probe array; the ultrasonic probe array is an ultrasonic transceiver assembly arranged in a preset spatial position, all of which have transmission and reception functions; the measurement reference plane is an absolute coordinate reference standard after eliminating the height difference of the drip tray and environmental noise; when a target container is detected, controlling the ultrasonic probe array to perform alternating spatial scanning pulse detection based on the measurement reference plane to obtain an echo signal containing the internal reflection characteristics of the target container; using a priori motion model to perform spatial neighborhood association and temporal state recursion on the echo signal, aggregating and mapping it into a multi-target motion trajectory with continuous physical motion characteristics; the multi-target motion trajectory is a set of vector data streams showing the continuous positional changes of the internal reflective surface of the target container in time and space; monitoring the liquid level height change trend of the main motion characteristic trajectory representing the liquid surface in the multi-target motion trajectory; and generating a stop control command when the liquid level height exceeds a safety threshold.
[0007] By employing the aforementioned technical solution, the water dispenser learns the static physical boundary using an ultrasonic probe array when the target container is not detected. This enables the dispenser to establish a measurement reference surface that eliminates environmental noise in different installation environments, providing an accurate zero-point reference for subsequent measurements. Furthermore, after detecting the target container, echo signals containing the container's internal reflection characteristics are acquired. Using a priori motion models, these signals are spatially correlated and their temporal states are recursively extrapolated. This process aggregates and maps discrete, chaotic signal points into multi-target motion trajectories with continuous physical motion characteristics. This allows the water dispenser to distinguish between transient interference (such as splashing water) and steady-state targets (such as rising liquid levels). Finally, by monitoring the changing trends of the main motion characteristic trajectory representing the real liquid surface and generating stop commands accordingly, misjudgments caused by false peaks generated by splashing water can be avoided, improving measurement accuracy and spill prevention reliability in complex dynamic liquid surface environments.
[0008] In conjunction with some embodiments of the first aspect, in some embodiments, the learning of the static physical boundary specifically includes: when a power-on signal or reset signal of the water dispenser is detected, performing multiple cyclic no-load measurements on a preset static detection area using an ultrasonic probe array to obtain multiple reference reflection signals; comparing the reference reflection signals of different probes within the same time period to obtain a symmetry health level; when the symmetry health level is greater than a preset health threshold, calculating the average value of the reference reflection signals and determining the measurement reference plane by combining the coordinates of the ultrasonic probe array; when the symmetry health level is not greater than the preset health threshold, triggering an abnormal probe shielding command and switching to a single-sided redundant operation mode.
[0009] By adopting the above technical solution, the water dispenser performs multiple cyclic no-load measurements on the detection area when powered on or reset. Through data averaging, it can automatically identify and adapt to the current water tray height, establishing a zero-point reference. Furthermore, by comparing the symmetry of the reflected signals from different probes, the water dispenser can assess the physical state of the probe components in real time. When excessive symmetry deviation is detected, indicating potential water condensation or aging failure of the probe, the water dispenser can trigger an abnormal shielding command and automatically switch to a single-sided redundant operation mode. This allows the dispenser to maintain basic water dispensing functionality even under conditions of partial hardware damage, improving the product's environmental adaptability.
[0010] In conjunction with some embodiments of the first aspect, in some embodiments, before the step of using a prior motion model to perform spatial neighborhood association and temporal state recursion on the echo signal and aggregating and mapping it into a multi-target motion trajectory with continuous physical motion characteristics, the method further includes: stripping interference data from the echo signal and converting the echo signal into an echo point cloud; the step of using a prior motion model to perform spatial neighborhood association and temporal state recursion on the echo signal and aggregating and mapping it into a multi-target motion trajectory with continuous physical motion characteristics specifically includes: using a prior motion model to perform spatial neighborhood association and temporal state recursion on the echo point cloud and aggregating and mapping it into a multi-target motion trajectory with continuous physical motion characteristics.
[0011] By adopting the above technical solution, before sending the signal into the trajectory tracking model, interference data in the echo signal is stripped away and converted into an echo point cloud, eliminating interference data caused by water pump vibration, external harmonics, and reflections from non-target objects mixed in with the original sound wave signal. This reduces the computational burden and resource consumption of subsequent steps and improves the response speed of the water dispenser.
[0012] In conjunction with some embodiments of the first aspect, in some embodiments, the step of stripping interference data from the echo signal and converting the echo signal into an echo point cloud specifically includes: performing frequency band filtering on the echo signal to obtain a filtered echo signal; extracting amplitude variation features from the filtered echo signal to obtain a signal envelope; identifying regions with local maxima in the signal envelope to obtain candidate reflection peaks; calculating corresponding attenuation compensation parameters based on the detection distance corresponding to the candidate reflection peaks to obtain a dynamic detection threshold baseline that fluctuates with distance; the dynamic detection threshold baseline is negatively correlated with the probe detection distance; and when the signal strength of the candidate reflection peak is greater than or equal to the dynamic detection threshold baseline, extracting and confirming the spatial coordinates corresponding to the candidate reflection peak as an echo point cloud.
[0013] By adopting the above technical solution, the water dispenser does not use a fixed threshold standard during the signal-to-point-cloud conversion process. Instead, it constructs a dynamic detection threshold baseline that fluctuates with the detection distance. By extracting the envelope of the signal after filtering through the frequency band and identifying candidate peaks, the water dispenser can automatically calculate compensation parameters to adjust the interception standard based on the physical characteristic that signal attenuation increases with distance. In areas with extremely strong signals close to the probe, the threshold baseline automatically rises to shield against strong interference from splashing water; while at the bottom of the deep cup, where the signal is weak and far from the probe, the threshold baseline automatically lowers to sensitively capture the true liquid surface reflection. This avoids the inherent contradiction between misjudgment at shallow liquid surfaces and missed judgment at deep liquid surfaces, improving the ability to extract the true physical reflection interface at any water depth.
[0014] In conjunction with some embodiments of the first aspect, in some embodiments, the step of using a priori motion model to perform spatial neighborhood association and temporal state recursion on the echo point cloud, and aggregating and mapping it into a multi-target motion trajectory with continuous physical motion characteristics, specifically includes: splitting the echo point cloud into historical trajectories and current measurement points according to time; the historical trajectory is a temporal-spatial dimension; the current measurement point is a spatial dimension; extracting the historical trajectory state parameters from the historical trajectory; and inputting them into the priori motion model to perform position deduction to obtain predicted spatial measurement points; comparing the spatial distance between the current measurement point and the predicted spatial measurement point; when the spatial distance is less than or equal to a preset neighborhood radius, clustering and aggregating the current measurement point and the predicted spatial measurement point to obtain candidate matching point clouds; calculating the displacement smoothness of the candidate matching point clouds for multiple consecutive detection cycles in the time series; and when the displacement smoothness conforms to the preset fluid dynamics continuous characteristics, confirming the candidate matching point clouds as the main motion characteristic trajectory representing the liquid surface, and updating and storing them in the multi-target motion trajectory.
[0015] By employing the aforementioned technical solution, the echo point cloud is decomposed into historical trajectories and current measurement points using a priori motion model, and a deep comparison of spatiotemporal dimensions is performed. By extracting historical state parameters to predict spatial measurement points, and clustering only current measurement points falling within a preset neighborhood radius, the water dispenser can effectively associate signals belonging to the same physical object. Through displacement smoothness calculation of the candidate matching point cloud, only point cloud sequences conforming to the continuous upward characteristics of fluid mechanics are identified as the main motion characteristic trajectory representing the liquid surface. Utilizing the dual constraints of prior velocity prediction and spatial density classification, isolated and abrupt water splash noise points are forced to be eliminated because they cannot meet the continuity condition, enabling the water dispenser to evaluate the motion rationality of multiple reflecting surfaces in parallel and find the main line of uniform liquid surface rise. This allows for locking onto the real liquid surface in a multi-target coexisting interference environment, preventing target jumps and loss.
[0016] In conjunction with some embodiments of the first aspect, in some embodiments, before the step of using a priori motion model to perform spatial neighborhood association and temporal state recursion on the echo signal and aggregate and map it into a multi-target motion trajectory with continuous physical motion characteristics, the method further includes: inputting the echo signal into a buffer array with a time series dimension; observing the spatial jump characteristics of the echo signal in the buffer array within a continuous observation period; marking the echo signal as a static structural reference when the spatial jump characteristics are lower than a set physical fluctuation; confirming the static structural reference as the highest edge coordinate of the target container; determining the tracking space based on the highest edge coordinate; the tracking space is used for aggregation mapping using the priori motion model when the echo signal is within the tracking space.
[0017] By adopting the above technical solution, before performing dynamic trajectory tracking, the water dispenser first identifies static signals with extremely low spatial fluctuation characteristics and marks them as static structural references, confirming them as the coordinates of the highest rim of the target container. The tracking space determined based on this sets physical boundary constraints for the subsequent prior motion model. This ensures that all subsequent dynamic liquid level calculations are performed within this defined internal container space, filtering out diffuse reflection signals outside the tracking space (such as above or outside the cup rim). This eliminates external false signal interference caused by reflections from slanted walls or irregularly shaped cups, improving the water dispenser's compatibility with various complex shapes and tilted cups, and enhancing its resistance to misjudgments.
[0018] In conjunction with some embodiments of the first aspect, in some embodiments, before generating a stop control command when the liquid level exceeds a safety threshold, the method further includes: verifying the matching degree between the maximum coordinate height corresponding to the echo signal and the coordinate of the highest edge; if the matching degree is lower than the matching degree threshold in multiple consecutive detection cycles, determining that the target container has left the monitoring area, and generating a stop control command.
[0019] By adopting the above technical solution, the water dispenser performs real-time matching verification between the maximum coordinate height of the echo signal and the previously determined highest rim coordinate. If the matching degree is found to be lower than the threshold within multiple consecutive detection cycles, it means that the physical characteristic representing the container's presence (cup rim signal) has disappeared. At this point, the water dispenser does not need to wait for changes in liquid level data; it directly determines that the target container has left the monitoring area and generates a stop control command. This optimizes the strategy of inferring cup movement based on observing sudden drops in liquid level, achieving a high-speed response to cup movement.
[0020] In a second aspect, this application provides a water dispenser, which includes: one or more processors and a memory; the memory is coupled to one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the water dispenser to perform the method described in the first aspect and any possible implementation thereof.
[0021] Thirdly, this application provides a computer program product containing instructions that, when the computer program product is run on a water dispenser, cause the water dispenser to perform the method described in the first aspect and any possible implementation thereof.
[0022] Fourthly, this application provides a computer-readable storage medium including instructions that, when executed on a water dispenser, cause the water dispenser to perform the method described in the first aspect and any possible implementation thereof.
[0023] One or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages:
[0024] 1. By utilizing an ultrasonic probe array to learn the static physical boundary when the target container is not detected, the water dispenser can establish a measurement reference surface that eliminates environmental noise in different installation environments, providing an accurate zero-point reference for subsequent measurements. Then, after detecting the target container, echo signals containing the container's internal reflection characteristics are acquired. Using a priori motion models, these signals are spatially correlated and temporally recursively analyzed. This process aggregates discrete, chaotic signal points and maps them into multi-target motion trajectories with continuous physical motion characteristics. This enables the water dispenser to distinguish between transient interference (such as splashing water) and steady-state targets (such as rising liquid levels). Finally, by monitoring the changing trends of the main motion characteristic trajectory representing the real liquid surface and generating stop commands accordingly, misjudgments caused by false peaks generated by water droplet splashing can be avoided, improving measurement accuracy and spill prevention reliability in complex dynamic liquid surface environments. Attached Figure Description
[0025] Figure 1 This is a flowchart illustrating an overflow level detection method based on a multi-target tracking algorithm in an embodiment of this application.
[0026] Figure 2 This is another flowchart illustrating the overflow level detection method based on a multi-target tracking algorithm in this application embodiment;
[0027] Figure 3 This is another flowchart illustrating the overflow level detection method based on a multi-target tracking algorithm in this application embodiment;
[0028] Figure 4This is a schematic diagram of an exemplary hardware structure of a water dispenser in an embodiment of this application.
[0029] Figure 5 This is a front view of the ultrasonic probe array in the embodiments of this application;
[0030] Figure 6 This is a side view of the ultrasonic probe array in the embodiments of this application;
[0031] Figure 7 This is a bottom view of the ultrasonic probe array in the embodiments of this application;
[0032] In the diagram: 400, water dispenser; 500, ultrasonic probe array; 510, ultrasonic transceiver assembly. Detailed Implementation
[0033] The terminology used in the following embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to include the plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this application refers to and includes any or all possible combinations of one or more of the listed items.
[0034] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.
[0035] Please see Figure 1 , Figure 1 This is a flowchart illustrating an overflow level detection method based on a multi-target tracking algorithm in an embodiment of this application.
[0036] A method for preventing liquid overflow based on a multi-target tracking algorithm, comprising:
[0037] S101. In the absence of a target container, the measurement reference plane is obtained by learning the static physical boundary through an ultrasonic probe array. The ultrasonic probe array consists of ultrasonic transceiver components arranged in a preset spatial position, and all ultrasonic transceiver components have both transmitting and receiving functions. The measurement reference plane is the absolute coordinate reference standard after eliminating the height difference of the water tray and environmental noise.
[0038] Among them, the ultrasonic probe array refers to a hardware module consisting of at least two sensors installed above the water outlet of the water dispenser; the static physical boundary is used to represent the inherent physical reflection plane of the water receiving platform, water receiving tray, or lower bracket when no external container (such as a water cup) is involved; the measurement reference plane refers to the background distance value that the water dispenser deducts as the zero point when subsequently calculating the liquid level height.
[0039] Specifically, after power-on initialization or resetting after completing a water dispensing task, the water dispenser enters a reference calibration mode. At this time, the microcontroller drives an ultrasonic probe array to emit a probe beam towards an empty water-receiving area. Because the depth of the water tray varies between different water dispenser models, or because the same tray may have accumulated water, stains, or other environmental variations, the water dispenser calculates the time it takes for the probe to travel from the reflected signal from a stationary physical boundary to the surface of the water tray. This location is locked as the absolute coordinate reference standard, used to eliminate the influence of environmental noise through differential calculations when a container appears later, ensuring that only the relative height of the container and the liquid is measured.
[0040] Please see Figure 6 , Figure 5 This is a front view of the ultrasonic probe array in the embodiments of this application; Figure 6 This is a side view of the ultrasonic probe array in the embodiments of this application; Figure 7 This is a bottom view of the ultrasonic probe array in the embodiments of this application;
[0041] In some embodiments, the ultrasonic probe array 500 is arranged in a regular symmetrical layout. Specifically, the ultrasonic transceiver components 510 in the ultrasonic probe array 500 are distributed at equal intervals and angles along the circumference, with the water outlet as the center. For example, when dual ultrasonic transceiver components 510 are used, the two ultrasonic transceiver components 510 are symmetrically arranged with respect to the central axis of the water outlet, and the angle between the normals of their emitting surfaces and the central axis is the same. The advantage of this uniform layout is that it gives the echo data acquired by different probes a natural spatial symmetry, which facilitates direct weighted averaging or differential comparison, thereby quickly establishing a unified measurement reference surface.
[0042] In other embodiments, the ultrasonic probe array is arranged in an irregular and asymmetrical manner, meaning that the positions, spacing, or emission angles of the various ultrasonic transceiver components relative to the center of the water outlet are not entirely the same. For example, for irregularly shaped (such as rectangular or elliptical) water trays or water dispensers with special structures, the first probe can be set to emit vertically downwards to obtain the main height of the liquid level, while the second probe can be set to emit at a large angle to cover edge dead corners or detect side wall reflections.
[0043] In actual use, the zero-point reference for liquid level is hard-coded with fixed factory parameters. When users replace the drip tray with a different model or depth, or when water or foreign objects accumulate on the drip tray, the fixed physical reference fails to detect changes in external height, leading to a systematic deviation in the initial liquid level measurement. Furthermore, during long-term use, ultrasonic probes are prone to condensation from hot steam, or their transmission power and receiving sensitivity may decrease due to component aging. This can cause blind trust in abnormal data and the use of faulty data for liquid level calculations even when signal quality deteriorates, resulting in misjudgments or even ignoring rising liquid levels until overflow.
[0044] Therefore, in some optimized embodiments, step S101 specifically includes: S1011. When the power-on signal or reset signal of the water dispenser is detected, multiple cyclic no-load measurements are performed on the preset static detection area through the ultrasonic probe array to obtain multiple reference reflection signals. Among them, the power-on signal or reset signal refers to the trigger level when the main control board of the water dispenser is powered on and initialized, or when the water dispenser returns to the idle state after the user completes a water dispensing action and removes the container; the preset static detection area is used to indicate the expected physical location range of the water receiving tray below the water outlet; the reference reflection signal indicates the time flight data of the sound wave returning after contacting the device's own structure (base) under no-load conditions.
[0045] S1012. Compare the reference reflection signals of different probes within the same time period to obtain the symmetrical health status; Among them, different probes refer to ultrasonic sensors in an ultrasonic probe array that are physically located but have the same or complementary orientation (such as the left probe and the right probe); symmetry health is used to indicate the degree of consistency of measurement results of two probes on the same stationary plane under the same environmental conditions.
[0046] Specifically, after S1011 acquires multiple sets of reference reflection signals from the left and right probes and calculates their average values, theoretically, for a flat water tray, the distances measured by two probes installed at the same height should be very close. The water dispenser calculates the similarity of the distance measurement results from the two probes to reflect whether the probes are damaged, obstructed, or installed at an angle.
[0047] S1013. When the symmetry health degree is greater than the preset health threshold, calculate the mean value of the reference reflected signal and determine the measurement reference plane by combining the coordinates of the ultrasonic probe array. Among them, the preset health threshold refers to the degree of similarity that the water dispenser is allowed to have; the measurement reference surface refers to the actual "zero water level" reference coordinate after being affected by ambient temperature, humidity or installation errors.
[0048] Specifically, when the similarity of the measurement data from the two probes exceeds a preset health threshold, the water dispenser determines that the dual-probe module is working normally and the environment is stable. At this point, the water dispenser uses a data fusion strategy to perform a weighted average or arithmetic average of the measurement results from the two probes to obtain a comprehensive distance value. This value represents the actual physical distance from the probe surface to the water tray. Subsequently, the water dispenser locks this value as a global variable, and in all subsequent liquid level detection algorithms (such as cup bottom recognition and liquid height calculation), all measurement values will be subtracted from this value or a relative height conversion will be performed based on it.
[0049] S1014. If the symmetry health level is not greater than the preset health threshold, trigger the abnormal probe shielding command and switch to single-sided redundant operation mode.
[0050] Among them, the single-sided redundant operation mode is used to indicate that the water dispenser has been downgraded to a fail-safe state that relies solely on a single health probe to operate.
[0051] Specifically, if the symmetry health level in S1012 is not greater than the preset health threshold, it is determined that one probe is malfunctioning, blocked by a foreign object (such as water droplets blocking the probe at the water outlet), or damaged. In this case, the water dispenser first detects the echo energy by transmitting a test pulse; the probe with extremely low energy is identified as the malfunctioning probe. The water dispenser then sets a global fault flag, skipping the transmission of the malfunctioning probe or ignoring its received data in subsequent alternating scans, using only the healthy probe on the other side to maintain basic water dispensing functionality, and may flash an LED to alert the user to maintenance.
[0052] As can be seen, the water dispenser performs multiple cyclic no-load measurements on the detection area when powered on or reset. Through data averaging, it can automatically identify and adapt to the current water tray height, establishing a zero-point reference. Furthermore, by comparing the symmetry of the reflected signals from different probes, the water dispenser can assess the physical state of the probe components in real time. When excessive symmetry deviation is detected, indicating potential water condensation or aging failure of the probe, the water dispenser can trigger an abnormal shielding command and automatically switch to a single-sided redundant operation mode. This allows the dispenser to maintain basic water dispensing functionality even under conditions of partial hardware damage, improving the product's environmental adaptability.
[0053] S102. Upon detecting the target container, the ultrasonic probe array is controlled to perform alternating spatial scanning pulse detection based on the measurement reference plane to obtain an echo signal containing the internal reflection characteristics of the target container.
[0054] Alternating spatial scanning refers to controlling the time-division emission of different probes by rotating time slices to avoid acoustic interference caused by multiple probes working simultaneously; the echo signal is used to represent the original waveform data sequence that the sound wave is received by the sensor after being reflected by an obstacle and converted into a digital quantity.
[0055] Specifically, when an object enters the detection area and causes the reflection distance to be less than the measurement reference plane, the water dispenser determines that the target container has been detected. At this time, in order to comprehensively acquire the three-dimensional features inside the container (such as the bottom, walls, and liquid surface), the water dispenser uses a timer interrupt to generate a precise PWM drive signal to control probe A to first emit a set of ultrasonic pulses, wait for and receive the echo; then it controls probe B to emit a set of pulses and receive them. This alternating left-right scanning method solves the blind zone problem that is prone to signal loss when a single probe is facing irregularly shaped cups or tilted cup walls.
[0056] Continuing with the previous example, for the aforementioned irregular layout, a spatial mapping correction mechanism is introduced in step S102. This involves pre-storing the installation pose parameters of each probe in the controller. After acquiring the raw echo data, an omnidirectional field-of-view transformation matrix is constructed based on the pose parameters, uniformly mapping the one-dimensional distance data collected by probes at different angles to the same coordinate system.
[0057] S103. Using a priori motion model, the echo signal is spatially correlated and temporally recursively deduced, and aggregated and mapped into a multi-target motion trajectory with continuous physical motion characteristics; the multi-target motion trajectory is a set of vector data streams in which the reflective surface inside the target container continuously changes position in time and space.
[0058] Among them, the prior motion model refers to a mathematical model (such as a uniform linear motion model) pre-set based on fluid mechanics and physical motion laws, used to predict the state of the liquid surface at the next moment; spatial neighborhood association refers to the judgment logic for determining whether a newly collected data point belongs to an existing target; multi-target motion trajectory is used to represent the path record of multiple reflection sources (such as water surface, splashing water, bubbles, cup rim) tracked by the water dispenser at the same time as changing over time.
[0059] Specifically, after receiving the raw echo signal, the water dispenser first discretizes it into spatial coordinate points. Then, using Kalman filtering or other prediction algorithms as a priori models, it predicts the current positions of various targets (such as rising water or a stationary cup wall) based on their positions and velocities at the previous moment. Next, the water dispenser compares the currently measured echo points with the predicted spatial measurement points. If a measurement point falls within the "spatial neighborhood" of the predicted point, it is considered to belong to that target, and the target's trajectory is corrected accordingly. Through this continuous prediction, correlation, and correction, the water dispenser strings together the chaotic discrete echo points into multiple continuous vector trajectories with velocity and acceleration attributes, thus distinguishing between regularly moving entities and randomly occurring noise.
[0060] In some embodiments, a nearest neighbor association algorithm is employed: a list containing multiple target structures is established, each structure storing the target's current position and velocity. For each newly acquired echo point, its Euclidean distance to all predicted spatial measurement points is calculated. The target with the closest distance and a distance less than a set association threshold is selected for pairing, and the Kalman filter state variable of that target is updated; this is not limited here.
[0061] It should be noted that, in some other preferred embodiments, only the main motion characteristic trajectories in the multi-target motion trajectory may be recorded.
[0062] It should be noted that, prior to this embodiment, the bottom and top of the target container also need to be detected in order to obtain the safety threshold in step S105.
[0063] S104. Monitor the liquid level height variation trend of the main motion characteristic trajectory representing the liquid surface in the multi-target motion trajectory;
[0064] Among them, the main motion characteristic trajectory refers to the trajectory that is identified as the real liquid surface after feature screening among multiple parallel tracking trajectories; the liquid level height change trend is used to represent the rate of liquid level rise, acceleration, and changes in the current absolute height.
[0065] Specifically, the water dispenser's memory may contain multiple tracks being tracked at this time. The core logic of this step is to identify these tracks. The water dispenser analyzes the velocity vector and position variance of each track. Since the liquid level usually shows a relatively stable upward trend during the actual water filling process, while the cup wall is stationary and the water splashes are disorderly, the water dispenser uses these physical characteristics to select the track with a positive velocity, a variance within a reasonable range, and the longest duration as the "main motion characteristic track". After selection, the water dispenser continuously locks the coordinate data of this track, calculates the liquid level height it represents in real time, and analyzes the remaining distance from the target threshold.
[0066] S105. When the liquid level exceeds the safety threshold, generate a stop control command.
[0067] Among them, the safety threshold refers to the pre-set physical height limit corresponding to the container being full of water or the water volume set by the user; the drive-stop control command is used to represent the level signal or communication command that directly acts on the actuator to forcibly block the water path.
[0068] Specifically, the water dispenser compares the current height coordinates of the main motion characteristic trajectory locked in step S104 with a preset safety threshold in real time. This is not just a simple numerical comparison; it usually includes predictive logic. The water dispenser calculates the current "distance difference," and when this difference is less than a specific standard value, or when it predicts that the threshold will be reached within tens of milliseconds based on the current rising speed, the water dispenser determines that the liquid level has reached its upper limit. At this time, the microcontroller immediately triggers the highest priority control logic, generating a shutdown signal.
[0069] As can be seen, by using an ultrasonic probe array to learn the static physical boundary when the target container is not detected, the water dispenser can establish a measurement reference surface that eliminates environmental noise in different installation environments, providing an accurate zero-point reference for subsequent measurements. Furthermore, after detecting the target container, echo signals containing the container's internal reflection characteristics are acquired. Using a priori motion model, these signals are spatially correlated and their temporal states are recursively extrapolated. This process aggregates and maps discrete, chaotic signal points into multi-target motion trajectories with continuous physical motion characteristics. This enables the water dispenser to distinguish between transient interference (such as splashing water) and steady-state targets (such as rising liquid levels). Finally, by monitoring the changing trend of the main motion characteristic trajectory representing the real liquid surface and generating a stop command accordingly, misjudgments caused by false peaks generated by water droplet splashing can be avoided, improving measurement accuracy and spill prevention reliability in complex dynamic liquid surface environments.
[0070] In actual use, in step S104, the number of trajectories in the multi-target motion trajectory increases due to interference noise caused by water pump vibration, external harmonics and splashing water, and the trajectories are prone to breakage (main motion trajectory).
[0071] Please see Figure 2 , Figure 2 This is another flowchart illustrating the overflow level detection method based on a multi-target tracking algorithm in this application embodiment;
[0072] Therefore, before step S103, the method further includes: S201, stripping the interference data from the echo signal and converting the echo signal into an echo point cloud;
[0073] Interference data refers to spurious signal components generated by environmental electromagnetic noise, power supply ripple, and non-target objects (such as splashing water droplets); echo point cloud is used to represent a set of discrete coordinate points that retain only distance and intensity information after feature extraction.
[0074] Specifically, the echo signal is a continuous series of voltage waveform data. Most of this consists of existing background noise or clutter exceeding a threshold but whose shape does not conform to the laws of physical reflection. This step uses digital signal processing algorithms to clean the original waveform. The water dispenser not only extracts the signal strength but also analyzes the signal width and frequency characteristics, removing sharp spikes and extracting the peak positions that truly represent the physical reflective surface, converting them into specific spatial distance coordinates.
[0075] It should be noted that echo signals and echo point clouds essentially describe the same set of physical detection events, but echo point clouds have had invalid interference components removed, while echo signals may or may not have had invalid interference components removed.
[0076] In practical use, the echo signal is extremely weak (low signal-to-noise ratio) for the bottom of a deep cup or a distant real liquid surface due to significant attenuation over long distances. Conversely, for splashing water excited by water injection in the near-field area, the echo energy exhibits extremely strong transient amplitude due to its proximity to the probe. Therefore, if a high threshold is set in step S201 to shield near-field splash interference, the weak far-field liquid surface echo will be filtered out as background noise and missed. If a low threshold is set to capture far-field signals, the high-energy near-field splashes will be mistakenly identified as a full-water signal, leading to sensor false triggering and premature water shut-off.
[0077] In some specific embodiments, step S201 specifically includes:
[0078] S2011. Perform frequency band filtering on the echo signal to obtain the filtered echo signal;
[0079] Frequency band filtering refers to using digital filters to retain signals near the working center frequency of the ultrasonic probe while filtering out noise in other frequency bands; the filtered echo signal represents the waveform data after the signal-to-noise ratio is improved.
[0080] Specifically, the raw data acquired by the ultrasonic receiver is often superimposed with power frequency interference and high-frequency ripple from the switching power supply. Since the center frequency of the ultrasonic probe used in this water dispenser is typically 40kHz, a digital bandpass filter is designed with a passband range set from 35kHz to 45kHz. The raw sequence acquired by the ADC is fed into this filter for processing, and the output sequence is the filtered echo signal, which can remove low-frequency vibration noise and high-frequency electromagnetic spikes.
[0081] S2012. Extract the amplitude variation characteristics from the filtered echo signal to obtain the signal envelope;
[0082] Among them, amplitude variation characteristics refer to the trend of AC signal amplitude changing over time; signal envelope is used to represent low-frequency signals that retain only the outer contour after removing the high-frequency carrier, reflecting the fluctuations of echo energy.
[0083] Specifically, the signal after S2011 filtering is still an oscillating wave (alternating positive and negative). For ranging applications, there is no need to process the high-frequency oscillation period; only the arrival time of the energy envelope needs to be extracted. Therefore, the water dispenser performs detection processing on the signal. A common practice is to take the absolute value of the data and then pass it through a low-pass filter to flatten the high-frequency oscillations, resulting in a smooth positive curve, which is the envelope.
[0084] S2013. Identify the regions with local maxima in the signal envelope to obtain candidate reflection peaks;
[0085] Among them, the local maximum is the point on the envelope where the derivative changes from positive to negative, that is, the vertex of the "peak"; the candidate reflection peak is used to represent the set of all possible obstacle reflection points, and at this time the true and false are not yet distinguished.
[0086] Specifically, the water dispenser iterates through the envelope array generated by S2012. By calculating the first-order difference (slope), it searches for all zero-crossing points where the slope changes from positive to negative. To prevent small fluctuations caused by noise from being misjudged as peaks, the water dispenser typically sets a minimum peak width limit (e.g., the bulge must last for at least 3 sampling points). All peak positions that meet the conditions and their corresponding amplitude values are recorded in the "candidate list".
[0087] S2014. Based on the detection distance corresponding to the candidate reflection peak, calculate the corresponding attenuation compensation parameter to obtain the dynamic detection threshold baseline that fluctuates with distance; the dynamic detection threshold baseline is negatively correlated with the probe detection distance.
[0088] Among them, the attenuation compensation parameter refers to the gain factor calculated based on the energy loss formula of ultrasonic waves propagating in the air; the dynamic detection threshold baseline is used to represent a voltage comparison curve that gradually decreases over time (distance).
[0089] Specifically, this step aims to overcome the inherent defects of fixed threshold detection, namely "false alarms (strong noise) at shallow liquid levels and missed detections (weak signals) at deep liquid levels." Given the physical property that the energy attenuation of ultrasound in air and liquid media follows the inverse square law of distance, the signal strength decreases non-linearly with increasing detection depth.
[0090] S2015. When the signal strength of the candidate reflection peak is greater than or equal to the dynamic detection threshold baseline, the spatial coordinates corresponding to the candidate reflection peak are extracted and confirmed as echo point clouds.
[0091] Here, signal strength refers to the digitized amplitude value of the candidate peak in ADC sampling; echo point cloud represents the effective distance data set that is finally output to the tracking algorithm.
[0092] Specifically, the water dispenser compares the height of each candidate reflection peak found in S2013 with the dynamic detection threshold baseline calculated in S2014 for the same location. Only candidate reflection peaks exceeding the threshold are considered reflections from physical entities, and their corresponding indices (representing time / distance) are converted into spatial coordinates in centimeters and stored in a point cloud list. Candidate reflection peaks that do not exceed the dynamic detection threshold baseline are identified as air turbulence or false sidelobes and are discarded directly.
[0093] As can be seen, during the signal-to-point-cloud conversion process, the water dispenser did not use a fixed threshold standard, but instead constructed a dynamic detection threshold baseline that fluctuates with the detection distance. By extracting the envelope of the signal after passing through the frequency band and identifying candidate peaks, the water dispenser can automatically calculate compensation parameters to adjust the interception standard based on the physical characteristic that the signal attenuates more with distance. In areas close to the probe with extremely strong signals, the threshold baseline automatically rises to shield against strong interference from splashing water; while at the bottom of the deep cup, far from the probe with weak signals, the threshold baseline automatically lowers to sensitively capture the true liquid surface reflection. This avoids the inherent contradiction between misjudgment at shallow liquid surfaces and missed judgment at deep liquid surfaces, improving the ability to extract the true physical reflection interface at any water depth.
[0094] S202. Using a priori motion model, spatial neighborhood association and temporal state recursion are performed on the echo point cloud, and the aggregated mapping is transformed into a multi-target motion trajectory with continuous physical motion characteristics.
[0095] Among them, the prior motion model refers to the pre-set equation of motion law of the object; the temporal state recursion refers to the process of using the state of the previous frame to predict the current frame, and using the measurement of the current frame to correct the prediction.
[0096] Specifically, at this point, the water dispenser receives a set of discrete point cloud data. It iterates through the existing list of trajectories in memory. For each trajectory, it uses the Kalman filter's prediction equation to calculate its current position. Then, it searches the point cloud for the point closest to this prediction space measurement point. If found, this point is considered part of the trajectory, and the trajectory's position and velocity are updated using this point; if not found, the trajectory is considered potentially lost or occluded. Points not associated with any trajectory are considered new potential targets (such as newly splashed water) and may be initialized as a new trajectory.
[0097] As can be seen, before sending the signal into the trajectory tracking model, the interference data in the echo signal is stripped away and converted into an echo point cloud, eliminating interference data caused by water pump vibration, external harmonics, and reflections from non-target objects mixed in with the original sound wave signal. This reduces the computational burden and resource consumption of subsequent steps and improves the response speed of the water dispenser.
[0098] In some embodiments, step S202 specifically includes:
[0099] S2021. The echo point cloud is split into historical trajectory and current measurement point according to time; the historical trajectory is the temporal and spatial dimension; the current measurement point is the spatial dimension.
[0100] Among them, the current measurement point refers to a set of discrete point cloud data that is captured and extracted in real time through the preceding signal processing step (e.g., S2015), which only contains spatial coordinate information (such as distance value) and has not yet completed the target attribution determination; the historical trajectory is a set of known target states that are recursively evolved based on the multi-target motion trajectory of the previous detection cycle, which includes the historical position and motion trend parameters of each independent target confirmed through time-series accumulation.
[0101] Specifically, the system enters the main loop logic of the multi-target tracking algorithm. At this time, two independent data structures are maintained and processed simultaneously in the memory space: multiple independent target objects that inherit from the detection results of the previous frame and are continuously tracked; the theoretically predicted spatial measurement points for each trajectory at the current moment have been pre-calculated based on its historical motion model; and several discrete distance points that have just been acquired and calculated within the current detection cycle.
[0102] S2022. Extract the historical trajectory state parameters from the historical trajectory; and input them into the prior motion model to perform position deduction and obtain the predicted spatial measurement points;
[0103] Among them, the historical trajectory state parameters refer to the state vector and error covariance matrix in the Kalman filter; the prior motion model refers to the preset equation of uniform or uniformly accelerated linear motion; and the predicted spatial measurement point refers to the position that the target should theoretically appear at the current moment, calculated based on the model.
[0104] Specifically, the prediction equation of a linear discrete Kalman filter is used to perform state recursion for each continuously tracked historical trajectory in memory. Based on the updated state estimation vector from the previous moment and the current time sampling interval, combined with a preset kinematic model (such as a uniform or uniformly accelerated linear motion model), the theoretical predicted spatial measurement point of the target at the current moment is calculated.
[0105] S2023. Compare the spatial distance between the current measurement point and the predicted spatial measurement point;
[0106] Spatial distance refers to the absolute difference between the actual measured point cloud coordinates and the coordinates predicted by the algorithm.
[0107] S2024. When the spatial distance is less than or equal to the preset neighborhood radius, the current measurement point and the predicted spatial measurement point are clustered and aggregated to obtain the candidate matching point cloud.
[0108] Among them, the preset neighborhood radius refers to the association threshold, which determines the range of points around the predicted spatial measurement point that are considered to be the same target; clustering and aggregation refers to the process of assigning measurement points to trajectories and updating the trajectory status.
[0109] Specifically, the correlation matrix generated in step S2023, which reflects the deviation between the measured and predicted points, is traversed, and a globally optimal assignment strategy is executed. For example, the nearest neighbor algorithm is used to search for pairs in the correlation matrix that have the smallest Euclidean distance and are within the correlation gate constraint range. For a single current measured point that is confirmed to be associated, its "observation update" is applied to the matched historical trajectory. The optimal state estimate for the current moment is calculated using the observation residual and Kalman gain, thereby correcting the position parameters. The corrected trajectory is then updated to the "current frame confirmed" state.
[0110] S2025. Calculate the displacement smoothness of candidate matching point clouds for multiple consecutive detection periods in the time series.
[0111] Among them, displacement smoothness refers to whether the positional change of the trajectory within several consecutive frames (such as 5 frames) conforms to physical inertia, that is, whether the acceleration changes abruptly.
[0112] Specifically, after association by S2024, although the trajectory continues, it may be mixed with noise. This step detects the updated trajectory. For example, the water dispenser calculates the position increment sequence of the most recent 5 frames for this trajectory. The variance or second difference of these increments is calculated. If the variance is small, it indicates that the object's movement is very smooth (like a real water surface); if the variance is large (uneven speed), it indicates that this trajectory may be a false trajectory pieced together from random noise.
[0113] S2026. If the displacement smoothness meets the preset fluid dynamics continuity characteristics, the candidate matching point cloud is confirmed as the main motion feature trajectory representing the liquid surface and updated and stored in the multi-target motion trajectory.
[0114] Among them, the fluid dynamics continuity characteristic means that the rise of the real liquid surface under the action of gravity and pump pressure must be continuous and without abrupt changes; the main motion characteristic trajectory represents the most reliable liquid level data source that is finally output to the application layer.
[0115] Specifically, the water dispenser sets a smoothness threshold. If the variance calculated by S2025 is less than this threshold, and the trajectory's lifespan exceeds the minimum lifespan, the water dispenser marks that trajectory as a "certain target." Among all certain targets, the one with the highest position and positive (upward) velocity is selected and marked as the "main motion characteristic trajectory." Thereafter, the water dispenser's display and control logic only references data from this one trajectory. For trajectories with poor smoothness or intermittent flow, the water dispenser retains them in the background as backups or deletes them directly after a timeout.
[0116] It should be noted that although this embodiment describes steps S2021 to S2026 as a specific implementation of S202, this does not constitute the only limitation on the process. Those skilled in the art should understand that the above steps are also applicable to further refinement and limitation of step S103, and the technical principles and beneficial effects achieved are substantially the same, so they will not be repeated here.
[0117] As can be seen, by using a priori motion model to decompose the echo point cloud into historical trajectories and current measurement points, and performing in-depth comparisons in the spatiotemporal dimensions, and by extracting historical state parameters to predict spatial measurement points, and only clustering current measurement points falling within a preset neighborhood radius, the water dispenser can effectively associate signals belonging to the same physical object. By calculating the displacement smoothness of the candidate matching point cloud, only point cloud sequences that conform to the continuous upward characteristics of fluid mechanics are identified as the main motion characteristic trajectory representing the liquid surface. Utilizing the dual constraints of prior velocity prediction and spatial density classification, isolated and abrupt water splash noise points are forced to be eliminated because they cannot meet the continuity condition, enabling the water dispenser to evaluate the motion rationality of multiple reflective surfaces in parallel and find the main line of uniform liquid surface rise. Thus, it can lock onto the real liquid surface in an interference environment where multiple targets coexist, preventing the tracking target from jumping or being lost.
[0118] In practical use, when placing cups of different diameters, heights, or irregular shapes with sloping sidewalls into the cup, vertically incident ultrasonic waves are prone to complex multiple reflections or lateral specular reflections on the cup surface. These unexpected reflected echoes are often very similar to the actual liquid surface echoes in signal intensity and temporal location, making it difficult for threshold detection or simple trajectory tracking algorithms to distinguish between the two. This frequently leads to the static cup wall structure being misinterpreted as a dynamically rising liquid surface signal, thus triggering an incorrect full-water shutdown command.
[0119] Please see Figure 3 , Figure 3 This is another flowchart illustrating the overflow level detection method based on a multi-target tracking algorithm in this application embodiment;
[0120] In some preferred embodiments, before step S103, the following steps are further included:
[0121] S301. Input the echo signal into a buffer array with a time series dimension;
[0122] Among them, the time-series dimension cache array refers to a two-dimensional array allocated in RAM to store the raw echo data or point cloud data of the past dozens of frames.
[0123] S302. Observe the spatial fluctuation characteristics of the echo signal within a continuous observation period in the buffer array;
[0124] Among them, spatial jitter characteristics refer to the positional stability (variance or frequency of occurrence) of the echo at a certain distance on the time axis.
[0125] Specifically, the water dispenser performs a vertical scan of the cache array. For a specific distance range, it counts how many frames over a past period detected an object at that location. If a point is detected at this location in every frame, it indicates that the object is stationary; if it is detected in only a few frames, it indicates occasional interference.
[0126] S303. When the spatial fluctuation characteristics are lower than the set physical fluctuation, the echo signal is marked as a static structural reference.
[0127] The physical fluctuations specified refer to the allowable measurement error range of the water dispenser (e.g., standard deviation <2mm); the static structural reference is used to represent the physical boundaries identified as fixed (e.g., the rim of a cup).
[0128] Specifically, if an echo sequence at a certain distance is detected in S302 with a very small variance, and it does not disappear even during the water filling process, the water dispenser determines that the echo originates from a rigid, stationary object, rather than the flowing water surface. The water dispenser then locates the coordinates of this object, which is usually the edge of the container's rim.
[0129] S304. The static structural reference is determined as the coordinate of the highest edge of the target container;
[0130] The highest rim coordinate refers to the Z-axis height of the physical opening plane of the container.
[0131] Specifically, the water dispenser may detect multiple stationary objects (e.g., both the bottom and the rim of the cup). In this step, the dispenser performs a simple logical judgment: among all targets marked as "static structural references," it selects the one closest to the probe as the "highest rim coordinate." This is because physically, the rim of the cup is always higher than the bottom and higher than most of the water surface. This ensures that the dispenser locks onto the top edge of the cup.
[0132] In actual use, there are scenarios where the user reaches in, their hand is still, and it is higher than the rim of the cup, so the water dispenser will not mistake their hand for the rim of the cup.
[0133] In some preferred embodiments, verification of the reflected signal strength is added. The rim of a cup typically has a smaller reflective cross-sectional area, resulting in weaker and sharper echo energy; a hand has a larger reflective cross-sectional area, resulting in stronger and wider echo energy. Simultaneously, the static feature must have existed before water was poured and remained there until now. If a static high point suddenly appears midway through the process, the water dispenser will treat it as a "foreign object obstruction" rather than a "cup rim reference" and refuse to update the highest rim coordinates.
[0134] S305. Determine the tracking space based on the coordinates of the highest edge; the tracking space is used for aggregation mapping using a priori motion models when the echo signal is within the tracking space.
[0135] The tracking space refers to a three-dimensional (or one-dimensional) effective physical region, with its upper bound being the coordinates of the highest rim and its lower bound being the bottom of the cup or infinity.
[0136] Specifically, given that the actual physical height of the injected water surface is necessarily within the container's internal space (i.e., between the rim and the bottom), a signal filtering strategy based on spatial location is implemented by setting an effective data selection threshold. During the subsequent execution of the multi-target trajectory tracking algorithm, any discrete point cloud data with spatial coordinates lower than the highest rim coordinate (i.e., located in the area above the container rim) is determined to originate from external environmental interference, equipment structural reflections, or non-target splashes, and is directly removed and shielded at the algorithm input. This mechanism is equivalent to constructing a virtual directional field-of-view constraint at the algorithm level, effectively isolating unrelated echo noise from above the container opening plane and improving the signal-to-noise ratio of the main tracking target (liquid surface).
[0137] As can be seen, before performing dynamic trajectory tracking, the water dispenser first identifies static signals with extremely low spatial fluctuation characteristics and marks them as static structural references, confirming them as the coordinates of the highest rim of the target container. The tracking space determined based on this sets physical boundary constraints for the subsequent prior motion model. This ensures that all subsequent dynamic liquid surface calculations are performed within this defined container interior space, filtering out diffuse reflection signals outside the tracking space (such as above or outside the cup rim). This eliminates external false signal interference caused by reflections from slanted walls or irregularly shaped cups, improving the water dispenser's compatibility with various complex shapes and tilted cups, and enhancing its resistance to misjudgments.
[0138] In practical use, the instantaneous drop in liquid level is typically used to infer whether a container has been removed. However, when filling certain containers with water, the liquid level can easily experience violent up-and-down fluctuations or the bursting of large air bubbles, causing the sensor echo signal to exhibit a sudden drop similar to "container removal." If only a single threshold logic is used in this situation, misjudgment is highly likely. Conversely, if the threshold is relaxed to avoid misjudgment, it may fail to respond promptly when a real container is moved, resulting in continuous spraying of hot water and posing a safety risk.
[0139] In some embodiments, prior to step S105, the method further includes:
[0140] S401. Verify the matching degree between the maximum coordinate height corresponding to the echo signal and the coordinate of the highest edge.
[0141] The maximum coordinate height refers to the effective physical reflection point position that is closest to the ultrasonic probe array (i.e., the smallest Z-axis coordinate value) among all echo signals acquired in the current detection cycle; the matching degree verification refers to the process by which the system performs spatial correlation analysis between the currently detected maximum coordinate height and the absolute coordinates that have been stored and confirmed as static structural references (e.g., the edge of a container) in advance through S304.
[0142] Specifically, this step establishes a continuous monitoring mechanism for the container's in-situ status. During normal water injection operations, regardless of the rise or fluctuation of the internal liquid level, the static structural features representing the container's physical existence (the coordinates of the highest rim determined in S304) should always remain stable and detectable. In each detection frame, a small search tolerance range (e.g., ±3mm) is set centered on this known static coordinate. If an echo peak with sufficient energy intensity is successfully retrieved within this range, and its waveform envelope characteristics conform to the rigid boundary reflection model, a high matching score is calculated, confirming that the container is still in place; conversely, if the corresponding feature echo is not extracted within this range, the matching is considered a failure, indicating that the static feature is suspected to be lost.
[0143] S402. If the matching degree is lower than the matching degree threshold in multiple consecutive detection cycles, it is determined that the target container has left the monitoring area, and a stop control command is generated.
[0144] Among them, multiple consecutive detection cycles refer to a confirmation time window; leaving the monitoring area means that the cup has been removed from the drip tray by the user.
[0145] As can be seen, the water dispenser performs real-time matching verification between the maximum coordinate height of the echo signal and the previously determined highest rim coordinate. If the matching degree falls below the threshold within multiple consecutive detection cycles, it means that the physical characteristic representing the container's presence (the rim signal) has disappeared. At this point, the water dispenser does not need to wait for changes in liquid level data; it directly determines that the target container has left the monitoring area and generates a stop control command. This optimizes the strategy of inferring cup movement based on observing sudden drops in liquid level, achieving a high-speed response to cup movement.
[0146] The following describes an exemplary water dispenser 400 provided in an embodiment of this application. Figure 4 This is an exemplary hardware structure diagram of the water dispenser 400 provided in the embodiments of this application.
[0147] In some embodiments, the water dispenser 400 is a computer device or includes a computer device within the water dispenser 400. The computer device includes a processor, memory, and a network interface connected via a system bus. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer device stores data. The network interface of the computer device is used to communicate with other external terminals or servers via a network connection. In some embodiments, the network interface can be a wired network interface; in some embodiments, the network interface can also be a wireless network interface. When the computer program is executed by the processor, it implements the methods described in the embodiments of this application.
[0148] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0149] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0150] As used in the above embodiments, depending on the context, the term "when..." can be interpreted as meaning "if...", "after...", "in response to determining...", or "in response to detecting...". Similarly, depending on the context, the phrase "when determining..." or "if (the stated condition or event) is interpreted as meaning "if determining...", "in response to determining...", "when (the stated condition or event) is detected", or "in response to detecting (the stated condition or event)".
[0151] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive), etc.
[0152] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
Claims
1. A method for preventing liquid overflow based on a multi-target tracking algorithm, characterized in that, include: In the absence of a target container, a measurement reference surface is obtained by learning the static physical boundary through an ultrasonic probe array. The ultrasonic probe array consists of ultrasonic transceiver components arranged in a preset spatial position, and all ultrasonic transceiver components have both transmitting and receiving functions. The measurement reference surface is an absolute coordinate reference standard after eliminating the height difference of the water tray and environmental noise. Upon detection of the target container, the ultrasonic probe array is controlled to perform alternating spatial scanning pulse detection based on the measurement reference plane to obtain an echo signal containing the internal reflection characteristics of the target container. The echo signal is spatially correlated and temporally recursively analyzed using a priori motion model, and then aggregated and mapped into a multi-target motion trajectory with continuous physical motion characteristics. The multi-target motion trajectory is a set of vector data streams showing the continuous positional changes of the reflective surface inside the target container in both time and space dimensions. Monitor the liquid level height variation trend of the main motion characteristic trajectory representing the liquid surface in the multi-target motion trajectory; If the liquid level exceeds the safety threshold, a stop control command is generated.
2. The method according to claim 1, characterized in that, The learning of the static physical boundary specifically includes: When a power-on signal or reset signal of the water dispenser is detected, the ultrasonic probe array performs multiple cyclic no-load measurements on a preset static detection area to obtain multiple reference reflection signals. By comparing the reference reflection signals from different probes within the same time period, the symmetrical health status is obtained; When the symmetry health degree is greater than a preset health threshold, the mean value of the reference reflected signal is calculated, and the measurement reference plane is determined by combining the coordinates of the ultrasonic probe array. If the symmetry health level is not greater than the preset health threshold, an abnormal probe shielding command is triggered, and the system switches to a single-sided redundant operation mode.
3. The method according to claim 1, characterized in that, Before the step of using a priori motion model to perform spatial neighborhood correlation and temporal state recursion on the echo signal, and aggregating and mapping it into a multi-target motion trajectory with continuous physical motion characteristics, the method further includes: The interference data in the echo signal is removed, and the echo signal is converted into an echo point cloud; The step of using a priori motion model to perform spatial neighborhood correlation and temporal state recursion on the echo signal, and aggregating and mapping it into a multi-target motion trajectory with continuous physical motion characteristics, specifically includes: The prior motion model is used to perform spatial neighborhood association and temporal state recursion on the echo point cloud, and aggregate and map it into a multi-target motion trajectory with continuous physical motion characteristics.
4. The method according to claim 3, characterized in that, The step of stripping interference data from the echo signal and converting the echo signal into an echo point cloud specifically includes: The echo signal is frequency-band filtered to obtain a filtered echo signal; The amplitude variation characteristics in the filtered echo signal are extracted to obtain the signal envelope; By identifying regions with local maxima in the signal envelope, candidate reflection peaks are obtained. Based on the detection distance corresponding to the candidate reflection peak, the corresponding attenuation compensation parameter is calculated to obtain the dynamic detection threshold baseline that fluctuates with distance; the dynamic detection threshold baseline is negatively correlated with the probe detection distance. If the signal strength of the candidate reflection peak is greater than or equal to the dynamic detection threshold baseline, the spatial coordinates corresponding to the candidate reflection peak are extracted and confirmed as the echo point cloud.
5. The method according to claim 3, characterized in that, The steps of using the prior motion model to perform spatial neighborhood association and temporal state recursion on the echo point cloud, and aggregating and mapping it into a multi-target motion trajectory with continuous physical motion characteristics, specifically include: The echo point cloud is divided into historical trajectories and current measurement points according to time; the historical trajectory is the temporal-spatial dimension; the current measurement point is the spatial dimension. Extract historical trajectory state parameters from historical trajectories; and input them into the prior motion model to perform position deduction and obtain predicted spatial measurement points; Compare the spatial distance between the current measurement point and the predicted spatial measurement point; When the spatial distance is less than or equal to the preset neighborhood radius, the current measurement point and the predicted spatial measurement point are clustered together to obtain a candidate matching point cloud; The displacement smoothness of the candidate matching point cloud is calculated for multiple consecutive detection periods in the time series. If the displacement smoothness meets the preset fluid dynamics continuity characteristics, the candidate matching point cloud is confirmed as the main motion feature trajectory representing the liquid surface and updated and stored in the multi-target motion trajectory.
6. The method according to claim 1, characterized in that, Before the step of using a priori motion model to perform spatial neighborhood correlation and temporal state recursion on the echo signal, and aggregating and mapping it into a multi-target motion trajectory with continuous physical motion characteristics, the method further includes: The echo signal is input into a buffer array with a time series dimension; The spatial fluctuation characteristics of the echo signal within a continuous observation period are observed in the buffer array; When the spatial fluctuation characteristics are lower than the set physical fluctuation, the echo signal is marked as a static structural reference; The static structural reference is determined as the coordinate of the highest rim of the target container; The tracking space is determined based on the highest edge coordinates; the tracking space is used for aggregation mapping using the prior motion model when the echo signal is within the tracking space.
7. The method according to claim 6, characterized in that, Before the step of generating a stop control command when the liquid level exceeds a safety threshold, the method further includes: Verify the matching degree between the maximum coordinate height corresponding to the echo signal and the highest edge coordinate. If the matching degree is lower than the matching degree threshold in multiple consecutive detection cycles, it is determined that the target container has left the monitoring area, and a stop control command is generated.
8. A water dispenser, characterized in that, The water dispenser includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the water dispenser to perform the method as described in any one of claims 1-7.
9. A computer program product containing instructions, characterized in that, When the computer program product is run on the water dispenser, it causes the water dispenser to perform the method as described in any one of claims 1-7.
10. A computer-readable storage medium comprising instructions, characterized in that, When the instruction is executed on the water dispenser, the water dispenser performs the method as described in any one of claims 1-7.
Citation Information
Patent Citations
Water level measurement method under multi-target background
CN114184256A
Improved water quantity control method and system for self-service equipment
CN117770650A
Real-time dynamic trajectory tracking method and system for millimeter wave radar gesture recognition
CN120802203A
Target detection method and system based on millimeter wave radar
CN120871064A
Intelligent water level detection method, system and equipment for water conservancy project and medium
CN120927094A