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.

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 MechanismsAdding 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 FeedbackWhen 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.

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.

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 basedLEDs 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

LED ON/OFFIn 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 EffectsThere 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 brightnessBy 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 FadingBy 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 breathingGradually 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 basedMany 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 FeedbackBuzzers 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.