When move very slowly finger on PSoC4 Capsense slider sensor, whether it can be detect.

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

cross mob
hiyac_351831
Level 3
Level 3
25 replies posted 10 replies posted 10 questions asked

Dear

I have a question about CapSense Slider.

I am going to evaluate PSoC4S.
(using evaluation board: CY8CKIT-145-40XX)

I'm checking a worst case scenario test.
In particular, when move very slowly finger on sensor, whether it can be detect.
(For example, take 10 seconds to move to the next electrode B from a electrode A)

Such a case, the raw count always rise within electrode B becomes slow, because diff count is less than threshold.
Therefore, baseline within electrode B keeps track an compensates for the raw count.
When my finger complete move to electrode B, CapSense cannot detect my finger.(because diff count is less than threshold.)

In such a case, I want to detect my finger on electrode B.
what would be a good way to do it?
Probably, about speed to finger slide, exist a restriction?

0 Likes
1 Solution

Sorry for the delay in reporting.

answer one's own question.

This problem was resolved.
I can achieve it by not changing baseline when slider sensor ON.

The example is below.

=============================================================================
<main.c>
#include "project.h"

uint16 baselineBackup[5];
uint8 baselineExtBackup[5];
uint8 baselineRstCount[5];

void SaveBaselineParameters(void){
baselineBackup[0] = CapSense_LINEARSLIDER0_SNS0_BSLN0_VALUE;
baselineBackup[1] = CapSense_LINEARSLIDER0_SNS1_BSLN0_VALUE;
baselineBackup[2] = CapSense_LINEARSLIDER0_SNS2_BSLN0_VALUE;
baselineBackup[3] = CapSense_LINEARSLIDER0_SNS3_BSLN0_VALUE;
baselineBackup[4] = CapSense_LINEARSLIDER0_SNS4_BSLN0_VALUE;

baselineExtBackup[0] = CapSense_LINEARSLIDER0_SNS0_BSLN_EXT0_VALUE;
baselineExtBackup[1] = CapSense_LINEARSLIDER0_SNS1_BSLN_EXT0_VALUE;
baselineExtBackup[2] = CapSense_LINEARSLIDER0_SNS2_BSLN_EXT0_VALUE;
baselineExtBackup[3] = CapSense_LINEARSLIDER0_SNS3_BSLN_EXT0_VALUE;
baselineExtBackup[4] = CapSense_LINEARSLIDER0_SNS4_BSLN_EXT0_VALUE;

baselineRstCount[0] = CapSense_LINEARSLIDER0_SNS0_NEG_BSLN_RST_CNT0_VALUE;
baselineRstCount[1] = CapSense_LINEARSLIDER0_SNS1_NEG_BSLN_RST_CNT0_VALUE;
baselineRstCount[2] = CapSense_LINEARSLIDER0_SNS2_NEG_BSLN_RST_CNT0_VALUE;
baselineRstCount[3] = CapSense_LINEARSLIDER0_SNS3_NEG_BSLN_RST_CNT0_VALUE;
baselineRstCount[4] = CapSense_LINEARSLIDER0_SNS4_NEG_BSLN_RST_CNT0_VALUE;
}

void RestoreBaselineParameters(void){
CapSense_LINEARSLIDER0_SNS0_BSLN0_VALUE = baselineBackup[0];
CapSense_LINEARSLIDER0_SNS1_BSLN0_VALUE = baselineBackup[1];
CapSense_LINEARSLIDER0_SNS2_BSLN0_VALUE = baselineBackup[2];
CapSense_LINEARSLIDER0_SNS3_BSLN0_VALUE = baselineBackup[3];
CapSense_LINEARSLIDER0_SNS4_BSLN0_VALUE = baselineBackup[4];

CapSense_LINEARSLIDER0_SNS0_BSLN_EXT0_VALUE = baselineExtBackup[0];
CapSense_LINEARSLIDER0_SNS1_BSLN_EXT0_VALUE = baselineExtBackup[1];
CapSense_LINEARSLIDER0_SNS2_BSLN_EXT0_VALUE = baselineExtBackup[2];
CapSense_LINEARSLIDER0_SNS3_BSLN_EXT0_VALUE = baselineExtBackup[3];
CapSense_LINEARSLIDER0_SNS4_BSLN_EXT0_VALUE = baselineExtBackup[4];

CapSense_LINEARSLIDER0_SNS0_NEG_BSLN_RST_CNT0_VALUE = baselineRstCount[0];
CapSense_LINEARSLIDER0_SNS1_NEG_BSLN_RST_CNT0_VALUE = baselineRstCount[1];
CapSense_LINEARSLIDER0_SNS2_NEG_BSLN_RST_CNT0_VALUE = baselineRstCount[2];
CapSense_LINEARSLIDER0_SNS3_NEG_BSLN_RST_CNT0_VALUE = baselineRstCount[3];
CapSense_LINEARSLIDER0_SNS4_NEG_BSLN_RST_CNT0_VALUE = baselineRstCount[4];
}

int main()
{
uint8 isSliderActivated;
uint16 sliderPos;



    /* Enable global interrupts before starting CapSense and EzI2C blocks*/
    CyGlobalIntEnable; 

    EZI2C_Start();    /* Initialize EZI2C block */
    /* Make CapSense RAM data structure an I2C buffer, to use CapSense Tuner */
    EZI2C_EzI2CSetBuffer1(sizeof(CapSense_dsRam),
                          sizeof(CapSense_dsRam),
                          (uint8 *)&CapSense_dsRam);

CapSense_Start();  /* Initialize CapSense Component */
    CapSense_ScanAllWidgets();   /* Scan all widgets */

    for(;;)
    {
        /* Process data for previous scan and initiate new scan only when
         * the CapSense hardware is idle */
        if(CapSense_NOT_BUSY == CapSense_IsBusy())
        {
   /* Save baseline and related parameters before baseline update */
   SaveBaselineParameters();
  
            CapSense_ProcessAllWidgets();   /* Process data for all widgets */
           
   sliderPos = CapSense_GetCentroidPos(CapSense_LINEARSLIDER0_WDGT_ID);
   if( sliderPos != 0xFFFF ){
    isSliderActivated = 1;
    Pin_LED_Write(0);
   } else {
    isSliderActivated = 0;
    Pin_LED_Write(1);
   }
  
   /* If Slider widget is activated, restore baseline and related parameters */
   if( isSliderActivated ){
    RestoreBaselineParameters();
   }
  
            /* Sync CapSense parameters with those set via CapSense tuner before
             * the beginning of new CapSense scan */
            CapSense_RunTuner();

            /* Initiate new scan for all widgets */
            CapSense_ScanAllWidgets();                     
        }
    }
}

/* [] END OF FILE */

View solution in original post

0 Likes
4 Replies
Yuva
Moderator
Moderator
Moderator
250 replies posted 250 sign-ins 100 solutions authored

Dear Yamashita-san,

By the slider design guidelines, the width of each segment is smaller than the finger size with chevron pattern. When the finger is present on the slider it contacts more than one element, this helps to get good centroid as we get signal on the neighboring element as well. In your test case you move the finger slowly from a element to another, here we must tune the slider such that we signal on the neighboring signal is higher than noise threshold so the baseline is not updated.

Thanks,

Yuva.

0 Likes

Hello Yuva-san,

Thank you for your reply.

You've got a point.
Detect have only to Diff count need to beyond the noise threshold.

By the way, Were there similar questions from other user in the past?
I think it's a common use cases...
How's ohter user doing?

Best Regards

0 Likes
Yuva
Moderator
Moderator
Moderator
250 replies posted 250 sign-ins 100 solutions authored

Yamashita-san,

In typical applications the  CapSense slider scan time will be very fast compared to the finger movement so that this effect will not be observed at all.

Thanks,

Yuva

0 Likes

Sorry for the delay in reporting.

answer one's own question.

This problem was resolved.
I can achieve it by not changing baseline when slider sensor ON.

The example is below.

=============================================================================
<main.c>
#include "project.h"

uint16 baselineBackup[5];
uint8 baselineExtBackup[5];
uint8 baselineRstCount[5];

void SaveBaselineParameters(void){
baselineBackup[0] = CapSense_LINEARSLIDER0_SNS0_BSLN0_VALUE;
baselineBackup[1] = CapSense_LINEARSLIDER0_SNS1_BSLN0_VALUE;
baselineBackup[2] = CapSense_LINEARSLIDER0_SNS2_BSLN0_VALUE;
baselineBackup[3] = CapSense_LINEARSLIDER0_SNS3_BSLN0_VALUE;
baselineBackup[4] = CapSense_LINEARSLIDER0_SNS4_BSLN0_VALUE;

baselineExtBackup[0] = CapSense_LINEARSLIDER0_SNS0_BSLN_EXT0_VALUE;
baselineExtBackup[1] = CapSense_LINEARSLIDER0_SNS1_BSLN_EXT0_VALUE;
baselineExtBackup[2] = CapSense_LINEARSLIDER0_SNS2_BSLN_EXT0_VALUE;
baselineExtBackup[3] = CapSense_LINEARSLIDER0_SNS3_BSLN_EXT0_VALUE;
baselineExtBackup[4] = CapSense_LINEARSLIDER0_SNS4_BSLN_EXT0_VALUE;

baselineRstCount[0] = CapSense_LINEARSLIDER0_SNS0_NEG_BSLN_RST_CNT0_VALUE;
baselineRstCount[1] = CapSense_LINEARSLIDER0_SNS1_NEG_BSLN_RST_CNT0_VALUE;
baselineRstCount[2] = CapSense_LINEARSLIDER0_SNS2_NEG_BSLN_RST_CNT0_VALUE;
baselineRstCount[3] = CapSense_LINEARSLIDER0_SNS3_NEG_BSLN_RST_CNT0_VALUE;
baselineRstCount[4] = CapSense_LINEARSLIDER0_SNS4_NEG_BSLN_RST_CNT0_VALUE;
}

void RestoreBaselineParameters(void){
CapSense_LINEARSLIDER0_SNS0_BSLN0_VALUE = baselineBackup[0];
CapSense_LINEARSLIDER0_SNS1_BSLN0_VALUE = baselineBackup[1];
CapSense_LINEARSLIDER0_SNS2_BSLN0_VALUE = baselineBackup[2];
CapSense_LINEARSLIDER0_SNS3_BSLN0_VALUE = baselineBackup[3];
CapSense_LINEARSLIDER0_SNS4_BSLN0_VALUE = baselineBackup[4];

CapSense_LINEARSLIDER0_SNS0_BSLN_EXT0_VALUE = baselineExtBackup[0];
CapSense_LINEARSLIDER0_SNS1_BSLN_EXT0_VALUE = baselineExtBackup[1];
CapSense_LINEARSLIDER0_SNS2_BSLN_EXT0_VALUE = baselineExtBackup[2];
CapSense_LINEARSLIDER0_SNS3_BSLN_EXT0_VALUE = baselineExtBackup[3];
CapSense_LINEARSLIDER0_SNS4_BSLN_EXT0_VALUE = baselineExtBackup[4];

CapSense_LINEARSLIDER0_SNS0_NEG_BSLN_RST_CNT0_VALUE = baselineRstCount[0];
CapSense_LINEARSLIDER0_SNS1_NEG_BSLN_RST_CNT0_VALUE = baselineRstCount[1];
CapSense_LINEARSLIDER0_SNS2_NEG_BSLN_RST_CNT0_VALUE = baselineRstCount[2];
CapSense_LINEARSLIDER0_SNS3_NEG_BSLN_RST_CNT0_VALUE = baselineRstCount[3];
CapSense_LINEARSLIDER0_SNS4_NEG_BSLN_RST_CNT0_VALUE = baselineRstCount[4];
}

int main()
{
uint8 isSliderActivated;
uint16 sliderPos;



    /* Enable global interrupts before starting CapSense and EzI2C blocks*/
    CyGlobalIntEnable; 

    EZI2C_Start();    /* Initialize EZI2C block */
    /* Make CapSense RAM data structure an I2C buffer, to use CapSense Tuner */
    EZI2C_EzI2CSetBuffer1(sizeof(CapSense_dsRam),
                          sizeof(CapSense_dsRam),
                          (uint8 *)&CapSense_dsRam);

CapSense_Start();  /* Initialize CapSense Component */
    CapSense_ScanAllWidgets();   /* Scan all widgets */

    for(;;)
    {
        /* Process data for previous scan and initiate new scan only when
         * the CapSense hardware is idle */
        if(CapSense_NOT_BUSY == CapSense_IsBusy())
        {
   /* Save baseline and related parameters before baseline update */
   SaveBaselineParameters();
  
            CapSense_ProcessAllWidgets();   /* Process data for all widgets */
           
   sliderPos = CapSense_GetCentroidPos(CapSense_LINEARSLIDER0_WDGT_ID);
   if( sliderPos != 0xFFFF ){
    isSliderActivated = 1;
    Pin_LED_Write(0);
   } else {
    isSliderActivated = 0;
    Pin_LED_Write(1);
   }
  
   /* If Slider widget is activated, restore baseline and related parameters */
   if( isSliderActivated ){
    RestoreBaselineParameters();
   }
  
            /* Sync CapSense parameters with those set via CapSense tuner before
             * the beginning of new CapSense scan */
            CapSense_RunTuner();

            /* Initiate new scan for all widgets */
            CapSense_ScanAllWidgets();                     
        }
    }
}

/* [] END OF FILE */

0 Likes