12 Replies Latest reply on Jun 6, 2019 5:16 AM by BragadeeshV_41

    Raw count minimum changing




      It's me again!

      I'm using CapSense in a manual mode with all the parameters set (as far as all can be set in the window of the component) but I found out that my raw count dont go back always to the same value as you can see on that simple screen when I put something in the vicinity of the proximity sensor.




      The parameters I have set are:



      • IDACMOD = 13
      • IDACComp = 12
      • Modulator clock =1 (12000khz)
      • Sensor clock=16 (375kHz)
      • Fingerth=48
      • Noiseth=24
      • Negnoiseth=24
      • Hysteresis=6
      • Debounce=3
      • Lowbaselinereset=30
      • Proxtouchtreshold=144
      • Snsclksource=64 (PRS8)


      I see the sensor frequency that it's the maximum and the average is 187.5khz. Does it mean that it's changing and it could be the reason?


      Thank you so much



        • 1. Re: Raw count minimum changing

          Hi almc_4008691,


          Please let us know the PSoC 4 device you are using in your application.


          Also, this is an expected behavior. When you place a grounded object near the prox sensor the raw count is expected to rise. But if you can increase the noise threshold to greater than that, then your baseline will track the raw count.


          Do you see false triggers when you place the object near the prox sensor? That would be a real problem. In that case you can increase the prox threshold so that it doesn't false trigger.




          • 2. Re: Raw count minimum changing

            Hi BragadeeshV_41


            Thanks for you reply but think you didn't understood my problem.

            If you look the picture both rectangles mean there is nothing near the proximity sensor then it's rising because I put something close to it.

            So it's perfectly correct! But If you look at the raw counts in both rectangles, there are not the same and they should be because nothing changed!

            How can you explain that? because I'm using a both IDAC in manual mode so it's not changing and the only other thing  in the formula is the frequency of the sensor. But it doesn't seems to change when I look at it with  "CapSense_dsRam.wdgtList.capteur.snsClk;".

            Do you have an idea?



            • 3. Re: Raw count minimum changing

              Hi almc_4008691,


              Thank you for the clear explanation of your issue.


              We have seen noise related issues when IDAC is less than 20. Can you please turn OFF comp IDAC and enable IDAC auto calibration and see if it is greater than 20?


              Also please set your MOD Clock to a higher value (the maximum your device will permit). Please let us know the PSoC device you are using so that we can support you better.


              Under these conditions, make sure your SNR is at least 5 :1




              • 4. Re: Raw count minimum changing

                I set that value of IDAC because a I found it with the auto calibration.

                The modulator clock is at the maximum 12MHZ

                I'm using the kit CY8Ckit-040 with CY8C4014LQI-422

                • 5. Re: Raw count minimum changing

                  Hi almc_4008691,


                  We don't recommend IDAC values less than 20. Please follow the suggestion in my previous response.

                  Please let me know the version of capsense component you are using. If you're using version 2.6, please turn on the ALP filter and check your results.

                  Also are you using any low power mode in your application?

                  Can you please share your project file so that we can investigate this issue further?




                  • 6. Re: Raw count minimum changing

                    I will try with an higher IDAC and let you know.

                    I'm using the new one but I was wondering if it's better to use the new one or the last one with the ALP?

                    I'm not using any low power mode I think.

                    Here is the simple project.

                    I also want to improve my distance sensing! What should I do?

                    Here is the board I'm using with a heat shrink tube around to avoid the direct touch.

                    The top hatch I'm using the ground and on the bottom the hatch is the shield


                    with my cover:


                    Now I have more or less with my hand 3 cm distance sensing but I will not sense a hand so I need a better distance to be sure to sense the object.


                    Thank you,



                    • 7. Re: Raw count minimum changing

                      Hi almc_4008691,


                      Thanks for the update.


                      1. Are you using those buttons for the proximity or are you using a proximity loop for proximity?


                      2. If they are just normal buttons, how does putting a black tube help the user identify the button location?


                      3. If they are meant for proximity, we don't recommend such a pattern for proximity sensor. We recommend proximity loop along with a ground loop that runs around the area of interest where proximity is meant to detected as shown below


                      4. Any particular reason for ground at top and shield at bottom? We usually recommend shield to be placed in a direction where you want proximity detection. Putting a ground hatch near proximity will increase Cp and will reduce the proximity distance.


                      5. If you want increase distance with good SNR (> 5 : 1), we recommend to use v2.6 CapSense component with ALP filter enabled.


                      Please refer to the following app note for designing prox sensor with PSOC 4 ( AN92239 Proximity Sensing with CapSense®.pdf)




                      • 8. Re: Raw count minimum changing

                        Hello BragadeeshV_41,


                        Do you have an idea about my first question? Why the raw count is sometimes no going back to the same value when there is nothing in the vicinity of the sensor as in the rectangle on the picture? Is it the sensor clock changing even if I set it to 750kHz?



                        1. I have done both design but in my application we would like to get 5 cm sensing distance +/- but the material that we sense will touch the sensor plate so it's not mandatory to get the sensing distance but it could be even better for the accuracy. I have tested both plate and it doesn't seemed to get better distance sensing with the loop! Here the design of the pcb with a loop sensing and I have tested it with the shield or the ground on the top hatch pattern.
                        2. It's all for distance sensing so we dont care we it's touching because the piece of material that will touch is bigger than the sensor
                        3. Last time I have asked on the forum nobody told me to used this configuration but I will design it and try it thanks. But What do you suggest to as a hatch pattern on the top and the bottom layer? I Have a conductive metal object near so the shield for the bottom but on the top between both loop/inside and outside them? Or a ground plane as an other layer inside the pcb?
                        4. I think you are wrong, the shield is meant to avoid the sensing in that direction so if I put the shield on the bottom is for the conductive object nearby and to sense only in front of the loop or round. And for the top I have red all documentation from cypress and it's confusing depending on what you want to improve. So I have been testing both ground and shiel on the top an bottom layer hatch pattern.
                        5. I have been testing today the ALP and the old CapSense and it was not interesting when looking at the noise that I get with that version with my parameters and with smartsense. And I have been playing with the filter K and the threshold but nothing really interesting compared to what I have now with the new capSense version.
                        6. Other question, do you know if there is a possibility to get the Cp with SmartSense running?
                        7. I have the kit CY8Ckit040 but I get a Cp around 125 all the time in manual mode. What's the limit of Cp in manual mode ? also 65pF? Therefore should I change to PSoC 4100 or other one with higher Cp possibilities?



                        Thank you so much


                        • 9. Re: Raw count minimum changing

                          Hi almc_4008691,


                          Thanks for the update.


                          PSoC 4 third generation CapSense supports only 5 - 60 pF even in manual mode.


                          So if you have 125pF of Cp, you may have to move to a fourth generation CapSense. We'd recommend 4000S device for that.

                          If this is not possible, you need to reduce the Cp of the sensor to less than the max limit. You can do this by removing the ground hatch pattern totally and have nothing inside the loops. It is better to have a ground loop around the proximity loop for better noise immunity. Have a shield at the bottom where you want to reduce the effect of conductive objects around the prox sensor


                          But, putting a ground hatch will increase the Cp and will decrease the sensitivity of proximity. The sensitivity of the prox sensor is given as Cf/ Cp . Hence don't have ground hatch at all. Just have a ground loop.


                          Also, you need to note the proximity distance depends on the diagonal of the proximity loop (limited to the shortest side). When you have smaller breadth and longer length, you will have proximity sensing distance limited to shortest length. But in case you need higher proximity distance with the same design, you have to use the ALP filter which will reduce the noise for higher sensing distance. You will obtain 2 * diagonal distance. ie , the SNR will be good at higher distance.


                          But since the noise is the issue, I would recommend the following  as a summary:


                          1. Mod IDAC > 20

                          2. Sense clock source : Direct

                          3. Ground loop around prox sensor

                          4. Shield pattern as suggested in this thread Capsense Proximity sensing loop design


                          Answer to your previous responses:


                          1. Can you please send us a video for what exactly you are doing when you obtained this waveform.


                          2. Okay, but we recommend you to use some overlay to be placed over the PCB as suggested in our app note getting started with Capsense Pg no 39



                          3. Discussed above


                          4. Sorry for the confusion, you are right. But don't put ground, it will decrease sensitivity.


                          5. Discussed above. It is recommended to use ALP with older component for prox sensor provided your Cp is less that 60 pF


                          6. No, this is not possible.


                          7. Discussed above.




                          • 10. Re: Raw count minimum changing

                            Hi Alex,


                            Regarding  your first question about raw-count not returning to the original level, I've noticed this kind of behavior in following kind of conditions earlier, is your situation like any of these:


                            a. If you turn ON an LED/GPIOs to sink current or trigger a firmware action based on detection of a touch/proximity event or somewhere during the time the signal is present. In this case, sinking current from GPIOs causes a slight shift in digital vs analog grounding in the device which raises the level. Even if the touch or proximity signal is removed at this instant, the raw-count remains high due to this signal being present. You could try removing all logic from your firmware and only monitor the raw-count to confirm if something like this is the cause here.

                            Note that this may be noticeable when the sensor is tuned for a very high sensitivity like >2000 counts/pF. Do you know how much is the rawcount per unit pf sensitivity you have tuned the sensor to?

                            b.  I've also noticed this kind of behavior if there is less or no grounding around the sensor and if the sensor is tuned to very high sensitivity. If you improve the grounding around the sensors, this doesn't happen. You mentioned you have hatched ground on top layer, but you may want to look at how it connects to the main board i.e. impedance from device ground may have some role here. (Note that amount of grounding is a compromise, higher shielding/less ground implies better sensitivity but also higher noise)




                            • 11. Re: Raw count minimum changing



                              Sorry for the late reply,


                              1. I'm wondering how the get and tune the sensitivity in manual mode? Then I check what is the sensitivity that we have
                              2. I dont have any triggering right know in the project except an interrupt for a reset button but it's in commented right know.
                              3. About the ground, I know that BragadeeshV_41 told me that we should try with two loops (sensor and ground) but if I'm using a hatch, do I have to put the hatch as I did (inside the loop and around) or just around or inside? I'm wondering if the hatch inside the loop is not decreasing my sensing distance too!?
                              4. Other question, with CapSense v6, the raw count command used is "CapSense_dsRam.snsList.capteur[0u].raw[0u];" but is it the raw count filtered or not? If it is, how can I get the raw count before and after filtration?
                              5. I would like to used a simple button with an interrupt in my prototype. This reset button need to reset the whole CapSense component, which API should I use?
                              6. I have found that there is a CapSense_ADC component but I dont find it in the PSoC creator 4.2. Is it still possible to use it? Otherwise How can I use and ADC and the CapSense at the same time?
                              7. In which is it interesting to use the Cshield_tank?
                              8. I also didnt understood what do you mean with the impedance? The cable impedance?


                              I still need to test with the direct clock as you suggested before.


                              Thank you again !


                              • 12. Re: Raw count minimum changing

                                Hi almc_4008691,


                                Sorry for the delay in response. Please note the answer to your questions:


                                1.  Sensitivity in general is defined as the change in raw counts for change in sensor capacitance (nothing but the Cf you add). Let's say you are adding a known capacitance to the sensor, the signal you obtain divided by change in capacitance(diff counts = raw count - baseline) will be the sensitivity. Can you do this and see?

                                2. Alright

                                3. There should be two loops. Inner loop - prox, outer loop - ground. Put hatch shield inside the loop. No need hatch outside loop.

                                4. After scan is complete, and when there is not active  scan, read CapSense_dsRam.snsList.capteur[0u].raw[0u], this will give unfiltered raw counts. If you do CapSense_ProcessAllWidgets() and then read CapSense_dsRam.snsList.capteur[0u].raw[0u], this will give filtered raw counts. Make sure that you don't scan will reading these values using any interface.

                                5. If this button is pressed, do CapSense_Stop() and then Capsense_Start() again. This will reset the component again (Re-initializes the component hardware and calibration parameters).

                                6. Capsense and ADC uses the same hardware resources and hence they can't be used at the same time in PSoC 4 devices. But in PSoC 4S  (4000S, 4100S and 4100S plus) devices, it has a Capsense_ADC component that does time multiplexed Capsense and ADC operation. So you can do both.

                                7. Csh_tank is optional and is required in case when your Cp of shield is high.

                                8. I'll confirm and let you know.