Basics and implementation of capacitive proximity sensing (Part 1 of 2)

(Editor's note : Capacitive proximity sensing has been a very popular topic with our audience over the past year. For your convenience, at the end of this article, there is a hot-linked list of related articles published at Planet Analog .)

Capacitive-proximity sensors have been used widely in industrial applications such as counting products on a conveyor, detecting position of valves, presence of objects etc. In recent years, the use of capacitive-proximity sensors has moved into other areas like automotive (keyless entry) and consumer goods (automatic backlight control).

Capacitive sensing basics
All objects in the universe, conducting or non-conducting, exhibit capacitance with respect to infinity (in practice, the Earth). The capacitance of some common shapes can be found by the following equations:

(Click on image to enlarge)

An object's capacitance increases when another object is brought nearer to it. This change in capacitance is brought about by the capacitance of the approaching object and the mutual capacitance between the objects.

The capacitance between two objects can be understood by the well-known formula for a parallel plate capacitance:

(Click on image to enlarge)

Though the actual capacitance between two objects will depend on the geometry of the objects, the basic rule is that the capacitance between two objects is directly proportional to the area of objects and inversely proportional to the distance between the objects.

Proximity sensing
A proximity sensing system has a sensor (which could be a wire, PCB trace, or a part of the enclosure), a circuit to measure the capacitance of the sensor, and logic to detect the change in capacitance when another object approaches the sensor. Two types of sensors can be used in proximity sensing: dual-pole and single-pole.

Dual-pole sensors have two sensor elements, Figure 1 . The circuit measures the mutual capacitance between the two sensors CAB . When an object approaches the sensor, the mutual capacitances of the object with respect to the sensor elements, CAX and CBX will increase CAB . The change in CAB is measured and proximity is detected.

Figure 1: Dual-pole sensors

Though dual-pole sensing is widely used in many applications, this method suffers from reduced sensitivity.

A single-pole sensor has a single sensing element, Figure 2 . The circuit measures the capacitance CA with respect to Earth. When an object approaches the sensor, the mutual capacitance between the object and the sensor, CAX , causes CA to increase.

Figure 2: Single-pole sensor

For the same size of sensor, single-pole sensors can detect more distance than a dual-pole sensor. A sigma-delta modulator is an effective circuit for sensing capacitance of a single-pole sensor.

Sigma-delta modulator
Figure 3 shows the block diagram of the sigma-delta modulator.

Figure 3: Sigma-delta modulator

(Click on image to enlarge)

Cx is the capacitance of the sensor whose capacitance is to be measured. SW1 and SW2 are break-before-make switches that are operated 180° out of phase by a clock source at frequency FS, which could be in the range of a few hundred kHz to a few MHz. During Φ1, SW1 closes and charges Cx (Figure 4 ). During Φ2, SW2 closes and transfers the charge in CX to CINT . This operation takes place continuously at FS . The quantum of charge that is being transferred is a function of CX and FS .

Figure 4: The switched-capacitor cell

(Click on image to enlarge)

Effectively, SW1, SW2, and CX form a switched-capacitor cell which can be equated to a resistor RX given by formula:

This RX charges the integrating capacitor CINT . When the voltage across CINT exceeds VREF , the output of the comparator goes high, and Rdis is connected across CINT and discharges CINT . When the voltage across CINT goes below (VREF ” Hysterisis), the comparator output goes low. In this process, the comparator tries to keep the voltage across CINT equal to VREF . The percent of time the comparator remains ON represents CX . The greater the value of Cx , the greater the time the comparator output is high.

Bit-stream integrator

For the output of the comparator to be useful, the duty cycle of the comparator output has to be converted to a number. The digital logic shown in Figure 5 does this conversion; we'll call this the bit-stream integrator.

Figure 5: Bit-stream integrator

(Click on image to enlarge)

The output of a PWM gates the bit stream output to the enable input of a counter. Both the PWM and counter are fed by FS, the clock that operates the switches in the modulator. The pulse width of the PWM sets the time frame during which the bit stream output enables the counter. At the end of the PWM ON time, the value in the counter will be proportional to the duty cycle of the bit stream.

By setting the length of the PWM ON time, the resolution of the output can be controlled. For example, if the PWM is ON for 1024 cycles, the resolution is 10 bits. Sensitivity increases as the resolution is increased. The output of the bit stream integrator is passed on to the processing logic. This is usually done in a firmware running on a microcontroller which detects the change in the bit stream integrator output and senses proximity.

Dynamic range
In proximity sensing, we are interested in relative change in capacitance of the sensor than the actual capacitance. By adjusting Rdis and VREF (from Figure 3), the gain of the sigma-delta modulator can be tuned to get the maximum dynamic range. For optimum dynamic range utilization, set the output of the converter to between 70% and 80% of the full scale counts when there is no object near the sensor. For example, if the converter resolution is set to 14, Rdis may be adjusted to produce about 11500 to 13000 counts from the sigma-delta modulator.

Selecting the Sensor
Anything that is conductive, and is isolated from Ground can be used as a sensor in a proximity sensing application. This could be a piece of wire, a PCB trace, or a metal piece which is the part of an enclosure etc. We will discuss more about the sensor size in the next section.

Building the perfect system
Making the perfect proximity-sensing design is more of an art than science. Various factors affect the performance of a proximity sensing system. All these factors have to be taken into consideration while designing the system.

  • Noise : The most prominent factor that affects the effective sensing range and reliability is noise. There are many sources of noise in a system, including noise from switching signals, noise coupled from the supply, noise in the reference, EMI, and RFI, to name a few. The sigma-delta modulator, being an integrating converter, takes care of some of this noise. The noise may be reduced further by good hardware design like using decoupling capacitors, isolating the digital and analog grounds, keeping high-frequency signals isolated from the sigma-delta modulator, and proper shielding to protect against EMI and RFI. Noise that is still present in the system can be taken care of by carefully selecting the trigger threshold such that the SNR of the system is at least 5.

Figure 6 shows the plot of instantaneous counts from a sigma-delta modulator when a hand approaches a 25 cm sensor at 15 cm. Note the small fluctuations in the raw counts. This fluctuation is the noise and is about 10 counts. The difference caused due to the proximity of hand is about 60 counts, so the SNR of this system is 6.

Figure 6: Plot of instantaneous counts

(Click on image to enlarge)

  • Sensor Size and Length : Next to noise, the sensor geometry plays a major role in sensitivity. In a proximity-sensing application, where the sensor capacitance and the change in capacitance created by an approaching object depend on sensor size and objects surrounding the sensor, the optimum sensor size has to be decided by experimenting under actual working conditions.

    For example, if the application is a door-edge sensor where you have a choice of using a wire length of 75 cm to 200 cm, parameters like raw counts, noise, and difference counts for different sensor lengths and different sensing distances have to be plotted. Select the length that provides maximum detection distance with maximum SNR.

  • Ground Plane, Metal Objects, and similar : When the sensor is very close to ground plane or a metal object, the capacitance of the sensor increases, thus reducing its sensitivity. For example, the capacitance of a 0.5 mm2 wire, 25 cm long, and fixed to a wooden frame is about 6.2 pF. An approaching hand at 15 cm adds 0.1 pF to this capacitance. The percentage of change in capacitance is 1.6%.

    When the same sensor is tied to a grounded metal frame, the capacitance of the sensor increases to 13.3 pF, while the change in capacitance caused by the approaching hand remains the same. The percent change in capacitance now drops to 0.75%, and is more difficult to detect. For this reason, avoid placing the sensor near a ground plane or metal object wherever possible. Where such isolation is not possible, the effect of ground plane/metal object can be reduced by introducing a shield between the sensor and the ground plane/metal object. The shield should be driven by the same signal FS, that drives the switches in the sigma-delta modulator.

  • Drift in Capacitance due to Temperature, Humidity, and other factors : The capacitance of the sensor can drift because of temperature and humidity changes, which could cause false triggering. This drift is automatically taken care of by the IIR filter that creates the baseline.
  • Change in Supply voltage : As the switched-capacitor cell operates from VDD , any change in VDD will affect the instantaneous counts and may result in false triggering. By deriving VREF from VDD , the effect of change in VDD can be minimized.

(Part 2 looks at an actual design, along with code and suggestions for “tuning” the system; you can read it here.)

About the author
Ganesh Raaja of Cypress Semiconductor Corp. received his degree in Electronics and Communication Engineering from Motilal Nehru Government Polytechnic, Pondicherry. His expertise lies in developing with analog circuits, embedded systems, designing PCBs, and working with Assembly and C.

1. Capacitive Sensors , Larry K. Baxter, IEEE Press, ISBN: 0-7803-5351-X (Chapter 2: Equation for capacitance of a Cylinder to a Plane, Chapter 6: Proximity sensor basics)
2. Fundamentals of Physics , J. Walker, E-book (Chapter 26: Capacitance and Dielectrics, Equation for Capacitance of sphere to infinity, Equation for Capacitance of parallel plate capacitance)
3. Engineering Electromagnetics , William Hayt, E-book, McGraw Hill Series (Chapter 5.10: Capacitance Examples)

Related articles of interest
1. Using capacitive sensor user interfaces in next generation mobile and embedded consumer devices,Mariel Van Tatenhove and Andrew Hsu, Synaptics, Inc.
2. Designer’s guide to rapid prototyping of capacitive sensors on any surface, Mark Lee, Cypress Semiconductor Corp.
3. Capacitive sensors can replace mechanical switches for touch control, Wayne Palmer, Analog Devices Inc.
4. Building a reliable capacitive-sensor interface, Wayne Palmer, Analog Devices, Inc.
5. The art of capacitive touch sensing, Mark Lee, Cypress Semiconductor Corp.
6. Practical considerations for capacitive touchscreen system design (Part 1 of 2), Yi Hang Wang, Cypress Semiconductor Corp.

0 comments on “Basics and implementation of capacitive proximity sensing (Part 1 of 2)

Leave a Reply

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