Capacitive sensing for advanced user interfaces -

Capacitive sensing for advanced user interfaces


Editor's note: Subbarao Lanka and Shruti H of Cypress Semiconductor provide an update on capacitive touch sensor technology and how to use it to design advanced user interfaces for a variety of embedded consumer electronics, white goods, and automotive applications.

Capacitive touch sensing is a popular alternative to mechanical switches and knobs in consumer electronics, white goods, and automotive applications. In traditional designs, capacitive touch sensing is implemented by using a dedicated IC, while advanced user interface features such as proximity sensing, LED dimming, haptics, and liquid level detection are implemented with one or more separate ICs. Using multiple ICs increases board size, BOM cost, and time-to-market. In this article we discuss how to design advanced user interfaces using a single SoC. After giving a brief overview of capacitive touch sensing, we will discuss the following topics:

Feedback Mechanisms: We will demonstrate how to integrate multiple user interface features using a single SoC and how to overcome some of the problems caused by this integration.

Proximity Sensing:
This technology is being widely adopted across many applications. We will briefly discuss the technology and the challenges faced during implementation.

Liquid Level Sensing: This feature is a step beyond the user interface, but it too can be implemented using capacitive sensing technology. We will explain the benefits of using the capacitive sensing method as well as how to overcome common issues with this method.

Capacitive touch sensing basics

Capacitive touch sensors consist of copper pads connected to capacitive sensing controller input pins with traces. Figure 1 shows a typical capacitive sensor.

Figure 1: Cross-section of a capacitive touch sensor

When a finger is not touching the overlay, the capacitive sensing controller measures parasitic capacitance (CP) as shown in Figure 2 . CP is the sum of the distributed capacitance on the sensor.

Figure 2: Parasitic capacitance (CP)

When a finger comes in contact with the overlay it forms a simple parallel plate capacitor called finger capacitance (CF). In the presence of a finger the total sensor capacitance (CX) is defined by the equation CX = CP + CF.

The capacitive sensing controller monitors the sensor capacitance by converting the measured capacitance into a digital value called Raw Counts. The Raw Counts value is used to detect the presence of a finger on or near the sensor. Figure 3 shows the block diagram of a capacitive touch sensing pre-processing circuit.

Figure 3: Pre-processing circuit for capacitance measurement

Feedback Mechanisms
Adding feedback mechanisms to your user interface differentiates your end product and makes the user’s interaction with your product complete. Haptic (tactile), visual (LED, LCD), and audio (buzzer) are the most common types of feedback. Multiple types of feedback can be used in a single user interface. In the past, adding feedback to a user interface meant using multiple ICs in your design, adding BOM cost and board size. An SoC can integrate all of these features into a single chip.

Haptic Feedback
When you touch a button on your cell phone screen, you feel a vibration. This is an example of haptic feedback. The vibrations are created by an amplifier connected to an actuator (DC motor) with Eccentric Rotating Mass (ERM). Haptic feedback enables capacitive touch sense buttons to feel like they press and release and improves the usability of sliders, scrolling lists, and list end stops. Also, haptic feedback gives capacitive touch sense buttons an edge over mechanical buttons by allowing you to select different tactile feedback for each button.

Figure 4 shows a user interface designed with two controllers, one for capacitive sensing and one for haptics drive control.

Figure 4: Capacitive touch sensing and haptic feedback with two controllers

This design includes:

  • User Interface – An overlay surface that senses a finger touch.
  • Capacitive Sensing Controller – A microcontroller that interprets the touch input signals from the user interface. It captures analog signal information and converts it into digital information. It then sends this information to the host.
  • Host or Embedded Application – The host or embedded application determines what the user is touching and commands the haptics drive controller to send the appropriate signal to the actuator hardware.
  • Haptics Drive Controller – A microprocessor that enables the amplifier and drives a PWM signal based on the host device’s input.
  • Amplifier – The amplifier drives the haptics actuator with a differential output.

You can remove the haptics drive controller if you select an SoC for the capacitive sensing controller, as shown in Figure 5 .

Figure 5: Haptics capacitive touch sensing and haptic feedback with SoC

A pulse width modulator (PWM) and a timer in the SoC can generate different kinds of tactile feedback, depending on what the user is touching.

Visual feedback – LED based
LEDs are generally used to indicate the status of buttons, sliders, and proximity sensors. LEDs can give feedback to the user in various forms based on the capacitive touch sensing button’s status. Feedback can range from simple ON/OFF status to complex, and often beautiful, effects.

Figure 6: LED-based visual feedback ok

In its simplest form, LEDs turn ON or OFF in response to a finger touch. For this effect, GPIOs of a Soc are used to drive LEDs in either a sourcing or sinking configuration, as shown in Figure 7 .

Figure 7: LED sourcing and sinking configurations

Advanced LED Effects
There are many applications where simple LED ON/OFF is not sufficient. Most modern TVs have capacitive touch sensing buttons that light up when touched. In these user interfaces, the LEDs behind the buttons generate aesthetically pleasing effects when the buttons are touched. Standing air conditioners require LEDs to have specific effects when certain buttons are touched. In extended capacitive touch sensing user interfaces like sliders, LEDs can produce a comet effect that follows the finger movement along the slider and leaves behind a tail.

For user interfaces requiring such sophisticated visual effects, a single hardware PWM or timer can be used to drive multiple LEDs. By varying the duty cycle of the PWM output you can achieve advanced effects such as variable LED brightness, fading, and breathing.

LED brightness
By varying the duty cycle of the PWM output you can adjust the LED brightness as shown in Figure 8 . This allows you to adjust your user interface brightness in response to ambient lighting conditions.

Figure 8: LED brightness control

LED Fading
By gradually changing the duty cycle between LED states you can achieve a fading effect as shown in Figure 9 . For example, The LED appears to “fade in” (from OFF to ON) when the duty cycle is increased in a series of small steps.

Figure 9: LED fading

LED breathing
Gradually increasing and decreasing the duty cycle between two levels on a continuous basis makes the LED appear to “breathe” as shown in Figure 10 . LED breathing is useful when a system is in idle or stand-by mode. For example, a power button can appear to breathe to alert the user that it is active and can be operated.

Figure 10: LED breathing

When implementing LED effects, you should understand the relationship between the PWM duty cycle and brightness as perceived by human eye.

Visual feedback – LCD based
Many consumer electronics devices, such as MP3 players, have LCD screens and capacitive touch sensing buttons. A single SoC can control both the buttons and the LCD. Figure 11 shows a typical circuit diagram for driving the GLK 24064-25 WB graphics LCD along with a button.

Figure 11: Implementing LCD feedback

In this design, the Soc uses the I2C lines to communicate button status to the host as well as to control the LCD.

Audio Feedback
Buzzers and speakers give audio feedback when a button is pressed, letting the user hear that a touch has been sensed by the system. Common sounds for audio feedback include a momentary chime, pulsing tone, simple click, or constant buzz. Pitch can vary based on the position of a finger and volume can increase or decrease depending on which button is pressed.

A PWM can be used to drive a buzzer. By varying the duty cycle of the PWM output, you can achieve a variety of sound effects.

Figure12: Implementing Audio Feedback with a SoC ok

Challenges of integrating feedback

Noise due to crosstalk
Acommon backlighting technique for panels is to mount an LED under thesensor pad so that it shines through a hole in the middle of the sensor.When the LED is switched ON or OFF, the voltage transitions on thetrace that drives the LED can couple into the capacitive sensor input,creating noisy sensor data. This coupling is referred to as crosstalk.To prevent crosstalk, capacitive touch sensing button traces (shown in Figures 13 and 14 as CapSense Traces) and LED drive traces should be isolated from oneanother. A minimum separation of 4 mm is recommended. A hatched groundplane also can be placed between those traces to isolate them. LED drivetraces and capacitive touch sensing button traces should not be routedtogether.

Figure 13: NOT Recommended – LED and button (CapSense) traces in close proximity

Figure 14: Recommended – LED and button (CapSense) traces with wide separation

Anotherapproach to reducing crosstalk is to slow down the rising and fallingedges of the LED drive voltage using a filter capacitor, as shown in Figure 15 . The value of the added capacitor depends on the drive current requirements of the LED; however, a value of 0.1 µF is typical.

Figure 15: Filter capacitor solution for crosstalk

These recommendations also apply to the PWM signals used for haptic and audio feedback.

ISR overhead

Ifyou use timers or software counters to generate software PWMs, the ISRshould be optimized for execution speed, even if it requires additionalmemory.

Noise due to IR-drop
If your design uses GPIOsto drive LEDs in sinking mode, you may suffer from noise on the IR-drop.When multiple GPIOs sink current at the same time, the IR-dropincreases and shifts the ground (reference level). This is a majorproblem as it can cause false triggering of the buttons. To avoid thisproblem, minimize the overall sinking current.

LCD inverter noise
Ifyour design includes an LCD inverter you must be careful to keep itfrom upsetting the capacitive touch sensing system. An LCD inverterinduces a lot of noise and reduces SNR drastically.

A simpletechnique to minimize LCD inverter noise is to partition the system withnoise sources from the capacitive touch sensing inputs, as shown in Figure 16 . Even a few inches can provide the extra margin required for good sensor performance.

Figure 16: Separating noise source from capacitive touch sensing interface

Proximity sensing with capacitive sensing

Asdiscussed earlier, capacitive touch sensing buttons detect a finger’spresence through overlays made of non-conductive materials such asacrylic and glass. In medical and industrial applications, the buttonsare operated using gloves. In such cases, the gloves thickness adds tothe thickness of the overlay. This reduces the sensitivity of buttonsand may cause the touch of a finger to go undetected.

Inapplications like digital photo frames, LCD monitors/TVs, ID-consciousproducts, and hidden intercoms, the capacitive touch sensing buttons arehidden. When a human hand approaches the device, the front panel canlight up with LEDs to provide an enhanced user interface.

Inbattery-powered applications low power consumption is crucial. It is achallenging task to optimize both response time to a button touch andpower consumption.

When you bring your cell phone near your earfor talking, you do not want the touchscreen to be activated when yourface touches it. The touchscreen should be deactivated when the phoneapproaches your ear and reactivated when it is taken away.

Thesolution to all of these issues is proximity detection using capacitivesensing technology. Capacitive sensing is by definition proximitydetection. For standard buttons, the thickness of the overlay is theproximity setting. The sensor response is highest when a finger istouching the overlay. In true proximity sensing, no contact is requiredbetween the sensor overlay and the user's finger or hand. In thisapplication, it is necessary to increase the sensitivity of the sensorover that required for buttons.

Increased sensitivity isrealized by acquiring data from the sensor for a greater time. Longeracquisition times allow very small changes in capacitance that arisefrom more distant conductive objects to be magnified. Therefore, it ispossible to detect conductive objects over greater distances whileachieving the kind of update rate and response time required.

Inbattery powered applications, only the proximity sensor is scanneduntil the hand approaches. Once the proximity sensor is triggered, therest of the buttons are scanned for button touches. Thus, this algorithmsaves power. One more advantage is that it fastens the response timefor button touches, as buttons start getting scanned at a fast rate assoon as the hand approach is detected.

Types of proximity sensor implementation
Differentapplications have different proximity detection range requirements aswell as restrictions on PCB layout. These two factors have led to avariety of different proximity sensor patterns. The most commonly usedare:

Gang proximity sensor
This is accomplishedby combining multiple sensor pads into one larger sensor using firmwareto connect and disconnect the sensors from the internal analogmultiplexer bus of the Soc. This method can be used when requiredproximity detection range is 1 or 2 cm.

Proximity sensor using wire
Thismethod gives a larger proximity detection range and is commonly used inapplications where there are curved surfaces that cannot accommodatelong PCBs.

Figure 17: Proximity sensor using wire

Proximity sensor using PCB trace
This version of a proximity sensor consists of a long trace around the perimeter of the user interface, as shown in Figure 18 .This method provides a larger proximity detection range than gangproximity sensing and is easier to mount than proximity sensors that usewires.

Figure 18: Proximity sensor using PCB trace

Challenges of proximity sensing

High sensor CP
Toachieve a large proximity detection range, the proximity sensor loopsize must be large. However, this long sensor trace has a high CP andwill need to be scanned for a longer time for accurate touch detection.This results in increased power consumption and decreased response time.One way to reduce CP is to use a shield electrode, as shown in Figure 19 .

Figure 19: Proximity sensor using PCB trace and shield electrode

Inorder to get good proximity detection range, the sensor data needs tobe scanned for a longer time than for simple buttons. Longer acquisitiontimes allow very small changes in capacitance that arise from moredistant conductive objects to be magnified. This also magnifies thenoise seen by the system, which reduces the signal-to-noise ratio (SNR).

Softwarefilters can be implemented to reduce noise and improve SNR. IIR filtersof the appropriate order are used for white noise while averagingfilters are used for periodic noise.

Metal object
Metal objects close to the proximity sensor significantly degrade the proximity detection range. Figure 20 illustrates the effect of a metal object. When a ground casing or metalobject is close to the PCB, the electric field lines converge towardthe conductive object.

Figure 20: Proximity sensor using PCB trace and shield electrode; metal object near proximity sensor

Placing a shield electrode between the sensor and the metal object eliminates this effect, as shown in Figure 22 .

Figure 22: Metal Object near Proximity Sensor with Shield Electrode

Liquid Level Sensing
Watertanks, coffee vending machines, and fuel systems are examples ofapplications that require liquid level sensors. Mechanical floats,ultrasonic sensors, and conductivity measurements are some of themethods commonly used to perform liquid level sensing. However, thesesolutions have significant drawbacks, including poor reliability and theinability to be used with beverages and flammable liquids. Usingcapacitive sensing to perform liquid level sensing is a robust andreliable solution.

Capacitive sensors external to the reservoirmeasure the change in capacitance caused by a change in the liquid levelas shown in Figure 23 .

Figure 23: Sensor Capacitance with Liquid

Theobject capacitance (CO) is the capacitance measured on the outsidesurface of the tank when liquid is present. The total sensor capacitanceis defined by the equation CX = CP + CO.

Challenges of liquid level sensing

Liquid present at power up
Asseen in the above equation, CX is CP when there is no liquid in thetank. The capacitive measuring system detects the presence of liquidwhen CX increases by CO. A problem occurs when liquid, CO, is present onthe sensor at power up. CO will be considered to be part of CP, and thesensor will fail to detect the liquid.

There are two ways to solve this problem.
1. A virtual sensor is a dummy sensor with similar physicalcharacteristics to the actual sensor. The virtual sensor does notcontact with the liquid in any way, it must remain unaffected by liquid.The raw counts of the virtual sensor will be used as reference for theactual sensor as both these sensors posses same physical properties andmust have same baseline ideally.

Figure 24: Board with virtual sensor

2.Alternately, you can measure CP during the design phase of your projectand store it in nonvolatile memory to be used as a reference.

Temperature drift
Temperaturedrift affects many of the parameters used for capacitance measurement,including CP, current source, and external passive components. This canchange the Raw Counts measured for a specific sensor capacitance, asshown in Figure 25 , and break the liquid level sensing system.

Figure 25: Temperature (oC) vs. Raw Counts measured without varying sensor Capacitance

There are two ways to account for temperature drift:

1.As mentioned earlier, a virtual sensor has the same physicalcharacteristic as the actual sensor, so the effect of temperature onboth the sensors will be same. When the differential capacitance betweenthe two sensors is measured the temperature effect is eliminated.

2.Another solution is to use a software algorithm that creates andupdates a reference based upon how quickly Raw Counts change. Ingeneral, temperature drift occurs slowly in comparison with the increasein capacitance caused by the presence of liquid. Therefore, analgorithm can be used where the reference is increased when Raw Countsincrease slowly and decreased when Raw Counts decrease slowly. This onlyworks if the temperature drift is slow compared to the change caused bythe liquid. If this is not the case, a virtual sensor is the bestsolution.

Tank wall thickness
The tank wall acts as theoverlay in the capacitive measuring system. As the thickness of thetank wall increases, the change in capacitance caused by the liquiddecreases. Thus small change in capacitance might go undetected. Thiscan be corrected by scanning the sensor for a longer time.

Liquid viscosity
Every liquid possesses a unique viscosity. Table 1 gives the viscosity of some common liquids.

Table 1: Viscosity

Lowviscosity liquids such as water can be accurately measured withcapacitive sensing. However, higher viscosity liquids can leave aresidue on the side of the tank when it is emptied. This residue canimpact the capacitance measurement system and delay when the systemdetects that the tank is empty.

Capacitivesensing technology is gaining momentum in many markets, from consumer toindustrial, primarily due to its ability to sense robustly. Another keyfactor in the success of this technology is its ability to combinemultiple user interface features as well as features beyond the userinterface into a single Soc. This type of flexible integration isinvaluable in markets where there is constant innovation and competitionamongst technologies. As innovations continue to emerge, capacitivesensing technology can make applications feature rich, power savvy, andeven more user-friendly.

Subbarao Lanka is a SeniorApplications Engineer working in Cypress Semiconductors on CapacitiveTouch Sensing applications since 2007. His responsibilities includedefining technical requirements for new capacitive sensing controllers,developing new capacitive sensing controllers, conducting systemanalysis, debugging technical issues for customers, and technicalwriting. He can be reached at

Shruti H is an Applications Engineer working in Cypress Semiconductors onCapacitive Touch Sensing applications since 2009. She works on definingdebugging technical issues for customers, technical requirements for newcapacitive sensing controllers, developing new capacitive sensingcontrollers, conducting system analysis, and technical writing. She canbe reached at

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.