Cypress CY8CKIT-059 PSoC 5LP Prototyping Kit – CapSense Linear Slider

I’ve been experimenting more in the scope of the Cypress CY8CKIT-058 PSoC 5LP Prototyping Kit RoadTest. This time, I experimented with CapSense and created my own linear slider.


There are two parts to the TopView:

  • a PWM signal directly connected to the onboard LED on P2_1
  • a CapSense component

The CapSense component can be used for different types of capacitive touch buttons. In this particular case, I opted for the linear slider.

The goal is to control the duty cycle of the PWM signal depending on where the linear slider was touched.

Screen+Shot+2015-05-17+at+21.48.53 Screen+Shot+2015-05-18+at+21.53.16

Screen+Shot+2015-05-17+at+21.47.40 Screen+Shot+2015-05-17+at+21.47.51

The code example was found here: PSoC 4 Pioneer Kit Community Project#02 – CapSense Slider

#include <project.h>
#define NO_SLIDE 0xFFFFu

int main() {
  /* Place your initialization/startup code here (e.g. MyInst_Start()) */
  uint16 SliderPos = NO_SLIDE;
  uint16 LastPos = NO_SLIDE;


  for(;;) {
    /* Place your application code here. */


    SliderPos = CapSense_1_GetCentroidPos(CapSense_1_LINEARSLIDER0__LS);

    if(SliderPos != NO_SLIDE && SliderPos != LastPos) {

Linear Slider

To create the linear slider, I used a piece of cardboard on which I created some shapes using copper tape. The shapes were then connected to alligator clips using conductive paint. Why paint and not just more copper tape ? Purely because I wanted to experiment with different conductive materials

Finally, the alligator clips were connected to the kit’s pins assigned to the CapSense Linear Slider. The copper tape was covered with regular tape, making it easy to slide back and forth without ripping the copper tape.

photo+2 (1) Screen+Shot+2015-05-18+at+21.48.41

It is possible to create a longer slider with up to ten electrodes using the same five pins, by configuring and wiring the slider in “diplexed” mode. This allows for a finer granularity of the measured values.


A demo of the PWM signal’s duty cycle being changed based on the input of the linear slider:

© Frederick Vandenbosch, 2014-2021. Unauthorised use and/or duplication of this material without express and written permission from this blog’s author and owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Frederick Vandenbosch with appropriate and specific direction to the original content.