A temperature-compensated liquid level detection algorithm

Through the temperature compensation liquid level detection algorithm, combined with capacitance detection and linear fitting, the problem of low accuracy of liquid level detection in high-temperature and low-temperature environments is solved, and high-precision liquid level detection is achieved, simplifying the structure and installation, and avoiding the The liquid properties affect the system's anti-interference.

CN114216541BActive Publication Date: 2025-01-03SHENZHEN XIHAI SEMICON CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111311002.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-06
Publication Date
2025-01-03
Estimated Expiration
2041-11-06

AI Technical Summary

Technical Problem

When faced with dirt, impurities, precipitates and temperature changes in liquids, the existing liquid level detection technology has low measurement accuracy and complex maintenance. Especially in high or low temperature environments, it is difficult to effectively solve the accuracy of liquid level detection. question.

Method used

Using temperature compensation liquid level detection algorithm, IIC or UART is used to combine high water level, low water level and auxiliary channels through the main control module, LDO voltage stabilization module, 5V DC power supply module and debugging/calibration interface installed on the circuit board. The communication is connected to the upper computer, perform linear fitting and temperature compensation processing, eliminate the temperature influence and achieve accurate liquid level detection.

Benefits of technology

It realizes high accuracy of liquid level detection at different temperatures, avoids the impact of liquid properties on detection, simplifies structure and installation, responds quickly dynamically, and is not affected by liquid dirt and impurities, improving the anti-interference of the system and Practicality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114216541B_ABST
    Figure CN114216541B_ABST
Patent Text Reader

Abstract

The present invention discloses a temperature-compensated liquid level detection algorithm, which detects the change of capacitance and uses a special capacitance detection chip to process data to achieve the purpose of liquid level detection. It has the advantages of simple structure and installation process, fast dynamic response, etc. It can be used to detect the liquid level by simply sticking the PCB to the outer wall of the container. The feature of non-contact measurement makes it unaffected by dirt, impurities, sediments and other substances in the liquid and various properties of the liquid itself, and combined with the temperature compensation algorithm, it can perform accurate detection at different temperatures.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of liquid level detection, and in particular to a temperature-compensated liquid level detection algorithm. Background Art

[0002] Daily-used household appliances such as drinking liquid dispensers, humidifiers, coffee machines, etc. have water tanks inside, which require a liquid level detection function to control the liquid level and realize functions such as water shortage protection, water shortage alarm, and automatic water addition.

[0003] Currently, the main liquid level detection sensors in the home appliance field include float level gauges, photoelectric liquid level sensors, and ordinary touch liquid level detection.

[0004] Among them, the float type liquid level meter uses a float to move up and down according to the liquid level. The magnet inside the float drives the reed switch to open / close to detect the liquid level. This method requires direct contact with the liquid in the container, and the impurities, sediments, viscosity of the liquid itself, and corrosiveness of the liquid will affect the accuracy of liquid level detection, and daily cleaning and maintenance are also more troublesome.

[0005] The detection principle of the photoelectric liquid level sensor is optical reflection, which will not be affected by dirt, impurities, sediment, etc. in the liquid. However, the light intensity in the environment, the liquid drops on the probe, the fluctuation of the liquid level, etc. will affect the measurement accuracy. To solve these problems, it is usually necessary to modify the mechanical structure, and the software processing is also more complicated.

[0006] Ordinary touch liquid level detection has low detection accuracy, cannot detect liquid level outside a 2-3MM thick shell, and has no temperature compensation function. Although it has good detection accuracy at room temperature, it may misjudge when measuring high-temperature or low-temperature liquids or when the ambient temperature changes, and is not very practical. Summary of the invention

[0007] Based on the technical problems existing in the background technology, the present invention proposes a temperature-compensated liquid level detection algorithm.

[0008] A temperature-compensated liquid level detection algorithm proposed in the present invention comprises a main control module, an LDO voltage regulator module, a 5V DC power supply module, a water level detection result display module and a debugging / calibration interface respectively installed on a circuit board, the LDO voltage regulator module, the water level detection result display module and the debugging / calibration interface are all electrically connected to the main control module, and the LDO voltage regulator module is electrically connected to the 5V DC power supply module, the main control module is also electrically connected to at least one high water level detection channel K1 installed on the circuit board, at least one low water level detection channel K2 installed on the circuit board and at least one auxiliary channel K3 installed on the circuit board, characterized in that the specific detection steps are as follows:

[0009] Step 1: Communicate with the host computer through IIC or UART, upload the real-time value detected by each detection channel to the host computer and print it out for easy observation;

[0010] Step 2: Save the data to a spreadsheet for later analysis.

[0011] Step 3: Analyze the impact of temperature on real-time values ​​by linear fitting.

[0012] Step 4: The real-time value of each channel can be temperature compensated by the temperature compensation algorithm to obtain the processed value caused by the water level change only.

[0013] Preferably, step 5, gap tolerance or elimination, is also included. When the product ages after long-term use, gaps will inevitably appear in the shell, which will cause changes in the original data, data anomalies, and misjudgment. Different channels have different sensitivities to gaps, but they will present a fixed ratio relationship with each other. The change value of the gap in other channels is obtained by the change value of the auxiliary channel. The data after eliminating the influence of the gap can be obtained by subtracting the gap change value from the original value.

[0014] Preferably, analyzing the impact of temperature on the real-time value specifically includes:

[0015] Step 31: The real-time value of each channel at room temperature (25°C) and full of water is used as the calibration value of the corresponding channel at room temperature and full cup, which is collectively referred to as the calibration value b below. 满 , the real-time value of each channel at room temperature (25℃) and empty cup is used as the calibration value of the corresponding channel at room temperature and empty cup, hereinafter collectively referred to as the calibration empty value b 空 ;

[0016] Step 32, after the host computer issues the instruction, it controls the single-chip microcomputer to complete the empty mark and full mark instructions through the IIC mode, UART mode or key mode, and then the single-chip microcomputer writes the real-time value corresponding to each channel into the EEPROM;

[0017] Step 33, read the empty and full values ​​of the EEPROM, sum them up and divide by 2 to obtain the median value, subtract the empty value from the full value and multiply by 5% or 10% to obtain the error value, and obtain the judgment thresholds of each channel by adding and subtracting the error value from the median value, which are: full judgment value and empty judgment value;

[0018] Step 34, when the real-time value after temperature compensation is greater than the full judgment value, it means that the output liquid level reaches the current channel. When it is lower than the empty judgment value, the output liquid level is lower than the current channel. When the liquid level is in the middle, the result of the last judgment is retained.

[0019] Preferably, the temperature compensation algorithm specifically includes:

[0020] Step 41: The real-time value of each channel at different temperatures. The relationship between the real-time value of the channel and the temperature can be expressed as: 实时值 =kT+b, where T represents temperature, y represents real-time value, k is temperature compensation coefficient, and b is a constant;

[0021] Step 42: The temperature compensation coefficient k of the liquid level channel can be obtained by fitting the straight line, where

[0022] Step 43, after obtaining the temperature compensation coefficient of each channel, the real-time PCB copper foil temperature of other channels is reversely deduced from the real-time value of any channel. To ensure that the selected channel can respond to the liquid temperature change in a timely and rapid manner, the real-time T value of the temperature detection channel is used to obtain the real-time T 通用 Value, the formula is: where y 时温 : Indicates the real-time value of the temperature detection channel, from which the theoretical value of each liquid level channel at this temperature, the change from normal temperature or any temperature and other temperature-related data can be obtained;

[0023] Step 44, obtain the value of each channel affected by temperature and causing the real-time sampling data to change, which is collectively referred to as the compensation value below, and can be obtained

[0024] Step 45, through the formula: y 实时值 -y 补偿值 =y 处理值 , the temperature influence is eliminated (or compensated) to obtain the processed value in which only the real-time value of each touch sampling channel changes due to the liquid level change.

[0025] Compared with the prior art, the present invention has the following beneficial effects:

[0026] The present invention detects the change of capacitance and uses a special capacitance detection chip to process data to achieve the purpose of liquid level detection. It has the advantages of simple structure and installation process, fast dynamic response, etc. It can be used to detect the liquid level by simply sticking the PCB to the outer wall of the container. The feature of non-contact measurement makes it unaffected by dirt, impurities, sediments and other substances in the liquid and various properties of the liquid itself. Combined with the temperature compensation algorithm, it can perform accurate detection at different temperatures. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 A device connection block diagram of a temperature-compensated liquid level detection algorithm proposed by the present invention;

[0028] Figure 2 It is a curve chart showing the real-time value decrease during temperature drop;

[0029] Figure 3 It is the temperature drop curve;

[0030] Figure 4 It is a functional relationship diagram between temperature and real-time value;

[0031] Figure 5 Output result graph for real-time value of liquid level change. DETAILED DESCRIPTION

[0032] The present invention will be further explained below in conjunction with specific embodiments.

[0033] Based on the principle of capacitive touch detection, the present invention utilizes specially designed temperature detection channels and the powerful sensitivity of the A1semi chip to measure the sensing capacitance value of each channel, and combines the liquid level detection algorithm to determine whether the liquid level reaches the preset liquid level.

[0034] Because different temperatures at the same liquid level have different effects on the sensing capacitor, the real-time value of capacitance detection at different temperatures at the same liquid level is obtained in real time through the self-developed upper computer software. The temperature compensation coefficient of the influence of temperature on the sensing capacitor is obtained by fitting the curve and substituted into the temperature compensation algorithm. The current temperature can be obtained through the temperature detection channel, and the capacitance change caused by temperature in the liquid level detection channel can be obtained.

[0035] The real-time capacitance detection value of each channel with or without liquid at room temperature is used as a benchmark, and then combined with the temperature compensation algorithm, the real-time value data generated by different liquid levels of each channel at different temperatures are all compensated to the real-time value at different liquid levels at room temperature, thereby removing the influence of temperature on the sensing capacitance and only considering the influence of liquid level on the real-time value.

[0036] For easy understanding, a brief introduction to the hardware part is given below: Figure 1 The hardware system uses multiple copper foils, and the number of copper foils is related to the range of water level detection. Figure 1 Only two high and low water level copper foils and one temperature compensation copper foil are shown.

[0037] Communicate with the host computer through IIC, UART and other methods, upload the real-time value detected by each detection channel to the host computer for printing and observation, and save the data in a spreadsheet for later analysis. Analyze the impact of temperature on real-time values ​​through linear fitting.

[0038] In order to verify the reliability of the patent of this invention, we tested different temperatures at the same water level.

[0039] The specific operations are as follows:

[0040] Pour 100℃ boiling water into the container to start collecting real-time values. When the temperature drops to room temperature, stop collecting. Draw the data into a chart to qualitatively determine the impact of temperature on the data, such as Figure 2, 3 As shown. According to Newton's cooling law, when the temperature of the liquid is much different from the ambient temperature, the cooling speed is faster. The experimental results show that the temperature drop curve is similar to the real-time value drop curve during the cooling process.

[0041] From this we can draw the following conclusions:

[0042] 1. Different temperatures will affect the water level sampling value. The higher the temperature, the larger the sampling value. Therefore, water level sampling needs temperature compensation to eliminate the influence of temperature on the sampling value.

[0043] 2. From the above experimental results, it can be seen that the real-time sampling values ​​of each copper foil are consistent with the temperature change curve over time.

[0044] In a further experiment, the water temperature was raised to a certain temperature in the thermostat, and the real-time values ​​of each channel were detected and recorded. This experiment was repeated many times, and Python was used to perform linear fitting on the data to obtain the functional relationship between temperature and real-time value (such as Figure 4 Thus, the temperature compensation coefficient of each liquid level channel is obtained.

[0045] Temperature compensation algorithm description:

[0046] Figure 4 The midpoint is the real-time value of each channel at different temperatures. The relationship between the real-time value of the channel and the temperature can be expressed as y 实时值 =kT+b. (T represents temperature, y represents real-time value, K is temperature compensation coefficient, and b is a constant (its function will be introduced below)).

[0047] The temperature compensation coefficient of the liquid level channel can be obtained by fitting the straight line.

[0048] After obtaining the temperature compensation coefficient of each channel, the real-time PCB copper foil temperature of other channels can be reversely deduced from the real-time value of any channel. To ensure that the selected channel can respond to the liquid temperature change in a timely and rapid manner, we use the real-time value of the temperature detection channel to obtain the real-time T 通用 Value, the formula is:

[0049] (y 时温 : Indicates the real-time value of the temperature detection channel)

[0050] This can be used to obtain temperature-related data such as the theoretical value of each liquid level channel at this temperature, the change compared to normal temperature or any temperature, etc.

[0051] Further derivation

[0052] Here we only consider the real-time value changes of the touch sampling channel caused by temperature and liquid. In practice, the changes of other factors will be a constant, so we will not discuss them for now.

[0053] That is y 实时值 =y 温度值 +y 液体值

[0054] y 温度值 : Indicates the real-time value data of the touch sampling channel caused only by temperature influence

[0055] y 液体值 : Indicates the real-time value data of the touch sampling channel caused only by liquid influence

[0056] y 实时值 =kT+b. (T represents temperature, y represents real-time value, K is temperature compensation coefficient, and b is a constant)

[0057] Reverse temperature

[0058] y 时温 : Indicates the real-time value of the temperature detection channel.

[0059] b 满温 : Indicates the full scale value corresponding to each detection channel at the corresponding temperature during calibration.

[0060] Note: In practice, the calibration will be done at room temperature. 满温 As the real-time value corresponding to normal temperature, the changes of each channel are compensated to normal temperature.

[0061] K 温 : Indicates the temperature coefficient corresponding to the temperature detection channel.

[0062] This can be used to obtain the value of each channel's real-time sampling data change caused by temperature, which is collectively referred to as the compensation value below.

[0063] (Compensation value: indicates the value obtained after temperature compensation, which is only affected by temperature and causes the real-time value of the touch sampling channel to change.)

[0064] Thus, through the formula: 实时值 -y 补偿值 =y 处理值 , the temperature effect is eliminated (or compensated) to obtain the processed value in which only the liquid level change causes the real-time value of each touch sampling channel to change. (Processed value: the value corresponding to no temperature effect)

[0065] in conclusion:

[0066] The temperature compensation algorithm can be used to perform temperature compensation processing on the real-time values ​​of each channel to obtain the processed values ​​caused only by the water level change.

[0067] like Figure 5 The graph shown is a real-time output result of only the liquid level change after eliminating the temperature influence.

[0068] Gap tolerance or elimination algorithm:

[0069] After long-term use, the product will inevitably age and cause gaps in the shell, which will cause changes in the original data, abnormal data, and misjudgment. To this end, the system needs to eliminate certain gaps. By obtaining a large amount of experimental data, it is found that different channels have different sensitivities to gaps, but they present a fixed ratio relationship with each other. Through this ratio, we can obtain the change value of the gap in other channels through the change value of the auxiliary channel, and subtract the original value from the gap change value to obtain the data after eliminating the influence of the gap.

[0070] Production line calibration procedure:

[0071] The real-time value of each channel at room temperature (25°C) and full of water is used as the calibration value of the corresponding channel at room temperature and full cup, which is collectively referred to as the calibration value (b 满 ).

[0072] The real-time value of each channel at room temperature (25°C) and empty cup is used as the calibration value of the corresponding channel at room temperature and empty cup, which is collectively referred to as the calibration empty value (b 空 )

[0073] After the host computer issues the command, it controls the MCU to complete the empty and full mark instructions through IIC, UART or other communication methods or by pressing buttons. Then the MCU will write the real-time values ​​corresponding to each channel into the EEPROM). Then read the empty and full mark values ​​of the EEPROM, add them and divide them by 2 to get the median value. Subtract the empty value from the full value and multiply it by 5% or 10% (you can also choose one data according to the actual accuracy) to get the error value. By adding and subtracting the error value from the median value, the judgment thresholds of each channel (respectively: full judgment value and empty judgment value) are obtained.

[0074] Result determination procedure:

[0075] When the real-time value after temperature compensation is greater than the full value, it means that the output liquid level has reached the current channel. When it is lower than the empty value, the output liquid level is lower than the current channel. When the liquid level is in the middle, the result of the last judgment is retained. The advantage of this algorithm is that it forms a filtering-like interval to improve the anti-interference ability of the system.

[0076] The name of the temperature compensation in the temperature compensation algorithm is actually just for the convenience of description and understanding of the reader. The core of the actual temperature compensation algorithm is that each channel has different sensitivity to water temperature, which leads to different real-time values. Therefore, on any touch chip, as long as the trend of the curve of each channel changing with the water temperature is consistent, the software algorithm of the present invention can be used to perform water temperature compensation.

[0077] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A temperature-compensated liquid level detection method, comprising a main control module, an LDO voltage regulator module, a 5V DC power supply module, a water level detection result display module and a debugging / calibration interface respectively installed on a circuit board, the LDO voltage regulator module, the water level detection result display module and the debugging / calibration interface are all electrically connected to the main control module, and the LDO voltage regulator module is electrically connected to the 5V DC power supply module, the main control module is also electrically connected to at least one high water level detection channel K1 installed on the circuit board, at least one low water level detection channel K2 installed on the circuit board and at least one auxiliary channel K3 installed on the circuit board, characterized in that: The specific detection steps are as follows: Step 1: Communicate with the host computer through IIC or UART, upload the real-time value detected by each detection channel to the host computer and print it out for easy observation; Step 2: Save the data to a spreadsheet for later analysis. Step 3: Analyze the influence of temperature on real-time value by linear fitting. The influence of temperature on real-time value includes: Step 31: The real-time value of each channel at room temperature (25°C) and full water is used as the calibration value of the corresponding channel at room temperature when the cup is full, which is collectively referred to as the calibration value b. 满 , the real-time value of each channel at room temperature (25°C) and empty cup is used as the calibration value of the corresponding channel at room temperature and empty cup, hereinafter collectively referred to as the calibration empty value b 空 ; Step 32, after the host computer issues the instruction, it controls the single-chip microcomputer to complete the empty mark and full mark instructions through the IIC mode, UART mode or key mode, and then the single-chip microcomputer writes the real-time value corresponding to each channel into the EEPROM; Step 33, read the empty and full values ​​of the EEPROM, sum them up and divide by 2 to obtain the median value, subtract the empty value from the full value and multiply by 5% or 10% to obtain the error value, and obtain the judgment thresholds of each channel by adding and subtracting the error value from the median value, which are: full judgment value and empty judgment value; Step 34, when the real-time value after temperature compensation is greater than the full judgment value, it means that the output liquid level reaches the current channel, when it is lower than the empty judgment value, the output liquid level is lower than the current channel, and when the liquid level is in the middle, the result of the last judgment is retained; Step 4: Perform temperature compensation processing on the real-time values ​​of each channel through a temperature compensation algorithm to obtain a processing value caused only by water level changes. The temperature compensation algorithm specifically includes: Step 41: The real-time value of each channel at different temperatures. The relationship between the real-time value of the channel and the temperature is expressed as: 实时值 =kT+b, where T represents temperature, y represents real-time value, k is temperature compensation coefficient, and b is a constant; Step 42: Obtain the temperature compensation coefficient k of the liquid level channel by fitting a straight line, where Step 43, after obtaining the temperature compensation coefficient of each channel, the real-time PCB copper foil temperature of other channels is reversely deduced from the real-time value of any channel. To ensure that the selected channel can respond to the liquid temperature change in a timely and rapid manner, the real-time T value of the temperature detection channel is used to obtain the real-time T 通用 Value, the formula is: where y 时温 : Indicates the real-time value of the temperature detection channel, from which the theoretical value of each liquid level channel at this temperature and the change from normal temperature or any temperature can be obtained; Step 44, obtain the value of each channel affected by temperature and resulting in the change of real-time sampling data, hereinafter collectively referred to as compensation value, and obtain Step 45, through the formula: y 实时值 -y 补偿值 =y 处理值 , obtain the processed value in which the real-time value of each touch sampling channel changes due to only the liquid level change by eliminating the temperature influence; Step 5: Tolerance or elimination of gaps. After a product has been used for a long time, aging will inevitably lead to gaps in the shell, which will cause changes in the original data, data anomalies, and misjudgment. Different channels have different sensitivities to gaps, but they have a fixed ratio relationship with each other. The change value of the gap in other channels can be obtained by the change value of the auxiliary channel. The data after eliminating the impact of the gap can be obtained by subtracting the gap change value from the original value.