1 Reply Latest reply on Oct 7, 2020 4:06 AM by BragadeeshV_41

    PSoC 4 CapSense IIR Filter


      I've got some questions about the IIR Filter on CapSense block.

      1-  It appears that I have to make some coefficient adjustments for widget calibration. However, I do not have detailed information about what these coefficient values should take for proper filtering of high frequency spikes to prevent false triggers and noise for my application.


      2- I've made some research about the CapSense block on Cypress from the datasheets, but I couldn't get detailed information about the usage of this filter. It is clearly briefed that this filter is used for eliminating the high frequency noise. but I couldn't see about the information about what these filter coefficients should be in any situation.

      There's just an information about the raw count coefficient that the lower count value results in lower noise. According to my understanding, this coefficient parameter is set

      as low when the environment of touch widget has lower noise. According to these info, Should I set this raw count coefficient parameter as high in higher noise ? I'll be appreciated if you illuminate me on this matter.


      3- On the CapSense block, I do not understand exactly in which cases the parameter entered in the regular baseline coefficent section is used. However, according to the information in the above datasheet visual, as far as I understand, the parameter entered in the coefficient part of the IIR Filter section of the coefficient in the relevant field is the same. If it is like I understand, I would like to find out why there are two different parameter parts in the above CapSense block visual. I do not fully understand the part after the comma of the sentence highlighted in yellow in the baseline filter settings section. I'll be appreciated if you illuminate me also on this matter.


        • 1. Re: PSoC 4 CapSense IIR Filter

          Hi user_2581831,


          Could you please attach the images again?  I'm not able to see any of the images you have shared. i will try to answer the questions based on your description. Please feel free to correct me if I have misunderstood  any of your questions.


          1 and 2). I think you are referring to IIR rawcounts coefficient. The tunable parameter in this filter is the coefficient N. Lower the value of N, lower will be the noise. This means that when the peak to peak noise in rawcounts is high, choose a low value of N. When the value of N is low, raw counts can't follow a sudden change in the rawcounts. thereby eliminating high frequency noise in raw counts. Please refer to the formula of the First order IIR filter to know the response of this filter.


          If you want to use an IIR filter, begin by selecting a IIR filter with a higher value of the filter coefficient N. Keep decreasing it until you achieve an SNR greater than or equal to 5:1. Using filters will affect the response time. You must properly select the filter coefficient such that the response time and SNR requirement are satisfied.


          3. There are two types of IIR filter implemented on rawcounts. Both of these filters are applied on rawcounts but there is a key difference


          a. The rawcount IIR filter is applied simply on the rawcounts under touch and no touch condition. This is optional and selected based on noise in the rawcounts.

          b. The baseline IIR filter is applied on the filtered raw counts (from a. if applied) to obtain the baseline.

          c. Each filter can have independent coefficient settings so that they can have different roll off frequencies.


          Baseline is the filtered version of raw counts that is used as a reference value to know whether a touch was detected or not. Usually the coefficient of the IIR baseline filter is low so that it is not sensitive to sudden changes in rawcounts such as touch. When a user touches the button, there is a sudden increase in rawcounts. Since the coefficient of this filter is high, by default 1, the baseline cannot take this change.


          The baseline tracks the rawcounts only when the rawcounts - baseline (called the difference counts) is lesser than the noise threshold setting. This is called the baseline update algorithm. When the user touches a button, the difference counts is greater than the noise threshold and thus the baseline is not updated. Therefore the baseline provides the reference level for the capsense component to judge whether a touch has been detected or not.