Detection1This article describes how a technique consisting of a Capacitance Voltage Divider (CVD) and a peripheral microcontroller called a Charge Time Measurement Unit (CTMU) can be used to create low-cost capacitive touch sensors with a minimum of external components. Finally, a reference design will demonstrate how to replace mechanical switches with capacitive touch keys.


Capacitive Touch Sensor Technology
The capacitive sensor scroll wheel is increasingly predominant in electronic devices compared to other touch sensor technologies.


Operating Principles of the Capacitive Touch Sensor:
If a finger—or any other object with capacitive properties—approaches a capacitive touch sensor sufficiently, the sensor acts as another capacitor. This is due to the dielectric nature of the sensor, which varies the effective capacitance of the system used to detect touch.
Figure 1 shows how the parallel plate is connected to the sensor chip's input, while the finger acts as another parallel plate. The iron in blood creates bundles of capacitors aligned with the body's surface. When these bundles approach a conductor, they create a grounded capacitance, resulting in a change in voltage, determined by the finger contact.
A standard touch detection system consists of three main functional blocks:


An analog block for capacitive detection.
A controller for processing the data.
An interface block for communication with a host processor.


Capacitive touch detection solutions based on voltage variation can be effectively implemented using techniques that employ the following components:


- A peripheral charge time measurement unit (CTMU) integrated into a microcontroller
- A capacitive voltage divider (CVD), using the analog-to-digital converter (ADC), which does not require a dedicated peripheral for capacitive sensing

Detection2


* Effective Application of Capacitive Touch Sensing Using the CTMU Peripheral
The CTMU peripheral works in conjunction with an ADC to form a flexible analog module for the precise measurement of capacitance. As shown in Figure 2, it contains a constant current source connected to the ADC channel. The capacitance changes, and the time difference between events is calculated by the CTMU using a constant current source.


The CTMU's response will be faster than the CVD's because its current source has several Detection3selectable ranges. The response time of the capacitive touch system improves due to the faster charging of the analog channels.
The use of a CTMU peripheral for capacitive touch detection is summarized in the following equation:

I x T = C x V

Where
I is the constant current supplied by the CTMU source.
T is the fixed time during which the CTMU charges the capacitive touch sensor.
C is the capacitance of the capacitive touch sensor.
V is the voltage of the capacitive touch sensor, as read by the ADC.


A relative shift in capacitance can be detected by observing a change in voltage if the equation is readjusted:

C = (I x T) / V

This equation highlights the different steps involved in tactile contact detection, as follows:

The capacitive touch sensor functions as a capacitor and is connected to a multiplexed channel with the peripheral CTMU and the ADC.
The touch sensor is initially charged from a constant current source for a preset time (T). The voltage (V) across the sensor is measured by the ADC (Figure 3).
As long as there are no changes in capacitance due to touch on the sensor, this voltage remains relatively constant in successive iterations of the charge measurement.
Legend:
1. CTMU current source inactive
2. Analog-to-digital conversion (ADC) performed
3. Capacitive sensing circuit discharged
4. CTMU current source active

 

In conjunction with a multi-channel ADC, the availability of a constant current source in the peripheral CTMU provides an effective interface platform for the capacitive touch sensor. The peripheral CTMU connects directly to the ADC input, allowing it to be connected to any pin via the analog multiplexer. With this configuration, a single peripheral CTMU can measure a number of sensors equal to the number of ADC channels.
Calibration to counteract external interference and transmission losses is facilitated by the adjustment bits associated with the current source.


**The CVD for Capacitive Touch Sensing**
By comparing the fixed, known-value capacitor of the sample-and-hold (S/H) circuit with the variable, unknown-value capacitive sensor, the capacitive voltage divider (CVD) method uses only the ADC to perform a voltage-based measurement.
The CVD is manufactured identically to a typical sensor: a copper surface on a printed circuit board or similar conductive substrate for sensing, directly connected to an ADC channel. The rest of the process is completed specifically through the precise configuration of the ADC and I/O.
The basic principles for using the CVD are:

 

One channel of the ADC charges the internal capacitor of the ADC's sample-and-hold circuit to VDD.
The sensor channel is then grounded to bring it to a known state (Figure 4).
After grounding, the sensor must become an input again.
Once it becomes an input, the ADC channel is immediately connected to the sensor.


A voltage divider is created because the sensor capacitor is in parallel with the sample-and-hold capacitor, CHOLD. As a result, the voltages across the sensor capacitor are the same as those across the sample-and-hold capacitor. The ADC should be sampled, and the reading represents a ratio between the capacitors. When a finger touches the sensor, its capacitance increases; the voltage across the sensor will decrease, and the ADC readings will also increase.

Detection4
An absolute capacitance reading is not necessary for capacitive touch detection, because all decoding decisions are related to reference values.


Firmware Development to Eliminate External Interference:
Dynamic fluctuations in capacitance are caused by factors such as humidity, heat, contact pressure, contaminants on the sensors, and EMI/EMC interference, which affect the functionality of the system's touch sensors. To counteract these factors and strengthen the system, firmware can be used that enables dynamic averaging detection, anti-bounce functionality, and dynamic trigger level variation.
To resist residual noise in the sensor, filtering software must be incorporated; this allows the firmware to distinguish between an activated and an inactive sensor condition. The algorithm can be designed to detect multiple touch contacts and distinguish between desired and undesired contacts. The software can then be calibrated to detect a touch contact even when there is a thick coating over the capacitive touch layer.


Reference design for capacitive touch sensing applications

Figure 5 will help the user to immediately begin implementing a capacitive touch sensing system. This approach offers great flexibility for integrating other peripherals, such as USB and LCD, into the design. This can also help reduce the time to deliver the touch sensing system in a fully functional state. The microcontroller used in the reference design has 13 ADC channels for connecting to up to 13 sensors. Four capacitive touch sensors have been connected to ports A0–A3. The CTMU module has a programmable current source used to charge the capacitive touch sensors. The USB socket is also used as a bus-powered power source, utilizing an on-chip USB interface. The firmware can also provide information by displaying the appropriate touch sensor state on the LCD module via the pins of port D when the sensor is touched. A 6-pin male connector is also supplied for connecting the reference panel to a hardware programmer

Detection5
Factors Contributing to the Design of Effective Capacitive Touch Sensors*
Real-time applications present a number of challenges for capacitive touch sensors. Design can help reduce parasitic capacitances and increase finger capacitance, ultimately ensuring better sensor design, as detailed below:


Sensor substrate size. The shape of the sensor substrate is not important for a capacitive sensor, but the substrate area determines its sensitivity and therefore deserves consideration. The larger the substrate, the better the sensitivity; the area should be about the average size of a fingertip (15 x 15 mm). However, if the sensor substrate size is larger than optimal, parasitic capacitance can be increased due to its proximity to ground.
Sensor spacing. When a sensor is touched, the finger introduces additional capacitance, not only in the activated sensor but also in adjacent sensors. Therefore, to isolate the finger's capacitance, a gap must be maintained between adjacent sensors. The ideal spacing is 2 to 3 times the thickness of the capacitive touch sensing system's coating material. For example, if the coating thickness is 3 mm, the distance between sensors should be 6 to 9 mm for an effective capacitive touch sensing design.
 Printed circuit board trace length. The trace length between the sensor and the microcontroller can create greater susceptibility to parasitic capacitances if it is excessively long. This could change the trace resistance and affect sensitivity. The track length should not exceed 12 inches (300 mm).
Coating composition and thickness: The capacitance of a finger transmitted to the capacitive touch sensor is determined by the type of coating material used and its thickness. The coating material should have a high dielectric constant to increase sensitivity and be as thin as possible. If the coating thickness increases, crosstalk between the sensors also increases.
Grounding techniques: The detection method is affected by the parasitic capacitance of a sensor to ground; this can be counteracted by placing the ground very close to the sensor. This increases the parasitic capacitance and reduces its effect on the sensor.
Adhesive selection: The adhesive bonds the coating material to the printed circuit board and should be applied as a thin layer to achieve high sensitivity. It should be free of air bubbles, and all application instructions should be reviewed before application.


Abstract:
With the decreasing cost of touch sensor technology, it is now an ideal option for both industrial and consumer products. The main advantage over traditional mechanical switches is that capacitive touch sensors do not wear out over a long period. Using a CTMU peripheral with an on-chip microcontroller or CVD technology, designers can develop interfaces with capacitive touch sensors at low cost and with a minimum number of components.

If you need more information, please visit http://www.microchip.com/mtouch.

 

References
 1. PIC24F Family Reference Manual, Sect. 11 Charge Time Measurement Unit (CTMU), DS39724B, © 2010 Microchip Technology Inc.
 2. Microchip Application Notes:
    AN1101, Introduction to Capacitive Sensing by Tom Perme, © 2007 2010 Microchip Technology Inc.
    AN1334, Techniques for Robust Touch Sensing Design by Burke Davison, © AN1250
    , Microchip CTMU for Capacitive - Touch Applications by Bruce Bohn, © 2009 Microchip Technology Inc.
    AN1298,  Capacitive Touch Using Only an ADC [CVD] by Tom Perme, © 2009 Microchip Technology Inc.


Author:

By: Nithin Kumar Mada - Senior Application Engineer
Harsha Jagadish - Application Engineer
Advanced Microcontroller Architecture Division - Microchip Technology Inc.

More information or a quote