A method and device for detecting the level of a soap solution
By employing a liquid level detection method with three capacitor detection electrodes and strategy switching, the stability of soap solution container detection under varying dielectric properties and environmental changes is solved, achieving stability and reliability of liquid level detection and adapting to liquid level indication under complex working conditions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- XIAMEN OLT SCI & TECH ELECTRONICS DEVING
- Filing Date
- 2025-12-26
- Publication Date
- 2026-07-28
AI Technical Summary
Existing liquid level detection methods for soap containers are prone to instability due to differences in dielectric properties and environmental changes after long-term use and consumer refills, leading to problems such as misjudgment, missed judgment, or inconsistent timing of alerts.
The system employs a three-capacitor detection electrode arrangement, combined with pre-stored reference values and a strategy switching mechanism. It uses a combination of calibration-based and calibration-free decision strategies to determine the liquid level status based on the three-capacitor readings and pre-stored reference values. The system automatically switches decision strategies when the environment changes, and introduces benchmark correction and collaborative decision logic to improve robustness.
It achieves stability and reliability of liquid level detection under complex working conditions, reduces false alarms and missed alarms, improves the continuity and reliability of liquid level indication, adapts to environmental changes, and reduces the need for frequent calibration by users.
Smart Images

Figure CN121677869B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of liquid level detection technology, and in particular to a method and apparatus for detecting the liquid level of soap solution. Background Technology
[0002] Soap dispensers, such as foam soap dispensers and hand sanitizer dispensers, typically include a detachable soap container, a dispensing pump, and control circuitry. To prevent users from repeatedly triggering the dispensing pump when the soap is low or depleted, causing it to run dry, make abnormal noises, or trigger false alarms, existing products generally include a liquid level detection function. This function outputs low liquid level, no liquid level, or other status indicators, and provides prompts, flow limits, or shutdown control accordingly.
[0003] Existing liquid level detection methods for soap dispensers mainly include contact detection based on floats or mechanical travel, liquid surface obstruction detection based on optical transmission or reflection, weighing detection based on weight changes, and liquid level detection based on capacitive sensing. Among these, capacitive sensing typically involves placing detection electrodes on the outer wall of the soap dispenser, with a capacitance detection circuit acquiring the capacitance reading. When the liquid level rises or falls within the container, the equivalent capacitance formed by the liquid's dielectric constant, the container wall, and the air changes. The control circuit then compares this capacitance reading with a preset threshold to determine the liquid level.
[0004] In engineering implementation, capacitive liquid level detection is often paired with threshold calibration or reference value configuration. For example, during the factory assembly or production testing phase, baseline readings corresponding to soap-containing and soap-free states are recorded, and these baseline readings or thresholds calculated from them are written into a storage unit. During product operation, the real-time reading is compared with the baseline reading to output a low soap-containing state or a soap-free state. This type of solution is easy to implement at the factory, but in long-term use and in scenarios where consumers refill soap, there are still issues with insufficient detection stability. Specifically, the common refilling process during consumer use introduces differences in the dielectric properties of the soap, including changes in dielectric constant and viscosity due to brand, formula, concentration, and temperature. At the same time, factors such as container wall thickness, assembly position, bonding gap, adhesive or potting material, and parasitic wiring can also cause individual differences and drift in capacitance readings. If the threshold or baseline reading fixed at the factory is still used, the judgment boundary between low soap-containing and soap-free states may drift, leading to false positives, false negatives, or inconsistent prompting times. On the other hand, if recalibration is used as a correction method, users need to cooperate in completing the calibration process at specific times, such as collecting readings in the state without soap and after filling. This process is not user-friendly for ordinary consumers, and it is difficult to ensure that calibration conditions are consistent in real-world use environments, which may even introduce new sources of error. Summary of the Invention
[0005] To overcome the shortcomings of the prior art, the technical problem to be solved by the present invention is to provide a soap solution level detection method and device, which adopts the following technical solution: A soap solution level detection method is applied to a soap solution container including a first capacitance detection electrode, a second capacitance detection electrode, and a third capacitance detection electrode, wherein the first and third capacitance detection electrodes are arranged at intervals from bottom to top, and the second capacitance detection electrode is a reference electrode. The method includes: S10: Acquire the first capacitance reading data1 of the first capacitance detection electrode, the second capacitance reading data2 of the second capacitance detection electrode, and the third capacitance reading data3 of the third capacitance detection electrode as real-time readings. S20: Call at least one pre-stored reference value, wherein the reference value includes at least one of the following: Pre-calibrated reference value groups for soap-free and soap-containing solutions; The difference_value between soap-containing and soap-free liquids was obtained in advance by statistically analyzing multiple samples, and a second reference value ref2 characterizing the state of soap-free liquid was obtained. S30: Based on the above real-time readings and reference values, execute at least one of the calibration determination strategy or the calibration-free determination strategy: When the above reference values include the above soap-free reference value group and the above soap-containing reference value group, the above calibration determination strategy shall be executed; When the above reference value includes the above feature difference_value and the above second reference value ref2, the above calibration-free determination strategy is executed, and the above calibration-free determination strategy uses the above second capacitance reading data2 as the reference reading for determination. S40: Output liquid level status, wherein the liquid level status includes at least a low soap liquid status indicating insufficient soap liquid and a no soap liquid status indicating that the soap liquid is exhausted.
[0006] Further improvements include the strategy switching procedure: S31: The above calibration and determination strategy is executed by default; S32: When the difference between the second capacitor reading data2 and the second reference value without_data2 in the soap-free reference value group exceeds a preset threshold, switch to executing the above calibration-free determination strategy. S33: After receiving the user calibration instruction and completing the calibration, switch back to executing the above calibration determination strategy.
[0007] As a further improvement, when executing the above calibration and determination strategy: When conditions one through three are met simultaneously, the condition is determined to be in a low soap solution state: Condition 1: data3 < α × without_data3; Condition 2: data1 > β × withing_data1; Condition 3: data1-data3>γ×(withing_data1-without_data3); When both conditions one and four are met, the condition is determined to be soap-free: Condition 4: data1 < α × without_data1; Wherein, without_data1, without_data2, and without_data3 represent the first, second, and third reference values in the above-mentioned soap-free reference value group measured by the first, second, and third capacitance detection electrodes, respectively; withing_data1, withing_data2, and withing_data3 represent the first, second, and third reference values in the above-mentioned soap-containing reference value group measured by the first, second, and third capacitance detection electrodes, respectively.
[0008] As a further improvement, when implementing the above-mentioned calibration-free determination strategy: When conditions five and six are met simultaneously, the condition is determined to be in a low soap solution state: Condition 5: data3 < δ × data2; Condition 6: data1 - data3 > ε × difference_value; When conditions seven and eight are met simultaneously, the condition is determined to be soap-free: Condition 7: data3 < α × ref2; Condition 8: data1 < α × ref2; Wherein, difference_value represents the difference between soap solution and soap-free solution; ref2 represents a pre-stored second reference value, which is determined based on the reference reading of the second capacitor detection electrode in the soap-free state.
[0009] For further improvements, the first coefficient α = 1.2, the second coefficient β = 0.8, the third coefficient γ = 0.6, the fourth coefficient δ = 1.4, and the fifth coefficient ε = 0.8.
[0010] As a further improvement, the above-mentioned calibration-free determination strategy includes benchmark correction processing, including: Calculate the correction factor k = ref2 / data2; The corrected readings are obtained as data1c = k × data1 and data3c = k × data3; Data1c and data3c are used instead of data1 and data3 in the above calibration-free determination strategy.
[0011] Further improvements include consistency checks and collaborative decision-making steps: S50: Determine the reference consistency of the second channel based on whether the deviation between the second capacitor reading data2 and the second reference value ref2 is less than a preset deviation threshold. S51: If the above deviation is less than the above deviation threshold, then execute the above calibration-free judgment strategy; if the above deviation is not less than the above deviation threshold, and the above reference value includes both the above soap-free reference value group and the soap-containing reference value group, then enter the collaborative judgment mode. S52: In the collaborative determination mode, the above calibration determination strategy is executed to obtain the first determination result, and the above calibration-free determination strategy is executed to obtain the second determination result; S53: When the first determination result is consistent with the second determination result, output the liquid level status; when the first determination result is inconsistent with the second determination result, output the liquid level status according to the conservative priority, wherein the conservative priority is that the soap-free state takes precedence over the low soap state.
[0012] Another aspect of the present invention provides a soap solution level detection device, comprising: The capacitance detection processing unit has a first capacitance detection channel, a second capacitance detection channel and a third capacitance detection channel, which are respectively used to connect the first capacitance detection electrode, the second capacitance detection electrode and the third capacitance detection electrode. A storage unit is used to store at least one of the following: a soap-free reference value group, a soap-containing reference value group, a feature difference value (difference_value), and a second reference value (ref2). The processing unit is configured to execute the soap liquid level detection method described above and output the soap liquid state judgment result.
[0013] Further improvements include: A trigger input unit is used to receive external trigger signals to record the soap-free reference value group and the soap-containing reference value group. The output unit is used to output the soap liquid status judgment result by means of indicator light status change, buzzer prompt, display screen display or communication interface reporting.
[0014] Compared with the prior art, the beneficial effects of the present invention are: Firstly, this invention proposes a liquid level detection method for soap dispensers. It acquires three capacitance readings through first, second, and third capacitance detection electrodes and combines these readings with pre-stored reference values to determine the liquid level status. On one hand, when both soap-free and soap-containing reference value groups are available, a calibration-based decision strategy can be employed, directly providing the determination of low or no soap level by comparing real-time readings with the calibration references. On the other hand, when only characteristic differences and a second reference value are available, a calibration-free decision strategy can be adopted, utilizing the second channel reading as a reference for judgment, thus adapting to environmental changes. Based on this framework, the system can obtain more definitive judgment results when the references are sufficient, and maintain availability even when the references are incomplete or drift, reducing false alarms and missed alarms and improving the continuity of liquid level indication.
[0015] Secondly, this invention further introduces an event-triggered strategy switching mechanism: under normal conditions, the calibration judgment strategy is used first to obtain a more certain liquid level judgment; when the deviation between the second channel reading and the soap-free liquid calibration benchmark exceeds a threshold, it is regarded as a signal of a significant change in the environment or soap properties, and the system automatically switches to the calibration-free judgment strategy to continue working; after receiving a user calibration instruction and completing the calibration, the system switches back to the calibration judgment strategy. By combining automatic triggering conditions with user maintenance behavior, the system can respond to drift and sudden changes in daily use without frequent manual intervention, avoiding the gradual inaccuracy of judgment due to long-term reliance on a single calibration data, thereby improving reliability and maintainability during long-term use.
[0016] Thirdly, this invention introduces a fallback logic of benchmark correction and collaborative judgment under the calibration-free judgment strategy: A correction factor is calculated based on the second reference value and the second channel reading, and the readings of the first and third channels are synchronously corrected, ensuring the comparability of the two readings with liquid level sensitivity under environmental changes. When the second channel reference consistency is insufficient and calibration data is available, a collaborative judgment mode is entered, simultaneously running calibration judgment and calibration-free judgment and cross-validating the results. When the two are inconsistent, a safer liquid level conclusion is output based on conservative priority. Through the above methods, the robustness of the applied system under complex operating conditions can be significantly enhanced, and the reliability and security of alarm conclusions can be improved. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained from these drawings without creative effort.
[0018] Figure 1 This is a flowchart of the steps of the method of the present invention; Figure 2 This is a schematic diagram of the circuit structure of an embodiment of the device of the present invention. Detailed Implementation
[0019] To facilitate understanding by those skilled in the art, the structure of the present invention will now be described in further detail with reference to the accompanying drawings: In the description of this invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated.
[0020] This invention provides a soap liquid level detection method, applicable to soap liquid containers equipped with a first capacitance detection electrode, a second capacitance detection electrode, and a third capacitance detection electrode.
[0021] The first and third capacitance detection electrodes are arranged alternately from bottom to top along the direction of liquid level change. This allows the surrounding medium environment of the two electrodes to change at different stages as the soap solution level descends, resulting in a distinguishable trend in the capacitance readings. The second capacitance detection electrode serves as a reference in the system design and is typically positioned closer to the top of the soap solution container or in a location less affected by short-term fluctuations in the liquid level. This allows the third capacitance reading to form a hierarchical comparison with the first capacitance reading.
[0022] The second capacitance detection electrode, acting as an independent channel, participates in the determination, primarily reflecting the overall impact of common-mode factors such as container material, ambient temperature and humidity, and installation fit on the capacitance reading. Therefore, it serves as a benchmark reading in the calibration-free determination strategy, used to normalize or compensate for the first and third capacitance readings. In one embodiment, the second capacitance detection electrode is positioned outside the normal liquid level variation range, away from the liquid surface, ensuring that its readings are approximately consistent whether soap is present or absent.
[0023] By employing this three-electrode arrangement, the sensitivity of the first and third capacitor detection electrodes to changes in liquid level can be used to identify the liquid level status. On the other hand, the second capacitor detection electrode can provide a relatively stable reference, reducing the interference of different batches of containers, different installation conditions, and environmental changes on the judgment results.
[0024] like Figure 1As shown, in step S10, the system acquires the first capacitance reading data1 of the first capacitance detection electrode, the second capacitance reading data2 of the second capacitance detection electrode, and the third capacitance reading data3 of the third capacitance detection electrode as real-time readings. Specifically, the capacitance readings can be acquired and quantified by the capacitance detection processing circuit within a predetermined sampling period. The sampling period can be set according to the soap consumption rate and alarm response requirements. For example, the real-time readings can be refreshed periodically at intervals of seconds to minutes. Alternatively, the sampling frequency can be increased at critical moments such as when the user triggers a button, the device performs a power-on self-test, or the liquid level status is about to switch to obtain a more stable judgment basis. To ensure the availability of real-time readings, multiple samples can be taken from each channel within the same judgment period and the average value can be taken during the acquisition process. Alternatively, the readings can be smoothed within adjacent judgment periods to reduce instantaneous noise, hand-touching interference, mechanical vibration, and random fluctuations caused by electromagnetic coupling. After acquisition, the system uses data1, data2, and data3 as the basic inputs for subsequent judgment strategies and maintains consistency in the time of the three readings within the same judgment period to ensure the correspondence of subsequent comparisons.
[0025] In step S20, the system calls at least one pre-stored reference value, which includes at least one of the following: the first type of reference value is a set of reference values for soap-free liquid and a set of reference values for soapy liquid obtained in advance through calibration; the second type of reference value is the difference_value between soapy liquid and soap-free liquid obtained in advance through statistical analysis of multiple samples, and a second reference value ref2 characterizing the state of soap-free liquid.
[0026] Specifically, the soap-free reference value group can include without_data1, without_data2, and without_data3, corresponding to the reference readings measured by the first, second, and third capacitance detection electrodes when the soap container is empty. The soap-containing reference value group can include withing_data1, withing_data2, and withing_data3, corresponding to the reference readings measured by the three channels when the soap container is containing soap. The calibration process can be completed during the manufacturing stage or triggered by the user during equipment maintenance. Taking user maintenance as an example, when the user confirms that the soap container is empty or about to be refilled, a calibration command can be triggered through the human-machine interface. The system will collect and write without_data1, without_data2, and without_data3 in the soap-free state. After the user completes refilling and confirms that the normal operating liquid level has been reached, another calibration can be triggered, or the system can automatically collect and write withing_data1, withing_data2, and withing_data3 after a delay. In this way, the calibration data can be more closely aligned with the current container and installation conditions, making it suitable as a more accurate reference for judgment.
[0027] In one specific embodiment, the statistical reference values difference_value and ref2 can be used to reduce the burden of frequent calibration for users. difference_value is the difference extracted between the soap-containing and soap-free states, used to establish a relatively stable judgment scale across different devices or batches of containers. This difference characteristic can originate from the statistical results of multiple samples. For example, during the R&D and pilot production phases, data from different containers, different soap batches, and different environmental conditions can be collected to statistically determine a typical difference range that can distinguish between soap-containing and soap-free states, and this range can be solidified as difference_value. The second reference value ref2 is used to characterize the reference level of the second channel in the soap-free state. ref2 is determined based on the baseline reading of the second capacitive detection electrode in the soap-free state. For example, it can be based on without_data2 collected in the soap-free state, combined with the offset range from multiple sample statistics to determine the value of ref2, enabling it to provide a reusable benchmark reference in the calibration-free judgment strategy. By preparing two types of reference values simultaneously, the system can achieve a higher degree of fit when calibration data is available, and can still maintain its operational decision-making capability when calibration data is lacking or when the calibration data is no longer reliable.
[0028] In step S30, the system determines the liquid level status by executing at least one of a calibration decision strategy or a calibration-free decision strategy based on real-time readings and reference values. When the reference values include a soap-free reference value group and a soap-containing reference value group, the system executes the calibration decision strategy; when the reference values include difference_value and ref2, the system executes the calibration-free decision strategy and uses the second capacitor reading data2 as the reference reading for the decision. Specifically, the calibration decision strategy relies on the reference readings formed by the same device under soap-free and soap-containing conditions, and is suitable for periods when the device has completed its initial deployment, maintenance calibration, or when the system determines that the environment is relatively stable. The calibration-free decision strategy relies on statistical reference values and the reference reference of the second channel, and is suitable for periods when the user has not performed recalibration, the reference has drifted due to long-term use of the device, or the dielectric properties of the soap and environmental conditions have changed. The coexistence of the two strategies is not a simple superposition, but rather a balance between two contradictions in actual use: on the one hand, it is necessary to obtain a clearer and more consistent decision boundary under ideal conditions; on the other hand, it is necessary to maintain stable output capability even when the user does not intervene or the conditions are incomplete.
[0029] In this embodiment, to ensure that the two strategies form a clear logical closed loop during operation, the method further includes strategy switching steps S31 to S33. In step S31, the system defaults to executing the calibration determination strategy. Specifically, the default calibration determination strategy is based on the premise that the system currently holds valid soap-free reference value groups and soap-containing reference value groups, and that the installation conditions and container status reflected by these reference values have not changed significantly. In step S32, when the system detects that the difference between the second capacitor reading data2 and the second reference value without_data2 in the soap-free reference value group exceeds a preset threshold, it switches to executing the calibration-free determination strategy. Here, the difference of the second channel is used as the trigger signal because the second channel is more likely to reflect common-mode changes, such as changes in ambient temperature and humidity causing changes in the dielectric constant of plastic, water film or stains adhering to the outer wall of the container causing changes in the coupling path, and changes in the degree of installation fit causing an overall shift in the equivalent capacitance. When data2 deviates from without_data2 by more than a threshold, it can be considered that the reference system has changed significantly. Continuing to use the original calibration reference may lead to misjudgment risks. Therefore, automatically switching to a calibration-free judgment strategy that uses data2 as the reference is more robust. In step S33, after the system receives the user calibration command and completes the calibration, it switches back to the calibration judgment strategy. Specifically, the user calibration command can be triggered through device buttons, touch interface, mobile terminal application, or host computer maintenance command. After the system completes the calibration and writes the new soap-free reference value group and soap-containing reference value group, the calibration judgment strategy regains a higher degree of fit. Therefore, it reverts to the default strategy to obtain a more stable judgment boundary.
[0030] In the above embodiments, when the system executes the calibration determination strategy, the determination of the liquid level status can be completed according to conditions one to four: Condition 1: data3 < α × without_data3; Condition 2: data1 > β × withing_data1; Condition 3: data1-data3>γ×(withing_data1-without_data3); Condition 4: data1 < α × without_data1; Wherein, without_data1, without_data2, and without_data3 represent the first, second, and third reference values in the soap-free reference value group measured by the first, second, and third capacitance detection electrodes, respectively; withing_data1, withing_data2, and withing_data3 represent the first, second, and third reference values in the soap-containing reference value group measured by the first, second, and third capacitance detection electrodes, respectively; and α, β, and γ are preset coefficients.
[0031] Specifically, when conditions one through three are met simultaneously, the system is determined to be in a low-soap-liquid state. The above judgment logic can be understood as utilizing the sensitivity and differential characteristics of the upper and lower electrodes to the drop in liquid level: data3, relative to the third benchmark value without_data3 in the soap-free state, has entered the threshold range, reflecting that the medium environment around the third capacitor detection electrode is close to a soap-free state or that the soap coverage is insufficient; data1 still satisfies a certain proportional relationship higher than the first benchmark value with_data1 in the soap-containing state, reflecting that there is still a certain degree of soap influence or residual medium difference near the first capacitor detection electrode; simultaneously, the difference between data1 and data3 is compared with the benchmark difference, making the judgment not only dependent on the amplitude change of a single path but also on the relative difference between the upper and lower electrodes, thereby enhancing the ability to characterize changes in liquid level stratification and reducing the risk of misjudgment.
[0032] Furthermore, when conditions one and four are met simultaneously, the system is determined to be in a soap-free state. This determination logic can be understood as follows: the readings of both the upper and lower electrodes have entered the threshold range corresponding to the soap-free baseline level, indicating that the liquid level has essentially left the effective range of the first and third capacitor detection electrodes, and the container is in a state of soap depletion.
[0033] In the above embodiments, when the system executes the calibration-free determination strategy, the determination of the liquid level status can be completed according to conditions five to eight: Condition 5: data3 < δ × data2; Condition 6: data1 - data3 > ε × difference_value; Condition 7: data3 < α × ref2; Condition 8: data1 < α × ref2; Wherein, difference_value represents the difference between soap solution and soap-free state; ref2 represents the pre-stored second reference value, which is determined based on the reference reading of the second capacitor detection electrode in the soap-free state, and δ and ε are preset coefficients.
[0034] Specifically, when conditions five and six are met simultaneously, the system is determined to be in a low soap solution state. Data2 is used as the baseline reading for this determination because establishing a proportional relationship between data3 and data2 can, to some extent, offset the overall drift caused by environmental changes. Simultaneously, the difference between data1 and data3 is introduced and compared with the difference_value to improve the reliability of low soap solution state identification.
[0035] Furthermore, when conditions seven and eight are simultaneously met, the condition is determined to be soap-free. Here, ref2 represents the reference level of the second channel in the soap-free state. By establishing a comparison relationship between data1 and data3 and ref2, a more conservative and reliable judgment on the soap-free state can still be given even in the absence of the device's own calibration reference. The meaning of difference_value is further clarified here as the difference characteristic between soap-containing and soap-free states. ref2 is a pre-stored second reference value, and ref2 is determined based on the reference reading of the second capacitance detection electrode in the soap-free state, thus providing a repeatable and deployable reference reference for the calibration-free judgment strategy.
[0036] Regarding the specific parameter settings, the first coefficient α can be 1.2, the second coefficient β can be 0.8, the third coefficient γ can be 0.6, the fourth coefficient δ can be 1.4, and the fifth coefficient ε can be 0.8.
[0037] Specifically, the coefficient values can be determined through debugging based on the container's structural dimensions, the installation positions of the three electrodes, the dielectric properties of the soap solution, and the user's desired alarm lead time. Taking a low soap solution alarm as an example, the coefficient setting can trigger a low soap solution status warning in advance when the soap solution is almost depleted but still has a small amount remaining, allowing the user to replenish it promptly. For an empty soap solution alarm, the coefficient setting can be more conservative to reduce the risk of missed alarms. Once determined, the coefficients can be permanently set as device parameters, or they can be written to the storage unit during factory commissioning and adjusted with firmware upgrades.
[0038] In the above embodiments, the calibration-free determination strategy may further include a benchmark correction process to further enhance the ability to suppress environmental drift. Specifically, before each output of liquid level status, the system calculates a correction factor k based on the second reference value ref2 and the second capacitance reading data2, where the correction factor satisfies k = ref2 / data2. This correction factor reflects the proportional deviation of the second channel reading relative to the reference level within the current determination period. Subsequently, the system obtains the corrected first capacitance reading data1c and the corrected third capacitance reading data3c based on the correction factor k, where data1c = k × data1 and data3c = k × data3. Through this processing, the readings of the first and third channels are uniformly mapped to a normalized scale with ref2 as the reference, thereby maintaining the stability of the determination conditions even when factors such as container medium, ambient temperature and humidity, and external wall deposits cause synchronous deviations in the three readings. During the execution of the calibration-free determination strategy, the system uses data1c and data3c instead of data1 and data3 in the determination of the calibration-free determination strategy, ensuring that the determination basis and the benchmark reference remain consistent within the same determination period. To avoid dynamic inconsistencies caused by the lag of the correction factor, the correction factor k can be updated and recalculated once with data2 in each decision period, and used for the correction calculation of data1 and data3 in the same decision period, thereby ensuring the synchronization of the correction action and the decision action.
[0039] Preferably, in order to avoid the nonlinear amplification of data2 introduced by the correction factor k=ref2 / data2 and the second capacitor reading data2 in condition 5 being compared at the same time, thereby reducing the stability of the calibration-free determination strategy, the benchmark correction process may optionally only replace data1 and data3 in conditions 6 to 8.
[0040] In step S40, the system outputs the liquid level status, which includes at least a low soap solution status and a no soap solution status. Specifically, the liquid level status can be output to the upper-layer application in the form of discrete status codes, or it can directly drive the prompt logic. For example, in the low soap solution status, a yellow indicator light may be constantly lit or intermittently flashing to prompt the user to replenish the soap solution; in the no soap solution status, a red indicator light may be constantly lit to provide a stronger prompt. The output action can also be implemented through buzzer prompts, display screen prompts, or reporting via a communication interface. The communication interface can be used to synchronize the liquid level status to an external controller or mobile terminal, thereby realizing remote reminders or maintenance management. The output timing can be set to output once after each judgment cycle, or it can be output immediately when the liquid level status changes, in order to reduce invalid prompts and improve the interactive experience.
[0041] To further address the issue of abnormal readings and strategy consistency under complex operating conditions, the method may further include consistency checks and collaborative judgment steps S50 to S53. Specifically, in step S50, the system determines the reference consistency of the second channel based on whether the deviation between the second capacitor reading data2 and the second reference value ref2 is less than a preset deviation threshold. This deviation can be measured using absolute or relative differences, and the deviation threshold can be set according to the long-term drift range of the equipment. When the deviation is less than the deviation threshold, the second channel can be considered to still be in a reference-consistent state, and data2 can still serve as a stable reference. Therefore, in step S51, the calibration-free judgment strategy continues to be executed to maintain normal operation with low maintenance costs. When the deviation is not less than the deviation threshold and the reference value includes both the soap-free reference value group and the soap-containing reference value group, the system enters the collaborative judgment mode. The motivation for entering the collaborative judgment mode is that the second channel has shown a significant deviation, and relying solely on the calibration-free judgment strategy may lead to misjudgment risks. However, since the system has a calibration reference at this time, the two strategies can be used for parallel calculation and cross-validation to improve the reliability of the judgment conclusion.
[0042] In collaborative judgment mode, the system executes a calibration judgment strategy to obtain a first judgment result and a calibration-free judgment strategy to obtain a second judgment result. Inconsistencies between the two judgment results are possible in engineering practice. For example, the formation of a foam layer or a film adhering to the wall of the soap solution near the electrode may cause the changing trends of the first and third channels to differ from normal operating conditions; sudden environmental changes may cause the shift of the second channel to be asynchronous with the shifts of the first and third channels; or the container may be moved briefly, causing liquid surface sloshing and the instantaneous reading to fall near the threshold boundary. In these cases, the two strategies may yield different conclusions due to different reference systems. To ensure that the system can still output a definite liquid level state even when there is inconsistency, the collaborative judgment mode introduces a conservative priority rule: when the first and second judgment results are consistent, the system outputs the liquid level state corresponding to that consistent conclusion; when the first and second judgment results are inconsistent, the system outputs the liquid level state according to the conservative priority, with the conservative priority set to prioritize the no-soap-solution state over the low-soap-solution state. The engineering significance of this priority lies in avoiding false alarms, i.e., misjudging a situation where there is actually no soap solution as a situation with only low soap solution, thus delaying the warning and causing problems such as dry running, pump running dry, or reduced cleaning effectiveness if the user continues to use the product. In case of inconsistency, the system prioritizes issuing more stringent alarm conclusions, which is more in line with the product requirements for liquid level safety warnings. After the collaborative judgment result is output, the system can maintain the current strategy or re-evaluate the consistency conditions in the next judgment cycle to achieve dynamic adaptation.
[0043] This invention also provides a soap liquid level detection device for implementing the above-described method and outputting the soap liquid state judgment result. The device includes a capacitance detection processing unit, a storage unit, and a processing unit. The capacitance detection processing unit has a first capacitance detection channel, a second capacitance detection channel, and a third capacitance detection channel, respectively connected to the first capacitance detection electrode, the second capacitance detection electrode, and the third capacitance detection electrode, for completing capacitance acquisition, signal conditioning, and reading output. The storage unit stores at least one of the following: a soap-free reference value group, a soap-containing reference value group, difference_value, and ref2, and stores coefficient values, threshold values, and reference data written during the calibration process. The processing unit executes the aforementioned soap liquid level detection method, including reading real-time readings, calling reference values, selecting and executing a judgment strategy, performing strategy switching and consistency checks, and outputting the liquid level state. The processing unit can be integrated with the capacitance detection processing unit, or it can be implemented separately via a bus or interface connection. The storage unit can be a non-volatile memory to ensure that the reference data is not lost after power failure.
[0044] like Figure 2The circuit schematic shown illustrates that the circuit introduces power supply VCC and communication or debugging signal lines through connector J2. Power supply VCC enters the power supply node VDD of capacitance detection chip U1 via ferrite bead FB1 to suppress external power supply ripple and high-frequency interference. A transient suppression device TVS1 is installed at the VDD node to clamp to ground, absorbing electrostatic discharge or surge impacts. A storage capacitor EC1 and decoupling capacitors C2 and C3 are connected in parallel at the VDD node to provide transient current and reduce power supply noise coupling into the measurement channel during capacitance measurement and communication switching. The multiple touch or capacitance detection pins of capacitance detection chip U1 output as KEY1, KEY2, and KEY3, respectively. KEY1, KEY2, and KEY3 are connected to the touch electrode leads PIN1, PIN3, and PIN2 via current-limiting resistors R1, R3, and R2, respectively, forming three capacitance detection channels. These three channels correspond to the access terminals of the first, second, and third capacitance detection electrodes in the device of this invention. The current-limiting resistor is used to limit the transient current when the touch electrode is broken down by electrostatic discharge and to improve the oscillation stability caused by lead parasitics. The circuit also reserves two serial signal lines, T_CK and T_DIO, for data interaction with the external processing unit or for configuring the operating parameters of the capacitance detection chip. The series resistor R4 in T_DIO is used to suppress signal edge overshoot and improve anti-interference capability. With the above circuit structure, the capacitance detection processing unit can output three-channel capacitance readings under the triggering or timing control of the processing unit. The processing unit then completes the liquid level status judgment based on the reference value and judgment conditions, thereby realizing the above method. This circuit schematic is an example of one implementation of the capacitance detection processing unit. It does not limit the specific model of the capacitance detection chip, nor does it limit the specific values of the power supply filter and interface resistors. Its core lies in forming a one-to-one correspondence between the three capacitance detection inputs and the three capacitance detection electrodes, providing a stable power supply and a usable data interaction path.
[0045] Based on the aforementioned hardware implementation of the capacitance detection processing unit, the storage unit can employ on-chip non-volatile memory, external serial memory, or runtime cache after parameters are sent from the host computer to store the baseline value group, difference, and reference value. The processing unit can manage the timing of reference value updates through strategy switching logic. For example, upon receiving a user calibration command, it can guide the process into a soap-free sampling stage to record without_data1, without_data2, and without_data3, and then into a soap-containing sampling stage to record withing_data1, withing_data2, and withing_data3, writing these values to the storage unit. After completing the baseline value group update, the processing unit can also synchronously update difference_value and ref2, ensuring that the calibration-free decision strategy automatically uses the latest statistical parameters the next time it is activated, thereby maintaining parameter consistency and long-term maintainability between the two strategies.
[0046] The soap liquid level detection device may also include a trigger input unit and an output unit. The trigger input unit receives external trigger signals to record the soap-free and soap-containing baseline value groups. External trigger signals can come from buttons, touch commands, host computer commands, or maintenance tool triggers. The trigger input unit works in conjunction with the processing unit to complete the calibration process control. The output unit outputs the soap liquid status judgment result, and the output form includes indicator light status changes, buzzer prompts, display screen displays, or communication interface reporting. The output unit and processing unit can be connected via GPIO control, serial communication, or a bus. The processing unit maps the low soap liquid state and the soap-free state to different output modes, forming an intuitive and understandable prompt for the user, and can form a linkage control with other actuators when needed.
[0047] As can be seen from the above specific implementation methods, the three-electrode division of labor allows the liquid level sensitive channel and the reference channel to be observed simultaneously. The calibration judgment strategy provides a clearer individual judgment boundary when the reference value group is reliable. The calibration-free judgment strategy provides stronger adaptability when there is environmental drift or changes in soap solution properties. The strategy switching organizes the two types of strategies into an interpretable operating logic. The reference correction processing maps the drift of the second channel to the compensation of the first and third channels through the correction factor k, so that difference_value and ref2 still have a comparative scale under cross-environment conditions. The consistency check and collaborative judgment resolve the differences between the two strategies through conservative priority in extreme cases, so that the low soap solution state and no soap solution state can still be stably output under long-term use and complex working conditions.
[0048] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for detecting the liquid level of soap solution, characterized in that, An application to a soap container including a first capacitance detection electrode, a second capacitance detection electrode, and a third capacitance detection electrode, wherein the first and third capacitance detection electrodes are arranged at intervals from bottom to top, and the second capacitance detection electrode is a reference electrode, the method comprising: S10: Acquire the first capacitance reading data1 of the first capacitance detection electrode, the second capacitance reading data2 of the second capacitance detection electrode, and the third capacitance reading data3 of the third capacitance detection electrode as real-time readings. S20: Invoke at least one pre-stored reference value, the reference value including at least one of the following: Pre-calibrated reference value groups for soap-free and soap-containing solutions; The difference_value between soap-containing and soap-free liquids was obtained in advance by statistically analyzing multiple samples, and a second reference value ref2 characterizing the state of soap-free liquid was obtained. S30: Based on the real-time readings and reference values, execute at least one of a calibration determination strategy or a calibration-free determination strategy: When the reference value includes the soap-free reference value group and the soap-containing reference value group, the calibration determination strategy is executed; When the reference value includes the feature difference_value and the second reference value ref2, the calibration-free determination strategy is executed, and the calibration-free determination strategy uses the second capacitance reading data2 as the reference reading for determination. S40: Output liquid level status, wherein the liquid level status includes at least a low soap liquid status indicating insufficient soap liquid and a no soap liquid status indicating that the soap liquid is exhausted. When the calibration and determination strategy is executed: When conditions one through three are met simultaneously, the condition is determined to be in a low soap solution state: Condition 1: data3 < α × without_data3; Condition 2: data1 > β × withing_data1; Condition 3: data1-data3>γ×(withing_data1-without_data3); When both conditions one and four are met, the condition is determined to be soap-free: Condition 4: data1 < α × without_data1; Wherein, without_data1, without_data2, and without_data3 represent the first, second, and third reference values in the soap-free reference value group measured by the first, second, and third capacitance detection electrodes, respectively; withing_data1, withing_data2, and withing_data3 represent the first, second, and third reference values in the soap-containing reference value group measured by the first, second, and third capacitance detection electrodes, respectively. When the aforementioned calibration-free determination strategy is executed: When conditions five and six are met simultaneously, the condition is determined to be in a low soap solution state: Condition 5: data3 < δ × data2; Condition 6: data1 - data3 > ε × difference_value; When conditions seven and eight are met simultaneously, the condition is determined to be soap-free: Condition 7: data3 < α × ref2; Condition 8: data1 < α × ref2; Wherein, difference_value represents the difference between soap solution and soap-free solution; ref2 represents a pre-stored second reference value, which is determined based on the reference reading of the second capacitor detection electrode in the soap-free state.
2. The soap solution level detection method according to claim 1, characterized in that, It also includes a strategy switching step: S31: The calibration and determination strategy is executed by default; S32: When the difference between the second capacitor reading data2 and the second reference value without_data2 in the soap-free reference value group exceeds a preset threshold, switch to executing the calibration-free determination strategy; S33: After receiving the user calibration instruction and completing the calibration, switch back to executing the calibration determination strategy.
3. The soap solution level detection method according to claim 1, characterized in that, The first coefficient α = 1.2, the second coefficient β = 0.8, the third coefficient γ = 0.6, the fourth coefficient δ = 1.4, and the fifth coefficient ε = 0.
8.
4. The soap solution level detection method according to claim 1, characterized in that, The calibration-free determination strategy includes benchmark correction processing, including: Calculate the correction factor k = ref2 / data2; The corrected readings are obtained as data1c = k × data1 and data3c = k × data3; And data1c and data3c replace data1 and data3 in the determination of the calibration-free determination strategy.
5. The soap solution level detection method according to claim 4, characterized in that, It also includes consistency checks and collaborative decision-making steps: S50: Determine the reference consistency of the second channel based on whether the deviation between the second capacitor reading data2 and the second reference value ref2 is less than a preset deviation threshold. S51: If the deviation is less than the deviation threshold, the calibration-free determination strategy is executed; if the deviation is not less than the deviation threshold, and the reference value includes both the soap-free reference value group and the soap-containing reference value group, the collaborative determination mode is entered. S52: In the collaborative determination mode, the calibration determination strategy is executed to obtain the first determination result, and the calibration-free determination strategy is executed to obtain the second determination result; S53: When the first determination result is consistent with the second determination result, output the liquid level status; when the first determination result is inconsistent with the second determination result, output the liquid level status according to the conservative priority, wherein the conservative priority is that the soap-free state takes precedence over the low soap state.
6. A soap solution level detection device, characterized in that, include: The capacitance detection processing unit has a first capacitance detection channel, a second capacitance detection channel and a third capacitance detection channel, which are respectively used to connect the first capacitance detection electrode, the second capacitance detection electrode and the third capacitance detection electrode. A storage unit is used to store at least one of the following: a soap-free reference value group, a soap-containing reference value group, a feature difference value (difference_value), and a second reference value (ref2). The processing unit is configured to perform the soap liquid level detection method according to any one of claims 1-5 and output the soap liquid state judgment result.
7. The soap solution level detection device according to claim 6, characterized in that, Also includes: A trigger input unit is used to receive external trigger signals to record the soap-free reference value group and the soap-containing reference value group. The output unit is used to output the soap liquid status judgment result by means of indicator light status change, buzzer prompt, display screen display or communication interface reporting.