Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Capacitive Proximity Sensing – KBA92366

lock attach
Attachments are accessible only for community members.

Capacitive Proximity Sensing – KBA92366

Not applicable
Version: **


Question: How do you implement capacitive proximity sensing using the CY8C21x34 device?



The attached project implements capacitive proximity sensing using the CY3280-21x34 kit. Use the following steps to test this project.

Programming the PSoC®

  1.   Open PSoC Programmer™ from the path Start > All Programs > Cypress > PSoC Programmer.
  2.   Load the hex file Proximity_CY3280_21x34_Kit.hex from the attached project folder “Proximity_CY3280_21x34_Kit” by clicking the File Load option and setting the Programmer settings as shown in Figure 1.  

       Figure 1. PSoC Programmer Settings


       PSoC Programmer

  3.   Connect the MiniProg3 to the ISSP header of the CY3280-21x34 kit as shown in Figure 2.  

       Figure 2. MiniProg3 Connection


       MiniProg3 Connection

  4.   Click the Program option as shown in Figure 3.  

       Figure 3. Program the PSoC



Proximity Sensing and Data Viewing

Follow the steps below to set up the hardware for proximity sensing and data viewing:

  1.   Connect the MiniProg3 (used as I2C to USB bridge) to the CY3280-21x34 kit and a wire loop (10 cm circumference) to P0[0] on the P2 connector of the CY3280-21x34 kit as shown in Figure 4.  

       Figure 4. MiniProg3 Connection and Sensor Connection


       MiniProg3 Connection

  2.   Open the Bridge Control Panel (BCP) software from Start > All Programs > Cypress > Bridge Control Panel.
  3.   Open the Variable Setting window from Chart > Variable Settings in the BCP software.
  4.   Enter the variable names and data type in the Variable Settings window as shown in Figure 5 and click OK.  

       Figure 5. Variable Settings on the Bridge Control Panel


       Variable Settings

  5.   Enter the commands shown in Figure 6 into the Editor window of the BCP.  

       Figure 6. I2C Communication Commands


       I2C Communication Commands" src="https://community.cypress.com/api/core/v3/images/182804?a=1503033807502">

  6.   Click on the Toggle Power button (shown in Figure 7) at the bottom of the BCP window to power the board using the MiniProg3.  

       Figure 7. Bridge Control Panel Settings


       Bridge Control Panel Settings

  7.   Keep the cursor on the first command (w 04 0) in the Editor window and press Enter.
  8.   Keep the cursor on the second command line in the Editor window and click Repeat.
  9.   Click the Chart tab on the BCP and select the plot Status listed in the top right corner.
  10.   Bring the hand towards the wire loop and observe in the BCP that the status variable becomes ‘1’ as shown in Figure 8.  

       Figure 8. Status Variable on Bridge Control Panel


       Status Variable

  11.   Deselect the Status plot and select the plot RawCount to see the profile of Raw counts shown in Figure 9.  

       Figure 9. Raw Count Profile


       Raw Count Profile

Proximity Tuning Steps

The following steps can be used to tune the CapSense® system for proximity detection.

  1.   Determining Proximity Distance 

       For reliable proximity detection, the SNR needs to be 5:1. Follow the steps below to determine the proximity distance.

    1.     Find the Noise Count.
    3.     Calculate the Signal count that is required to achieve a 5:1 SNR (Signal Count = 5*Noise Count).
    5.     Bring the hand towards the wire sensor until the signal count reaches the value calculated in Step-ii. The present distance between the wire sensor and the hand is called the Proximity distance.

       Note: Refer to section 4.1.1, “Signal, Noise, and SNR” in the CY8C21x34/B CapSense Design Guide for more information about SNR calculation.

  2.   Determining CapSense Sigma Delta (without Prescalar) User Module Parameters for Proximity Detection 

       The following steps can be used to determine the CapSense Sigma Delta (CSD) User Module (UM) parameters for proximity detection.

    1.     Find the peak Difference Count from the BCP when there is no hand present.
    3.     Find the Peak Difference Count from the BCP when the hand is present at the proximity distance calculated above.
    5.     Set the Finger Threshold parameter to 60 percent of the Difference Count observed in Step-ii (when the hand is present).
    7.     Set the Noise Threshold parameter to 40 percent of the Difference Count observed in Step-i (when no hand is present).
    9.     Set Baseline Update Threshold to 100.
    11.     Set Sensor Autoreset to Disabled.
    13.     Set Hysteresis to 15 percent of the Difference Count observed in Step-ii (when the hand is present).
    15.     Set Negative Noise Threshold equal to Noise Threshold.
    17.     Set Scanning Speed to Slow.
    19.     Set Resolution to 16.
    21.     Set Ref Value to 1.
    23.     Leave all the other parameters as their default values.

       Note: Click on the tab Table in the BCP to observe the Difference count values.