Skip to content

Example code in C for a capacitive touch method that requires only copper pads.

Notifications You must be signed in to change notification settings

forshee9283/pio-touch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pio-touch

Example code in pio assembly and C for a capacitive touch method that requires only copper pads. I've attempted to optimize the code to use as few hardware components as possible (just copper pads) and for flexibility. The speed at which the state machines run will need to be tuned to the size of the copper pads and the desired sensitivity. Fine tuning of some of the delays in the pio code may be necessary.

Known issues: The pio code will re trigger with the same values occasionally this is filtered in C with 'touch_change_flg' but will create additional interrupts.

If using more than one state machine (i.e. more than five buttons) the state machines will be out of sync. The signal from the other state machines can change the reading. This is worse when one hand is used across multiple state machines.

Simplified Theory of Operation: The pio blocks will set a pin high, wait a very short amount of time, and then read that same pin. Because of the internal pull down the voltage will discharge based on how much capacitance is on the pin. Adding a finger on a copper pad adds enough capacitance to hold the voltage high enough to read high assuming the system is tuned properly for the size of the pad.

Button Signal Without a Finger Applied image

Button Signal With a Finger Applied image

About

Example code in C for a capacitive touch method that requires only copper pads.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published