When a capacitive touch screen goes into sleep or standby mode to save energy, how can you design the system to wake up quickly without degrading its performance or burning a lot of power. Here are two options: a traditional method and a new MCU-based method.
Touch-sense keys are gaining popularity with both end users and developers of everyday human-interface applications because the technology is aesthetically appealing, easy to use, and avoids any mechanical design. In particular for developers, capacitive touch sensors are popular because they can be implemented using a copper pad as part of the standard printed circuit board's design.
Employed as a user interface to electronic equipment, capacitive touch sensors may be arranged in a keypad matrix and are activated (controls a signal indicating activation) by a change in capacitance of the capacitive touch sensor when an object, usually a user's fingertip, causes the capacitance of the capacitive touch sensor to change (see sidebar on for details).
The basics of capacitive touch-sensing technology
The recent success of the capacitive-sensor scroll wheel, now being used in quite a few devices, has given this technology an edge over other touch-sense technologies.
When any object with capacitive characteristics—such as a finger—comes close to a capacitive touch sensor, it acts as another capacitor due to its dielectric nature. This varies the effective capacitance of the system, which is used to detect the touch.
The finger acts as one of the parallel plates, while another parallel plate is connected to the sensor input of the chip, as shown in the illustration below. The iron content in human blood creates strings of capacitors that are aligned to the surface of the body. When such strings of capacitors come in proximity with a conductor, a capacitance that is essentially coupled to ground is created, which causes a change in the measured voltage, determining the touch.
A typical capacitive touch-sense system is composed of three main functional blocks:
• An analog block for capacitive sensing.
• A controller for processing the data.
• An interface block for communicating with a host processor.
Generally, the keypad matrix of capacitive touch sensors is fabricated on a substrate with a protective covering, such as glass or a clear plastic resin cover, over the capacitive touch sensors. The protective covering may also have alpha-numeric characters thereon, to identify the purpose of each of the associated capacitive touch sensors.
When an object having capacitance, such as a user's fingertip, comes in close proximity to the sensor element, the capacitance value of the sensor element changes. This capacitance change is electronically detected so as to generate a signal indicating activation of that capacitive touch sensor by the object in close proximity thereto. This electronic detection must be performed by an electronic device, which requires power to operate.
But there is a problem. Current technology requires that the electronic device, when in a sleep mode, be awakened before it scans the keypad matrix of capacitive touch sensors. When the electronic device is in a low-power standby or sleep mode, one of two things occur: either response time to the detection of the capacitance degrades or power consumption of the electronic device suffers.
Clearly, what is needed is a way to provide automated scan and control of capacitive keypads—irrespective of whether the major power-consuming logic circuits of an electronic device are in a run, idle, or sleep mode. Being able to scan and control the capacitive touch sensors of the keypad matrix will allow the power-consuming logic circuits of an electronic device to remain in the low-power sleep mode until awakened for processing data or controlling a function. Not having to program for the various power modes of the electronic device simplifies the code in the user software (firmware) application.
This article describes two approaches, both based on voltage variation, that can be used for implementing capacitive touch sensing.
The first approach is implemented with a charge time measurement unit (CTMU) peripheral that can be implemented on-chip with the microcontroller. Cap-touch solutions using the CTMU peripheral will have a faster response, as it has different ranges of current source that help to charge the analog channels at a faster rate—thereby improving the response time of the cap-touch system.
The second approach is the more traditional one which uses the capacitance voltage division (CVD) technique, which uses a microcontroller's on-chip analog-to-digital (A/D) converter and doesn't need a dedicated capacitive-sensing peripheral. The CVD technique is widely used, since it can be implemented with any microcontroller that has an A/D converter. However, the response time is slower when compared with implementations using a CTMU.
Using the CVD method
CVD is most often the technique of choice in low-cost capacitive touch-sensing designs, to produce an output voltage that is a fraction of its input voltage. It's commonly used to create a reference voltage or to get a low-voltage signal proportional to the voltage to be measured.
The CVD method uses only the A/D converter to take a voltage-based measurement by comparing the known, fixed internal sample-and-hold capacitor with the unknown, variable capacitive sensor.
Sensor construction for the CVD is the same as a typical sensor; a sensor is an area of copper on a PCB or similar conductive pad for sensing. The sensor will be tied directly to an A/D converter channel. The rest of the process is done by configuring the A/D converter and I/O in a specific manner.
The basic principle for using the CVD method is as follows:
• It starts with one A/D converter channel charging the internal sample-and-hold cap for the A/D converter to VDD (shown in Figure 1).
• The sensor channel is then grounded, to bring it to a known state.
• After the sensor is grounded, it must be made an input again.
• Immediately after it's made an input, the A/D converter channel is switched to the sensor.
This puts the sample and hold cap, CHOLD, in parallel with the sensor capacitor, creating a voltage divider between the two. Thus, the voltages on the sensor capacitor are the same on the sample and hold capacitor. The A/D converter should be sampled, and the reading represents a ratio between caps. With the addition of a finger touching the sensor, the capacitance of the sensor will increase. As a result, the voltage on the sensor will be lower. The A/D converter readings will increase.
For capacitive touch sensing, an absolute capacitance reading is not required, because all decoding decisions are related to baseline readings.
The CTMU approach
Alternatively, the CTMU technique (illustrated in Figure 2) is based on the use of a flexible analog module (CTMU) that incorporates the following elements:
• A pulse generator.
• An on-chip current source.
• Edge input signal sources.
• Polarity control for each edge source.
• Edge logic for control edge sequences and responses to the edges.
• A/D converter interface control logic.
• Control registers.
• Channels (up to 27) for capacitive or time measurement.
At the heart of the CTMU is a precision current source, designed to provide a constant reference for measurements. The level of current is user-selectable across three ranges, or a total of two orders of magnitude, with the ability to trim the output in ±2% increments (nominal).
As shown in Figure 3, the CTMU is designed to work with an A/D converter for precise measurement of capacitance. The CTMU contains a constant current source connected to the A/D converter channel and uses a constant current source to calculate capacitance changes and the time difference between events.
The CTMU works by using a fixed current source to charge a circuit. The type of circuit depends on the type of measurement being made. In the case of charge measurement, the current is fixed and the amount of time the current is applied to the circuit is fixed.
The amount of voltage read by the A/D converter is then a measurement of the capacitance of the circuit. The voltage read by the A/D is representative of the amount of time elapsed from the time the current source starts and stops charging the circuit.
It can be used to provide up to 27 channels for time or charge measurement, depending on the specific device and the number of A/D channels available. The CTMU can be "programmed" for a variety signal-source variations, via on-chip registers containing control bits for configuring edge source selection, edge source polarity selection, edge sequencing, A/D trigger, analog circuit capacitor discharge, as well as for selecting the current source range and current source trim.
Theory of operation
Operationally, the CTMU peripheral is based upon the following relationship among current, time period, capacitance, and voltage:
I x T = C x V
• I is the constant current source of the CTMU.
• T is the fixed period that the CTMU charges the capacitive touch sensor.
• C is the capacitance of the capacitive touch sensor.
• V is the capacitive touch-sensor voltage, as read by the A/D converter.
By rearranging this equation as follows, a relative shift in capacitance can be sensed by observing a change in voltage:
C = (I x T)/V
Based upon the preceding equation, the different steps that are involved in detecting the touch are as follows:
• The capacitive touch sensor, which acts a capacitor, is connected to a channel that is multiplexed with the CTMU peripheral and A/D converter.
• The touch sensor is initially charged from a constant current source for a fixed time period (T), and the voltage (V) across the sensor is measured using the A/D converter, as illustrated in Figure 4.
• This voltage remains relatively constant in the successive iterations of charge measurement, as long as no change in the capacitance is caused by a touch on the sensor pad.
The availability of a constant current source in the CTMU peripheral, in conjunction with a multichannel A/D converter, provides an effective platform for interfacing to the capacitive touch sensor.
The CTMU peripheral is connected directly to the A/D converter's input, allowing it to connect to any pin through the analog multiplexer. With this configuration, a CTMU peripheral can measure the capacitance of all the sensors that are connected to the A/D converter channels.
The trim bits associated with the current source facilitate the calibration, to counter the external interference and transmission losses.
Factors for effective capacitive touch-sensing designs
Capacitive touch sensing poses various challenges for real-time applications. The following design considerations help to reduce parasitic capacitance and increase finger capacitance, ultimately ensuring better sensor design:
Size of the sensor pad. When designing a capacitive sensor, the shape of the sensor pad is not important. The main concern is the area of the pad, which determines its sensitivity. The larger the pad, the better the sensitivity. As a rule of thumb, the area should be about the size of an average user's finger press (15 x 15 mm). If the size of the sensor pad is larger than optimal, the parasitic capacitance can increase because of the proximity to the ground.
Separation between the sensors. The proximity of the sensor to the adjacent sensors should be considered. When a sensor is touched, the finger introduces additional capacitance not only to the current sensor, but also to the nearby sensors. Therefore, to insulate the finger's capacitance, a space between adjacent sensors must be maintained. Ideally, the sensors' separation should be 2 to 3 times the thickness of the covering material of the capacitive touch-sense system. For example, if the thickness of the covering material is 3 mm, the distance between the sensors should be 6 mm to 9 mm, for a typical capacitive-touch design.
Length of the trace. The trace length between the sensor and the microcontroller must not be too long, which otherwise might have a higher susceptibility to parasitic capacitance. This could change the trace resistance and will affect the sensitivity. Ideally, the length of the trace should not exceed 12 inches (300 mm).
Material and thickness of the covering material. The covering material used and its thickness determines the capacitance of a finger that is transmitted to the capacitive-touch sensor. The covering material used must have a large dielectric constant, to increase the sensitivity. Keep the covering material as thin as possible. If the thickness of the covering material increases, then the crosstalk effect between the sensors increases.
Grounding techniques. The sensing method is affected by the parasitic capacitance of a sensor to ground. This can be countered by placing ground very close to the sensor, which increases the parasitic capacitance and, hence, reduces its effect on the sensor.
Selecting an adhesive. The adhesive is used to secure the covering material to the PCB. The adhesive that is used should be kept thin, in order to keep the sensitivity high. Care should be taken to make sure that there are no air bubbles when applying the adhesive. The bonding instructions of the adhesive should be read before applying it.
Firmware eliminates EMI/EMC
Firmware eliminates EMI/EMC
Factors such as humidity, heat, extent of touch, contaminants on sensors, and EMI/EMC interference can cause dynamic fluctuations in capacitance, thereby impacting the system's capacitive touch-sensing capabilities.
To counter these influences, firmware can be employed with both the CVD and CTMU methods. Trip-level dynamic variation can also be used. These techniques will make the system more robust.
Additionally, this approach allows the use of software filtering, which resists any residual noise on the sensor pad by programming the firmware registers to distinguish between a touched and an untouched condition.
Design teams can develop algorithms for both the CMTU and CVD methods that detect multiple-touch conditions, to help the system differentiate between the intended and the unintended touch. The software can then be calibrated to sense a touch even when there is a thick overlay on the capacitive-touch pad.
Capacitive touch sensing with a CMTU
Figure 5 illustrates a reference design for a capacitive touch-sense application. The microcontroller that is used in the reference design has 13 A/D converter channels that can connect to a maximum of 42 touch sensors.
The design includes four capacitive touch sensors connected to Ports A0 through A3. The CTMU module has a programmable current source that is used to charge the capacitive touch sensors. The USB receptacle is used for application power as a bus-powered device, which uses the microcontroller's on-chip USB engine.
When the sensor is pressed, the firmware can provide feedback by displaying the appropriate status of the touch sensor in the LCD module, driven by the pins in Port D. A six-pin header is provided, for connecting the reference board to a hardware programmer.
The CVD or CTMU
In this article, we've described two approaches to awakening electronic devices that have capacitive touch keypads. We briefly touched on the CVD method, which uses a microcontroller's A/D converter, and went into some detail about the CTMU method, which involves a separate MCU peripheral. The CTMU approach enables the design of scan modules that detect the actuation of any capacitive touch sensor; these modules remain in operation even when major power-consuming circuits of the electronic device are in a sleep mode and will not wake up the major power-consuming circuits until an action requiring the circuits is needed.
This approach reduces the overall power consumption of the electronic device while still maintaining the scanning of the capacitive sensors on such things as keypads. When the CTMU detects a valid key press of a capacitive touch sensor, the CTMU sends an interrupt to the electronic device that brings it out of a sleep mode and into an operating mode, for further processing and appropriate action commensurate with the actuation of the specific capacitive touch sensor.
About the authors:
Nithin Kumar Mada is a senior applications engineer in Microchip Technology's Advanced Microcontroller Architecture division. He is a group leader for the capacitive touch-sense applications team as well as for the PIC18, 8-bit microcontroller products at Microchip's India Design Center.
Harsha Jagadish is an applications engineer in Microchip Technology's Advanced Microcontroller Architecture Division. Harsha has worked on various PIC microcontrollers for applications ranging from user-interface development, energy-meter designs, and personal-electronic-device accessories for smartphones and tablets.
For more information from Microchip about its MCUs and the CTMU and CVD methods, see application notes and product data sheets, available from their website online:
• PIC24F Family Reference Manual, Sect. 11 Charge Time Measurement Unit (CTMU), DS39724B.
• Perme, Tom. "AN1101: Introduction to Capacitive Sensing."
• Davison, Burke. "AN1334: Techniques for Robust Touch Sensing Design."
• Bohn, Bruce. "AN1250: Microchip CTMU for Capacitive-Touch Applications."
• Perme, Tom. "AN1298: Capacitive Touch Using Only an ADC (CVD)."