Page 2
PARTICULAR PURPOSE. Cypress reserves the right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of the application or use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user.
1.2 Cypress’s CapSense Documentation Ecosystem Figure 1-1 Table 1-1 summarize the Cypress CapSense documentation ecosystem. These resources allow implementers to quickly access the information needed to successfully complete a CapSense product design. Figure 1-1 shows the typical flow of a product design cycle with capacitive sensing; the information in this guide is most pertinent to the topics highlighted in green.
Page 7
Introduction Figure 1-1. Typical CapSense Product Design Flow 1. Understanding CapSense technology = Topics covered in this document 2. Specify system requirements and characteristics = Applicable to MBR family of devices only † = Applicable to programmable devices only 3. CapSense device selection based on needed functionality Design for CapSense 6.
CY8C20xx7/S ● CY8C20xx7/S CapSense Design Guide (this document) ● CapSense Code Examples 1.3 CY8C20xx7/S CapSense Family Features Cypress‟s CY8C20xx7/S is a low-power, high-performance, programmable CapSense controller family that features: Advanced Touch Sensing Features Programmable capacitive sensing elements Supports a combination of CapSense buttons, sliders, and proximity sensors ...
Page 9
Introduction SmartSense_EMCPLUS compensates for environment and noise variations automatically SmartSense_EMCPLUS offers superior noise immunity for applications with challenging conducted and radiated noise conditions Internal regulator provides stability against power supply noise and ripple up to 500 mV of supply V ripple acceptable ...
Introduction 1.4 Document Conventions Convention Usage Displays file locations, user entered text, and source code: Courier New C:\ ...cd\icc\ Displays file names and reference documentation: Italics Read about the sourcefile.hex file in the PSoC Designer User Guide. Displays keyboard commands in procedures: [Bracketed, Bold] [Enter] or [Ctrl] [C] Represents menu paths:...
2. CapSense Technology 2.1 CapSense Fundamentals CapSense is a touch-sensing technology, which works by measuring the capacitance of each I/O pin on the CapSense controller that has been designated as a sensor. As shown in Figure 2-1, the total capacitance on each sensor pin can be modeled as equivalent lumped capacitors with values of C ,1 through C ,n for a design with n...
CapSense Technology Figure 2-2. Section of Typical CapSense PCB with the Sensor Being Activated by a Finger In addition to the parallel plate capacitance, a finger in contact with the overlay causes electric field fringing between itself and other conductors in the immediate vicinity. The effect of these fringing fields is typically minor compared to that of the parallel plate capacitor and can usually be ignored.
Page 13
CapSense Technology Figure 2-3. CSD Block Diagram Switched-capacitor input CY8C20xx7/S circuit converts capacitance to current Sigma delta converter converts current to digital counts Precharge clock Modulation Analog Mux Sigma Delta High Z Modulator input External Connection 2.2nF/X7R/5V 2.2.1.1 Switched-Capacitor Input The CSD method in the CY8C20xx7/S device incorporates C into a switched capacitor circuit, as Figure 2-3...
Page 14
CapSense Technology Figure 2-5. Switched-Capacitor Input Sinking Current from AMUXBUS AMUXBUS AMUXBUS SENSOR SENSOR The sigma delta converter maintains the voltage of AMUXBUS at a constant V (this process is explained in Sigma Delta Converter). Figure 2-6 shows the voltage waveform across the sensor capacitance. Driving switches Sw1 and Sw2 through non-overlapping precharge clocks thus results in an average current sink (I ) from the AMUXBUS SENSOR...
CapSense Technology raw counts to increase proportionally. By comparing the shift in steady state raw count level to a predetermined threshold, the high-level algorithms can determine whether the sensor is in the ON (touch) or OFF (no touch) state. Figure 2-7. CSD Raw Counts during a Finger Touch The hardware parameters or the CSD/CSDPLUS User Module Low-Level Parameters such as I...
Page 16
CapSense Technology Figure 2-8. CSDPLUS Block Diagram Switched-capacitor input CY8C20xx7/S circuit converts capacitance to current Sigma delta converter converts current to digital counts Precharge clock Compensation Modulation Analog Mux Sigma Delta High Z Modulator input External Connection 2.2 nF/X7R/5 V 2.2.2.1 Switched-Capacitor Input The CSDPLUS method in CY8C20xx7/S devices incorporates C into a switched-capacitor circuit, as...
Page 17
CapSense Technology Figure 2-10. Switched Capacitor Input Sinking Current from AMUXBUS AMUXBUS AMUXBUS SENSOR SENSOR The sigma delta converter maintains the voltage of AMUXBUS at a constant V (this process is explained in Sigma Delta Converter). Figure 2-11 shows the voltage waveform across the sensor capacitance. Driving switches Sw1 and Sw2 through non-overlapping precharge clocks thus results in an average current sink (I ) from the AMUXBUS SENSOR...
CapSense Technology The raw count is interpreted by high-level algorithms to resolve the sensor state and detect touches. Figure 2-12 plots the CSD raw counts from a number of consecutive scans during which the sensor is touched and then released by a finger.
CapSense Technology Figure 2-13. Design of Laptop Multimedia Keys for a 21-Inch Model Figure 2-14. Design of Laptop Multimedia Keys for a 15-Inch Model with Identical Functionality and Button Size 2.2.3.2 Reduced Design Cycle Time Usually, the most time-consuming task for a capacitive sensor interface design is firmware development and sensor tuning.
3. CapSense Design Tools 3.1 Overview Cypress offers a full line of hardware and software tools for developing your CapSense capacitive touch-sensing application. See Resources for ordering information. 3.1.1 PSoC Designer and User Modules Cypress‟s exclusive integrated design environment, PSoC Designer, allows you to configure analog and digital blocks, develop firmware, and tune and debug your design.
CapSense Design Tools 3.1.1.1 Getting Started with CapSense User Modules To create a new CY8C20xx7/S project in PSoC Designer: Create a new PSoC Designer project with CY8C20xx7/S as the target device. Select and place the CSDPLUS/SmartSense_EMCPLUS User Module. Right-click the user module to access the User Module wizard. Set button sensor count, slider configuration, pin assignments, and associations.
CapSense Design Tools 3.2 User Module Overview Figure 3-3. User Module Block Diagram User modules contain an entire CapSense system from physical sensing to data processing. The behavior of the user module is defined using a variety of parameters. These parameters affect different parts of the sensing system and can be separated into low-level and high-level parameters that communicate with one another using global arrays.
CapSense Design Tools 3.3.1 Raw Count The hardware circuit in the CapSense controller measures the sensor capacitance C . The circuit stores the result in a digital form called raw count upon calling the user module API UMname_ScanSensor(), where UMname can be CSD, CSDPLUS, or SmartSenseEMC_PLUS.
CapSense Design Tools Figure 3-5. PSoC Designer – CSDPLUS Parameter Window 3.4.1 User Module High-Level Parameters 3.4.1.1 Finger Threshold The Finger Threshold parameter is used by the user module to judge the active/inactive state of a sensor. If the difference count value of a sensor is greater than the finger threshold value, the sensor is judged as active. This definition assumes that the hysteresis level is set to „0‟...
Page 25
CapSense Design Tools Figure 3-6. Sensor State versus Difference Count with Hysteresis Set to Zero Figure 3-7. Sensor State versus Difference Count with Hysteresis ≥ + , = ≤ − , = Equation 3-1 Possible values are 0 to 255.
Page 26
CapSense Design Tools 3.4.1.4 Baseline Update Threshold As previously explained, the baseline variables keep track of any gradual variations in raw count values. In other words, baseline variables hold the output of a digital low-pass filter to which the raw count values are input. The Baseline Update Threshold parameter is used to adjust the time constant of this low-pass filter.
CapSense Design Tools 3.4.2 CSD/CSDPLUS User Module Low-Level Parameters The CSD/CSDPLUS User Module has several low-level parameters in addition to the high-level parameters. These parameters are specific to the CSD/CSDPLUS sensing method and determine how raw count data is acquired from the sensor.
Page 28
CapSense Design Tools Figure 3-9. Signal Values for Different Conversion Gains raw count maximum raw count = 2 Signal 2 Baseline 2 Signal 1 Baseline 1 > G > G Figure 3-9 shows three plots corresponding to three conversion gain values G , and G .
Page 29
CapSense Design Tools 3.4.2.2 Compensation I Value The Compensation I parameter sets the offset of the raw count versus C graph. Compensation I may be used to achieve a high sensitivity for high-C sensors. Figure 3-11 shows a plot of raw count versus sensor capacitance when I is non-zero.
Page 30
CapSense Design Tools 3.4.2.4 Scanning Speed This parameter sets the sensor scanning speed by setting the clock input to the Sigma Delta Converter. Although a faster scanning speed provides a good response time, slower scanning speeds give the following advantages: ...
CapSense Design Tools 3.5 SmartSense_EMCPLUS User Module Parameters Figure 3-12. PSoC Designer SmartSense_EMCPLUS Parameters 3.5.1.1 Immunity Level This parameter defines the immunity level of the user module against the external noise. Selecting a High immunity level provides maximum immunity against the external noise. A Medium immunity level provides moderate immunity. Setting the immunity level to Medium consumes twice the scan time and RAM memory, and setting the immunity level to High consumes three times the scan time and RAM memory for sensor implementation compared to the Low immunity mode.
Page 32
CapSense Design Tools Figure 3-14. PSoC Designer SmartSense_EMC_PLUS Sensor Setting Low Level High Level 3.5.1.3 Sensor Sensitivity This parameter is used to increase and decrease the sensitivity of a sensor. Possible values are 0.1 pF, 0.2 pF, 0.3 pF, and 0.4 pF ®...
4. CapSense Performance Tuning with User Modules Optimal user module parameter settings depend on board layout, button dimensions, overlay material, and application requirements. These factors are discussed in Design Considerations. Tuning is the process of identifying the optimal parameter settings for robust and reliable sensor operation. 4.1 General Considerations 4.1.1 Signal, Noise, and SNR A well-tuned CapSense system reliably discriminates between ON and OFF sensor states.
CapSense Performance Tuning with User Modules 4.1.1.2 CapSense Noise CapSense noise is the peak-to-peak variation in sensor response when a finger is not present, as demonstrated in Figure 4-1. In this example, the output waveform without a finger is bounded by a minimum of 5912 counts and a maximum of 5938 counts.
CapSense Performance Tuning with User Modules = 3 MHz 4.1.3 Importance of Baseline Update Threshold Verification Temperature and humidity both cause the average number of counts to drift over time. The baseline is a reference count level for CapSense measurements that is an important part of compensating for environmental effects. High- level decisions, such as Finger Present and Finger Absent states, are based on the reference level established by the baseline.
Page 36
CapSense Performance Tuning with User Modules Figure 4-3. Tuning the CSD/CSDPLUS User Module High-Level API Hardware Parameters Parameters Start Set Shield Electrode Out Measure C of sensors according to needs Set Finger Threshold using EP64134 of design Revise PCB design to 80% of signal according to AN2292 and AN2318...
CapSense Performance Tuning with User Modules 4.2.2 I Range For projects where the maximum sensor C is less than 45 pF, use 4X; otherwise, use 8X. 4.2.3 Autocalibration Autocalibration should always be set to „Enabled‟ in CY8C20xx7/S CSD/CSDPLUS designs. The ability of the autocalibration algorithm to successfully set the I relies on the prescaler being set properly and C being the...
CapSense Performance Tuning with User Modules higher SNR at the expense of longer scan time and more power consumption. Table 4-3 shows the actual scan time in microseconds for a single sensor based on resolution and scanning speed. Table 4-3. Scan Time for a Single Sensor in µs Based on Resolution and Scanning Speed Scanning Speed Resolution (bits)
CapSense Performance Tuning with User Modules 4.2.11 Set High-Level Parameters The following recommendations are a starting place for selecting the optimal parameter settings: Finger Threshold: Set to 80 percent of raw counts with sensor ON Noise Threshold: Set to 40 percent of raw counts with sensor OFF ...
CapSense Performance Tuning with User Modules 4.3.3 Recommended C Value for SmartSense_EMC_PLUS The recommended C value for a SmartSense_EMC_PLUS-based design is 2.2 nF. X7R or NPO type capacitors are recommended for C stability over temperature. The capacitor should have voltage rating not less than 5 V. 4.3.4 SmartSense_EMCPLUS User Module Parameters Only four parameters must be set for this user module.
CapSense Performance Tuning with User Modules To implement a robust electromagnetic compliant algorithm, the SmartSense_EMCPLUS UM uses RAM memory. As a result, the highest immunity mode (High) needs approximately three times the RAM memory used in immunity mode Low. Immunity mode Medium uses only about two times more RAM memory than that of immunity mode Low.
CapSense Performance Tuning with User Modules 10 to 23 1360 17 to 35 1360 10 to 23 23 to 41 2730 35 to 41 2730 23 to 41 1360 41 to 45 5460 41 to 45 5460 41 to 45 2730 Table 4-6.
CapSense Performance Tuning with User Modules This means that, when a CapSense sensor is activated, firmware produces the sensor ON status within 7.35 ms (the sensor should be active for debounce number of consecutive scans). This is often referred to as the response time of a CapSense system.
CapSense Performance Tuning with User Modules Figure 4-7. Sensor Signal for a Typical Sensor with a Finger Touch 4.3.9 Firmware Design Guidelines The response time of the CapSense sensors may change due to the increased parasitic capacitance of the sensor. It is also important to watch the loop execution time (see the following example code), which may also increase.
Page 46
CapSense Performance Tuning with User Modules void main() M8C_EnableGInt; SmartSense_EMC_PLUS_Start(); SmartSense_EMC_PLUS_ScanAllSensors(); SmartSense_EMC_PLUS_SetDefaultFingerThresholds() ; Timer16_EnableInt(); Timer16_SetPeriod (TIMEOUT_10MS) ; Timer16_Start(); while( 1 ) /* Scan all 3 sensors and update Baseline */ SmartSense_EMC_PLUS_ScanAllSensors(); SmartSense_EMC_PLUS_UpdateAllBaselines(); /* Wait till timer expires or sleep here */ while (bTimerTicks != 1) ;...
CapSense Performance Tuning with User Modules 4.4 Design Migration from CY8C20xx6A/AS to CY8C20xx7/S The CY8C20xx7/S family of CapSense controllers provides superior noise immunity based on QuiteZone technology and improved sensitivity of 0.1 pF with a 5:1 SNR. This section summarizes key points to migrate an existing CY8C20xx6A/AS design.
5. Design Considerations When designing capacitive touch-sense technology into your application, it is crucial to keep in mind that the CapSense device exists within a larger framework. Careful attention to every level of detail from PCB layout to user interface to end-use operating environment will lead to robust and reliable system performance. For more in-depth information, see Getting Started with CapSense.
Design Considerations 5.2 ESD Protection Robust ESD tolerance is a natural byproduct of thoughtful system design. By considering how contact discharge will occur in your product, particularly in your user interface, it is possible to withstand an 18-kV discharge event without incurring any damage to the CapSense controller.
Design Considerations Current Loop Area: Minimize the return path for current. Hatched ground instead of solid fill should be provided within 1 cm of the sensors and traces to reduce the impact of parasitic capacitance. RF Source Location: Partition systems with noise sources such as LCD inverters and switched-mode power supplies (SMPS) to keep them separated from CapSense inputs.
Design Considerations Table 5-4. RAM and Flash Requirements Filter Type Filter Flash (Bytes) Flash (Bytes) Order (Bytes per sensor) ImageCraft Compiler ImageCraft Pro Compiler Average 2–8 Median Jitter filter on raw counts Jitter filter on slider centroid 5.5 Power Consumption 5.5.1 System Design Recommendations For many designs, minimizing power consumption is an important goal.
Design Considerations 5.5.4 Measuring Average Power Consumption The following instructions describe how to determine average power consumption when using the sleep-scan method: Build a project that scans all of the sensors without going to sleep (continuous-scan mode). Include a pin-toggle feature in the code before scanning the sensors.
Design Considerations Figure 5-2. Recommended Port Isolation for Communication, CapSense, and LEDs All GPIOs of the CapSense controller are capable of implementing the CapSense sensor and drive LEDs. However, if the GPIOs LED drive and CapSense sensors are implemented in the same project, it is recommended to use GPIO according to Table 5-5 for best performance.
Design Considerations Figure 5-3. GPIO Load Transient Noise in a CapSense System GPIO Load Transient LED is ON Noise LED is OFF When current is sunk through a GPIO pin, the voltage at CapSense ground (GPIO PAD) will not be zero because of the non-zero bond-wire resistance, R3.
Design Considerations the amplitude of the GPIO load transient-noise to increase. Therefore, it is recommended to minimize the sensor by following the layout guidelines mentioned in the Getting Started with CapSense design guide. Reduce LED sink current The GPIO load transient noise is directly proportional to the LED sink current. It is recommended to keep the LED sink current within the limits as specified in the device datasheet.
Page 56
Design Considerations Figure 5-5. CapSense Sensor Variables when Baseline is Not Compensated Shift Due to GPIO Load Transient Rawcount Stuck due to Shift Due to GPIO Load Transient Finger Touch Finger Threshold No Touch No Touch Touch LED OFF LED ON Sensor Status Baseline Rawcount...
Design Considerations Figure 5-6. CapSense Sensor Variables when Baseline is Compensated Shift Due to GPIO Load Transient Baseline Compensated Difference Count is Zero Due to Baseline Compensation Shift Due to Finger Touch Finger Threshold Baseline is reset due to Low Baseline Reset Algorithm No Touch No Touch...
6. Liquid-Tolerant Design Considerations Some CapSense capacitive touch-sensing applications require reliable operation in the presence of water or other liquids such as ketchup and blood. White goods, automotive applications, and industrial applications are examples of systems that must perform in environments that include water, ice, humidity changes, or any other liquids. For such applications, shield electrodes and guard sensors can provide robust touch sensing.
Page 59
Liquid-Tolerant Design Considerations Figure 6-2. Capacitance Measurement with Liquid Drop = Capacitance between the liquid drop and shield electrode The purpose of the shield electrode is to set up an electric field around the touch sensors that helps attenuate the effects of water.
Page 60
Liquid-Tolerant Design Considerations Figure 6-4. Enabling CapsenseShieldSignal from GUI Step 2: Route the shield electrode out to the shield pin. There are five possible shield drive buffers, labeled Buf 0 through Buf 4; their mapping is shown in the following table. Shield Buffer Output Port Pin Buf 0...
Liquid-Tolerant Design Considerations Figure 6-6. Schematic View of Polarity Select 6.1.2 Guard Sensor Figure 6-7. PCB with Shield and Guard Sensor Shield Electrode Guard Sensor Sensor Pads A guard sensor is a copper trace, as shown in Figure 6-9, that surrounds all the sensors on the PCB, which is used to detect the presence of a continuous water stream or a large liquid spill.
Page 62
Liquid-Tolerant Design Considerations Figure 6-8. Capacitance Measurement with Large Liquid Spills or Water Stream - Capacitance between the water stream/liquid spill and shield electrode - Capacitance between the water stream/liquid spill and the system ground - Capacitance between the water stream/liquid spill and the guard sensor The guard sensor should be implemented in firmware.
Liquid-Tolerant Design Considerations Figure 6-9. Flow Chart to Implement the Guard Sensor Start of main function Initialize CapSense block and other blocks Scan all sensors including Guard sensor Update baseline of all sensors Is Guard Sensor ON? Turn off all the sensors Guard sensor counter elapsed? Report sensor status normally...
7. Proximity Sensing Design Considerations Proximity sensors detect the presence of a hand or other conductive object before it makes contact with the capacitive touch surface. Imagine a hand stretched out to operate a car audio system in the dark. Proximity detection enables the system to light up with the approach of a finger.
Proximity Sensing Design Considerations 7.2 Design Recommendations Using a shield electrode effectively extends the detection distance of the proximity sensor. This is particularly helpful when the proximity sensor must operate in the presence of metal. A wire sensor increases the beneficial effect of the shield electrode because it can be located farther from the shield electrode.
8. Low-Power Design Considerations Power consumption is an important aspect of microcontroller designs. Among the several techniques to reduce the average current used by the CapSense controller, sleep mode is the most popular. The CapSense controller uses sleep mode when it is not required to perform any function, similar to a cell phone backlight dimming after an idle period.
Low-Power Design Considerations PRT0DM0 = 0x00; // low bits PRT0DM1 = 0xff; // med bits PRT0DM2 = 0xff; //high bits 8.1.2 Putting it All Together The following code is a sample of a typical sleep preparation sequence for a 28-pin part. In this sequence, interrupts are disabled, the analog circuitry is turned off, all drive modes are set to Analog HI-Z, and interrupts are re-enabled.
Low-Power Design Considerations 8.1.6 Global Interrupt Enable The Global Interrupt Enable register (CPU_F) need not be enabled to wake the CapSense controller from interrupts. The only requirement to wake up from sleep by an interrupt is to use the correct interrupt mask within the INT_MSKx registers, as in the following example.
Low-Power Design Considerations Figure 8-1. Wakeup Sequence 8.2.4 Sleep Timer The CapSense controller offers a sleep timer and a Sleep Timer User Module. These are used while the CapSense controller is asleep and both perform similar functions. The actual sleep timer runs off the internal low-speed oscillator, which is never turned off.
CY8C20xx7/S Datasheet 9.3 Technical Reference Manual Cypress created the following technical reference manual to give quick and easy access to information on the CapSense controller functionality, including top-level architectural diagrams along with register and timing diagrams. CY8C20xx7/S Technical Reference Manual (TRM) ®...
Resources 9.4 Development Kits 9.4.1 CY8C20xx7/S QuietZone Starter Kit The CY8C20xx7/S QuietZone Starter Kit shown as Figure 9-1 is a 0.75-inch squared PCB based on the CY8C20247S 16-pin QFN package. Figure 9-1. CY8C20xx7/S QuietZone Starter Kit The CY8C20xx7/S QuietZone Starter Kit hardware has the following features: ...
Resources 9.5 Sample Board Files Cypress offers sample schematic and board files, which can be used as a reference to quickly complete your PCB design process. Button design with I C header on CY8C20xx7/S Button and slider design with I C header on CY8C20xx7/S Note The board files (schematic, layout, and Gerber files) will be placed in the landing page of this document.
Page 73
Resources Figure 9-3. Liquid-Tolerant Button Design with I C Header on CY8C20437 ® CY8C20xx7/S CapSense Design Guide Doc. No. 001-78329 Rev. *E...
PSoC Designer comes with a built-in C compiler and an embedded programmer. A pro compiler is available for complex designs. 9.9 Code Examples Cypress offers a large collection of code examples to get your design up and running fast. CapSense Controller Code Examples Design Guide 9.10 Design Support...
Revision History Document Revision History Document Title: AN78329 - CY8C20xx7/S CapSense® Design Guide Document Number: 001-78329 Revision Issue Date Origin of Description of Change Change 05/09/2012 New Design Guide 06/28/2012 UDYG Edits made to 8.1.3.1 Entry into I2C Sleep Mode 09/06/2012 ZINE Updated links to external documents...
Need help?
Do you have a question about the CY8C20xx7/S CapSense Series and is the answer not in the manual?
Questions and answers