Dangerous Prototypes

In development => Project logs => Topic started by: Tuomas on May 08, 2012, 05:24:37 pm

Title: Single pin capacitive touch sensing with an AVR
Post by: Tuomas on May 08, 2012, 05:24:37 pm
Hi there.

I've had a project idea on my mind for a while now that would probably need some capacitive touch buttons, but I've never used them before. About a month ago I started looking at some of the possibilities out there. After ruling out external controllers as an option, I noticed that Atmel provides a library for using a normal AVR ADC peripheral to do capacitive touch sensing, with only a single external component. The library is provided as a binary blob, however, and I couldn't find any source code for it. So I decided to try implementing it myself.

As far as I could figure it out, the idea is to take advantage of the sample&hold capacitor inside the ADC block.

I ended up making a dedicated PCB with an ATMega32u4 microcontroller for testing out the capacitive touch sensing (it's amazing having access to a PCB router at the university, transforming a PCB design into a physical board is simply a matter of some clicks of a mouse and waiting 30 minutes. Except for vias, they need to be painstakingly riveted one at a time...):
[attachment=0]

I've got a full writeup of the experimentation on my website, including my understanding of the theory of operation and code (and a video of the board in action, the three buttons controlling the three colors of an RGB LED):
http://tuomasnylund.fi/drupal6/content/ ... le-adc-pin (http://tuomasnylund.fi/drupal6/content/capacitive-touch-sensing-avr-and-single-adc-pin)

I'm sure this has been done before many times over, but I had fun trying to figure it out myself and it seems like a pretty elegant and reliable solution in my opinion. I'll probably end up using this in a project in the near future.

Thoughts, comments and corrections are always welcome.
Title: Re: Single pin capacitive touch sensing with an AVR
Post by: ian on May 10, 2012, 10:42:51 am
Very cool, thanks for sharing and liberating the technique from the binary blob :)

I've heard before that most methods of cap sense touching are covered by patents, that may be why everyone is so fussy about it.

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.04032056896session_write_close ( )...(null):0
20.04062188488ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.04062189264Database_MySQL->query( ).../DatabaseHandler.php:119
40.08532328000Database_MySQL->error( ).../Db-mysql.class.php:273