Here is what you need to know to design a capacitive sensor-based liquid-level sensing system

BY SUBBARAO LANKA, Senior Staff Applications Engineer, and SHRUTI HANUMANTHAIAH,
Staff Applications Engineer

sensing based on capacitive sensors comes with its own challenges. It’s like
absolute capacitance sensing. Unlike touch detection, the absolute value of the
liquid level needs to be measured.

environmental factors such as temperature and the presence of conductive
objects can affect sensing accuracy. The common factors that impact
liquid-level sensing are as follows:

1. Temperature drift
2. Tank thickness
3. Liquid viscosity
4. Liquid salt
5. Conductive
6. Air gap between
sensors and tank

Temperature drift
fluctuations during sensing operation have the most significant impact on
performance. With finger-activated capacitive sensing buttons — as compared to liquid-level sensing — the sensor value while not being touched by a
finger is tracked over time to account for any ambient temperature-induced

compensated non-touched value is called the baseline. In touch applications,
this is possible because, most of the time, the sensor is not being touched.
Moreover, the relatively short touch events provide a large, instantaneous
change in sensor values.

liquid-level sensing applications, temperature compensation is more difficult
because we cannot assume that the liquid sensor is not covered with liquid; it
may be covered to any level for any length of time. We must, therefore,
compensate for temperature variation through the use of algorithms and
optimized sensor designs.

approach minimizes the impact due to temperature drift, which affects a number
of parameters in a liquid-level sensing system. First is the capacitance to be
measured. Drift impacts other system parameters, such as the integrating
capacitor and the current used by the capacitive sensing engine.

a result of these variations, the raw count also increases or decreases because
of temperature (Fig. 1). Capacitive sensing circuitry
converts the measured capacitance to a digital count, which is known as raw


Fig. 1: Change in raw count due to change in temperature;
X-axis is temperature and Y-axis is raw count.

are two possible ways to overcome the issue:

Fixed temperature compensation capacitor
temperature compensation capacitor is a sensor that has similar characteristics
as the other sensors used for detecting the liquid level. However, it is not
placed in direct contact with the liquid. In other words, this sensor must
remain unaffected by the liquid level. The raw count of this capacitor is used
as a reference for the actual sensors.

the temperature compensation sensor and the actual sensor have the same
characteristics, the effect of temperature on both of the sensors will be the same.
In this way, the impact of temperature on the liquid-level detecting sensors
can be nullified by using the temperature compensation sensor as a reference.

worth noting that temperature compensation on the liquid-level detecting sensor
using the temperature compensating sensor has to be performed both when the
tank is empty and when there is liquid in the tank.

Software algorithm on baseline
algorithms to detect a finger touch with capacitive sensing comprise a
reference that is a filtered version of the raw count. This reference keeps
track of slow environmental changes in raw count, and it’s typically called a

baseline is used to detect the presence of a finger in case of touch detection.
With liquid-level sensing, the baseline can be used to track changes in raw count.
Temperature drift is often slow; hence, its effect on raw count is also slow.

such cases, with appropriate values of baseline update parameters, the baseline
can be used to compensate for temperature variations in raw count. If the
effect of temperature on raw count is very fast, then a temperature
compensation capacitor should be used instead.

secondary effect of temperature is condensation. A liquid that is significantly
colder than the ambient air temperature may cause condensation to form on the
sensor surface. Condensation may cause a higher capacitance, which, in turn, causes
an increased error.

during low-temperature testing can be reduced by insulating the surface of the
sensor. Another approach is to provide a small insulating air gap between the
liquid container and the sensor substrate. The air gap should not be larger
than 3 mm for the best performance.

Tank thickness
response depends on the overlay thickness that is considered as the insulating
material between the sensor and the conducting material to be detected.
Challenges can arise if the tank thickness is too high or the change in signal
with liquid and without liquid is too small to detect.

thicker the tank, the lower the capacitance seen by the measuring system. And
that leads to a smaller signal to work with. One solution to this problem is to
get a large signal for a small variation in measuring capacitance. It can be
achieved by scanning the sensor with higher resolution.

example, if a sensor is scanned at a resolution of 9 bits when the liquid is
present, the raw count increases by 10. Now if the resolution is increased to
13 bits, the sensor is effectively scanned for a duration 16 times that of the
previous resolution. With this resolution, for the same range of capacitance
sensing, the signal will be 160.

Liquid viscosity
capacitive sensing, liquids with low viscosity can be measured accurately.
However, for highly viscous liquids, the liquid residue left when the tank is
emptied will impact sensing. It delays the detection of tank emptiness, which
can cause problems.

design tradeoffs must be made to achieve the best accuracy possible. For instance,
the inside wall of the tank can be made smooth and slippery so that the liquid
doesn’t stick to the wall.

Liquid salt concentration
concentration in the liquid affects sensing accuracy. The higher the salt
concentration, the lower the sensing accuracy. At room temperature, the effect
of salt concentration is not very high. However, with an increase in
temperature, the effect of salt concentration also increases.


Fig. 2: Salt concentration impact on
sensing accuracy.

shows the deviation from the real
liquid level with 0.5-g/L and 35-g/L salt concentrations. It is important to recognize
that salt concentration has an impact on accuracy. And design tradeoffs must be
made to achieve an acceptable accuracy level.

Conductive object interference
sensor used for liquid detection and temperature compensation capacitor should
be placed away from other conductive objects like people. If a conductive object
is close by, there is a higher chance of reporting the wrong result.

the solution to this problem is proper isolation between the sensing circuitry
and other conductive objects through the use of shields.

Air gap between the tank and the sensors
the air gap between the sensors and the tank increases, sensing accuracy
decreases. One solution to this problem is to increase the sensitivity of the
sensors and avoid crosstalk between sensors using appropriate threshold values
and firmware algorithms.


3: Air gap between the tank and the sensors.