Skip to content

A touch-sense technique that works on any MCU

Notifications You must be signed in to change notification settings

M-J-Bauer/Touch-sense-on-any-MCU

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A touch-sense technique that works on any MCU

Some micro-controller devices have on-chip hardware to support reading of capacitive touch-pads. These devices provide “automatic” measurement of capacitance between an I/O pin and earth (GND). However, a change in capacitance on an input pin can be detected quite easily without any special on-chip wizardry. This method requires a resistor and diode for each touch input.

The processing overhead to service the touch-pads is very low. The interval between calls to the touch-pad “service routine” may be anywhere in the range 100 microseconds up to 5 milliseconds, or more. Execution time of the service routine itself is under 30 microseconds for each touch input.

The micro-controller must have I/O pins which can be configured as either digital (GPIO) or analog (ADC inputs). One such pin is required for each touch input.

The touch-sense technique has been tested successfully on a “low-end” 8-bit AVR micro-controller (ATmega328P) as found in many popular development boards including the Arduino Uno R3 and Nano boards.

The Test & Demo program presented here was designed to run on a Microchip AVR 'X-mini' board which is compatible with the Arduino Uno and Nano. The program was developed under Microchip Studio IDE for AVR and SAM Devices.

The Touch-Sense algorithm is easily adapted to other micro-controllers.

A full description is provided in the PDF document: "Touch sense for any MCU".

Update, July 2024...

An example application including functions to detect touch-pad "strike" and "release" events can be found in the folder "Pro_Micro_touch_sense". Reliable, glitch-free detection of such events can be tricky. The application runs on a 'Pro-Micro' MCU module (ATmega32U4) from Sparkfun. The touch-sense service routine has been customized accordingly. A description of the application can be found on the author's website:

http://www.mjbauer.biz/MIDI-Rifficator-blog.html

Languages