Initial report by Deqing Sun, Feb, 2012
In this application I choose PIC16F707 as a trackpad sensor. It isn't the only one sensor available for a trackpad or touchscreen application, but it may be the only sensor with reference material on their website. Strictly speaking it is a microcontroller rather than a sensor. But despite of it's 32 channel Capacitive Sensing Module, other resources are really scare for task other than capacitive sensing and signal analysis. So I just program it as a sensor and sent it's result via I2C bus.
In capacitive sensing, any conductive material with a low resistance can act as an electrode. Normally there will be a distributed capacitance between electrode and ground which can be measured by sensor, though it's absolution value is unknown. When you put your finger on that, due to the conductivity of your body and the huge size (compared to the electrode) of your body, your fingertip will introduce a small additional capacitance to the electrode. Although the absolute value of neither state can be measured, the change between them can. That is the physical principle of this kind of sensor.
In order to measure a capacitance, the simplest way is to convert capacitance to time which is the most accurate and easy for a digital system to measure. Often a discrete or distributed resistor is used along with the capacitor. Since the resistance of resistor is fairly stable, the change of capacitance will change the RC constant (a value related to speed of charging or discharging the capacitor). Arduino's Capsense library uses step response of the RC circuit. The larger the capacitance be, the longer time it will take for the sensing pin to reach threshold. Quantum, now Atmel Qtouch, uses a serial of pulses to charge the capacitor instead of a simple high level voltage. Microchip's mtouch technology uses it's internal module to form a free-run oscillator with the distributed capacitor on electrode. It measures time when the oscillator runs a certain number of oscillations.
That is how a single touch key works. With interpolation technique, we can combine several keys to form a slider or wheel. If we go even further, we can use two set of orthogonal electrodes to form a touch screen or touch pad.
The easiest way to do capacitive sensing is use electrode independently. Each electrode is sensed separately and all other electrodes are tied to ground meanwhile. Ground other electrode creates a reference to capacitive sensing. The capacitance between finger tip and ground electrode nearby may reduce the necessity of a real ground.
My first attempt was creating a touchpad and a PIC16F707 breakout board. The sensor sends information to Arduino via I2C to maximize usable channels. The program read each electrode one by one to get capacitance on them. It is effective for single touch.
This method is called "Self Capacitance". Peaks of values on both X and Y axis can be figured out easily. With interpolation (will be explained later), the position of both X and Y can be obtained and the touching position is on the intersection.
The biggest drawback of this method is it can not handle multi-touch well. In the following example, there are peaks on X1 and X2, Y0 and Y3 and creates 4 intersections. But the system can not figure out the combination is X2Y0 and X1Y3 or X2Y3 and X1Y0, or combination of 3 points or 4. X2Y3 and X1Y0 are called ghost points. However, gestures may still be recognized as long as probable combination won't change in touching process. Thus, Scrolling, Multi-finger tapping, Zooming, Rotation (within one quadrant) and Swiping are still achievable by software because we don't care the real combination in these gestures.
There is way called "Mutual Capacitance". Instead of scanning every electrode, mutual capacitance scans each combination of X and Y electrode (a node). When scanning a certain node, one electrode works as a driving electrode and the other works as a sensing electrode. When finger tip is near this node, finger tip will reduce the coupling between two electrodes and steal some charge. So the affection on sensing node is reduced and the touch can be figured.
It is obvious that using mutual capacitance is the best way to get touch statues on each node. The only problem is time. If we spend too much time on sensing finger's position, it will slow down refresh rate and causes feeling of lag. For a M by N matrix, there will be M+N samples for self capacitance. But there will be M*N samples for complete mutual capacitance sensing. In order to save time. We can first perform a self capacitance scan and get all intersections. Then we can only test mutual capacitance on these intersections. For a two finger touch. Only M + N + 4 scans can get correct position of fingers.
In order to get a correct reading from capacitance. A baseline is applied as a reference. When reading value exceed a certain threshold over baseline, it is judged as a "touch". Due to parasitic capacitance variations in the touch system that can not be controlled, a touch is determined based on measurement differences from “no-touch” capacitance measurements. The reading is normalized according:
Normalized = Raw – Baseline
The baseline is updated constantly. If there is no touch for some time, reading of electrodes will be saved. If touch doesn't appear for a while after sampling, that sample will be accepted as a new baseline.
Another issue of touch pad is resolution. Normally the pitch of electrode is too big for our desired level of accuracy. Since the sensor reading contains more information than ON and OFF, we can use these value to interpolate touch positions between adjacent electrodes. First peak detection is used to get the rough position of touch. Then the precise position is determined by calculating a ratio of the measured signal strength for the two electrodes that are adjacent to the identified peak electrode.
AN1101–Introduction to Capacitive Sensing _ Microchip Technology Inc.
TB3064-mTouchTM Projected Capacitive Touch Screen Sensing Theory of Operation _ Microchip Technology Inc.
Projected-Capacitive Touch Technology _ Gary Barrett and Ryomei Omote
Touch Technology Brief: Projected Capacitive Technology _ 3M Touch Systems