About this document

Scope and purpose

This application note explains how to use PSOC™4 MCUs with the fifth-generation CAPSENSE™ technology and capacitive sensors to implement the wear detection for wearable devices.

Intended audience

This document is intended primarily for developers, engineers, and designers who are interested in implementing wear detection solutions using Infineon CAPSENSE™ technology.

Note:

This application note is for advanced users of CAPSENSE™ technology who are familiar with PSOC™ 4 devices, CAPSENSE™ technology, and CAPSENSE™ middleware library. If the user is new to CAPSENSE™ technology, see AN64846- Getting Started with CAPSENSE™ application note. For more information on CAPSENSE™, see AN85951 - PSOC™ 4 and PSOC™ 6 MCU CAPSENSE™ Design Guide.

Introduction

Wear detection allows users to interact with various wearable electronic devices and enables devices to detect the presence of human body with or without physical contact. It can be used to switch the mode of the device based on whether or not the user is currently wearing the device. This makes wear detection an attractive feature for wearable applications such as over-ear headphones, on-ear headphones, in-ear headphones, smart watches, fitness bands, smart glasses, smart rings, and so on.

Wear detection can be implemented using various technologies, such as capacitive sensing, inductive sensing, optical sensing, etc. Each of which has their own advantages and disadvantages.

Capacitive sensing is widely adopted as it enables robust designs with low cost, high reliability, low power, sleek aesthetics, and seamless integration with existing user interfaces. Infineon CAPSENSE™ devices provide robust capacitive-sensing capabilities for such applications.

Features


CAPSENSE™ sensing technology has the following features:

  • Reduces overall sensor construction cost

  • Easy and flexible to design

  • Occupies less space than optical sensor

This document explains hardware design guidelines, discuss some example sensor designs, describe external factors that affect the system, and describe software techniques to implement power-on wear detection.

Wear detection in wearable devices

There are multiple wearable devices available in market such as headphones, smart watch, fitness band, smart glass, smart ring, and so on. Most common requirement for all these wearable devices is wear detection or human interaction with the device. Most of such devices uses IR proximity based sensors for wear detection. Some common operation where the wear detection is used is to play or pause tasks, enable or disable ANC, activate or standby wireless interface, activate or standby display, etc. This IR based proximity sensor requires specific placement and cutouts in enclosure adds cost.

Infineon PSOC™4 CAPSENSE™ enables multiple human machine interface (HMI) use cases such as volume control, mute/unmute button, mode selection, mic position detection, power mode switching, ANC selection, and many more. There are multiple ways to implement these interfaces using buttons, sliders, touchpads, and proximity sensors. Another advantage is that the CAPSENSE™ provides water tolerance and low power. In applications where CAPSENSE™ is already being used to implement the HMI can also implement wear detection to reduces the component cost. In applications where the user makes contact with the device, a regular CSD button can be used for wear detection. In other devices where user does not make direct contact, a CSD proximity sensor will be required.

Hardware design guidelines

This chapter explains the hardware design considerations and guidelines for Infineon CAPSENSE™.

Sensor construction and stack up

A capacitive sensor can be constructed using different materials depending on the application requirement. In a typical sensor construction, a conductive pad, or surface that senses a touch is connected to the pin of the PSOC™4 using a conductive trace or link. This whole arrangement is placed below a non-conductive overlay material and the user interacts on top of the overlay.

Figure 1

shows the most commonCAPSENSE™ sensor construction.

Figure 1.

CAPSENSE™ sensor construction



The Copper pads etched on the surface of the PCB act as CAPSENSE™ sensors. A non-conductive overlay serves as the touch surface. The overlay also protects the sensor from the environment and prevents direct finger contact. A ground hatch surrounding the sensor pad isolates the sensor from other sensors and PCB traces.

The simplest CAPSENSE™ PCB design is a two-layer board with sensor pads and hatched ground plane on the top, and the electrical components on the bottom.

Figure 2

shows an exploded view of the CAPSENSE™ hardware and

Figure 3

shows the typical PCB stack up. Sensors may also be constructed by using materials other than Copper, such as Indium-Tin-Oxide (ITO), or printed ink on substrates such as glass or a flex PCB.

Figure 2.

CAPSENSE™ hardware overview



Figure 3.

PCB stackup - 2 layer



Layout guidelines

In a CAPSENSE™ system the capacitance of the sensor in the absence of a touch is called the parasitic capacitance (C

P

). The main components of C

P

are sensor pad capacitance, trace capacitance, and pin capacitance of the device. The pin capacitance is device-dependent. The C

P

of the sensor must be within the range supported by the device. You can find the supported C

P

range (CIN_Self, CIN_Mutual) in the device datasheet. You must ensure that the sensor and trace capacitance of your design meet the C

P

criteria specified in the datasheet.

The relationship between C

P

and the PCB layout is not simple. C

P

increases with an increase in the sensor pad size and trace length and width, and with a decrease in the gap between the sensor pad and the ground hatch.

There are many ways to decrease the C

P

:

Below is the layout checklist which can be used to verify your layout.

Table 1.

Layout rule checklist

No.

Category

Minimum value

Maximum value

Recommendations/remarks

1

Button

Shape

N/A

N/A

Circle or rectangular with curved edges

Size

5 mm

15 mm

10 mm

Clearance to ground hatch

0.5 mm

2 mm

Should be equal to overlay thickness

2

Overlay

Type

N/A

N/A

Material with high relative permittivity (except conductors)

Remove any air gap between sensor board and overlay/front panel of the casing.

Thickness for buttons

N/A

5 mm

3

Sensor traces

Width

N/A

7 mil

Use the minimum width possible with the PCB technology that you use.

Length

N/A

300 mm for a standard (FR4) PCB

50 mm for flex PCB

Keep as low as possible.

Clearance to ground and other traces

0.25 mm

N/A

Use maximum clearance while keeping the trace length as low as possible.

Routing

N/A

N/A

Route on the opposite side of the sensor layer. Isolate from other traces. If any non- CAPSENSE™ trace crosses the CAPSENSE™ trace, ensure that intersection is orthogonal. Do not use sharp turns.

4

Via

Number of vias

1

2

Use the minimum number of vias possible to route CAPSENSE™ signals, to minimize parasitic capacitance. Place the vias on the edge of the sensor pad to reduce trace length.

Hole size

N/A

N/A

10 mil

5

Ground

Hatch fill percentage

N/A

N/A

Use hatch ground to reduce parasitic capacitance. Typical hatching:

25% on the top layer (7-mil line, 45-mil spacing)

17% on the bottom layer (7-mil line, 70-mil spacing)

6

Series resistor

Placement

N/A

N/A

Place the resistor within 10 mm of the PSOC™ pin.

See

Figure 4

for an example placement of series resistance on board.

7

Shield electrode

Spread

N/A

1 cm

If you have PCB space, use 1-cm spread.

8

Guard sensor (for water tolerance)

Shape

N/A

N/A

Rectangle with curved edges

Thickness

N/A

N/A

Recommended thickness of guard trace is 2 mm and distance of guard trace to shield electrode is 1 mm.

9

C

MOD

Placement

N/A

N/A

Place close to the PSOC™ pin. See

Figure 4

for an example placement of C

MOD

on PCB.

Figure 4.

Example placement for CMOD, and series resistance on input lines in PSOC™4 device



For more details, refer to the 'Design considerations' Section in the AN85951 - PSOC™4 and PSOC™6 MCU CAPSENSE™ design guide.

Example designs for sensor

Wear detection with CAPSENSE™ has the advantage of being flexible, and can be accommodated in various form factors as per the requirements of the end application. In this section we will examine two common applications that require wear detection.

Over-ear headphones - sensor construction and stack up

Over-ear headphones are constructed in such a way that the device enclosure is not in direct contact with the head. Usually, there is cushion that is in contact with head due to which we will use a CSD proximity sensor configuration for wear detection.

Figure 5

shows a suggested placement of the sensor PCB. Care must be taken to place the sensor away from other components like battery, speaker driver, and wireless antenna if possible. The wear detection sensor consists of electrode patterns on a two layer PCB.

Figure 5.

Over-ear headphone - proximity sensor placement outer view



Figure 6

shows the layers of the wear detection sensor PCB from the top and bottom.

Figure 7

shows the sensor stack-up side view. The pattern shown here is designed to detect the presence of the wearer's head at a distance of approximately 20 mm, that is the typical thickness of the cushion on a headphone. The sensor includes a cross-hatched plane around the proximity loop that is connected to an active-shield. This active-shield will protect the proximity loop from the effects of nearby ground or active components.

Figure 6.

Over-ear headphone example sensor design



Figure 7.

sensor stack up side view



Directionality

Due to the highly sensitive nature of a proximity sensor, it can detect touches from all directions. But this is undesirable, since the wear detection sensor can be falsely triggered by the user handling the headphone from the external side. Implementing directional sensing in an end-system poses a significant challenge, as it relies on factors such as overall enclosure design, hardware components, and PCB layout.

The placement of a ground plane at the bottom of the sensor reduces the possibility of unintended touches coming from below and achieves directional sensitivity in proximity sensors. Since the ground plane can decrease the sensor’s sensitivity, it must be placed with some separation from the bottom layer of the sensor PCB. The optimal distance depends on various system factors and requires testing on the actual system to determine the best distance. However, it is recommended to keep the separation at least 30% of the target sensing distance as shown in

Figure 8

. The separation can be increased gradually if the desired sensitivity is low.

Figure 8.

Over-ear headphone sensor stack up



Smart glasses - sensor construction and stack up

For other application such as smart glasses, the human body will be in direct contact with enclosure of the device. In such an application, a regular CSD button can be used.

Figure 9

shows a suggested placement of the sensor PCB. Care must be taken to place the sensor away from other components like battery, speaker driver, and wireless antenna if possible. The wear detection sensor consists of electrode patterns on a two layer PCB.

Figure 9.

Smart glass - sensor placement overview



Figure 10

shows the layers of the wear detection sensor PCB from the top and bottom.

Figure 11

shows the sensor stack-up side view. The pattern shown here is designed to detect the presence of the wearer's head which is in direct contact with device. The sensor includes a cross-hatched plane around the sensor electrode that is connected to an active-shield. This active-shield will protect the sensor electrode from the effects of nearby ground or active components.

Figure 10.

Smart glass - example sensor design



Figure 11.

Smart glass sensor stack-up side view



External factors affecting the system

In any system, there are multiple external factors that affect system performance. These aspects are described in details in the 'Noise in CAPSENSE™ system' Section in PSOC™ 4 and PSOC™ 6 CAPSENSE™ design guide. This section discusses a few additional considerations that need to be made for wear detection in particular.

Temperature effect

Gradual temperature change

After tuning the sensor, the raw count value may vary gradually due to changes in the environment such as temperature and humidity. Therefore, the CAPSENSE™ middleware creates a new count value known as 'baseline' by low-pass filtering the raw counts. Baseline keeps track of, and compensates for, the gradual changes in raw count. The baseline is less sensitive to sudden changes in the raw count caused by a touch. Therefore, the baseline value provides a reference level for computing signal.

If your design environment includes large temperature variation, you may find that the 85% CDAC calibration level is too high, and that the raw counts saturate easily over large changes in temperature, leading to lower signal to noise ration (SNR). If this is the case, you can adjust the calibration level to be lower by changing value from

CAPSENSE™ Configurator

. Navigate to

CSD Settings

tab under

Advanced

tab as shown in

Figure 12

. Locate

Raw count calibration level (%)

and change the value.

Figure 12.

Raw count calibration level value location



Sudden temperature change

The baseline tacking algorithm cannot compensate for sudden temperature changes, as this can affect the sensor in a manner that is similar to a valid touch event. Some additional measures will be needed in the design to handle such events.

One such measure is the inclusion of a sensor that will not be subject to user interaction. This is referred to as a temperature reference sensor (TRS). Since the TRS will not be affected by user touch, any change in it's raw count can be considered as the impact of an external factor like temperature change. This change can then be compensated in the raw count of the actual wear detection sensor.

Temperature reference sensor design

The temperature reference sensor is a standard CAPSENSE™ sensor. Hence, it must be configured as a CSD button. To maximize the effectiveness of reference sensors, select a placement and location with minimal user contact. All design consideration mentioned in 'Design considerations' Section in AN85951 - PSOC™4 and PSOC™6 MCU CAPSENSE™ design guide are applicable and must be followed when designing the TRS.

Since the TRS is a standard CAPSENSE™ sensor, tuning steps are same as any CSD button. Tuning is described in

Firmware/software design considerations

of this document. Since the TRS will not be used to detect a touch, the finger threshold for this sensor needs to be set to 65535. This is the only unique configuration needed for the TRS.

Firmware implementation of TRS algorithm

Figure 13

shows the flow chart for the firmware implementation of the TRS algorithm,

Figure 13.

Compensation flow chart



Below is the formula to calculate Ktemp-ratio, Adjusted SensRC, and its associated variable.

Ktemp-ratio=1.0+((tccf*(ref _ rawcounts-ref _ bsln))/ref_bsln)
Adjusted SensRC = SensDiffCnt * Ktemp-ratio
  • tccf = Temperature compensation correction factor

  • ref_rawcounts = Reference sensor RawCounts

  • ref_bsln = Reference sensor baseline

  • SensDiffCnt = Sensor difference count

Table 2

shows the guidelines for setting the threshold parameters,

Table 2.

Recommended values for the threshold parameters

Serial no.

CAPSENSE™ threshold parameter

Recommended value

Finger threshold

80% of signal

Noise threshold

40% of signal

Negative noise threshold

40% of signal

Hysteresis

10% of signal

ON debounce

3

Low baseline reset

30

Noise effect

Wearable devices are usually very dense in design and have multiple metal or conductive objects that are in close proximity to the CAPSENSE™ sensor and the PSOC™ device. As part of sensor and system design try to keep metal objects and battery as far as possible from the CAPSENSE™ sensor, since these can act as high noise sources for CAPSENSE™ sensors. In some devices magnetic objects such as speakers are present. These must also to be kept as far from the CAPSENSE™ sensors as possible.

CAPSENSE™ sensors are susceptible to noise because of their large sensor area or high sensitivity setting. High noise makes it difficult to achieve a good signal-to-noise ratio (SNR) (typically greater than 5:1), which is required for the wear detection sensing system.

Table 3

lists the common sources that contribute to noise and their respective recommended mitigation techniques.

Table 3.

Sources of noise and mitigation techniques

Noise source

Examples

Recommended noise mitigation technique

PWM driven devices

LEDs, motors

  • Design to keep these sources as far as possible from the sensor

  • Add a ground hatch between these devices and sensors

Switching power converter

AC-DC, DC-DC, DC-AC

High-speed communication interfaces

USB, Ethernet

  • Use shielded twisted pair wires

  • Design to keep these sources as far as possible from the sensor

  • Add a ground hatch between these devices and sensors

AC supply lines

Relays and switches

  • Use shielded twisted pair wires when power lines are passing near the sensors

Battery-powered application

When configuring CAPSENSE™ sensors on wearable devices that run on battery power, it is essential to consider a few key points. These points are explained in detail below.

In battery-powered portable applications, device ground and earth ground are lightly coupled, so, capacitance between device ground and earth ground (C

GE

) is small. The resulting equivalent circuit is shown in

Figure 14

. So, in this condition, you get a lower sensitivity; that means you will get a lower signal for a finger touch, which is due to a decrease in capacitance seen at the device.

Figure 14.

Equivalent circuit of the CSD for battery-powered application



Following are the recommendations for a CSD system design in a portable application powered by a battery:

  1. Add a large ground plane to the system. The ground plane should be away from the sensing element such that it does not increase the parasitic capacitance of the sensor. Follow the best practices for the PCB layout guidelines described in 'PCB layout guidelines' Section in AN85951 - PSOC™4 and PSOC™6 CAPSENSE™ design guide

  2. Use a driven shield to improve the sensitivity of portable devices. For more information, refer to 'Layout guidelines for shield electrode' Section in

    AN85951 - PSOC™4 and PSOC™6 CAPSENSE™ design guide

  3. Reduce the thickness of the overlay material or use an overlay with better dielectric value to improve sensitivity

  4. Place the system ground such that it can refer more closely with the user. This can also improve the ground reference

Firmware/software design considerations

This section assumes that the user is familiar with PSOC™ 4 devices, CAPSENSE™ technology, CAPSENSE™ middleware library and software tools including the CAPSENSE™ Configurator, and tuner. For more information, refer to Associated content.

For details on how to develop the firmware for a proximity sensor, refer to the

PSOC™ 4: MSCLP low-power proximity

.

For details on how to develop the firmware for a proximity sensor, refer to the

PSOC™ 4: MSCLP low-power self-capacitance button

.

Sensing method

The CAPSENSE™ CSD method is generally considered the most appropriate choice for wear detection. However, depending on the specific end application, it may be possible to utilize either the CSD or CSX method. As per application requirements, either a button or a proximity sensor, or a combination of the two, can be used to sense human presence.

Low-power aspects

The CPU intervention is not required between the start and end of a CAPSENSE™ scan. If the firmware does not have any additional tasks other than waiting for the scan to finish, you can put the device to Sleep mode after initiating a scan, to save power. When the CSD hardware completes the scan, it generates an interrupt to return the device to the Active mode. To achieve low power operation with a PSOC™4 CAPSENSE™ design, refer to the AN234231 - PSOC™4 CAPSENSE™ ultra-low-power capacitive sensing techniques application note.

For details on how to develop the firmware to achieve low power operation, refer to the

PSOC™4: MSCLP low-power self-capacitance button

or

PSOC™4: MSCLP low-power proximity

code example.

Power on wear detection

Power on wear detection is one of the use cases in wearable devices. This is the condition where the user wears the device before turning it ON. In such a condition, the device still needs to detect that it has been worn and needs to change its status and take required actions. There are multiple ways to detect power on wear detection. This section describes one approach which re-uses the TRS for Power On Wear Detection (POWD).

During the end-of-line (EOL) calibration process, the user should store the wear detect sensor capacitance (WearSensCap_Cal) and reference sensor capacitance (RefSensCap_Cal) into non-volatile memory. These values will be used for POWD calculations.

Next, the user should calculate the following parameters based on the recommended values:

  1. WearSensCap_Hys

    : Hysteresis value for WearSensCap

  2. RefSensCap_Hys

    : Hysteresis value for RefSensCap

  3. WearSensCap_Thr

    : Threshold value for WearSensCap

  4. RefSensCap_Thr

    : Threshold value for RefSensCap

After the calibration process, the user should obtain the current wear detect sensor capacitance (WearSensCap) and calculate the RSCp-ratio, which is used to compensate for temperature variations.

Once the RSCp-ratio is calculated, the user should compensate the WearSensCap value using the RSCp-ratio:

Finally, the user should check if the Compensated_WearSensCap value is within the threshold range (WearSensCap_Thr and RefSensCap_Thr) and take the appropriate action based on the result. If the Compensated_WearSensCap value is below the WearSensCap_Thr, the system should detect wear upon power on

Figure 15.

Power On wear detection flow chart



Below is the formula to calculate RSCp-ratio, compensated SenseCap_Cur, and its associated variable. The Ktemp-ratio in the

Firmware implementation of TRS algorithm

is calculated using raw count values, while in this context, RSCp-ratio is based on reference sensor capacitance (C

p

) measurements.

RSCp-ratio=1.0+((tccf _ cp*(ref _ cp _ value-ref _ base _ cp _ val))/ref _ base _ cp _ val)
Adjusted WearSensCap = WearSensCap * RSCp-ratio
  • tccf_cp = Temperature compensation correction factor for Cp compensation

  • ref_cp_value = Reference sensor capacitance (Cp)

  • ref_base_cp_val = Reference sensor baseline capacitance (Cp)

  • WearSensCap = Sensor capacitance (Cp)

  • RSCp-ratio = Temperature reference sensor Cp ratio

Associated content

The following section provides the supporting resources relevant to this application note.

Online resources

Abbreviations/acronyms

Table 4.

Abbreviations/acronyms used in this document

Abbreviation/acronym

Description

ANC

Active noise cancellation

BLE

Bluetooth low-energy

C

p

Parasitic capacitance

CSD

Self-capacitance sensing

CSX

Mutual-capacitance sensing

ITO

Indium Tin Oxide

HMI

Human machine interface

pF

picofarad

PSOC™

Programmable system on chip controllers offered by Infineon

RSCp-ratio

Temperature reference sensor Cp ratio

SNR

Signal to noise ration

TRS

Temperature reference sensor

TRSRC

Temperature reference sensor raw count

TRSRC_Threshold

Temperature reference sensor raw count threshold

SensRC

Detection sensor raw count

SensThreshold

Detection sensor threshold

Ktemp-ratio

Temperature reference sensor ratio

Revision history

Document revision

Date

Description of changes

**

2025-04-03

Initial release

Trademarks

PSOC™, formerly known as PSoC™, is a trademark of Infineon Technologies. Any references to PSoC™ in this document or others shall be deemed to refer to PSOC™.