Optimizing Proximity Sensing for Consumer Electronics Applications

Por Nicholas Cravotta

Colaboración de Convergence Promotions LLC

Capacitive sensing is being utilized in a wide variety of consumer electronic applications to replace mechanical buttons and switches with a sleek, robust touch interface. When a user’s finger is close enough to the display, the capacitance of a sensor beneath the screen changes and allows the system to accurately determine the relative position of the finger. The flexibility and cost advantages of touch-based interfaces, as well as the enhanced interfaces made possible with gesture recognition, have led to the rapid adoption of capacitive touch sensing across nearly every industry.

The same capacitive technology used to detect touch, however, can also be used to detect the proximity of a finger as it approaches a device. This type of proximity sensing can be used to further enhance a device’s user interface in many ways:
  • Approach-to-wake: Portable devices power down when they are not used within a set time. Rather than wait for a user to physically touch a device to wake the system and then have the device turn on backlighting for the display, a low-power proximity sensing subsystem can detect that a person is reaching to pick up the device and turn backlighting on automatically.
  • Hover: With proximity sensing, a person could hold a finger above the screen to make it easier to move a cursor or to perform three-dimensional gestures (i.e., zoom in and out as a finger moves closer and further from the device).
  • User Position: Users can interact with devices in numerous ways, especially portable devices. These various “use cases” impact how the system needs to respond to the user. For example, when a cell phone is up against a person’s ear, the touch display needs to be disabled so an ear does not press the END button. Using multiple proximity sensors, a device can dynamically adjust its operation depending upon how it is being held and used.
  • Fluid Level: Fluid levels can be measured by sensing the proximity of the surface level of liquids in a storage tank.
The variety of applications that can make use of proximity sensing is endless, including consumer, embedded, industrial, communications, and medical applications. For example, the following is a short list of battery-operated applications that can benefit from approach-to-wake and other proximity-based functionality:
  • Remote-control backlighting (auto on/off)
  • Wireless mouse (auto on/off)
  • Coffee maker (water-level sensing)
  • Automatic fluid-level sensing
  • Gaming controller (auto on/off)
  • Cell phone (backlighting, face/talk detection)
  • Tablet computer (auto on/off, backlighting)
  • Vehicle remote keyless entry (RKE) (initiate transponder challenge/response)
  • Inventory-level detection
This article will cover how to implement proximity sensing and tune sensors to create a reliable interface.

Proximity sensing basics

Proximity sensing brings the third dimension to capacitive sensing. The science behind proximity sensing is very similar to touch sensing (see Figure 1). In fact, most proximity use cases can be supported using the same underlying technology used to measure capacitive touch. This has an impact on system cost in that a significant portion of the capacitive application software library is shared between touch and proximity functions. Thus, the incremental cost is minor in terms of additional memory to store code to support proximity sensing when a system already supports capacitive sensing.

The science behind proximity sensing

Figure 1: The science behind proximity sensing is very similar to that used for capacitive touch sensing. C = capacitance/sensitivity, Er = relative permittivity, A = overlapping area, and d = distance (Courtesy Microchip).

What is different is how the sensitivity and event thresholds for proximity sensing need to be managed. For example, the differential capacitance of a finger several inches away is much less than that of a finger registering a touch event (see Figure 2). Thresholds need to be higher for proximity sensing to reflect the greater range. The smaller difference means that proximity sensing requires longer sampling, higher accuracy, and potentially more attention addressed to noise (see Figure 3).

The differential capacitance of a finger

Figure 2: The differential capacitance of a finger several inches away is much less than that of a finger closer to the sensor (Courtesy Microchip).

Accurately detect proximity events

Figure 3: This table shows how it is easier to accurately detect proximity events closer to the sensor (Courtesy Microchip).

Sensitivity, for example, depends upon the physical size and shape of the sensor (see Figure 4). To achieve the right sensitivity for an application, the sensor must be sized relative to the object the system is trying to detect. Figure 5 shows the expected sensitivity for a particular sensing distance based on sensor size.

Sensitivity depends upon the size

Figure 4: Sensitivity depends upon the size of the proximity sensor being used (Courtesy Microchip).

The sensitivity of a proximity sensor

Figure 5: The sensitivity of a proximity sensor depends upon the size of the sensor, its relative size to the target being detected, and the distance the target is from the sensor (Courtesy Microchip).

Typical range for a capacitive proximity sensor in most applications is two to four inches. Range can reach six inches if the system has a strong signal and noise-free operating environment. Depending upon the intelligence of a proximity sensor node, the value received from the sensor by the application can either be a simple detect/no detect or an analog value to reflect the distance a finger is from the sensor. Working with a simple threshold is appropriate for some use cases, such as whether a phone is up to a person’s ear or not. Working with a proximity value enables more advanced evaluation of a user’s position relative to the device. For example, tracking the change in value enables an application to evaluate whether the device is moving closer to the user or further away. Change in value also enables the system to determine the speed of a user’s movement.

In general, proximity sensors are useful from one direction. Consider that a proximity sensor that is oriented flat to the display will detect a finger from both the front and back of a device. However, to detect a finger from the back using a sensor located on the front of a device requires assessing the capacitance through all the circuits and PCB layers, including ground planes, which introduces a lot of noise. To accurately detect proximity from the back, a separate sensor will likely be required on the back of the device.

It is important to note that any front sensors will still have to account for the effect on capacitance from a user’s hand holding the device. This is where use cases become important. The capacitance on a sensor when a finger is approaching a device is different when the device is being held in a user’s hand (or on their lap) compared to when the device is lying on a wood table. To accurately sense proximity, the device will need to adjust its thresholds accordingly.

One of the key benefits of using proximity sensing is to accurately determine how a user is actually holding and using a device. This can be achieved by positioning multiple sensors around a device’s enclosure. Rather than having only a limited “one-dimensional” view of the user (i.e., how far away is the user), the device can actually determine how and where the user is holding and interacting with the device. With this additional positioning information, the system can anticipate how a user wants to use a device to increase usability by creating an even more intuitive interface experience. For example, a device could detect if it is merely being held so it can quickly drop into standby mode. Similarly, if a device detects that the user is holding it out in front of herself, the camera application can be automatically loaded.

It is important to note that proximity sensing is still a new technology to many users. They are not used to it, so they don’t act in a consistent way. Developers will want to test their configuration and sensitivity to ensure the final interface experience feels natural to users.

Design with proximity sensing

Many vendors, including Cypress Semiconductor, Microchip Technology, and Texas Instruments, offer proximity sensing in a variety of formats and devices. With the rising importance of capacitive sensing, silicon manufacturers are further simplifying design with capacitive sensors by integrating peripherals which eliminate the need for external circuitry when connecting an MCU I/O pin to a capacitive sensor.

Certain members of TI’s MSP430G2xx series of MCUs, including the MSP430G2542, for example, integrate a ring oscillator inside the device to allow a direct connection to the capacitive sensor. All of Microchip’s PIC8 to PIC32 families of MCUs support its mTouch® technology. An internal ADC uses either a 10-bit SAR or Charge Time Measurement Unit (CTMU) but the result is the same – developers can connect the proximity sensor directly to any ADC on the device allowing support of multiple sensors. Cypress’ TrueTouch® controllers are based on Cypress’ mixed-signal programmable PSoC® architecture which allows developers to implement a high level of signal processing and sensor functionality with each proximity sensor.

Given that a capacitive sensor can be as simple as a wire or a trace on the PCB, the ability to directly connect to sensors simplifies design and manufacturing while keeping system cost extremely low. It also results in board space savings, which is also a critical consideration for many consumer devices.

Developing a proximity sensing subsystem initially is fairly straightforward and developers can have an operational system up in less than an hour. TI, for example, has designed its Capacitive Touch Sense Library to operate on all of its MSP430 processors. The library provides the necessary code and drivers to support different sensor configurations, including proximity sensing, and developers can tune the complex sensing algorithms through a simple API by adjusting various parameters, including scan rate, scan time, and event thresholds. Application code is alerted to sensor events and can take appropriate action, depending upon the current use case. TI provides the 430BOOST-SENSE1 Capacitive Touch Booster Pack which works with the MSP430 LaunchPad Development Kit to enable developers to evaluate capacitive proximity and touch sensing out of the box.

Microchip provides capacitive sensing libraries which run on all PIC8 to PIC32 MCUs. Microchip’s implementation is open, giving developers access to the source code, enabling them to tune the code and work with raw capacitive values or event detection thresholds. Developers can experiment with proximity and touch sensing with the AC103003 PIC10F mTouch Capacitive Demonstration Board.

Cypress also offers several development kits to assist with the prototyping, development, and tuning of capacitive proximity and touch sensing applications, including the CY8CKIT-003 FirstTouch™ Starter Kit for PSoC 3.

Tuning for performance and accuracy

Because it is relatively easy to get a capacitive touch and proximity sensing system up and running on a test bench, developers may feel that most of the work is done at this point. The reality is that it can be quite challenging to ensure that an implementation is truly robust. Even though two devices are the same product, small variations and tolerances in the manufacturing process can impact proximity sensing accuracy. Environmental conditions, such as humidity and temperature, can also affect results. Developers also have to take into account different types of noise. A cell phone, for example, sometimes radiates noise (i.e., during a call) or experiences conducted noise (i.e., when plugged into a noisy power source like a car charger).

Each of these sources needs to be addressed in different ways. Product variances, for example, can be addressed through calibration. For the least impact on manufacturing, calibration can be automated and regularly recalculated. Environmental conditions tend to be slow changing, and proximity sensing algorithms are designed to dynamically track these changes and compensate for them. Noise can often be associated with specific use cases (i.e., incoming call, device plugged into charger) and thresholds adjust accordingly.

The speed with which changes in the proximity value occur can be used to identify environmental changes as well. If there is a slow change in capacitance, there has likely been a shift in temperature. Similarly, if the change is fast (i.e., too fast to be a person moving), then a new source of noise or interference has likely been introduced which needs to be identified and compensated for by shifting the current use case.

Many sensor libraries are designed to provide dynamic compensation for a variety of noise sources and environmental conditions. They offer some digital filtering and automatically recalibrate the default capacitance level so the sensor is able to detect the presence of a finger or hand. However, while these algorithms can compensate for known sources, they are limited in their ability to handle major shifts in use without a bit of help from the application.

Tuning the sensitivity threshold of a capacitive proximity sensor is similar to tuning a capacitive touch sensor and can consume a significant amount of time. This is where the definition of use cases comes into play. Use cases help the proximity sensing subsystem to maintain its accuracy by utilizing higher, system-level information. For example, if a hand is approaching, the system needs to prepare for the device being held and the presence this hand around the device will have on sensing. Similarly, if the user lays the device down, the default capacitance level will change and the sensitivity of thresholds needs to be adjusted accordingly. The system also has to account for when a user holds onto a device for a long time as the sensor will build up capacitance over time in a way that will affect accuracy.

To prevent the system from erroneously detecting a user or failing to detect a user, these thresholds need to be adjusted for the various use cases that can arise. For example, if a system tends to wake on false detects, this will affect operating life for portable applications. Conversely, a system needs to be able to respond quickly enough to be robust and reliable.

Optimizing power

One of the key advantages of capacitive proximity sensors, compared to other proximity sensor technologies, is its power efficiency. Optical proximity sensing, for example, provides the highest accuracy and range but requires a camera and so is often not an option for price-sensitive applications. Passive iR proximity sensing is used today in cell phones to determine whether the user has lifted the handset up to their ear or not. In general, passive iR proximity sensors are well-suited in applications where range is important. Passive iR can accurately measure distance close up as well as many feet away. However, because a passive iR sensor is line-of-sight, it requires a window in the enclosure to operate. While excellent for longer range applications such as security, passive IR sensors tend to be relatively power hungry, consuming tens of mAs when they are sampling.

A capacitive proximity sensor can provide effectively continuous scanning while consuming less than 5 µA (average power). For some modes, depending upon the use, power can drop down to 1 µA. Also impacting power efficiency is the low duty cycle required to track human movement. Humans move quite slowly, compared to computers, and a scan rate of 500 ms is sufficient for applications merely detecting a user’s presence (e.g., sensing when a user is picking up a device). If more complex interactions (such as three-dimensional gesture recognition) or fast responsiveness are required, a faster scan rate will be necessary, depending upon the complexity of the interaction. For some use cases, such as detecting when a user has lifted a device to his or her face, a scan rate of one second may be enough.

What makes a capacitive proximity sensor superior to a passive iR sensor is that its power efficiency coupled with the low scan rate required for tracking human motion enables systems to continuously sense proximity. This capability can increase ease-of-use while reducing system cost. For example, many devices today require a physical key press or accelerometer event to wake the system. Through the efficiency of continuous capacitive proximity sensing, systems can instead wake when they are approached by a user. This eliminates some negative use cases as well (for example, a system that wakes via an accelerometer will wake when bounced on a couch or whenever a car turns sharply).

More importantly, approach-to-wake functionality can result in the complete elimination of physical buttons on a device. Specifically, devices that use a physical button to wake do this so they can turn off all of a system’s capacitive touch sensors and conserve power when in standby. With the low-power efficiency of a capacitive proximity sensor, a single sensor can wake the system. Thus, there is no longer a need for any physical buttons to serve as an on/off switch. This allows devices like handsets and remote controls to be completely touch-based. The result is a more intuitive interface that responds quickly and is lower cost by eliminating all mechanical button components.

The ability to always be sensing proximity also enables devices to implement more intelligent power management. A typical wireless mouse, for example, must always keep its laser on so that it can respond to a user. With proximity sensing, the mouse could detect whether it is being held or not. When it is not being held, the laser can be turned off. Since a capacitive proximity sensor consumes significantly less power than the mouse’s laser, product operating life is substantially increased.

Note that the MCU has to turn on to process a scan. With a low scan on the order of 500 ms, however, the impact on standby efficiency is negligible. The other factor impacting power efficiency is the scan time or scan window. A longer scan window consumes more power but results in greater sensitivity (i.e., better noise removal that leads to better accuracy at longer ranges) since the sensor can gather more charge. For a simple approach-to-wake function, accuracy is less important so a short window can be used. To detect three-dimensional gestures, a longer window may be necessary.

One common error developers make is tuning their system to the prototype. When the system is placed within the production enclosure, however, the difference in plastic thickness and air gap between the electrode and user can change the system’s responsiveness. The development team should shift from using a development board to the final enclosure as soon as possible to avoid this. Note that optimizing sensitivity is not done at the algorithmic level. It is a mix of adjusting thresholds to a wide range of use cases. Effectively, developers need to create a comprehensive state machine which covers all of the ways a user can hold and use a device. This level of thoroughness is the only way to ensure the system will react in a predictable and consistent manner.


Proximity sensing is the next step in the future of portable, consumer, industrial, and medical electronics. The use of multiple sensors increases usability by enabling devices to predict how users want to use them, providing the ultimate intuitive user experience. With its power efficiency, capacitive proximity sensing can also be used continuously to provide approach-to-wake functionality while eliminating the need for any mechanical buttons. By building on the same technology used to implement capacitive touch sensing, proximity sensing can be introduced to systems for a minimal increase to cost. 

Descargo de responsabilidad: Las opiniones, creencias y puntos de vista expresados por los autores o participantes del foro de este sitio web no reflejan necesariamente las opiniones, las creencias y los puntos de vista de Digi-Key Electronics o de las políticas oficiales de Digi-Key Electronics.

Acerca de este autor

Nicholas Cravotta

Nicholas Cravotta ha sido editor técnico de EDN, Programación de Sistemas Integrados y Diseño de Sistemas de Comunicaciones, y fue el editor fundador en jefe de Multimedia Systems Design. Con diecisiete años de experiencia como ingeniero en ejercicio, entiende de primera mano los problemas que hay detrás del diseño de sistemas complejos. Ha trabajado con sistemas integrados en tiempo real, ha escrito software de aplicación para PC y estaciones de trabajo, ha construido un sistema operativo desde cero, ha desarrollado herramientas internas de desarrollo y prueba de software y hardware, y ha portado software entre plataformas, entre otros proyectos. Ha escrito más de 800 artículos publicados, ha enseñado programación y escritura técnica en UC Berkeley, y es un galardonado diseñador de juegos en su tiempo libre.

Acerca de este editor

Convergence Promotions LLC