Editor's Note: See Part I of this article--Click Here
Implementation of liquid Level sensing
As mentioned earlier, point level measurement uses one or more sensors placed at discreet levels on the tank based upon the application’s need to know the liquid level. The system uses the on/off state of the various sensors to deduce the liquid level.
For example, Figure 6 shows a tank and PCB with one sensor attached to it at the end for tank empty detection. Tank Empty is determined by the sensor ON/OFF status--when the tank is filled with a conductive liquid, the sensor will be ON and when tank is empty the sensor will be OFF.
While the concept behind this approach appears simple, there are several issues, which need to be resolved while measuring liquid compared to detecting a human finger. Some of these issues include:
- Base lining
- Temperature drift
- Tank thickness
- Liquid viscosity
- Conductive object interference
1) Base lining
To make any measurement, there has to be a reference point. If that reference is not correct, the system will provide a false measurement. For the capacitive sensing algorithms discussed in this article, a baseline serves as the reference point. In a user interface implementation, for example, the system assumes that a finger is present at power on and the baseline is initialized based upon parasitic capacitance.
Establishing the baseline requires a different approach when it comes to liquid level measurement. Consider if there is no liquid at power on, then the sensor will be OFF indicating the tank is empty. Now, if tank is later filled with liquid, the liquid will add capacitance and the sensor will turn ON indicating tank is not empty. However, when there is liquid in the tank at power on, since the raw counts measured at power on are used as baseline reference, the sensor will be reported as OFF indicating that the tank is empty when in fact it is not.
A straightforward solution to this problem is to have a reliable reference. This can be achieved using a virtual sensor. A virtual sensor is a sensor that has similar characteristics as the sensor being used to detect the liquid but it is not placed in direct contact with the liquid or through overlay. Since this sensor takes a reading that is not affected by liquid, the raw counts of the virtual sensor can be used as the reference baseline for the actual sensor.
Let CX be the virtual sensor and tank empty detection sensor capacitance (without liquid). Let CL be the capacitance added by the liquid.
Virtual Sensor capacitance = CX
Tank empty detector sensor capacitance = CX
Virtual Sensor capacitance = CX
Tank empty detector sensor capacitance = CX+CL
The difference in the capacitance (CL) of the tank empty detector sensor and virtual sensor is measured to determine whether the tank is empty or not upon turning on the system.
Designing a reliable virtual sensor can be challenging for system layout designers since the capacitance of the virtual sensor has to match the capacitance of the actual sensor for the baseline to be of value. To achieve this, the virtual sensor should have the same dimensions as the actual sensor. The trace length to each sensor should be the same as well, although the trace length can be varied to accommodate other discrepancies in the system and match the capacitances. The number of vias should be the same for both sensors and, to reduce the overall parasitic capacitance, the number vias should be limited to no more than 3. In addition, the virtual sensor and actual sensor should be placed on different layers.
2) Temperature Drift:
Temperature drift can impact several system parameters, including the capacitance to be measured, the Cmod value, and the IDAC current, which is used to excite the sensor. As a result of these variations, the raw counts will also increase or decrease because of temperature (Figure 8). At power up, the system assumes the raw counts are ‘X’ counts, so the baseline is ‘X’. An increase in temperature, however, will increase the current raw count to ‘X+Y’. If Y is greater than the ON threshold, then the sensor will be reported as ON even though liquid is not present. Similarly, if the raw counts decrease due to temperature, then the sensor will be reported as OFF in the presence of liquid.
Since the virtual sensor has the same characteristic as that of the actual sensor, the effect of temperature will be the same on both sensors (i.e., the differential capacitance between the two sensors cancels the effect of temperature drift). For this reason, the system must regularly update the reference baseline to reflect any changes in the operating environment.
For systems not using a virtual sensor, a software-based algorithm, can be used to update the baseline. In general, temperature changes are slow compared to the ‘sudden’ increase in capacitance when liquid is added to the tank. When the raw counts slowly rise, the algorithm increases the raw counts slowly as well to accommodate the rise in temperature. Likewise, the baseline is reduced when the raw counts slowly decrease. With this approach, the effect of temperature drift can be nullified. Note that software-based compensation only works when environmental changes are slow in nature. When environmental changes are relatively fast, a virtual sensor will be required to achieve accurate compensation.
3) Tank Thickness
Sensor responsiveness depends on the overlay thickness; i.e., the material between the sensor and the object being detected. In the case of a liquid measurement system, the overly is the insulating material between the sensor and conducting material. The greater the thickness of the tank, the smaller the difference in raw counts when a measurement is made. If the tank overlay is too thick, then the count difference with liquid and without liquid will be too small to detect.
To overcome this problem, the system needs to obtain a high difference count for small variations in capacitance. This can be achieved by increasing the scan time of the sensor. For example, consider a thick tank scanned with a sensor having 9 bits of resolution and that when liquid is present, the raw counts increase by 10. If the resolution is increased to 13 bits, the sensor is effectively scanned 16 times more, and for the same range of capacitance, the measurement difference counts will be 160. In this way, tank thickness problem can be resolved.
4) Liquid viscosity
Every liquid possesses a different viscosity. Table 1 gives the viscosity of some common liquids.
Using capacitive sensing, liquids with low viscosity like water can be measured accurately. For highly viscous liquids such as oil, however, the liquid residue left when tank is emptied will have an impact on measurements and may delay the detection of an empty tank.
5) Conductive object interference
When another conductive object is close by, including a human hand, it may impact capacitive measurements. Therefore, the actual sensor used for liquid detection and the virtual sensor should be placed out of range of other conductive objects and have proper isolation. Isolation should be in such a way that any conductive object will not add capacitance to the sensor that is used for measuring the liquid level.
Capacitive sensing technology provides a means for reliably detecting liquid level measurements. As it does not need any movable parts and the sensor does not need to be in direct contact with the liquid being measured, it can be more reliable compared to other traditional ways of measuring liquid. In addition, with the availability of microcontrollers designed to reduce the overhead of making capacitive measurements for user interface applications, system cost and complex are reduced as well.
About the Authors
Subbarao Lanka is working as Sr. Applications Engineer in Cypress Semiconductor Consumer and Computation Division focused on CapSense applications. He can be reached at email@example.com.
Sachin Gupta is working as Sr. Applications Engineer in Global Applications team in Cypress Semiconductor. He loves working on different mixed signal applications. He can be reached at firstname.lastname@example.org.