Arduino Capacitive Switches
In this experiment I am going to use my first outside library to add Capacitive Sensing to the Arduino as demonstrated on You Tube. This is the same technique used by most modern touch screen such as the iPad and iPhone and this feature is brought to the Arduino via the CapSense library written by Paul Badger.
Installing the CapSense library.
To install the library it needs to be downloaded from the playground and placed into a folder called libraries inside your Ardiuno Sketchbook (the place you store all your Ardiuno projects).
Restart the Arduino IDE, open the project you are working on and then use sketch > import library to import the CapSense library into your sketch. At the most simple level you need to create a new CapSense object where pin 7 represents the source and pin 8 the signal lead.
CapSense cs_grey = CapSense(7,8);
and then inside the loop function you can call the CapSense object and test the current value. The value returned is in an arbitrary unit which you can test against and of course respond to.
long total1 = cs1over7_8.capSense(30);
For more information you should refer to the documentation written by Paul Badger.
Creating the Switches
The switches can be created using a number of different techniques including a paper clip and a piece of wire.
The circuit should look something like:
The recommended resistor value is anything from 50kΩ to 50mΩ with 10mΩ given as a starting point. Personally, I found that too low and need to pop a couple in series to give 20mΩ.
The following video shows the switches under operation without the stabilising capacitors suggested which I need to order.
/**** UPDATE ****/
So after a slight delay due to distractions I have added a stabilising capacitor to a single touch switch. I’ve also changed the design of the switch as shown below. In version 2 I have been able to glue some foil between the wood and paper.
In actual fact I found that the sensitivity of the switch varies greatly depending on whats around it. Three switches was less sensitive than a single one but once I had mounted the camera on the edge of the board the switch became so super sensitive it was more of a proximity sensor than touch sensitive switch!
Anyway, experiment over – next!
Here is the code I used for those that asked. You will need to remove the .txt file extension. (12/01/2013)