In the previous post I talked about my original goal to learn about the SmartIO.  But, in order fully try out the SmartIO I needed an input source.  On this board I had only one easy input from the factory – specifically the mechanical button on P0[7]- but I wanted to have multiple switches.  Well, the obvious choice was to use the three Capsense Buttons on the user interface expansion board.   When I looked at that board closely I remembered that the buttons were put there to support the new Capsense functionality of the PSoC4000s family.  Inside of Cypress we call the new feature “CSX”, but its real name is “Mutual Capacitance”.  Mutual Capsense works by transmitting a signal on the “Tx” pin and then receiving that signal by capacitively coupling that signal through your finger into the “Rx” line.  Here is a picture of that part of the PCB schematic and a zoom in of the board.  You can see that there are three different size buttons.  Each of the buttons is composed of an even number of pie shaped segments.

mutual-cap-buttonsScreen Shot 2016-03-06 at 2.03.17 PM

The mutual capacitance technique has a much higher Signal-to-Noise Ratio (SnR) as compared to the Self Capacitance technique of previous chips and as a result is more immune to noise and can work through a thicker overlay.  I thought that I would try putting on overlay on my board, so I cut out a piece of 1.5mm acrylic and used double sided tape to attach it to my board.  You can see it in the photograph above.

To make this work I started by creating a new project called “MutualCapButtons”.  I then added the Capsense component and three digital output pins (one for each of the three LEDs on the expansion board).  Here is the schematic:


The next step was to configure the CapSense block by double clicking it.  I then added three buttons and set the sensing mode to CSX (Mutual-cap).


It is possible to have dedicated Tx/Rx pins or you can share the Txs.  To do this, select “Advanced” and “Widget details”.  Then select “Button1_Tx”  and choose its sensor to be the same as “Button0_Tx”.  On this design I shared the Tx between all three of the buttons.


The next step is to assign the pins to the correct Port/Pin locations on the chip:


The last step is to write the firmware

  • Lines 8-10 Start the capsense block and get the scanning going
  • Line 14: If the capsense block is done scanning then process the results
  • Line 16: Take all of the raw data from the scan and setup all of the status information
  • Lines 18-20: If the buttons are being pushed then turn on the corresponding LED
  • Lines 22-23 Start another scan


That is all there is to making it work.

You can find this PSoC Creator workspace on github in the directory called “145MutualCap”.  This project is called “MutualCapButtons-145”.

In the next post Ill talk in detail about using the Capsense Tuner to understand the Capsense performance.

Recommended Posts


  1. Thanks for the desicription of the CSX feature. However, you should really note that this feature is only available in the preliminary 3.3 SP2.3 version of the PSoC Creator.

    Took me a while to find out what is “wrong” with the release that I am using.
    Thanks anyway, now I know.

    • You are right… sorry about that… I sometimes loose track that I run inside versions in advance…

      Incidentally they send me the new board today and it is great.

      I appreciate your feedback and I’m sorry I wasted your time looking.


  2. Hello Alan,
    It has been more than 2 years since that post, so the technology should be out by now. But when I look into the PSOC 41xx and 42xx datasheet, I see mention of CSD (self capacitance sense) but no mention of CSX (mutual capacitance sense). Could you confirm if these families should be able to use CSX? I had set my mind on the CYP-CY8C4245AZI-483, but I am starting to think my choice was wrong. Thanks for letting me know, as I am certain this answer will help many.

    • The 4100 family is CSD only… the 4100s has CSD & CSX … the one I looked at was CY8C4125axi-483

      The part you picked is from the 4200 family. I created a schematic with 8C4245AZI-483 put in capsense… and it let me choose CSX.

      Hope that helps.


  3. Thank you Alan.
    I hope Cypress figures out this would be a good feature to add in their datasheets.
    Meanwhile, yes, we can use the PSOC Creator to validate our choices.

    • Yes that is true… and the people that own that datasheet work for me now… so I suppose in this case it really is my problem 🙂

Add a Comment

Your email address will not be published. Required fields are marked *