Adaptive Kalman filtering for better buttons-slider capacitive sensing
Capacitive touch interfaces have become increasingly popular for button and slider interfaces used for input control. The performance of a slider or button under changing environmental conditions is important for final implementation and can vary based on the use case.
Software algorithms are used to process the sensor data to combat the various interferences that can affect the expected processed results. This article describes an adaptive filtering technique that can be used to improve sensor performance under changing environmental conditions, such as noise, moisture and temperature drift.
A slider is a series of touch buttons cascaded together with overlapping transitions and designed specifically to track finger position and movement. A slider is designed to detect the finger position as accurately as is necessary for an application.
An individual button detects the presence of a finger touch or the absence of a touch. Buttons and sliders can be used to detect simple single-touch motions or specific gestures, such as multiple taps and/or sliding touch for more sophisticated user control. (Silicon Labs offers several 8-bit and 32-bit microcontrollers (MCUs) with capacitive sensing capabilities including the 8-bit C8051F99x, C8051F8xx, C80517xx and 32-bit Precision32 SiM3U1xx MCUs.).
Signal conditioning for capacitive touch sensing in sliders
The dynamic behavior of the signal output from the touch sensor is described as the sum of a touch delta and a baseline. Combined, these two states create the output from the capacitive sensing block in the microcontroller.
The Kalman filter is an approach that is presented as an optimized filter of the sensor data. This filtering method has advantages over simple low-pass filters, which can be limited by delayed response times. Also, a low-pass filter does not track the baseline, and this must be done separately.
The Kalman filter monitors the two state variables based on the dynamic model of the touch delta and the baseline. The final position output on the slider benefits from further filtering using dejitter and deglitching algorithms to smooth out the data under noisy conditions. The following block diagram in Figure 1 shows the data flow from input into the sensor to positional output, computing the position of the finger on the slider.
Figure 1. Data flow from raw data to position output along a slider.
A state-space model is a method of describing estimation and control problems. It shows how a new state X (i+1) is modeled as a linear combination of both the previous state X (i) and some process noise U (i). A measurement equation describes the way the process measurements or observations Y (i) are derived from the internal state X (i).
These two equations are referred to as the process model and the measurement model and serve as the origin for all linear estimation methods, such as the Kalman filter. The state space model is often used to solve the black box problem, which is to determine the internal states of a linear system given access only to the system’s outputs. The following equation provides an example of a process and measurement model. A is the state space matrix; G is the input transfer function, and H is the output transfer function in Equation 1 below.
X (i+1) =AX (i) +GU (i) Process model
Y (i) =H (i) X (i) Measurement model
Equation 1. State-space model