Capacitive Sensing Solutions from Silicon Labs

Transcription

Capacitive Sensing Solutions from Silicon Labs
Capacitive Sensing Solutions from
Silicon Labs
In this section, we are going to cover the Silicon Labs Capacitive Sensing solutions.
1
Agenda
 What are we measuring?
 Capacitance measurement techniques
 Relaxation oscillator operation
 SAR operation
 CapSense system considerations
 C8051F93x-92x implementation
 C8051F700 implementation
 Tools to aid in capacitive sensing development
 Where to learn more
2
We are going to cover Capacitive Sensing technology starting with an overview of
how CapSense works. Next we will cover how the technology is implemented in
the C8051F900 family and the different pad topologies. We will also cover some of
the tools available for the technology.
2
What Are We Measuring?
 Capacitance
 If two metal plates are placed with a gap between them and a voltage is applied to one of
the plates, an electric field will exist between the plates
 Any two conductive objects can be used for the plates of the capacitor
 When using capacitive sensing for touch applications the capacitor is typically formed by
a PCB element and the conductive object in proximity
 Capacitor parameters
 Area — capacitance is directly proportional to the area of the plates
 Dielectric — capacitance is directly proportional to the relative permittivity of the material
between the plates (air, glass, plastic, etc.)
 Distance — capacitance is indirectly proportional to the distance between the two plates
 The capacitance of a parallel-plate capacitor is given by:
A
Capacitor
plates
Dielectric
d
ΔV
where:
Є0 is the permittivity of free space
Єr is the relative permittivity of the dielectric material
A is the area of the plates
D is the distance between the plates
3
When using capacitive sensing for touch applications the PCB trace typically acts as
one plate of the capacitor. When a conductive object (such as a finger for touch
sensing) comes into proximity it acts as the other plate and air is the dielectric. As
the object moves closer to the pad the capacitance changes based on the equation
for capacitance shown. The constants in the equation represent the value for the
dielectric constant of the material, i.e. air, glass etc. The value for A is a measure of
the area of the pad used for the sensor capacitor and d represents the distance
between the two plates. So you can see, for touch applications, as the finger moves
closer to a pad the value for d is reduced which then increases the capacitance.
єr is the relative static permittivity (sometimes called the dielectric constant) of the
material between the plates
A is the area of each plate
D is the separation between the plates.
3
Capacitive Sensing Technology
 What are capacitive sensing switches?
 They are external capacitors that are influenced by
the presence of conductive objects such as a finger
 They are also known as contact-less switches
 Why are they useful?
 Make it possible to revolutionize a product’s user
interface and industrial design
 Low-cost because the switch is as simple as a trace
on a PCB
 No moving components means long-term reliability
 Target applications







Handsets
Notebooks
Personal media players
White goods
Automotive
Medical
Industrial
Touch sensitive switches
Traditional push-button switches
4
Touch sensitive switches are found in a variety of consumer products including home
appliances, MP3 players and cell phones. A touch sensitive switch is a switch that is
implemented as a trace on a printed circuit board. The architecture of the trace creates a
capacitive element. Touching this trace with a finger creates a change in capacitance, which
is detectable using a variety of techniques. Capacitive sensing has received a lot of attention
lately due to the fact that it can replace mechanical switches that have a tendency to wear
out and break. Capacitive Sensing switches can be as simple as a trace on a PCB that forms
one plate of a capacitor and an object that is in close proximity to the pad represents the
other plate. With respect to human interface it is often a person’s finger that becomes the
second plate of the capacitor. When a person’s finger moves closer to the pad the
capacitance changes inversely with the distance. As the distance between the finger and the
pad decreases the capacitance increases. We can use several measurement techniques to
quantify the capacitance and provide a “pressed” or “not pressed” button state.
There are many applications for this technology, not just switches although that is probably
the most common. Industrial Applications can take advantage of capacitive sensing. There
are many industrial applications where detection can be done using a capacitive sensor, such
as detection of the water level in a tank.
4
How Is The Capacitance Change Detected?
 The are various techniques to detect the change
 Relaxation oscillator
 Builds an oscillator which uses the sensor capacitor as a timing element
 Resistor capacitor charge timing
 Resistor-Capacitor charge timing measures how long it takes to charge
or discharge a capacitor with a reference voltage applied
 Charge transfer
 Charging a sensor capacitor and then transferring that charge into an
integrating capacitor over several cycles
 Capacitor charge timing using successive approximation (SAR)
 Varies the current through the sensor capacitor to match a reference
ramp
5
There are many different techniques to measure the change in capacitance. ResistorCapacitor charge timing measures how long it takes to charge or discharge a capacitor. In
this case you discharge a capacitor and then apply a voltage to the RC network and measure
the time it takes to cross a threshold. Charge transfer involves charging a sensor capacitor
and then transferring that charge into an integrating capacitor over several cycles. The
voltage change on the capacitors gets exponentially smaller. You can then compare the
integrating capacitors voltage to a reference voltage or measure it with an ADC and
determine the time associated with it. The relaxation oscillator method builds an oscillator
which uses the sensor capacitor as a timing element. The C8051F900 family is capable of
implementing the relaxation oscillator method and generates the oscillator using an
integrated comparator. In order to build the oscillator we have to charge the sensor capacitor
to a specified upper threshold voltage. Once that value is reached we then discharge the
sensor capacitor to a specified lower threshold voltage. Using this method the oscillation
period is inversely proportional to the sensor capacitor value. As capacitance increases the
oscillator frequency decreases. The C8051F700 family uses a successive approximation
technique to compare the sensor capacitor ramp with a known time base.
5
The Relaxation Oscillator (RO)
 How a relaxation oscillator works
 Charge a capacitor until it reaches a certain voltage threshold
 Once the threshold is reached, discharge the capacitor until it
reaches a lower threshold
 The frequency of the relaxation oscillator is indirectly proportional to
the value of the capacitor
C > Inactive Capacitance
C = Inactive Capacitance
6
Here we will take a closer look at the relaxation oscillator method. As mentioned on the
previous slide, the relaxation oscillator method builds an oscillator which uses the sensor
capacitor as a timing element. The diagram shows the relationship of the comparator
reference voltages and the output waveform. The reference voltages used for the
comparisons in this example are the 2/3 and 1/3 VDD points. The exponential voltage rise
occurs from the 1/3VDD point and continues to the 2/3VDD point. At that point the
comparator output toggles and causes a change in current flow. This change causes the
voltage to decay back down to the 1/3VDD point and then the cycle repeats. We will take a
look at this cycle in more detail in some of the following slides. Using this method the
oscillation period is inversely proportional to the sensor capacitor value. As capacitance
increases the oscillator frequency decreases.
6
Charge Timing Using SAR
 How the successive approximation technique works
 Drive a current through the sensor capacitor and compare the
generated voltage potential to the voltage of a reference capacitor
with a known ramp rate
 Successive comparisons modify the current value in order to
provide equivalent ramp rates for the ISENSOR and the IREF
 Silicon Labs patent pending approach
V
ISENSOR
IREF
t
MSB Bit Decision
(Bit 15)
LSB Bit Decision
(Bit 0)
7
The SAR implementation is based on the principle of capacitance that as you source a
constant current then the voltage output will increase over time. This is based on the
equation dV = I/C dt. The comparison point of the generated voltage is set to a constant
voltage over all cycles. This constant voltage is also used as the reference point for the
charge time of a reference capacitor. When all bit values have been determined the ramp
rate of the sensor capacitor will be equal to that of the reference capacitor.
7
Relaxation Oscillator (RO)
Implementation
8
RO Capacitive Sensing Implementation (1 of 3)
 When the positive input is configured to generate the
threshold voltage levels, the comparator output is ‘1’ when
the positive input terminal (CP+) is greater than the negative
input terminal (CP-) and ‘0’ when CP- is greater than CP+
9
The next several slides show how the relaxation oscillator actually works. The slides
describe the inactive state behavior of the relaxation oscillator. By inactive state we mean
that a finger is not moved on or off the switch, and so the capacitance of the switch is the
same.
In this configuration, the output of the comparator is ‘1’ when the positive input is greater
than the negative input. In the initial state, we can assume the capacitor is at 0V or less than
2/3 VDD. The comparator output is then logic ‘1’ or VDD. This has two effects: 1) the
resistor network gets simplified to what is shown on the right and this sets the threshold to
2/3 VDD, which is shown in blue in the graph. 2) The switch capacitor is charged by the
output of the comparator through the feedback resistor. This is shown by the red line in the
graph.
9
RO Capacitive Sensing Implementation (2 of 3)
 When the positive input is configured to generate the
threshold voltage levels, the comparator output is ‘1’ when
CP+ > CP-, and ‘0’ when CP- > CP+
10
Once the voltage on the capacitor gets charged to 2/3 VDD, the output comparator becomes
logic 0, which has two effects. 1) The resistor network gets simplified to what is shown on
the top right and the positive input is changed to 1/3 VDD. 2) The capacitor, which is
charged to 2/3 VDD, now starts discharging through the feedback resistor.
10
RO Capacitive Sensing Implementation (3 of 3)
 When the positive input is configured to generate the
threshold voltage levels, the comparator output is ‘1’ when
CP+ > CP-, and ‘0’ when CP- > CP+
11
The final step of the cycle is the same as the first. Once the voltage on the switch capacitor
reaches 1/3 VDD, the output of the comparator switches to logic 1 or VDD, which starts the
charge process again. This repetitive scenario gives us our oscillation frequency based on
the value of the RC time constant of the feedback resistor and the sensor capacitor we are
trying to measure.
11
Putting Your Finger on the Switch
 By touching the switch directly with a finger the capacitance increases
 The rise and fall time of a parallel-plate capacitor is given by:
  RC
 The additional capacitance increases the time constant, thereby
reducing the output frequency
12
When using Capacitive Sensing the PCB trace acts as one plate of the capacitor.
When a finger comes into proximity it acts as the other plate and air is the dielectric.
As the finger moves closer to the pad the capacitance changes based on the equation
for capacitance shown. The constants in the equation represent the value for the
dielectric constant of the material, i.e. air, glass etc. The value for A is a measure of
the area of the pad used for the sensor capacitor and d represents the distance
between the two plates. So you can see as the finger moves closer the value for d is
reduced which then increases the capacitance. Keeping in mind the relaxation
oscillator operation from the previous slides we noted that as capacitance increases
the frequency of oscillation decreases.
єr is the relative static permittivity (sometimes called the dielectric constant) of the
material between the plates
A is the area of each plate
D is the separation between the plates.
12
How to Detect the Change
 There are two ways to measure the change in frequency
 Measure the frequency
 Count the number of relaxation oscillator cycles over a fixed period of time
 Measure the period
 Count the number of system clock cycles over a fixed number relaxation cycles
 The example code installed with the IDE counts the system clock cycles during one
relaxation oscillator cycle
Inactive State
Finger On the Pad
13
There are two ways to measure the change in the relaxation oscillator frequency. There is a calibration step that needs to be
performed first in order to measure a count value with no finger present on the pad. This would be considered the idle, steady
or inactive state. The first measurement technique uses two timers. The first timer is clocked by the relaxation oscillator (RO
timer) and the second is used to generate the fixed time base (Fixed Timer). At the overflow of the Fixed Timer the value of
the RO Timer value is read. If the RO Timer value is less than the inactive state value from a calibration then it is determined
that there is a valid button press. When measuring the period we use a timer that is clocked by the system clock (System
Timer). The comparator output in this case is used to provide a capture event. The captured value is compared to a calibrated
value and if the system clock counts are higher then the capacitance is greater causing the capture period to be longer, thus
allowing more system clocks. When this condition exists it is considered to be a valid button press. With the relaxation
oscillator solution, this is the minimum amount of cycles we can count and still get an accurate results. We cannot use a
sampling period shorter than 1 relaxation oscillator cycle and achieve repeatable measurements.
13
Charge Timing Implementation
14
Successive Approximation (CS Module)
 Two current DACs used
 First is the variable DAC for the current through the sensor capacitor
 The second is a constant current source for the internal reference
capacitor
 Two comparators are used
 First monitors the voltage of the sensor capacitor
 The second monitors the voltage of the internal reference capacitor
 The outputs of the comparators determine the logic level of the
associated bit
IREF
ISENSOR
VREF
CREF
SAR
CSENSOR
15
The successive approximation (SAR) method uses a pair of current sources to drive current
into separate capacitors. The first is the reference capacitor denoted as CREF and the other is
CSENSOR. The current source denoted as IREF is a fixed current used to drive the CREF
capacitor to provide a constant ramp voltage. The second current source denoted ISENSOR
sources a variable current to the sensor capacitor. After each measurement cycle the SAR
logic will change the value of ISENSOR, attempting to get the ramp rate the same as the
reference capacitor.
15
Putting Your Finger on the Switch
 By touching the switch directly with a finger the capacitance increases
 The change in voltage of a parallel-plate sensor capacitor is derived from the
current of the capacitor given by:
I SENSOR  CSENSOR
dV
dt
or
I SENSOR
dV 
dt
CSENSOR
 This additional capacitance reduces the voltage potential of the sensor capacitor
at a given current
Inactive Switch
Active Switch
16
Charge Time
As with the relaxation oscillator, when using Capacitive Sensing the PCB trace acts
as one plate of the capacitor. When a finger comes into proximity it acts as the
other plate and air is the dielectric. As the finger moves closer to the pad the
capacitance changes based on the equation for capacitance from the earlier slides.
Keeping in mind that as a finger moves closer the value for d is reduced which then
increases the capacitance. Keeping in mind the SAR operation from the previous
slides we note that as capacitance increases the comparison point for the threshold
voltage decreases.
16
Successive Approximation
 Decision tree based on binary weighted voltages.
 Start the first comparison at the mid-scale voltage IREF/2 (for 16 bit
conversion IREF=0x8000)
 Determine MSB value based on the timing of the capacitors
 VSENSOR > VREF then MSB = 0
 VSENSOR < VREF then MSB = 1
 Set the next comparison voltage to the next comparison value
 If the bit was a 1 IREF=0xC000
 If the bit was a 0 IREF=0x4000
 Continue process through all 16 bits
Current value for
ISENSOR = 0x6000
IREF Charge Time
Current value for
ISENSOR = 0x8000
Current value for
ISENSOR = 0x4000
IREF
ISENSOR
Bit 15 = 0
Bit 14 = 1
Bit 13 = 0
Bit 0 = 0
Total Sample Time < 50us
17
Let’s take a closer look at the successive approximation steps in determining the value of
the ISENSOR source. The SAR will set the current source to the mid-scale and drive the
ramp until the timeout period expires as governed by the reference capacitor charge time.
Mid-scale for the 16 bit current source is 0x8000. At this point the voltages are compared.
If the sensor capacitor has charged to a value that is greater than the reference as shown in
the figure then there was too much current and the MSB value is then set as a zero
(conversely, if the current did not reach the threshold then that means there wasn’t enough
current and the MSB is then set to a one). Since the previous bit was set low the next
weighted bit is set to the a value lower and half of the setting or at 0x4000. The charge
cycle is started again and the voltages are once again compared. In the example above we
see that with this new value the voltage didn’t make it to the threshold point meaning we
need to supply more current to the sensor capacitor. This bit is then set as a one and the
next value is again the halfway point to the mid-scale voltage or 0x6000. This process
continues all the way to the last bit at which time the ramp rates of the two capacitors are
equal.
17
CS Module Advantages
 No external components required
 Differential measurements reduce noise susceptibility
 SAR sampling immune to DC offsets and low frequency noise
 DC offset voltages have no effect on bit determination algorithm
 Fast conversion time
 Low frequency coupled AC noise susceptibility reduced (50/60 Hz)
 High frequency susceptibility reduced by design
 Can be configured for autonomous operation
IREF
ISENSOR
VREF
CREF
SAR
CSENSOR
18
The SAR implementation eliminates the need to provide any external components
and can monitor capacitance just by connecting to the pad of the MCU. All of the
components necessary to implement CapSense are integrated on chip. Another
benefit is the fact that the implementation uses a differential measurement for the
sensor capacitor and the reference capacitor thus providing very high rejection to
power supply noise. The SAR sampling method is not affected by DC offsets as the
relative change in the voltage and the time period for that change is dependent on
the capacitance. Also, the sampling time is very short minimizing the affects of low
frequency noise. The design provides filtering for any high frequency interference
that may cause inadvertent switch actuation. Since the peripheral is self timed it can
run autonomously from the CPU which means the CPU can be in a low power state
and be woken up by a switch actuation event.
18
Capacitive Sensing In System
19
Designing Touch Sensitive Switches
 Since we are detecting a change in capacitance,
it follows that we want to maximize the change as
much as possible
 On the PCB there are two main factors that affect the switch
capacitance and how much it changes
 Size, shape and placement of the switch pattern on the PCB
 The characteristics of the trace that connects the switch to the MCU
20
Now that we understand how Capacitive Sensing works, let’s take a look at the
system implementation. Our main goal in designing CapSense switches is to
maximize the change in capacitance between the inactive state and a finger press.
In order to accomplish our goal we have to keep in mind the equation for
capacitance that we discussed earlier and is shown here for reference. When
looking at this we see that the areas we can control are the pad dimensions which
relate to the quantity A in the equation. This directly relates to the size and shape of
the switch pattern. We also control d which is the distance from the pad of our
assembly and the dielectric constant relating to the material we use to cover the pad.
One thing that tends to get overlooked is the characteristics of the trace that
connects the switch to the MCU. Being connected to the switch pad, all capacitance
we add in the form of trace capacitance increases our inactive state capacitance.
20
Initial Configuration

Performed for each switch individually




Even if all the switches are the same size and shape, their location on
the board will affect their inactive state capacitance
Performed during development or production test

The results should be programmed to Flash
Three step procedure
1.
2.
3.
Measure the sensing method output with nothing on the switch (inactive state count)
Measure the sensing method output with the switch active (active state count)
Set the threshold to a value between the two measurements
The threshold value determines the sensitivity
Active State Counts
Least
Inactive to Active Count
Inactive State Counts
Sensitivity
Single count threshold
Active to Inactive Count
Most
21
The purpose of the initial configuration is to determine the operating parameters of
the switches. These values can be used as reference points for subsequent runtime
operation of the switch. Measuring the inactive and the active state of the switches
provides us with the information necessary to generate initial threshold values for
each of the switches. One element of setting the threshold levels shown in the
diagram is hysteresis. We can separate the inactive to active state threshold to one
count value and the switch active to inactive state to a lower value. When we are in
the inactive state we compare the difference to the upper threshold. When the
button has been considered active, a release of the button would occur after the
lower threshold is crossed. An important note with these thresholding techniques is
that the closer to the inactive state we set the compare value the more sensitive the
switch as it would take less capacitance to cause the switch to be active the lower
we set the threshold value. See application note AN367 for threshold
recommendations as well as the capacitive sensing API for firmware
implementations.
21
Traditional System Signal to Noise
 SNR is affected by different system level parameters
 Capacitive sensing pad layout
 External stimuli
 Proximity to other conductive objects
 Electrical interference
 Ground planes
 Environmental affects like temperature
 Dielectric material and thickness
and contaminants on the switch
 Calculating SNR – traditional method
1. Calculate the mean for the inactive and the active state
B
1 n 1
 B(t )
n 0
A
1 n 1
 A(t )
n 0
2. Calculate the peak noise value for the inactive state.
N S  max( B(t ))  B
3. Determine the number of counts for the signal
S  AB
4. Divide the signal (S) by the noise (NS)
SNR 
S
NS
22
There are many system level considerations when implementing Capacitive sensing.
The responsiveness of a switch in the application is dependent on the pad size, the
dielectric material type and thickness as well as the layout and how the PCB is
oriented and what is in proximity to the pad. Once all of these factors are in place,
only characterization of the switch can really provide the information required for
the firmware to make the determination as to whether or not the switch is in the
inactive state or the active state. In order to provide adequate margin between the
two states all of the design considerations mentioned must be structured such that
the maximum signal to noise ratio can be realized. This is required so suitable
threshold levels can be identified. This slide explains the traditional signaling
details required to characterize the system. In literature you can find that a suitable
signal to noise ratio for Capacitive sensing for touch applications is 5 to 1. The
equations listed above outline the traditional method to calculate the system level
signal to noise ration of the switches.
22
System Characterization (1 of 3)
 Can be conservative based on increased SNR capability of the C to D converter
 Calculate the inactive and active baselines
AB 
1 n 1
 AB (t )
n 0
IB 
1 n 1
 I B (t )
n 0
 Calculate the standard deviation of the noise for the inactive and active state and
determine the safe zone

 A
 


 

SafeZoneItoA  A B   A  I B  3.3 x I B
SafeZone AtoI
B
 3.3 x A   I B   I
 Determine the thresholds of the signal

InactiveToActive  0.75 xSafeZoneItoA   I B  3.3 I



ActiveToInactive  A B  3.3 A  0.75 xSafeZoneAtoI 
23
With the traditional approach to switch characterization no consideration is given to
the noise in the active state. In reality, the human body is a good antenna and
injects quite a bit of noise into the system. It makes sense that the noise level of the
active state should be considered in setting the appropriate threshold values.
Additionally, the traditional method only uses peak values of noise in the
calculation of SNR. Here is a different approach where the noise level of both the
inactive and active state are used to determine the threshold levels. We break this
up into two different conditions, the first is when going from the inactive to the
active state and the second is from the active to the inactive state. In order to
calculate thresholds we first calculate the mean of both the inactive and active
states. Next, a safe zone is determined which takes into account 3.3 standard
deviations about the mean of the current state and 1 standard deviation about the
mean of the next state. For example, when going from the inactive state to the
active state we calculate 3.3 standard deviations about the inactive state mean and 1
standard deviation about the active state mean. Combining these values with the
means determines the safe zone. As a first approximation the thresholds are set at
75% of these values as shown in the last set of equations.
23
System Characterization (2 of 3)
 Initial Configuration
 Even if all the switches are the same size and shape, their location on the
board will affect their inactive and active state capacitance
Active State noise
1σ
Active State MEAN
75% * SafeZoneItoA
SafeZoneItoA
Inactive State noise
3.3 σ
24
Inactive State MEAN
Inactive to Active Threshold Setting
Here we see the preceding equations represented graphically for the inactive to
active state transition. From the graph you can see that the standard deviations for
both steady state values are used for determining the safe zone. The threshold is set
to 75% delineated by the green hash mark.
24
System Characterization (3 of 3)
 Store the operating parameters to the flash
 The threshold values determine the sensitivity
Active State noise
3.3 σ
Active State MEAN
SafeZoneItoA
75% * SafeZoneAtoI
Inactive State noise
1σ
Inactive State MEAN
Active to Inactive Threshold Setting
25
Here we see the preceding equations represented graphically for the active to
inactive state transition. This graph differs from the one on the preceding slide in
that the active state noise being considered is now 3.3 standard deviations about the
mean instead of 1 standard deviation when going in the reverse direction. The
threshold is set to 75% of the safe zone this time delineated by the red hash mark.
25
Periodic Configuration
 Perform similar procedure as initial configuration during normal operation to
account for a dynamic operating environment
 Some relevant factors are:
 Water, oil, or other materials on the switch
 Changes in supply voltage
 Change in humidity and temperature
 These factors can affect the capacitance of the switch or the charge/discharge
profile
 If the effects are large enough, the incorrect measurements can lead to false switch
events
26
Once a system is deployed, there may be environmental effects that change the characteristics of the
switch. An example would be a touch panel outside or an industrial environment where some oil or
other material can get on the switch. When it rains the water would change the properties by altering
the dielectric constant thereby changing the capacitance we would measure. Another effect could be
as simple as differences in finger sizes. To compensate for these problems, periodic configuration (or
baselining) compares runtime baseline values to calibrated reference baseline values and scales the
thresholds appropriately. The inactive baselines are a way to determine the offset between inactive
capacitance measured during calibration and inactive capacitance measured at runtime. The active
baselines are a way to determine how much the channel's gain has changed. Without periodic
configuration, calibrated active and inactive threshold values can become invalid as conditions
around the device change.
Determining the threshold values is an important part of the Capacitive sensing system. Following
the guidelines ensures reliable switch actuation when the system is deployed. All of these
measurements should be tailored to the system. For example, the value of the noise should be
determined in the environment that the system will be used. The active region should be set to a
value that takes into account the distance of the finger to the pad due to dielectric gap as well as
possible offset positions (which would reduce the output). These values are generated during the
development phase of the project and can be stored in flash. The sensitivity margins provide the
capability to enhance the detection algorithms in order to adjust for environmental affects such as
temperature drift. The inactive measurement can be continually updated as long as it is below the
noise threshold. Keep in mind this is only a recommendation for standard switch implementations.
There are many applications that may require deviating from these guidelines.
26
Different Switch Arrangements
 Solid pads
 Square pads and round pads
 Round pads have uniform field lines around the pad and are preferred
 Have similar sensitivity
 Highest sensitivity
 Interleaved pads
 Reduces pad area and increases parasitic capacitance
 Not recommended
 Effects of grounding
 Grounding around switches reduces sensitivity by absorbing some of the field lines
 The smaller the gap the more parasitic capacitance
 The gap should be sized according to the thickness of the dielectric material
 Necessary if no ground reference to the object in proximity
 Hatched ground planes minimize desensitizing parasitic capacitance while providing
good noise reduction
27
Now let’s put what we learned to use. There are different topologies to consider
when generating the Capacitive Sensing pads. When designing the pads we have to
keep in mind that the field currents are going to try and find their way to ground
whether it is a ground connection or a virtual ground represented by a finger. The
most common type of pad is the solid circular pad. This provides the highest
sensitivity because of the area based on our equation for capacitance. Without any
grounding, all of the field lines would be directed from the positive pad to the lower
potential represented by the finger. There are also designs that interleave pads.
These methods reduce the flux density to the finger because of reduced area and
parasitic capacitance, thereby reducing sensitivity, and are not recommended.
Another topology is to surround the pad with a ground or guard. The size of the gap
between the pad and the ground changes the field lines which affect the parasitic
capacitance. This shows up as a smaller net change in capacitance.
27
Effects of the Switch Size and Shape
 The inactive state capacitance (in pF) for each switch
without any material on top is provided below
A
pF
A
B
C
1
8.4
4.8
6.4
2
8.4
4.8
6.4
3
3.9
2.5
3.1
4
2.2
1.1
1.9
B
C
1
2
3
4
 It is easy to see that the bigger the switch and the more
traces there are within a certain area, the more inactive
state capacitance the switch has
 Both of these factors make the switch more robust
28
Let’s take a look at some of these using real examples. The table shows
measurements taken from the pad topologies shown. The values in the table are
marked according to the letter and number designations from the figure. For
example, A4 is the largest circular pad with a small gap to the ground ring. The
values represented in the table show the inactive state capacitance (capacitance with
no finger present). Since we are trying to measure the relative change in
capacitance we would like to start with a low inactive state capacitance which
provides greater dynamic range. You can see the coupling of the interleaved pads
increases the inactive state capacitance and the solid pad enables us to get a lower
inactive state capacitance.
28
Effects of Trace Length
 In order to achieve reliable switch measurements,
the percentage change in capacitance between
an inactive switch and an active switch should be at
least 0.5%
 The trace that connects the switch to the MCU input pin
should be as short as possible to minimize the total parasitic
capacitance added to the switch
 With lower parasitic capacitances, any change in the switch
capacitance is more significant and more easily detected
29
Parasitic capacitance in the PCB design affects the measurement capability. When
we talk about parasitic capacitance we are referring to the voltage potential that
exists along the length of the trace, therefore, longer traces have a higher
susceptibility to parasitic capacitance. This is important in reaching our goal of
increasing the relative change in capacitance when using this method for switches
and is often an area overlooked. The value of trace capacitance adds to the overall
inactive state capacitance of the Capacitive Sensing switch. In order to reduce the
effects of trace capacitance shorter, narrower traces, which exhibit lower overall
capacitance, are recommended. In addition to the inactive capacitance value of the
trace, its proximity to noisy signals and grounds affect the overall performance of
the system. Long traces are no big deal unless they are surrounded by conductive
objects (like traces or grounds) at a different voltage potential (parasitic) or, and just
as important, neighbored by other conductive objects with changing voltage
potential (noise), such as traces from other nearby capacitive sensors. Why are
these factors important? It is desirable to have at least a 0.5% change in the
capacitance between the inactive state and the active state. For example, if the total
capacitance of the switch and parasitic capacitances is 200 pF, the change in
capacitance when you put your finger on the switch should be at least 1 pF.
Overall, we want to reduce parasitic capacitance on the trace and at the sensor to
maximize the sensitivity.
29
Switch Arrangements—Size and Shields
 Switch size
 Same size as the expected conductive object recommended
Pad area larger than needed
Conductive
object
 Shields
Pad
 Plane layer at the same voltage potential as the pad
 Introduces no parasitic capacitance
 Increase sensitivity by forcing all field lines to the approaching
conductive object
No voltage potential exists
Shield
30
When designing the Capacitive sensing pad the overall dimensions of the object you
are trying to sense should be considered. For example, the conductive object shown
in the slide is much smaller than the Capacitive sensing pad shown. With the
conductive object of this size we would have unnecessarily oversized the pad. The
same guidelines hold true when the conductive object is the human finger. Another
aspect of switch design is the concept of shielding. In most instances we are
familiar with using grounds as shields in order to block unwanted noise. However,
when we are driving the pad capacitance with our excitation source (like the
relaxation oscillator) and if we add a ground under the pad we will induce a voltage
potential difference and thus a parasitic capacitance. There will be field lines from
our pad that are attracted to the lower voltage potential. But what happens if we use
a plane that is at the exact same potential as the pad we are exciting as shown in the
figure? Since we now have the same voltage potential between the two plates there
is no capacitance. All field lines that are generated from the pad are directed to the
conductive object we place near the pad while blocking the unwanted parasitic
capacitance.
30
Effects of Different Materials for the Dielectric
 The type of material on top of the switch affects the inactive state
capacitance and the active change in capacitance
 The materials covered in the application note AN338 are:





Glass (3.2, and 5.9 mm)
Plexiglass (1.6, 5.0, and 9.8 mm)
Mylar (0.35 and 0.70 mm)
ABS plastic (2.0 and 4.0 mm)
FR4 (1.6 mm)
 Recommendations
 Use the thinnest material possible to maximize the change in capacitance
 Use materials with a higher dielectric, such as glass, to increase the
absolute capacitance of the switch
 This increases the relative change in capacitance when compared to the trace
and other parasitic capacitances
31
We discussed different areas that we can control in the design of the pads in order to
increase the sensitivity and robustness of the switch. The first area we covered was
the pad area and we saw that larger solid pads increased our sensitivity. The next
area we can control is the dielectric material and the distance d from the pad. Most
Capacitive Sensing pads have an overlay of some sort, like glass. The thicker the
glass the farther away from the pad we are for the touch. Remember that
capacitance goes down with an increase in distance so the material we place on top
of the switch should be as thin as possible and still meet the application
requirements. Also, the material chosen influences the capacitance via its dielectric
constant. Using materials with a high dielectric constant will increase the
sensitivity. Here are some materials that were tested in application note AN338
from Silicon Labs. A link to the appnote can be found at the end of this
presentation.
31
Design Considerations Summary
 The circular switches have the lowest inactive
capacitance and also exhibit the largest relative
change in capacitance when the switch is active
 Use the thinnest possible material with the highest dielectric constant
 Ensure that there is no gap between the board and the covering material
 Application notes are available to provide more detailed design
guidelines including switch spacing and trace routing
32
The advantage of having the lowest inactive capacitance is that it takes a shorter
amount of time to measure one period when considering the relaxation oscillator
method. The SAR technique conversion time is constant regardless of the value of
the capacitance. This provides a consistent measurement from pad to pad. The
advantage of having the largest change in capacitance is that it is easier to detect.
The solid circular pad met both design goals, lower inactive capacitance and a high
sensitivity. Using the thinnest possible material to meet the design goals enables the
largest change in capacitance to be detected and therefore makes the design more
robust. By maximizing the change in capacitance that can be detected the threshold
and calibration algorithms can potentially be simplified reducing code space. When
adding the material over the switches it is important to make sure there is no air gap.
Air has a low dielectric constant compared to materials such as glass. Ensuring that
there is no gap will ensure that the highest change possible will occur when the
switch is active. Certain adhesives from 3M (such as 467 or 468) provide good
bonding of the dielectric material while providing a uniform area and high dielectric
constant. See application note AN338 for more information regarding capacitive
sensing and measurement results of different materials.
32
C8051F93x Implementation
33
Capacitive Sensing RO Implementation
 How this is implemented on the C8051F93x-92x
devices
 The relaxation oscillator is implemented using an on-chip
comparator
 The switch is the capacitor that is charged and discharged
 Measure the output frequency using a capture mode of the timer
34
Let’s take a look at how to implement the Capacitance Sensing using the C8051F9xx family
from Silicon Labs. The relaxation oscillator itself is implemented using only the
comparator. Remember from our earlier discussion about how the relaxation oscillator
works. We have the resistor network used to set the comparator threshold and the feedback
resistor to provide the current path to charge and discharge the capacitor. The comparators
on the C8051F93x/92x family of devices include the charging mechanism for the switch
capacitors that are connected to the comparator multiplexer as well as automatically
configuring the varying voltage threshold on chip. All that is required is to connect the pad
to the pin of the MCU. The comparator output also can be used as the capture source for
the timer.
34
C8051F93x/92x Comparator Block Diagram
 Comparator block diagram
 Comparator configured
to monitor one touch
sensitive switch
35
The left side shows a simplified block diagram of the comparator peripheral when
configured for Capacitive Sensing mode. The positive input multiplexer is
configured to set the voltage threshold. The negative input multiplexer can select
between the different GPIO pins that are connected to touch sensitive switches. The
output of the comparator (CP OUT) has three functions. The first is to help set the
voltage threshold, which is the resistor network in the top left. The second is to
charge and discharge the capacitor through the Rfeedback resistor. The third
function is the the output frequency of the relaxation oscillator.
The simplified diagram on the left shows one configuration where the positive input
sets the threshold and the negative input is connected to the switches. The
comparator multiplexers can switch roles and the positive input can be connected to
the switches and the negative input can set the threshold. The positive input
multiplexer can connect to 12 different GPIO pins and the negative input
multiplexer can connect to 11 different GPIO pins for a total of 23 possible inputs.
The right side shows the block diagram simplified even further to show the
configuration for one touch sensitive switch.
35
RO Capacitive Sensing with Other MCUs
 The capacitive sensing solution can be implemented on other
Silicon Labs MCU families using only passive components
No External Components
External Resistors
 The only extra requirements compared to the C8051F93x/F92x solution
are the (3 + N) resistors, where N is the number of switches and 3 extra
port pins for the feedback
 Silicon Labs MCU families other than the C8051F93x/92x family can
interface up to 12 switches directly or more with an external
analog multiplexer
36
The C8051F9xx family integrates all of the components required to implement
Capacitance sensing. However, all of the active components are available in other
Silicon Labs MCUs so this technology can be used with those as well. The only
requirement is that the passive components are needed external to the device.
36
Adding Multiple Switches
 Adding multiple capacitive switches only requires
switching the comparator multiplexer input
 The active switch on the multiplexer will start the chargedischarge cycle as soon as the multiplexer is switched over
 This enables rapid measurement of all switches
37
There is an input multiplexor to the comparator that enables multiple switches to be
used. All that is required is to switch the register value to enable the next pad and
we can scan all of the switches. The comparator immediately starts the
charge/discharge cycle once the multiplexor changes state.
37
The Comparator Module
38
Here is a diagram of the actual implementation in the C8051F9xx family. Notice
that the input multiplexors exist for both the positive and negative inputs to the
comparator and that there are up to 23 pads that can be connected to the inputs. All
of the resistors are integrated on chip as well so that the Capacitive Sensing pad is
the only required external connection.
38
The Timer Module
 Comparator 0 is used as the capture event for the timer module.
 Allows for measuring the period of the relaxation oscillator using the system
clock (SYSCLK)
39
Here is a diagram of the actual timer implementation in the C8051F9xx family.
Notice that the comparator output is used to capture the number of system clock
counts at the end of each relaxation oscillator period. Earlier we discussed how this
measurement technique is accomplished. The value read from the timer capture
register (TMR2RLL/TMR2RLH) is the value we read and subtract our inactive
measurement. This difference calculated is the representation of the period of the
relaxation oscillator.
39
Benefits Of The Implementation
 Low MCU overhead
 443 bytes code space for one switch and only one additional byte for
each additional switch
 Only requires one comparator and one timer
 Efficient algorithm allows the MCU to go into low-power mode and wake up
periodically to detect a switch event
 Less than 0.05% CPU utilization
 No external hardware overhead
 Directly connect the switch traces to the MCU port pins
 No other external feedback resistors or capacitors are needed
 Simple configuration
 Easy to perform with any material on the switch
 Insensitive to noise and supply voltage
 Insensitive to 50/60 Hz noise
 Does not require precise source voltage (VDD)
40
What are some of the benefits of this implementation?
Low MCU overhead –
1) Most of the code space is used for initializing the peripherals and performing the
configuration. Adding additional switches is trivial because all that has to be done is to
increase the array size to store the mux settings and the configuration threshold.
2) Typically requires only 1 comparator and 1 timer. A second timer can be used to
schedule the measurements, but this is not necessary and the function can just be called as
often as possible or whenever the firmware requires it.
3) While the MCU is not measuring the switches, it can go into sleep mode.
4) All circuitry required to implement the excitation to the pad is integrated on chip. This
enable a direct connection to the pads from the MCU.
Simple Configuration
All configurable parameters are obtained the same whether the dielectric is plastic, glass,
just the PCB trace alone, or anything else that typically covers the switch.
Insensitive to noise and supply voltage
There are a couple of aspects that affect the supply sensitivity. Sensitivity to noise and
VDD drift. If there are transient glitches they would not be apparent across multiple
samples and we can remove there affects. Also, because of the reference threshold
tolerances and set up of the comparator circuitry, supply voltage variation does not affect
the value of the time constant of the measured capacitance. Thus we can have the same
period across temperature and don’t need a precise VDD. The system clock is also stable
across temperature which is the time base used for the measurement of the oscillator period.
40
ToolStick Evaluation Kit




Four capacitive sensing pads
Four LEDs
Light sequence game
Source code available
 Sample configurations for timers and the comparator modules
available
 Wake on touch
ToolStick Base Adapter
41
Capacitive Sensing
Daughter Card
Part Numbers:
CAPTOUCHSENSESK — Capacitive Sensing Starter Kit
CAPTOUCHSENSEDC — Capacitive Sensing Daughter Card
Let’s take a look at some of the hardware available to check out Capacitive Sensing.
The ToolStick base adapter can connect to the Capacitive Sensing daughter card.
This card implements the touch pads as 4 solid round pads with a ground guard.
The sample code provided allows customers to play with the sensitivity of the
switches and see how Capacitive Sensing might work in their application.
41
What Can You Do With the Kit?
 Check out the effect of differing sensitivities
 Play with the polling speed in firmware to see
responsiveness and that it is easily fast enough that you can
press multiple switches simultaneously and not recognize
any delay
 Look at environmental effects to verify sensitivities
 The moisture in your breath increases the dielectric of the capacitor
 This is an example of configuring the switches to be too sensitive
Active Counts
Least
Inactive to Active Threshold
42
Inactive Counts
Sensitivity
Single count threshold
Active to Inactive Threshold
Most
The development tool is a good starting point for implementing your own system.
You can play with the values in the source code provided in order to see how
varying the threshold value affects the trip point of the switch. You can also take
this a step further to see how environmental affects change the capacitance values.
Even by blowing on the board, the humidity of your breath can change the dielectric
constant and cause false positives depending on sensitivity settings.
42
C8051F700 CS Implementation





16-bit SAR converter
32 channel input multiplexor
Single channel or multi-channel scanning using auto scan
Hardware accumulator
Window logic threshold to trigger an event when an active state is detected
43
Let’s take a look at how to implement the Capacitive Sensing using the C8051F700 family
from Silicon Labs. The 16 bit SAR block itself is implemented as a complete stand alone
block and generates it’s own time base. This allows it to run autonomously from the CPU
and provides the capability to wake the CPU from a low power state. Also integrated is a
20 bit accumulator that can add 1, 4, 8 or 16 scans and then provide the division using a
simple shift function. Using this hardware accumulator and simple shift function provides a
low overhead averaging function to reduce the affects of noise in the system. The window
comparator is software programmable and is set based on the system level performance of
the pad configurations. After the inactive and active signal levels are determined and a
suitable threshold is obtained the window comparator can be set to trigger an event when
the active switch threshold is met. This is useful to reduce CPU overhead and also for low
power modes. The conversion of the CS0 module is capable of being generated from
several sources including software trigger, all of the timers and auto-scanning. All of the
required components for Capacitive sensing are integrated on chip. Therefore, we can
connect the Capacitive Sense pad directly to the pin of the MCU.
43
Benefits of the CS Implementation
 Increased sensitivity to change in capacitance
 Hardware accumulator
 Decreases system noise
 Reduces CPU overhead
 Insensitive to noise and supply voltage changes
 Insensitive to 50/60 Hz noise due to sample time
 Differential sampling doesn’t require precise supply voltage
 No external hardware overhead
 Directly connect the switch traces to the MCU port pins
 No other external feedback resistors or capacitors are needed
 Low MCU overhead
 Autonomous peripheral allows the MCU to go into low-power mode and wake up on a
switch event
 Simple configuration
 Easy to perform with any material on the switch
44
44
Results
45
CS0 vs. RO Set-up
 Set-up
 C8051F700 and C8051F930 daughter cards used


Similar layout
Similar pad dimensions. The pads were simple as they were designed just for demo purposes.
 1/8” dielectric material
 Measured parameters
 Inactive state counts
 Active state data
 Calculated parameters





Determine the mean of the inactive data
Determine the noise of the inactive data
Determine the mean of the switched active state data
Calculate the Signal level
Calculate the SNR and thresholds
ToolStick Base Adapter
1/8” overlay
Capacitive Sensing
Daughter Card
46
The hardware used to compare the relaxation oscillator method and the Capacitive
Sensing Module (CS0) was the ToolStick daughter cards. The overlay material was
placed on the switches and the data was accumulated viat the ToolStick Base
Adapter. The inactive measurements were taken and then a finger press on the
overlay material for each of the boards. The results are found on the next slides.
46
RO System Signal to Noise Example
 C8051F930 daughter card with 1/8” overlay results
Inactive State Average = 413.12
Active State Average = 419.87
**Inactive state noise peak = 0.799
*Inactive state noise = 1.3
Signal = 6.75
SNR = 6.75/.799 = 8.44
SNR 3.3sigma = 5.02
 Sensitivity much less than the CS0 module
 Not a lot of SNR margin in this set-up
 Would need to revisit pad design, overlay material and software
*The value of noise used is 3.3 standard deviations from the mean
**The value of noise used is the peak value from the mean
47
The RO method did not perform as well as the CS0 module. In order to use the RO
method the pad would have to be redesigned and special consideration would have
to be given to the overlay material and the thickness as well as the layout of the
board. These factors were not even really considered on the F700 board as it was
also just designed as a demo where a finger can be placed directly on the PCB.
47
CS0 System Signal to Noise Example
 C8051F700 daughter card with 1/8” overlay (raw data)
Inactive state ave. = 19942
Active state ave. = 20353
*Inactive state noise1 = 26.7
**Inactive state noise2 = 17.2
Signal = 20353-19942 = 411
*SNR1 = 411/26.7 = 15.4
**SNR2 = 411/17.2 = 23.5
Active State MEAN
**SNR= 23.5
Inactive State noise (N)
Signal (S)
Inactive to Active Threshold
Noise threshold = 164
OFF threshold = 246
ON threshold = 369
Active to Inactive Threshold
Inactive State MEAN
*The value of noise used is 3.3 standard deviations from the mean
**The value of noise used is the peak value from the mean
48
Here is an example using simulated data on a finger press using the CapSense
module. The inactive measurement yields an average value of 19942. The active
state measurement yields a average value of 20353. The difference of the average
values gives us our signal level and in this case is 411. Once the signal is obtained
the threshold values can be determined. For example, to set the value for the ON
threshold we calculated 90% of the signal (.9 * 411). This value is then added to
the inactive mean to give is the actual threshold value in either counts (for the
relaxation oscillator method) or 16 bit sample (using the SAR method). The other
values are found in the same manner. There are two ways to measure the noise in
the system. The first s using the standard deviation and the statistical value to
encompass a percentage of the data points. The next way is to take the maximum
value of the of the inactive data and subtract the mean to find the peak. Both values
are shown above.
48
CS0 Actual System Design Example
 Front panel display and touch pad input PCB with 1/8” overlay
 Raw data used—no oversample
Active State MEAN
**SNR= 26.5
Signal (S)
Inactive state ave. = 16436.7
Active state ave. = 16736.57
*Inactive state noise1 = 16.86
**Inactive state noise2 = 11.3
Signal = 16736.57 - 16436.7 = 299.87
*SNR1 = 299.87/16.86 = 17.8
**SNR2 = 411/17.2 = 26.5
Noise threshold = 120
OFF threshold = 180
ON threshold = 270
Inactive State noise (N)
Inactive State MEAN
*The value of noise used is 3.3 standard deviations from the mean
**The value of noise used is the peak value from the mean
49
Here is an example using actual data from a completed system. The CS0 module
was used in this example to accumulate single data points. The mean for the
inactive counts and the active state were calculated and are shown on the side bar.
The overall SNR in this system just using raw samples was 26.5 if using the
standard method to calculate SNR. When using the more conservative approach our
SNR measured 17.8 which is still 3.56 times better than what has been considered
the accepted SNR for touch sense applications.
49
CS0 Actual System Design Example (Averaged)
 Front panel display and touch pad input PCB with 1/8” overlay
 16x hardware-based oversample
Active State MEAN
**SNR= 99.7
Signal (S)
Inactive state ave. = 16387.5
Active state ave. = 16736.69
*Inactive state noise1 = 4.78
**Inactive state noise2 = 3.5
Signal = 16736 - 16387 = 349
*SNR1 = 349/4.78 = 73
**SNR2 = 349/3.5 = 99.7
Noise threshold = 114
OFF threshold = 170
ON threshold = 256
Inactive State noise (N)
Inactive State MEAN
*The value of noise used is 3.3 standard deviations from the mean
**The value of noise used is the peak value from the mean
50
Here is an example using actual data from a completed system. The samples in this
example were derived using a hardware averaging function. Sixteen samples were
accumulated and averaged using hardware. This approach requires no CPU
overhead to sum the sample and then perform the averaging function.
Oversampling by 16 should decrease the noise by a factor of 4. The overall SNR
will increase as a result.
50
CS0 vs. RO Conclusions
 CS0 sensitivity much greater than the RO module




Reduces software overhead
Provides margin in systems with changing environments
Allows the use of various overlay thicknesses and materials
Tests did not make use of the hardware accumulator
 Can increase the SNR even more
 CS0 scan time is extremely small
 Reduces noise sensitivity
 Increases number of switches that can be monitored
 RO method can achieve these good results with added software overhead
and scan time
 CS0 provides more SNR margin
 4x the SNR margin over the RO method
 16x the SNR margin using the hardware averaging
51
.
51
Learn More at the Education Resource Center
Visit the Silicon Labs website to get more information on Silicon Labs products,
technologies and tools.
The Education Resource Center training modules are designed to get designers up
and running quickly on the peripherals and tools needed to get the design done.





http://www.silabs.com/ERC
http://www.silabs.com/mcu
http://www.silabs.com/CapTouchSense
AN338: Capacitive Sensing Solution
AN367: Understanding Capacitive Sensing Signal To Noise Ratios and Setting
Reliable Thresholds
 AN366: QUICKSENSE™ Firmware API
 AN418: Baselining in the QUICKSENSE™ Firmware API
To provide feedback on this or any other training go to:
http://www.silabs.com/ERC
52
Visit the Silicon Labs Education Resource Center to learn more about the MCU
products.
52
www.silabs.com/MCU
53