DIY capacitive input device

Posted on March 11, 2010 in Hardware, Portfolio

As part of my on-going research into interaction design and alternative transparent interfaces for computers I’ve come up with an Arduino-based input device that can be used to easily launch programs or execute actions on a user’s machine (specifically Windows machines). The basic idea is to provide a pleasant, simple and intuitive interface for a user to complete a common action like check their e-mail or look at the weather forecast.

Initially I was thinking of involving RFID into the process somehow but upon creating the project I felt that this would decrease the simplicity and ease-of-use of the system I had come up with.



How does the hardware work?

I didn’t want to use simple tactile switches for two reasons; I was bored with them and I didn’t think that they’d be as inviting for general users. What I opted to go with is a few custom made capacitive buttons made from nothing but aluminum foil, paper and cardboard (all of which I had laying around my apartment). For those unfamiliar with the technology consider how a capacitor works. Inside a capacitor there are two parallel plates with something in between separating them (like ceramic, distilled water or mica) which is called a dielectric. When current is applied to the capacitor it takes a finite and predictable amount of time for the current to accumulate on one of the plates. Once it has reached a certain point the charge will then begin to jump the dielectric gap onto the other plate resulting in a flow of current and the completion of the rest of the circuit. The aluminum foil in these devices can be thought of as the charged plate of a capacitor while your finger as the other plate and the air between the two is the dielectric. When the plate is not being touched the capacitance does not vary much but when human skin makes contact with it the capacitance increases quite a bit, which I measure using the CapSense library for the Arduino.

My code monitors the input pins of the Arduino for changes in capacitance due to touch which it will then compare with a threshold that will absolutely be able to tell if a finger is in contact with it or not. When the finger is removed from the device my code then recognizes that a device has been pressed (and released) and sends a single packet of serial data to my PC over USB.

How does the software work?

Once a packet of serial data is sent to my machine I use a combination of very small background daemons to translate the serial data from the Arduino into system-level commands in the ASCII format. Specifically I am using AAC Keys and AutoHotKey. And yes I have read that AutoHotKey is able to do low-level COM port communication natively, but its a bit harder. Here’s a little more specific information about how I am using these programs:

AAC Keys – when serial data from the Arduino is received (for me its on port COM5 @ 9600bps) the information is translated into ASCII key codes and output to the system. I wanted to actually have my Arduino send out key combinations in order to launch functions within AutoHotKey so I found out that AAC Keys uses the GIDEI interface for key commands which takes care of this for me. So let’s say that I wanted to have my Arduino send in the combination Ctrl+1 which AutoHotKey will use as a function call. Using GIDEI syntax I have my Arduino execute the following command:

Serial.print("�33, combine, ctrl, 1.");
Please check out the program files I’ve linked to at the end of this post for the full program

AutoHotKey – when a key combination is detected (through a conventional keyboard or this device, source is irrelevant) it can be interpreted as a function call in AHK. I have one function for each physical capacitive button to take care of different things, specifically launching my Gmail inbox, opening the local weather forecast page on weather.com and launching the application file for Hulu Desktop. The specific .ahk file I used can be found in the accompanying ZIP package of source files at the end of this post.

Final thoughts

This project came together really, really well and I’m extremely satisfied with it. Once I had the parts in my possession I was actually able to put it all together in one evening and stamp out the bugs in my code over the next two days. The capacitive element of this approach is especially interesting due to the fact that by varying the inline resistance of the foil in the sensor one can enable very accurate readings to be taken either in open air (up to a few inches!) or by touch (can actually be used as a pressure sensor!). Furthermore since the essential component of the capacitive sensor in simply a piece of aluminum foil the sensor can be embedded into a variety of different packages like pillows or really anything without metal to short out the foil.

Download the project files