element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Cypress Kits
  • Products
  • Dev Tools
  • Cypress Kits
  • More
  • Cancel
Cypress Kits
Forum PSoC 4 Pioneer Kit Community Project#02 - CapSense Slider
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Cypress Kits to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 23 replies
  • Subscribers 26 subscribers
  • Views 3863 views
  • Users 0 members are here
  • 100projects
Related

PSoC 4 Pioneer Kit Community Project#02 - CapSense Slider

cy.gul
cy.gul over 12 years ago

On the 2nd day of our 100 Projects in 100 Days community effort, I am posting one of the PSoC 4 Pioneer Kit's bundled example projects.

 

This is a very simple yet effective CapSenseRegistered demo that implements a 5-segment slider, like the one available on the Pioneer kit.

Moving your finger across the capacative touch slider on the board, you will observe the multicolor LEDs gradually changing color from red to green. These LEDs are driven by the PWM Component.

 

 

Project Schematic:

image

                            (Actual PSoC Creator project schematic "TopDesign.cysch")

 

image

    (CapSense Component Customizer - Implementing a Capacitive Touch Slider)



Hardware Connections (all internal to the board, no external connections required):

  • 5-segment Slider - P1[1] - P1[5]
  • Green LED - P0[2]
  • Red LED - P1[6]

 

Software Setup:

  • See steps #1 - #6 from the main post here
  • Main.C - This example project implement simple firmware in the project's main.c as shown below (already completed in the example project). The code implmented scans the CapSense slider, then updates the PWM's PulseWidth with the slider value.

image

                                      ( Project firmware - main.c )


Demo Video

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Project Files:

  • CapSense.cywrk.Archive01.zip

 

 


Attachments:
CapSense.cywrk.Archive01.zip
CapSense_Configuration.zip
  • Sign in to reply
  • Cancel

Top Replies

  • Former Member
    Former Member over 11 years ago +1
    good~!
Parents
  • Former Member
    Former Member over 11 years ago

    Hi Im new to any sort of embedded programming but want to give it a go and get stuck in.

    I have the PSoC 4 pioneer kit and am trying to do these tutorials.

    I have tried to do this one however keep getting stuck.

    I have wrote the source code and built it and programmed it all onto the board with no errors showing up in the creator.

    However I just have a constant yellowish light on and the slider doesnt do anything.

    Was wondering if anyone else has encountered this problem or could suggest solutions.

     

    Cheers in advance

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • Former Member
    Former Member over 11 years ago

    Hi Im new to any sort of embedded programming but want to give it a go and get stuck in.

    I have the PSoC 4 pioneer kit and am trying to do these tutorials.

    I have tried to do this one however keep getting stuck.

    I have wrote the source code and built it and programmed it all onto the board with no errors showing up in the creator.

    However I just have a constant yellowish light on and the slider doesnt do anything.

    Was wondering if anyone else has encountered this problem or could suggest solutions.

     

    Cheers in advance

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • cy.gul
    cy.gul over 11 years ago in reply to Former Member

    HI George,

    This could be because you haven't assigned the CapSense slider to specific IO pins.

    You can do this by opening the "<project_name.CYDWR>" file from the project explorer.

    • 5-segment Slider - P1[1] - P1[5]
    • Green LED - P0[2]
    • Red LED - P1[6]
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 11 years ago in reply to cy.gul

    I understand wait you are saying, however  I tried opening a test project just drop in the CapSense device, and only two pins where assigned.  How do tell CYDWR to assign P1[1]-P1[5]?

     

    "This could be because you haven't assigned the CapSense slider to specific IO pins.

    You can do this by opening the "<project_name.CYDWR>" file from the project explorer.

    • 5-segment Slider - P1[1] - P1[5]
    • Green LED - P0[2]
    • Red LED - P1[6] "
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 11 years ago in reply to Former Member

    OK, I figured it out.  You must go in the the configure CapSense dialog, and under the Widgets Config tab add a Linear slider.  Now I see the pens in cydwr, and I now can assign the pens

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 11 years ago in reply to Former Member

    FYI, I am trying to use the CapSense and control the Clock.  Now, I am able to use the API Clock_SetDivider and so forth to change the speed of the RGB.   Now, is there on command that will say hey set the clock to Frequency Xhz, or Xmhz, etc?  I think there would be one, but I do not see it in the Clock API doc, unless I am missing something.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • cy.gul
    cy.gul over 11 years ago in reply to Former Member

    Brian,

    If you look at the APIs in the Clock Component's datasheet, you'll notice a _SetDivider() API that you can use to change frequencies.

    In the component configuration setup window you can setup the actual clock frequency.

    Note - the tolerance limits for this clock frequency will be shown in .CYDWR 'Clocks' tab.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 11 years ago in reply to cy.gul

    Thanks,

     

    that is what I am using: SetDivider() API.  I am using a small equation to

    set the divider, but is not very smooth over the capsense right now.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • cy.gul
    cy.gul over 11 years ago in reply to Former Member

    What are you trying to achieve by changing the clock?

    If you're looking for dynamic duty cycle (of the PWM), you might be better off changing the PWM's compare value while keeping a fixed input Clock.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 11 years ago in reply to cy.gul

    I am new to this.  I am trying to help my boss out.  So, I taking a project

    that I got to work and then add small pieces to it.  So, instead of taking

    the Capsense example that changes the color slowly. I am placing that in a

    project that blinks the RGB by the clock.  I have it.  I am learning more

    about going around the development studio.  Now I am going back to the XYZ

    accel project, and see if I can get anything talking not to the example

    project device, but the Freeescale XTRINSIC-SENSOR Board.  Also, he wish to

    talk to the other two sensor chips.  Right now, the project is loaded, and

    not even a simple UART print is not working.  I had the UART working all the

    time in my education project.  Well see, tomorrow is another day, and it is

    late here and I am tired. 12:15 est

     

    Thanks for staying in touch

     

    Brian.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • cy.gul
    cy.gul over 11 years ago in reply to Former Member

    Hi Brian,

    good to know, here's an example that may help with the serial communication (UART) -

    PSoC 4 Pioneer Kit Community Project#035 – UART, I2C, and SPI Joystick Example

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • kyle_lopin
    kyle_lopin over 10 years ago in reply to Former Member

    I had the same problem.  I changed the "API Resolution"  in the "Widgets Config" tab of the Capsense Configuration box after i setup the linear slider and that worked for me.  The default was 100, but as the PWM goes to 255 so I was getting stuck with one light always being mostly on which gave it bright yellowish color.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube