Capacitive Touch
There has been a lot of hype and hoopla about capacitive touch recently. Some of it is deserved and some not. The best way to separate fact from fiction is a basic understanding of the basic technology.
Let’s start with EE-101; a capacitor is basically two isolated conductors separated by an insulator. That means that two cars sitting next to each other in the parking lot can potentially store a charge, two airplanes passing each other at 30,000 feet can store a charge, and two red blood cells in your veins can hold charge. The basic equation for capacitance is C = eoerA/D, where C is capacitance in Farads, eo is the permittivity of free space, er is the relative permittivity of the insulator between the plates, A is the area of the smaller plate, and D is the distance between the plates.
The fact that your blood cells are capacitively coupled to one another is actually the basis for capacitive touch. Because your blood cells can form capacitors, it means that every surface of your body is capacitively coupled to every other surface. So, when you touch a button on your cap touch microwave oven, you are basically capacitively coupling the button to the cabinet of the microwave through your body, and potentially some of the floor, walls, and other objects in the vicinity.
Now, I know, the buttons is coupled to all of these surfaces anyway because air is an insulator as well. The difference is that you body is mostly water, and water has a higher relative permittivity, than almost every other insulator, by at least a factor of ten. That is why we can produce a relatively large shift in the capacitance, even through a relatively thick insulator.
Alright, so we improve capacitive coupling between objects, and that increases the capacitance between the senor and ground. How do we use this effect to create a capacitive touch button? Well, there are several ways, we can charge and discharge the sensor capacitance and measure the time required, we can build an oscillator with the capacitor and measure its frequency, we can drive it with an AC voltage and measure the voltage generated across it, or we can use it to couple an AC signal between two sensors and measure the attenuation of the signal. All of these systems work, it is just a matter of cost and complexity. At the end of the day, what we need is a value corresponding the capacitance of the sensor.
Once we have the capacitance value, then we can use changes in its magnitude to determine when a user has touched the sensor. We do this by periodically measuring the capacitance and comparing it against a threshold value. Now we can’t use a fixed value for the threshold because the capacitance will change over time due to temperature and humidity variations, but we can create a tracking average that follows the untouched value of the sensor and use that to create our threshold.
While this may sound simple, I can assure you that this is where you will start pulling your hair out. Our averaging system is supposed to track the un-pressed capacitance of the sensor, the problem is that we don’t know when the sensor is about to be pressed. As the user brings their finger closer to the sensor, the capacitance of the sensor will start to climb, and that will pump up the average. In fact, the act of touching and holding the sensor will also move the average if we don’t gate it off during a touch. On top of this is the problem of cross talk, specifically, the increase or ‘pumping’ of sensor average of sensors adjacent to the touched sensor just because they share the same insulator. Think of it as a sideways capacitor on the slant between the finger and the other sensors.
What this means for our system is that measuring the capacitance is actually the easy part, determining what is and is not a touch is the real challenge. That is why most suppliers of capacitive touch systems supply several averaging options for their systems. Picking the right averager is in fact critical to the correct operation of the system. Choosing the wrong averager can cause degradation in the sensor sensitivity, or even a lock up condition that will prevent the system from detecting anything.
So, what kind of averaging systems are there?
The polled average just grabs an un-pressed value from the interface periodically (1-10 seconds) and uses that for the average. This is relatively simple, but has a draw back; it can loose sensitivity if it is suddenly placed in close proximity to another metal object. This causes the average value for all of the sensors to jump and when that happens the system’s thresholds are all in the wrong place and it looses sensitivity until a new average is acquired.
The continuous average system combines every 3rd – 5th value into a continuous running average. This overcomes the problem with the polled average, but has a different draw back. If the user holds the button for any length of time, the average will shift down to the pressed value and the difference indicating a touch will disappear. In addition, the average is now offset for the un-pressed value and will take time to recover. Some systems get around the disappearing touch problem by using a software flip flop then set on the negative shift and clears on the positive shift. The average can also be made to recover quicker by resetting the average to the current value whenever the current capacitance value is greater than the average.
The gated average system uses a continuous average system with a guard-band. If the difference between the average and the current capacitance value is less than the guard band, the current value is included in the average, if the current value is outside the guard band; it is not use in the average. This maintains the average near the un-pressed value regardless of how long the sensor is touched, and gets around the problem with the continuous average. But it has the possibility to lock up, particularly when a metal object is placed in the vicinity of the sensor. So if a gated average is used on a hand held device and the device is placed on a metal table top, there is the possibility that the system will stop working until it is removed from the table. There is also the possibility that the un-pressed capacitance value could shift while a button is pressed (due to a temperature / humidity change) which would put the un-pressed value outside the guard band with no way to recover.
A dual average system can solve the temperature drift problem by using two different averages, one for the un-pressed state, and a second for the pressed state. The un-pressed state average is then used to set the press threshold and the pressed state average is used to set the un-press threshold. That way the system always has a good threshold, which tracks environmental conditions, to determine both the press and release of the sensor.
There are also other averaging systems, many of which are proprietary, which have been optimized by specific user interface conditions. However, the systems mentioned here are some of the more common ones that have been published.
So, capacitive touch works because the iron in our blood makes millions of little capacitors that capacitively couple every surface of our body to every other surface. When we touch a capacitive sensor, this capacitive coupling increases the capacitance of the sensor. The capacitance of the sensor is measured using one of several different methods, and the software in the system detects the touch by comparing the current capacitance against the current average capacitance for the sensor. So, as you can see, it is not really rocket science; there are just has a few subtleties that make a cap touch design a little challenging, but your don’t have to understand field theory to make a cap touch system work.