Capsense False Touch Detection

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

cross mob
Marcus_Hellen
Level 3
Level 3
10 replies posted 10 questions asked 10 likes given

Hello Folks!

 

I am using CY8C4124LQA-S433 IC and I did a project which has following specification: 
When I press the button related led on. Then when I press one again, related led turn off. So far everything is fine. I did this. 

But the problem begins with : "I do not want that Led toggle to on or off when I falsely touch a button."

However I could not  achive this. I tried everyting. I rised threshold values, I tried smartsense option. I could not do this. When I touch a button outside of my hand for only half of the second, led could not hold its last mode. 

I just want the led to change mode when I press the button hard.

Any solution, any idea to get more strong project?

Regards,

Mehmet

0 Likes
1 Solution

Mehmet,

Thank you for uploading your project.  I'm studying it.

Are you using a Cypress/Infineon kit or eval board for this project?

Are you willing to share your PCB layout with the forum?

A quick look at your project indicates that you are using the CSD (Self-capacitance) mode sensing.

This CapSense mode is generally the easiest layout mode and uses less pins.  However without very careful layout of the PCB traces, it is too tempting to route the trace of a one sensor 'button' near to another sensor 'button'.  When this happens, when you 'press' one button, the other button gets sensed because your finger is too close to the trace.

Using the CSX (Mutual Capacitance) mode is not as critical for layout.  Having said that, you should also take care in good layout to prevent false triggers even in this mode.

Here is a link to an AppNote for Capsense on the PsoC4 part family: Capsense App Note 

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

9 Replies
Marcus_Hellen
Level 3
Level 3
10 replies posted 10 questions asked 10 likes given

“Deleted”

0 Likes

Mehmet,

Thank you for uploading your project.  I'm studying it.

Are you using a Cypress/Infineon kit or eval board for this project?

Are you willing to share your PCB layout with the forum?

A quick look at your project indicates that you are using the CSD (Self-capacitance) mode sensing.

This CapSense mode is generally the easiest layout mode and uses less pins.  However without very careful layout of the PCB traces, it is too tempting to route the trace of a one sensor 'button' near to another sensor 'button'.  When this happens, when you 'press' one button, the other button gets sensed because your finger is too close to the trace.

Using the CSX (Mutual Capacitance) mode is not as critical for layout.  Having said that, you should also take care in good layout to prevent false triggers even in this mode.

Here is a link to an AppNote for Capsense on the PsoC4 part family: Capsense App Note 

Len
"Engineering is an Art. The Art of Compromise."

Hi Len,

i am using my own board

0 Likes

Thank you for your explanations Len. Actually I knew that layout design also critical. But I am not gonna share the layout because I am a little bit hesitate. 

i will try Mutual capacitance mode. 
hopefully, It would work:(

mehmet

0 Likes

mehmet,

I can understand the hesitation in sharing your design with the forum.

Are you working with a Infineon PSoC field representative?

It is common practice with CapSense design to have a CapSense expert at Infineon look at the layout design.  With an NDA in place, they can provide their evaluation of your layout.

If I'm correct, using mutual cap mode may require a re-layout of the PCB.

There is a possible SW solution to your issue with the layout as it is.

If the principle of your design is that ONLY ONE BUTTON can be pressed at a time, then you can prioritize you button sensing.

For example, let's say you have Button1, Button2 and Button3.

Only one button is expected to be pressed at a time.  Let's also say that Button1 is the lowest priority with Button2 next highest and Button3 the highest priority.

Let's say, that the only 'true' button press with a 'false' trigger on another button (Button1)  is Button3.  Therefore because you received a Button3 press (true trigger) AND a Button1 press (false trigger), you can ignore the Button1 event in SW.  Only process the Button3 event.

 

 

Len
"Engineering is an Art. The Art of Compromise."

Hi Len,

The Software solution is a really good idea. I really like it. But I am still thinking that how I can implement in the code. How I can implement “Only one button is expected to be pressed at a time” idea? 
is there a function in the capsense module or I manually have to write? If I have to write manually, could you please give an example code?

 

0 Likes

Marcus,

I don't which button input is the one that falsely triggers.

However, here is an idea of prioritizing your button inputs easily in your code.

 

In your main() you have the following structure:

    if(CapSense_IsAnyWidgetActive())
    {
        if(CapSense_IsWidgetActive (CapSense_BUTTON0_WDGT_ID))
        { ... }
        if(CapSense_IsWidgetActive (CapSense_BUTTON1_WDGT_ID))
        { ... }
        if(CapSense_IsWidgetActive (CapSense_BUTTON2_WDGT_ID))
        { ... }
        if(CapSense_IsWidgetActive (CapSense_BUTTON3_WDGT_ID))
        { ... }
        if(CapSense_IsWidgetActive (CapSense_BUTTON4_WDGT_ID))
        { ... }
    }

This code structure allows for more than one button to allowed on a press.   Each 'if' statement is processed for a press.

To allow for ONLY ONE button to be on a valid press you need to change your code to:

    if(CapSense_IsAnyWidgetActive())
    {
        if(CapSense_IsWidgetActive (CapSense_BUTTON0_WDGT_ID))
        { ... }  // highest priority
        else if(CapSense_IsWidgetActive (CapSense_BUTTON1_WDGT_ID))
        { ... }  // 2nd highest priority
        else if(CapSense_IsWidgetActive (CapSense_BUTTON2_WDGT_ID))
        { ... }  // 3rd highest priority
        else if(CapSense_IsWidgetActive (CapSense_BUTTON3_WDGT_ID))
        { ... }  // 4th highest priority
        else if(CapSense_IsWidgetActive (CapSense_BUTTON4_WDGT_ID))
        { ... }  // lowest priority
    }

By placing an 'else' after the first 'if' will not process further 'if' statements if that 'if' is satisfied.  This will then ONLY allow for one press to be validated.   Note: In this method, the Buttons need to be prioritized by placing those Button IDs earlier in the 'if' statement flow.

I hope this helps.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Len,

I have an idea which is following;

if  a sensor active, related sensor flag would set. if time between the flags is more than 500 ms, do your job. If lesser than 500 ms, do not do any thing.

How I can put my code to this idea? could you please give an example code because you have my project.

Regards

0 Likes

Marcus,

You can try it.  The good thing about SW is that you can experiment.

Try it.   However, note that I believe the CapSense component internal code has a MAXIMUM press time.  I think this is due to preventing a "stuck" button due to the environment (for example: moisture on the sensor area).  This is particularly true if you're using Auto-tuning.  Auto-tune will change the threshold of a "press" if it sees an active press too long.

Experiment Coding suggestion:

Place a 1 msec counter in SW or HW.  Everytime a specific button is pressed start the counter light an LED.  Keep counting until the button is no longer sensed to be pressed.  Then stop counting without resetting the counter and turn off the LED.

Using a UART output or debugging mode, you can read the counter value in msecs.

Here's the test:  With the code above, press the selected button and keep it pressed.  The LED should turn on an the counter active.   As you continue the button press, if the LED goes off, read the counter value.  This would be the "maximum" press allowed by the CapSense code.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes