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®
- Open PSoC Programmer™ from the path Start > All Programs > Cypress > PSoC Programmer.
- 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
- Connect the MiniProg3 to the ISSP header of the CY3280-21x34 kit as shown in Figure 2.
Figure 2. MiniProg3 Connection
- 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:
- Connect the MiniProg3 (used as I2C to USB bridge) to the CY3280-21x34 kit and a wire loop (10 cm circumference) to P0 on the P2 connector of the CY3280-21x34 kit as shown in Figure 4.
Figure 4. MiniProg3 Connection and Sensor Connection
- Open the Bridge Control Panel (BCP) software from Start > All Programs > Cypress > Bridge Control Panel.
- Open the Variable Setting window from Chart > Variable Settings in the BCP software.
- 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
- Enter the commands shown in Figure 6 into the Editor window of the BCP.
Figure 6. I2C Communication Commands
2C Communication Commands" src="https://community.cypress.com/api/core/v3/images/182804?a=1503033807502">
- 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
- Keep the cursor on the first command (w 04 0) in the Editor window and press Enter.
- Keep the cursor on the second command line in the Editor window and click Repeat.
- Click the Chart tab on the BCP and select the plot Status listed in the top right corner.
- 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
- 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
Proximity Tuning Steps
The following steps can be used to tune the CapSense® system for proximity detection.
- Determining Proximity Distance
For reliable proximity detection, the SNR needs to be 5:1. Follow the steps below to determine the proximity distance.
- Find the Noise Count.
- Calculate the Signal count that is required to achieve a 5:1 SNR (Signal Count = 5*Noise Count).
- 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.
- 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.
- Find the peak Difference Count from the BCP when there is no hand present.
- Find the Peak Difference Count from the BCP when the hand is present at the proximity distance calculated above.
- Set the Finger Threshold parameter to 60 percent of the Difference Count observed in Step-ii (when the hand is present).
- Set the Noise Threshold parameter to 40 percent of the Difference Count observed in Step-i (when no hand is present).
- Set Baseline Update Threshold to 100.
- Set Sensor Autoreset to Disabled.
- Set Hysteresis to 15 percent of the Difference Count observed in Step-ii (when the hand is present).
- Set Negative Noise Threshold equal to Noise Threshold.
- Set Scanning Speed to Slow.
- Set Resolution to 16.
- Set Ref Value to 1.
- Leave all the other parameters as their default values.
Note: Click on the tab Table in the BCP to observe the Difference count values.