Capacitance sensing systems can be used in applications that are exposed to rain or water. Such applications include automotive applications, outdoor equipment, ATMs, public access systems, portable devices such as cell phones, PDAs, and kitchen and bathroom applications. This Application Note discusses using capacitance sensing on systems that must continue operating under moisture, rain or water drops. The proposed technique prevents false touch detection even when the sense area is covered completely with water.
1. Capacitance Sensing - Waterproof
Capacitance Sensing
AN2398
Author: Victor Kremin and Ruslan Bachunskiy
Associated Project: Yes
Associated Part Family: CY8C21x34, CY8C24x94
GET FREE SAMPLES HERE
Software Version: PSoC Designer™ v. 4.3
Associated Application Notes: AN2352
PSoC Application Notes Index
Application Note Abstract
Capacitance sensing systems can be used in applications that are exposed to rain or water. Such applications include
automotive applications, outdoor equipment, ATMs, public access systems, portable devices such as cell phones, PDAs, and
kitchen and bathroom applications. This Application Note discusses using capacitance sensing on systems that must continue
operating under moisture, rain or water drops. The proposed technique prevents false touch detection even when the sense
area is covered completely with water.
Introduction
Table 1. Keyboard Characteristics
The capacitance sensing technique can be effectively used
in applications where the touch sensing zone is exposed to
Characteristic Value
moisture, rain, or water drops. PSoC® CapSense allows
Number of Keys 3
you to replace expensive mechanical switches, improve
device reliability, and reduce total system cost. Size of Sensors 15 × 15 mm
2
There are numerous areas where waterproof capacitance Host Communications Interface I C (for debug purposes)
sensing can be used. In vehicle applications, examples Insulation Overlay Thickness 1-5 mm (glass or plastic)
include door opening devices, code entry systems, alarm
Power Supply Voltage 5 ± 0.25V
sensors, and capacitive parking proximity sensors.
Waterproof capacitive sensors can be used in a wide variety
of home applications including kitchen equipment, bathroom Experimental Arrangement
light switches, automatic faucets, and dish and clothes
A simple test setup was created to test water’s influence on
washing machines. Water resistant capacitive touch screens
capacitive sensing. The CYC821x34 PSoC family device
can be used on ATMs, PDAs, cell phones, portable GPS
was used for testing with the CSD (CapSense Sigma Delta)
navigation systems, and other devices that are used
User Module sensing method. The PSoC device was placed
outdoors.
on the sensing board. To display sensor status, several
The project created to test the water resistant capacitive additional LEDs were located on a small supplemental
sensing technique under simulated application uses three board and connected to the PSoC board. This board can be
simple buttons on a keyboard. You can expand the project placed at different locations during tests to aid sensors’
to fit your specific application requirements. For example, status observations.
you can increase the number of buttons, use different button
To monitor the sensor, raw counts, and other data during
dimensions and shape, and so on. The technical
realtime tests, an I2C-USB bridge was used. The bridge GUI
characteristics of the associated project are shown in
PC tool monitors multiple traces at the same time, logs them
Table 1.
to a file, and calculates scale and offset factors on the
collected data. For more details about using the I2C-USB
bridge to debug CapSense applications, see AN2352, quot;I2C-
USB Bridge Usage.quot; Figure 1 shows the experimental
environment.
December 8, 2006 Document No. 001-14501 Rev. *A 1
[+] Feedback
2. AN2398
Figure 1. Experimental Environment The sensor board contains three touch sensors, a guard
sensor located around the perimeter and two shield
Sensor Board electrodes connected in parallel.
The three touch sensors are surrounded by the internal ring
of the shield electrode. The internal shield electrode protects
the button sensors from detecting false touches caused by
water drops. The guard sensor is located between the
internal and external rings of the shield electrode and is
LED Display Board
used to detect the presence of a water stream. The external
shield electrode ring protects the guard sensor from
PSoC Board
detecting false touches caused by water drops. The
shielding electrode also reduces the influence of parasitic
capacitance by lowering the sigma delta modulator input
current. See the CSD User Module Data Sheet in PSoC
I2C-USB Designer for more details about shield electrode operation.
Bridge
Water is applied to the sensor board from the insulation
layer side. To prevent the sensing electrodes from coming
PC into direct contact with water, they are coated with an
insulating varnish. The connection wires have waterproof
insulation as well. The metal zone of the sensor board is
The sensors are located on a separate plate and are 95*45 mm. Each sensor is a 15 mm square. The guard
connected to the PSoC CapSense board using thin pliable sensor is 2.5 mm wide.
wires. The sensors are located separately from the
CapSense PCB so that the sensor board can be easily
Test Setup Schematic
subjected to different conditions, for example, applying a
stream of water to the sensor board. Figure 3 shows the test setup schematic. The LEDs with
current limiting resistors are installed on a separate display
The sensor board was created using a 2-mm thick single
board. The standard CY3212 or CY3213 board can be used
side foil FR4 material. An illustration of the sensor board is
for experiments. The CY3213 board supports the CSD
shown in Figure 2.
method. The CY3212 can be modified to support the CSD
Figure 2. Sensors Board Drawing method by installing a modulator feedback resistor.
2,52
December 8, 2006 Document No. 001-14501 Rev. *A 2
[+] Feedback
3. AN2398
Figure 3. Test Setup Schematic
R4 240
CMOD
5V
C4
10nF
R6
2.2k
32
31
30
29
28
27
26
25
Vdd
Vss
P0[3]
P0[5]
P0[7]
P0[6]
P0[4]
P0[2]
R1 240 R3 240
1 24
P0[1] P0[0]
2 23
P2[7] P2[6]
3 22
P2[5] P2[4]
R2 240 4 U1 21
P2[3] P2[2]
5 CY 8C21434 20
P2[1] P2[0]
D1 D2 6 19 D3 D4
P3[3] P3[2]
7 18
Sens2 Guard Sens1 Sens3
P3[1] P3[0]
8 17
P1[7] XRES
P1[5]
P1[3]
P1[1]
P1[0]
P1[2]
P1[4]
P1[6]
Vss
9
10
11
12
13
14
15
16
FB
J1
5V 5V
1
2
3
I2CSDA 4
I2CSCL 5
+
C3 C2
100nF 10uF IS S P /I2 C
SENS3
SENS1 SENS2
SHIELD
GUARD
Sens1 Sens2 Sens3
Figure 4. I2C-USB GUI Variables Setting Example
Water Influence Tests
The following was used for all testing of the influence of
water on the raw sensor counts. The sensor board was set
vertically during all experiments. Photos of the tests are
shown in Appendix A. Tap water was used to test the
board. To simulate worst-case conditions, some kitchen
salt was dissolved in the water, resulting in increased
water conductivity.
Additionally, the effect of setting different modulator
The following tests were completed: reference values during the water droplets test was
examined. These results are discussed ahead.
Touching the dry sensor with a finger.
The first test checks the keyboard operation when no
Applying water droplets from a sprayer when the water is present on the board and a finger touches all of
shield electrode was connected to ground. the sensors sequentially (as shown in Figure 5a). As you
can see in the figure, the finger touches are easily
Touching the sensor with a finger after a water stream detectable.
was applied and water droplets were left on the
The second test checks the sensor functions when water
insulator.
drops are present on the sensor, the shield electrode is
enabled, and a finger touches all of the sensors
Applying water droplets from a sprayer when the
sequentially (as shown in Figure 5b). As can be seen from
shield electrode was active.
the figure, small signal spikes take place because the
finger first touches the water droplet, then the board.
Applying a continuous water stream to the board from
These spikes are negligible in comparison to the signal
a large cup.
from the finger and do not create any problems with touch
The results of these tests are shown in Figure 5. To make detection. The finger touch signals are easily detectable.
the collected data easy to visually analyze, the raw count
data from different sensors were biased using the Offset
feature in the I2C-USB bridge GUI PC tool. The settings
from the example are shown in Figure 4.
December 8, 2006 Document No. 001-14501 Rev. *A 3
[+] Feedback
5. AN2398
The third test checks the sensor functions when water is When a finger touches the dry surface, the finger adds
sprayed on the board and the shield electrode is disabled capacitance Cx to the sensing electrode (Figure 6a). When
(as shown in Figure 5c). As you can see in the figure, the an isolated water drop is located between the sensing and
water spray can produce signal spikes close to the signal shield electrodes (Figure 6b), the capacitive coupling
from the finger; the finger touch signal is 400 counts above between the shield and sensing electrodes is increased
baseline, while the water drop signal is 200 counts, about (via Cwd and Cws capacitances).
half. It may cause false touch detection under some
When a continuous water stream is applied to the sensing
conditions.
surface (Figure 6c), the large capacitance of the stream
The fourth test checks the sensor functions when water is Cst is added. This capacitance may be several times larger
sprayed on the board and the shield electrode is enabled than the shield electrode-to-water capacitance, Cwd.
(Figure 5d). As can be seen from this figure, the spike Because of this, the effect of the shield electrode is
levels are more than six times less than the finger signal completely masked and the sensor raw counts are the
and can be easily distinguished. Therefore, the shield same as or even higher than a finger touch. In this
electrode effectively protects the keyboard controller from situation the guard sensor can help. When it detects the
false touch detection. stream it can block the other sensors from triggering.
The next test checks the sensor functions when a water Several additional tests were done using different sigma
stream is applied to the board and the shield electrode is delta reference voltages to determine what effect they had
enabled (Figure 5e, and Figure 5f). As you can see from on the tests. Two of these results are shown in Figure 7.
the figures, the water stream produces signal spikes on all The area where there is little change in the raw counts is
sensors with the same magnitude as a finger touch. These when the sensor is dry. Then water is sprayed on the
will produce false touch detection. The guard sensor, insulator.
however, produces signals with even higher levels than
Figure 7. Raw Counts Change when Water Droplets were
the touch sensors, because the guard sensor has a larger
Applied at Different Reference Settings
sense area. So the guard sensor can be used to detect
the presence of a water stream on the board and 140 Ref=0.25Vdd
implement blocking decision logic when a water stream is Ref=0.4Vdd
120
detected. 100
There are some illustrations to show CapSense 80
configurations during water tests. See Figure 6. 60
40
Figure 6. Sensing On Dry Surface (a), with Water Droplets
20
on Surface (b) and when Water Stream is Applied to
0
Surface (c)
-20
-40
-60
-80
0 200 400 600 800
Sample #
As you can see in Figure 7, at a low reference voltage the
spikes are mostly positive, the same direction as finger
touches. When the reference voltage is increased, peaks
are mostly lower than the quot;no waterquot; level because when
the water droplet is located between the shield and
sensing electrodes, the modulator current is reduced more
than with a higher reference. The spike direction is the
opposite of a finger touch signal change. The high-level
API routines can utilize this characteristic and yield
benefits from this by not resetting baseline levels when
there are short durations of negative spikes. This
functionality is not supported in the current version of the
CSD User Module v. 1.0 but may be added in future
versions.
December 8, 2006 Document No. 001-14501 Rev. *A 5
[+] Feedback
6. AN2398
When water droplets are applied to the insulator, the water Demonstration Firmware
can create thin films over the insulation surface, increasing
The firmware uses the CSD User Module. Some post
sensing electrode capacitance. This is why at low
processing has been added to handle the guard sensor
modulator reference voltages the raw count changes are
signal. The updated baseline algorithm has been left
more positive, while at higher voltages they are more
without changes. The selected CSD User Module
negative. This is due to the increased effect of the shield
parameters are shown in Figure 9. Note that the Sensors
electrode.
Autoreset parameter has been enabled to allow baseline
The objective is to get the maximum difference between updates regardless of sensor state.
the finger touch signal and water droplet spike signals by
Figure 9. CSD UM Parameters
selecting the optimum reference voltage. This is especially
true if the water droplets cause negative peaks because at
this time, the CSD API resets the baseline to the minimum
value. The Figure 8 shows water droplets quot;signal-to-noise
ratioquot; for various reference voltages.
Figure 8. Relation between Finger Touch Response and
Water Droplets Noise for Different Reference Settings
Water Droplet
6
“SNR”
5
4
3
2
1
The firmware scans the touch sensors and the guard
sensor with different scanning parameters,
FingerThreshold and Reference values, because touch
0
0,10 0,15 0,20 0,25 0,30 0,35 0,40 0,45
sensors and guard sensors have different areas used for
Reference, x Vdd different purposes. The guard sensor is located around the
touch sensors and the guard sensor area is distributed
over a larger board area. The guard sensor should have
As you can see from this figure, the maximum relation was better sensitivity and a lower FingerThreshold value than
received at reference voltage 0.30 Vdd. That corresponds the touch sensor.
to the Ref Value = 1 in the CSD UM parameters. This
A special algorithm is used to provide reliable finger touch
value will be different for different electrodes and overlay
detection and eliminate false touch detection. This
configurations, so your configurations may use different
algorithm uses special resettable counters for each touch
values. In another version of the sensor panel, the best
sensor and the guard sensor, implemented in firmware.
results were obtained at Ref Value = 2.
These counters provide a debounce function. The touch
The experimental results and simple model we used sensor counter sets the minimum time interval during
clearly show that for reliable touch detection and which the sensor must be touched in order to be detected
elimination of false detection caused by the water droplets by the decision logic. The touch counters allow you to
and streams, a combination of shield electrodes and a eliminate short signal spikes caused by water leaks and
guard sensor should be used. The shield electrode remove false touch detection.
reduces the influence of water droplets at the physical
The guard sensor counter allows you to eliminate false
level and the guard sensor resets the decision logic
touch detection due to the remains of the water on the
operation at the logic level. The next section discusses the
board after a stream of water is applied. When a water
proposed high-level data processing scheme.
stream is applied to the board, the guard sensor detects
this event and disables the touch sensor processing logic.
Additional guard sensor quot;deadquot; time prevents unlocking
the sensor counters prematurely. When the water stream
is gone, the guard counter suppresses touch processing
for a short time. This eliminates false touch detection due
to water remaining on the board.
December 8, 2006 Document No. 001-14501 Rev. *A 6
[+] Feedback
7. AN2398
The algorithm is shown in Figure 10 as a simplified
equivalent electrical schematic so that its operation is
easier to understand.
Figure 10. Equivalent Simplified Schematic of the Post Processing Logic
Counters Update Upon
Scan Completion
Guard Counter
Sensors Array
-1
Sg in Sg out Load
En 0
Gcnt out
S1 S1 in
Multiple Touch
Detection
S2 S2 in S1
… Adder
Sn >1
Sensor 1 Counter
SN-1 SN-1 in
+1
R1 S1 cnt out
S1 out R =Thl
En <Thl
SN SN in
Sensors
Status
Sensor N Counter
SN cnt out
SN out
CSD API Post Processing Logic
Counters are updated after the completion of each Reaching the counter maximum value signals sensor
scanning cycle. The guard counter is loaded with its activation. Figure 11 shows the counter’s timing diagram.
threshold value when the guard sensor is triggered. The
counter is decremented until it reaches zero. The sensor
counters are enabled when the guard counter reaches
zero. When the sensor counter reaches the threshold
value it stops incrementing the count and holds the
maximum count value.
December 8, 2006 Document No. 001-14501 Rev. *A 7
[+] Feedback
8. AN2398
Figure 11. Timing Diagram of Guard and Sensor Counters Design Recommendations
Guard Сounter Operational Diagram This Application Note can be used as a design foundation
for other waterproof CapSense projects. From our
SG out experimentation we developed several recommendations
that you may find useful:
• Place the sensors vertically or at an angle to the
SGcnt out horizontal so that water drops naturally move off of
the sensor plate and large water drops do not
accumulate.
tg del
• Use a water-repellent, non-absorbent material as the
front panel insulator. This minimizes water streaks
and films on the device panel. This is especially
Sensor Counter Operational Diagram
important if the water is highly conductive. Seawater,
for example.
S1 out
• The guard sensor is required in situations where the
application may be subjected to continuous water
ts del streams. It is not required if the device is subjected to
S1 cnt out rain only.
• The shield electrode between buttons should be at
R least 10 mm wide. This allows you to effectively
suppress the influence of water drops.
Summary
Sg out – The guard sensor detection signal. This Application Note demonstrates a waterproof
capacitance sensing technique that can be used
SGcntout – The guard counter output signal: ‘1’ when water
successfully when the target detection area operates with
is present, ‘0’ when water is not present.
moisture, water films, drops, or even a continuous water
tg_del – The minimum time interval after the last water stream. The device continues to function in the presence
detection event before touch detection decision logic is of water drops and eliminates false triggering when a
enabled. water stream is applied to the sensing zone.
S1out – The first sensor touch detection signal. The post-processing algorithm can be used in other
applications where reliable touch detection is required, for
S1 cnt out – The first sensor counter output signal.
example, in white goods where the system should not
ts del – The minimum time interval during which sensor generate false triggers during cleaning. The software
must be touched continuously in order to be detected as counter mechanism is effective for preventing
touched by the decision logic. simultaneous touches of multiple sensors in conventional
CapSense applications, for example, placing an arm or
There is an additional mechanism in the API that tracks
palm on the sensing zone.
multiple sensor touches and resets all sensor counters
when more than one sensor is touched at one time. It
allows you to suppress false touch detection when a water
stream is applied or the customer places their palm on the
sensor zone. This mechanism is also useful when you
have several sensors located horizontally and it is possible
for a large water drop to cover several sensors at the
same time. In this case, touching one sensor may trigger
touch detection on all of the other sensors at the same
time. The multiple touch detection mechanism prevents
false detection in this situation.
A full listing of the post processing logic is available in
Appendix B.
December 8, 2006 Document No. 001-14501 Rev. *A 8
[+] Feedback
9. AN2398
Appendix A. Photos of Tests
In Figure 12, photos of the different keyboard water tests
are shown.
Figure 12a) shows the dry keyboard test. A finger touch on
the middle sensor turns on the middle LED.
Figure 12b) shows water sprayed on the keyboard. As can
be seen in the photo, no LEDs turn on.
Figure 12c) shows a finger touching the middle sensor
when water droplets are present on the board. The middle
LED turns on. No false detection takes place.
Figure 12d) shows a water stream applied to the keyboard
and the guard sensor LED turns on. No other sensors can
turn on while the guard sensor is active.
Figure 12. Test Photos a) Dry Board Test b) Spraying Water on Board; c) Touching Sensor when Water Droplets are on
Board; d) Applying a Stream of Water to Board
a) b)
c) d)
December 8, 2006 Document No. 001-14501 Rev. *A 9
[+] Feedback
10. AN2398
Appendix B. Post Processing Code
//----------------------------------------------------------------------------
// C main line
//----------------------------------------------------------------------------
#include <m8c.h> // part-specific constants and macros
#include quot;PSoCAPI.hquot; // PSoC API definitions for all User Modules
#define SENSOR_TOUCH_COUNT_TH 15
#define GUARD_TOUCH_COUNT_TH 10
#define GUARD_SENS_NUM 3
WORD iI2CBuf[CSD_TotalSensorCount];
BYTE touch_cnt_array[CSD_TotalSensorCount];
BYTE touch_cnt = 0;
BYTE guard_state = 0;
BYTE i;
extern BYTE EzI2C_bRAM_RWcntr;
void main()
{
M8C_EnableGInt;
CSD_Start();
CSD_SetDefaultFingerThresholds();
CSD_baBtnFThreshold[GUARD_SENS_NUM] = 100;
CSD_SetRefValue(0);
CSD_InitializeBaselines();
for (i = 0; i < CSD_TotalSensorCount; i++)
touch_cnt_array[i] = 0;
EzI2C_SetRamBuffer(2*CSD_TotalSensorCount, 0, (BYTE *)iI2CBuf );
EzI2C_Start();
while (1) {
CSD_SetRefValue(1);
CSD_ScanSensor(GUARD_SENS_NUM);
CSD_SetRefValue(1);
CSD_ScanSensor(0);
CSD_ScanSensor(1);
CSD_ScanSensor(2);
CSD_UpdateAllBaselines();
M8C_DisableGInt;
if ((0 == EzI2C_bRAM_RWcntr) || (EzI2C_bRAM_RWcntr > (2*CSD_TotalSensorCount-1)))
for (i = 0; i < CSD_TotalSensorCount; i++) iI2CBuf[i] = CSD_waSnsResult[i];
M8C_EnableGInt;
touch_cnt = 0;
for (i = 0; i < CSD_TotalSensorCount; i++)
if (GUARD_SENS_NUM != i)
{
if (0 != CSD_bIsSensorActive(i))
{
December 8, 2006 Document No. 001-14501 Rev. *A 10
[+] Feedback