Get Adobe Flash player
English Arabic French German Italian Portuguese Russian Spanish

Did you know?

On December 12, 1901, a radio transmission of the Morse code letter 'S' was broadcast from Poldhu, Cornwall, England, using equipment built by John Ambrose Fleming.

Help us stay online:

small donate


Digital-Capacitance-MeterThere are several methods for readout of sensor capacitance using microcontroller. Each of them has certain benefits and is used depending on microcontroller capabilities. These methods are:
•    Capacitive Voltage Divider (CVD)
•    Charge Time Measurement Unit
•    Relaxation Oscillator-Based Technique
•    Capacitive Sensing Module


1. Capacitive Voltage Divider (CVD)

Capacitive Voltage Divider (CVD) uses only the ADC (Analogue-to-Digital Converter) to perform capacitive touch sensing. The internal Sample and Hold capacitance of the ADC is used as a reference for calculating external capacitance. It offers high immunity to noise as well as very low emissions. Sensing requires two ADC channels, but they may both be sensors. While one channel is actively scanning, the other sensor may be reused for a secondary line that’s required while scanning the first channel. While sensors are not being scanned, they should be kept at ground or VDD. To perform the sensing, do the following: 1) Drive secondary channel to VDD as digital output, 2) Point ADC to the secondary VDD pin (charges CHOLD to VDD), 3) Ground sensor line, 4) Turn sensor line as input, 5) Point ADC to sensor channel (voltage divider from sensor to CHOLD), 6) Begin DC conversion, 7) Reading is in appropriate ADC module register.

Principle of Capacitive Voltage Divider operation

The basic principle begins with one ADC channel charging the internal sample-and-hold cap for the ADC to VDD. The sensor channel is then prepared to a known state by grounding it. After the sensor is grounded, it must be made an input again. Finally, immediately after it is made an input, the ADC 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 voltage on the sensor capacitor is the same on the sample and hold capacitor. After this step, the ADC should be sampled, and the reading represents an amount of capacitance on the external sensor. With the addition of a finger touching the sensor, the capacitance will increase, and the voltage on step 5 will be lower.

2. Charge Time Measurement Unit (CTMU)

The CTMU  is used in capacitive touch applications by applying the constant current source of the CTMU to the capacitive touch pad using the following :

     I x T=C x V

Where I is the constant current source of the CTMU, T is a fixed period that the CTMU charges the capacitive touch circuit, C is the capacitance of the touch circuit and V is the voltage read by the ADC after the capacitive touch circuit is finished charging.
Principle of Charge Time Measurement Unit operation

It is possible to sense a relative shift in capacitance by observing a change in voltage. The above equation can be rearranged to:

     V= (I x T) / C

Since the CTMU current source is constant (I), the voltage present on the capacitive touch sensor (V) relies on two variables: the amount of time the touch circuit is charged (T) and the capacitive size of the touch circuit (C). If the amount of time the touch circuit is charged is held constant, then changes in the capacitance of the touch circuit will ultimately affect the voltage that the circuit charges to in the fixed period. The ADC is used to read the voltage that the touch circuit is charged to with the CTMU. When the capacitance of a human finger is added to the touch sensor pad, the capacitance increases and the result is a lowering of the voltage seen by the ADC (since I and T are held constant).

3. Relaxation Oscillator-Based Technique

Usually used with small microcontrollers that have an onboard comparator that can be used for capacitive sensing of a single key.
Capacitive sensing is implemented by turning the comparator into a relaxation oscillator. The output of the comparator is used to charge and discharge the sensing capacitor, which is formed by a pad on the circuit board. The charge rate is determined by the RC time constant, created by an external resistor and the capacitance of the pad. Introduction of additional capacitance from a person’s finger to ground causes a frequency change. This change is measured by the PIC MCU and processed to detect a finger press.
The basic oscillator circuit is shown in next Figure.
Principle of Relaxation Oscillator-Based Technique

Cp is the parasitic capacitance. During start-up this capacitance has no charge and the voltage is zero. Therefore, the output of the comparator will be high and the touch pad is rapidly charged through D1 until it reaches VDD.
The output of the comparator will change to the low state. Then, it discharges slowly through R1 until it reaches the trip point of the internal band gap reference of 0.6V. The output of the comparator will go high again and the cycle repeats itself. The output of the comparator is a frequency that is related to the capacitance of the pad. Using a higher frequency makes the measurement cycle shorter.

4. Capacitive Sensing Module (CSM)

The CSM simplifies the amount of hardware and software setup needed for capacitive sensing applications. Only the sensing pads on the Printed Circuit Board (PCB) need to be added. The capacitive sensing modules allow for an interaction with an end user without a mechanical interface. In a typical application, the capacitive sensing module is attached to a pad on a PCB, which is electrically isolated from the end user. When the end user places their finger over the PCB pad, a capacitive load is added, causing a frequency shift in the capacitive sensing module. The capacitive sensing module requires software and at least one timer resource to determine the change in frequency. Key features of this module include:
•    Analogue MUX for monitoring multiple inputs
•    Capacitive sensing oscillator
•    Multiple Power modes
•    High power range with variable voltage references
•    Multiple timer resources
•    Software control
•    Operation during sleep
•    Acquire two samples simultaneously (when using both CSM modules)

Two identical capacitive sensing modules are implemented on the PIC16F707/PIC16LF707. The modules are named CPSA and CPSB (CPS – Capacitive Sensing). A block diagram of the capacitive sensing module is shown in Figure below.
Principle of Capacitive Sensing Module operation

The capacitive sensing oscillator consists of a constant current source and a constant current sink, to produce a triangle waveform. The oscillator is designed to drive a capacitive load (single PCB pad) and at the same time, be a clock source to one of the timers. It has three different current settings as defined by appropriate registers. The different current settings for the oscillator serve two purposes:
•    Maximize the number of counts in a timer for a fixed time base.
•    Maximize the count differential in the timer during a change in frequency.
The capacitive sensing oscillator uses voltage references to provide two voltage thresholds for oscillation. The upper voltage threshold is referred to as Ref+ and the lower voltage threshold is referred to as Ref-.
The capacitive sensing oscillator can operate in one of several different power modes. There are three distinct power modes; Low, Medium and High. Current consumption is dependent upon the range and mode selected.
The capacitive sensing oscillator will continue to run as long as the module is enabled, independent of the part being in Sleep. In order for the software to determine if a frequency change has occurred, the part must be awake. However, the part does not have to be awake when the timer resource is acquiring counts.