Capacitive Sensing

Sensor workshop

Deqing Sun

What is a capacitor

A Leyden jar is a device that "stores" static electricity between two electrodes on the inside and outside of a glass jar. It was the original form of the capacitor.

Leyden Jar

Theory of operation

A capacitor consists of two conductors separated by a non-conductive region of insulator. The conductors thus hold equal and opposite charges on their facing surfaces, and the dielectric develops an electric field.

Live Demostration

This is a demonstration of how capacitor works. When external power is applied on capacitor, current will run into capacitor and raise it's voltage until it's voltage is equal to external power source. It discharges in a similar way.

How capacitor is applied to touch sensor

Before we touch the sensor, there is already some distributed capacitance caused by physical structure. When we put finger on sensor, our finger and electrode will form a new capacitor. Then the equivalent capacitance will change from Cp to Cp+Cf. If we can measure this change, we will know there is a touch event.

How to measure capacitance.

 ​ Relaxation oscillator Step response Charge Transfer Pros High accuracy and stability by multiple cycle measurement Extremely simple implementation High accuracy and stability via transfer cycle counting Cons Require special hardware Can't both have resolution and stability More peripheral resource required

Relaxation Oscillator

When this oscillator output high, capacitor will be charged until voltage on it reaches a certain level, and the oscillator flips. Then capacitor is discharged, voltage on it drops till another level and oscillator flips again. Capacitance can be measured by measuring time of fixed oscillating cycles or oscillating cycles of fixed time.

Step response

In capacitance sensing, capacitor is discharged first. Then it is charged through a resistor. t0, time before voltage reaches 1/2 Vcc, is positive related to capacitance. If we look this circuit as filling a bucket with a pipe, a larger bucket needs more time to fill.

Charge Transfer

This method need a sampler capacitor. First sampler capacitor is emptied. Then we fully charge sensor capacitor, and use the fully recharged sensor capacitor to charge sampler capacitor. This process is repeated until sampler capacitor reach 1/2 Vcc. Using bucket as an example, it needs less buckets of water to fill the green one if the gray one is bigger.

Implementation on Arduino

Step response Charge transfer

Dynamic Calibration

Since the sensor is a converter to sample physical world to the digital world. We need to deal with noise and change of environment. A touch event can be characterized as a rising slope in the beginning, holding high for some time, and dropping down in the end. We can use threshold and changing baseline to detect that event.

Dynamic Calibration Logic

If the signal remains under the threshold value for a certain time, we can assign the first value in this period to be the new baseline value. We should not use the newest one because we never know if signal is rising until we have following values after that point.

Interpolation technique

In order to provide better result we need to recognize more position. But is not necessary to implement equal number of sensors to recognizable positions. In fact, our finger will affect several sensor at the same time. By comparing value among adjacent sensors, we can interpolate result to improve resolution.

Interpolation technique

If the sensor takes less space than our finger tip, we will at least affect 3 sensors. By comparing adjacent sensors to the peak sensor, we will get a finer position of finger.

Multi-touch recognition

One limitation of capacitive sensing is ghost point. If we put fingers on check marks position, we will get 2 peaks on both X and Y axises. It is impossible to figure out which combination we are touching

Mutual Capacitance Technique

One way to solve this problem is using mutual capacitance, which can scan each combination of electrodes. When we put our finger on one node, finger will steal some charge, and decrease field coupling on this node.

Capacitive Sensing Presentation - Google Slides