When liquid is present near the sensor, it changes the sensor capacitance. This brings into focus object capacitance (CO) in parallel to the Cp (Figure 4). Total sensor capacitance (Cx) is defined as shown in equation 2.
Figure 4: Sensor capacitance in the presence of conductive object
For the microcontroller to process the sensor capacitance (Cx), its value needs to be converted to a digital value. Figure 5 shows the block diagram of one of the capacitive sensing preprocessing circuits.
Figure 5: Capacitance measurment system
This system uses a switched capacitor block that emulates sensor capacitance Cx as resistance Req, a programmable current source (Idac), an external capacitor (Cmod), and a precision analog comparator. The current source (Idac) charges Cmod continuously until the voltage on Cmod crosses Vref and the comparator output is high. The Idac is disconnected and Cmod discharges through Req until the voltage on Cmod drops below Vref. The comparator output is now low, Idac now charges Cmod again charges to Vref. If Cx increases due to the presence of any conductive object, the emulated Req decreases according to Equation 3.
Where, Fs is the switching frequency of the Switched Capacitor block.
Thus, Cmod will discharge faster and the comparator output stays high for a shorter period of time. This means that the duration for which the comparator output is high is reduced if the capacitance value increases. The bit stream as shown in Figure 5 can be fed to a counter for a fixed amount of time. The counter value defined as raw count gives us an indication of the magnitude of Cx.
The raw count measured at power up is used as a reference to detect the change in capacitance. Let us call this reference count the baseline (BL). Raw counts will increase when capacitance is added to the sensor by any conductive object. Let the increased raw count be RC. The increase in counts will be calculated (RC-BL). Let the difference be DIF. DIF will be compared against a configurable threshold to decide the sensor tatus. If DIF is greater than a specific threshold, the sensor will report ON and if DIF is less than the threshold the sensor will report OFF.
Next: Implementation of Liquid Level Sensing
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 firstname.lastname@example.org.
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 email@example.com.