Update: New interface - look at the last step.

Credits: Arduino sensing done by DZL, Processing sketch and Instructable done by Mads Hobye

Disney Research lab designed a novel way to detect touch. You can see a video of their demo here:

I had the honor to meet them at CHI2012 in Texas and I discussed with them whether it would be possible to convert their system into the Arduino platform. Their immediate reaction was that the Arduino would not be able to generate good enough frequencies. I asked my friend DZL if he could solve this problem and this was his solution to the problem:

The Touché hardware uses a really fancy Direct Digital Synthesizer IC from Analog Devices. It generates a really pure sine wave signal with frequencies between 1kHz and 3.5MHz with high resolution. While the Arduino is capable of generating frequencies in this range the signal is a square wave with lots of harmonic frequency components and really low frequency resolution.
Simply using this signal with the circuit described in the Touché paper result in a really messy frequency graph due to the harmonics from the square wave. The solution is to use the filtering properties of the LC circuit to our advantage. By measuring the signal after the inductor (coil) rather than before we only see a nice sine wave shaped signal free of all the unwanted frequency components. As a result we now see a peak in signal at resonance rather than a notch but the signal contains the same information.

This has resulted in the following sensing capabilities:

At the conference they told me that they used 200 steps and they were able to get up to 2000. We have 150 in the above video. 

Step 1: Components neded

To make the shield for Arduino you will need the following components:
  • Arduino
  • Usb cable
  • Shield
  • pin headers
  • Resister: 10k, 1MOmh, 3,3k
  • Capacitor: 100pf, 10nf
  • Diode: 1N4148 diode
  • Coil / inductor: 10mH (cypax.dk  part no: 07.055.0510)
  • Water bottle as sensing object.

If you do not have the inductor, it is basically a coil. You should be able to roll your own. Grab an empty roll of toilet paper wind very thin wire around a couple of hundred times. You have to experiment until you get a peak on the graph.

Or be scientific:
You want 10000µH

Step 2: Build the hardware

The shield should be build according to the diagram included here. I have included a picture of the finished shield so you can look at the actual prototype.

Step 3: Upload code to the Arduino board

There are lots of tutorials who have already explained how to program an Arduino and they do a much better job than we could. So we will just give you a couple of links:
  • http://arduino.cc/en/Guide/HomePage
  • http://www.youtube.com/watch?v=4HqXAmV_Ock
  • http://www.ladyada.net/learn/arduino/lesson1.html

The 3 things that usually cause trouble:
  • On windows you have to install the proper drivers (sometimes also on mac).
  • Remember to select the right serial port in the gui.
  • Remember to select the right board in the gui.

Below are the simplified steps to uploading the code to your Arduino board:

Step 4: Run the Processing sketch

You will need processing to visualize the graph. Here are the general steps to get it up and running:
  • Download and install Processing (http://www.processing.org)
  • Get the sketch from github (https://github.com/Illutron/AdvancedTouchSensing - same link as the Arduino sketch)
  • Open the sketch in processing and run it. You will need to choose the right serial port in setup method. It is usually the lowest number.
  • At pointed out in the comments. Arduino uno has problems with high speed serial and you need to reset the board (or unplug) it every time you run the processing sketch. If you get an error please unplug and plug it in again for it to work. 

The graphing sketch is a modified version of Bool Scotts graphing example:


Congratulations - you are ready to go!

Step 5: Update: Alternative visualizer

Some of you have problem with the processing sketch. This is due to a crappy graphing interface written in processing. I have made an alternative version. It is based on my new Guino interface - which has much faster graphing. You have to do the following steps:

Download the arduino code here:

Follow the instructions here to upload it and run the guino interface:

Hope it helps.
<p>I don't see the coil in the assembled shield image... Also is it possible to add more step-by-step images on assembling the shield for us beginners?</p>
<p>This is an amazing tutorial. I made this several years ago during my MFA in Music Technology and had great success with. </p><p>I have made an open source arduino library to help with the code setup. It works with the Mega and and the Uno called SweepingCapSense. </p><p><a href="https://github.com/KingWalrus/SweepingCapSense" rel="nofollow">https://github.com/KingWalrus/SweepingCapSense</a></p><p>With it you can select which Timer you want to use, and let you use multiple timers as well. The arduino code becomes quite simple. I wrote a paper about it for the International Conference on New Interfaces for Musical Expression. </p><p><a href="http://www.nime.org/proceedings/2014/nime2014_515.pdf" rel="nofollow">http://www.nime.org/proceedings/2014/nime2014_515....</a></p><p>I even made a version that had 16 touch sensors for a project in collaboration with Art Center College of Design and Cloud9 Architects in Spain.</p><p><iframe allowfullscreen="" frameborder="0" height="281" src="//player.vimeo.com/video/85204158" width="500"></iframe></p><p>Mads and DZL thanks for this work, it was super inspiring and obviously very influential. </p>
<p>Do you think you can help me to do the circuit in a virtual breadboard? :D</p>
<p>portName= Serial.list()[PortSelected];<br>In this line error is coming in Processing<br>ArrayIndexOutOfBoundEception: 1</p>
<p>I'm getting the error message</p><p>/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude: line 6: exec: /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude_bin: cannot execute: Undefined error: 0</p><p>When uploading. Any thoughts?</p>
<p>I'm getting the error message</p><p>/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude: line 6: exec: /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude_bin: cannot execute: Undefined error: 0</p><p>When uploading. Any thoughts?</p>
<p>Sweet, now i just need an svm! Thanks for the help!</p>
<p>Hi,</p><p>Thanks for the great tutorial. Just made it both with guino and processing! The GUI with processing is not working in terms showing holding or touching, but graph is coming out nice and various touches can be identified. Initially there were problems with the processing part, but that is solved. </p><p>Corrections done in processing:</p><p>int PortSelected=0; (I did this and it gave output in serial of the com ports)</p><p>Line 58 in Serial link file of processing- The 'println' command is needed to be changed to 'printArray' for getting the values of serial print. </p><p>Then run the processing. This will return various values corresponding to COM port in the serial/console monitor (the black screen at the bottom of processing), put that in the beginning of the code. The processing screen might be white at the moment (this is because the serial port is not rightly entered).</p><p> Run it again and the screen won't be white anymore.</p><p>Regarding the units on x &amp; y: I think X should be frequency of and Y should be voltage or current change. So basically the working of capacitive touch could be understood well by this tutorial to understand what is happening here- </p><p>http://playground.arduino.cc/Main/CapacitiveSensor?from=Main.CapSense</p>
<p>What are the units for the x &amp; y axes of the graph? I know one of them is voltage and the other is time? Is it seconds or milliseconds, volts or millivolts?</p>
<p>Thanks for this wonderful instructable! I hope someone is still reading the comments, as the last one is 2 years old...</p><p>I built this device and it seems to work; I get a graph with a peak in the Processing app when the Arduino is attached with the sensing wire in a cup of water. When I put a finger in the water, however, the graph goes almost entirely flat. It does not matter how many fingers I put in, I always get the same result. It works more as an on/off switch than actual sensing... does anyone have any idea what could cause this behaviour?</p><p>See attached images for the board and graph outputs.</p>
<p>Was anyone able to find a solution to this problem? I am running into the same thing.</p>
<p>I'm also having the same problems. The different states couldn't be distinguished.</p>
<p>I have set up the circuit and ran the code on the Arduino. I also uploaded the code on Processing. But whenever I try to &quot;present&quot; the display graph the screen comes up blank. It seems like I'm missing a step that lets the Arduino Communicate with Processing.</p>
<p>any ideas?</p>
<p>Mate, really appreciate your work here! Awesome upload. looking forward to trying this over the holidays</p>
<p>Hi there, which exactly of the Adruino Proto shields are you using for this?</p>
<p>....and the issue with my Arduino MEGA is solved too: I downloaded the pinouts of both the Uno and the Mega and found that pin 9 on the Uno is pin 11 on the Mega. </p><p>I hope this helps others; I am on top of the world :-)</p>
<p>SOLVED. I was using my iduino MEGA with 2560 chip to no avail; today I tried with my sons Uno and sure enough it worked.. Now can someone tell me what is going on? A difference in pinout between the Uno and Mega? Please help!</p>
<p>:( I really want to build this, it is amazing. However: I get compile errors, both with a Arduino Uno and a iduino Mega R3, Same error: </p><p>sketch_mar03a.ino: In function &lsquo;void loop()&rsquo;:</p><p>sketch_mar03a.ino:82:28: error: &lsquo;PlottArray&rsquo; was not declared in this scope</p><p>Can someone help me?</p>
<p>Transfer the code from 'SendingData.ino' to 'Arduino_sensing.ino', then compile and test it back.</p>
<p>Thank you! This worked. Can you give me a hint on the Processing part as well? There are three files at Github:</p><p>GraphClass.pde, Processing_Graph.pde and SerialLink.pde</p><p>I have merged them, no avail, Put them in the same folder etc. nothing works. Problem may be I am on a Linux computer and don't have a &quot;Com port&quot; I tried this in ProcessingGraph.pde:</p><p>change &quot;PortSelected=3; &quot; in PortSelected=/dev/ttyACM0; which does not work. I also tried this, from another Processing sketch that works: </p><p>//PortSelected=0; </p><p>myPort = new Serial(this, &quot;/dev/ttyACM0&quot;, 115200);<br><br></p><p>What to do???</p>
<p>We get &quot;PlottArray was not declared in this scope&quot; each time we try to up load to the arduino. We have trired the various suggestions given in these comments--GUINO version and still get the same message.</p>
<p>Hi there! I am getting the same; did you find a solution?</p>
<p>Yes! It worked on the breadboard, immediately soldered it to a prototyping board. Thanks loads for this tutorial! :)</p>
How easy would it be to run this on an arduino pro mini? or arduino mega? Are there certain pins and settings that need changing?
As far as I know you can run it on any board that uses the same chip. So arduino pro mini should be the same. When using it for arduino mega - you probably have to customize the code for the pwn pin for it to work.
<p>Thank you for this amazing project. I have a small question. Is it possible to use another PWM pin simultaneously so we can use multiple objects with one Arduino? I'm getting signal drop when using the same PWM signal over two circuits. Could you please explain how this is done?Thank you very much for any respons. </p>
<p>Thanks a lot for this very nice instructable!</p><p>The sensor works quite well. But there is an issue which I can't solve so far. I connected the outcomming values to an led so that it goes on when I touch the sensor. It works really good when the arduino is connected via USB. But with an external power supply the led flickers (although the values should be exaclty the same). Can anybody help me so that I dont have to stay connected with the usb port?</p>
<p>Hi, I am not an expert with Arduino Micro Controllers, but to me is sounds like your power supply is either underpowered or failing. Check your input voltage and current with a meter or scope and if they are correct, then I would try adding an electrolytic capacitor (about 470uf) between your power supply and micro controller to condition your incoming power.</p>
<p>Very nice. Thank you for sharing</p>
<p>Is it possible to use the Touche on another Pin then Pin 9?<br>I'd love to use it with the Mozzi library to create output Sound. But they both use Pin 9.<br>Thanks in Advance,<br>Clem</p>
<p>Hi ! Same thing for me !! It woulfd be wonerfull if someone could solve this :-)</p>
<p>Hi... I am using Guino dashboard for blinking an Led at about every half of millisecond, and I am plotting the graph according as the led turns on and off. The problem is the width of graph is tooo small to recognize the signal. How can we increase or manipulate the axis??? @Madshobye</p>
<p>Hi... I am using Guino dashboard for blinking an Led at about every half of millisecond, and I am plotting the graph according as the led turns on and off. The problem is the width of graph is tooo small to recognize the signal. How can we increase or manipulate the axis??? @Madshobye</p>
<p>Hi... I am using Guino dashboard for blinking an Led at about every half of millisecond, and I am plotting the graph according as the led turns on and off. The problem is the width of graph is tooo small to recognize the signal. How can we increase or manipulate the axis??? @Madshobye</p>
<p>Hi, Thanks for posting this! I am having an issue that I suspect is related to my arduino board having a dodgy clock or something but I wanted to check - the peaks move from right to left very quickly during operation - the amplitude remains constant but the Readnumber changes constantly. Any suggestions? I am going to try with another mega soon. Thanks again!</p>
<p>Tried it on a second board - no change.</p>
<p>What an amazing instructable, thank you for posting! Now I am having the same issue described here on Arduino Uno. Would anyone have an idea of what is going on? Thanks for the help!</p>
Hey Mads, We built the touch&eacute; (thank you so much for your instructables) and interfaced it with two environments we love: PureData and Max/MSP. We have succeeded in this. Here we go the project: <br>http://madlabdk.wordpress.com/2013/04/08/2-touche-meets-pd-and-maxmsp/ <br>and the github ;) <br>https://github.com/madlabdk/touche <br> <br>keep on sharing !
Ive week working on a very similar project for a while, and wanted to check this out. Can you explain how to set it up? <br>I uploaded arduino graph, and ran the graph mxp and nothing happens. If I check the arduino serial port it it is just outputting nonsense (lots of numbers and symbols). <br>I did the same with the &quot;peak&quot; files and could not any results. <br>Any ideas?
<p>Did you ever figure this out? I'm running into the same problem, and I really need to work with this data in Max MSP rather than processing. </p>
<p>Solved! In case anyone else stumbles upon this problem, IT IS YOUR BAUD RATE! I made a post about it on the Arduino forums:</p><p><a href="http://forum.arduino.cc/index.php?topic=224730.msg1628483#msg1628483" rel="nofollow">http://forum.arduino.cc/index.php?topic=224730.msg...</a></p><p>The code works beautifully so madlabdk if you see this you are amazing! And of course Madshobye as well, bless yall, and this community!</p>
<p>Thanks so much for this Instructable! I'm looking forward to trying it. I'm new to these kinds of circuits, so I have a quick question -- for the inductor, is there a restriction on which kind I should purchase? Looking at Mouser, there are a ton of different (and different-looking) varieties...Does the max current or max resistance rating matter? Thanks!</p>
<p>May I ask if any Coil with10mH will do? I cannot seem to find something identical to the one you use. What I found was a coil that actually looks like a resistor.</p>
<p>This is awesome. The technique itself is cool, and having an Arduino implementation makes it so much better!</p><p>Just a quick comment on the Processing code, I was having issues with it because the dynamic arrays weren't getting initialized. The SerialEvent function was freaking out at me, so I just changed the declarations at the top:</p><p>float[] DynamicArrayTime1 = {}, DynamicArrayTime2 = {}, DynamicArrayTime3 = {};</p><p>float[] Time1 = {}, Time2 = {}, Time3 = {}; </p><p>float[] Voltage1 = {}, Voltage2 = {}, Voltage3 = {};</p><p>float[] current = {};</p><p>float[] DynamicArray1 = {}, DynamicArray2 = {}, DynamicArray3 = {};</p><p>Hopefully that helps someone else who gets stuck. :)</p>
<p>Hello, I'm having really small readings that's difficult to distinguish between different touch patterns (like one finger tip, multiple fingers, grab, palm... etc), the values are like:</p><p>untouched:</p><ul><li> Top: 1.00<li> Interpolated: 21.00<li> Basline (no value)<li>Value: 21.00</ul><p>palm:</p><ul><li> Top: 1.00<li>Interpolated: 26.00<li>Baseline (no value)<li>Value: 26.00</ul><p>I tried several differnt touch interface, including:</p><ul><li> nothing (just the wire)<li>a glass of water (in a ceramics cup)<li>a piece of aluminum paper (~14x30 cm^2)<li>a tin can (empty milk powder can)</ul><p>all giving similar results, almost indistinguishable.</p><p>I tried 2 types of inductors</p><ul><li> axial lead (brown black black silver)<li>radial (103J)</ul><p>I tried to play with different values of resistors, capacitors, and inductors, but nothing made a difference.</p><p>I'm stuck at here, can somebody help me?</p>
<p>Thank you so much for sharing this.</p><p>I used it with plants in my graduation research.</p><p>If anyone interested and have some time, you are very welcome to visit my page at<br>http://www.instructables.com/id/Calm-Relaxed-Interaction-Plant-Plus-1</p>
Thanks a lot for this instruction Mads! <br> <br>Somehow I can't see any graph in processing. The original sketch just opens a blank window. Also tried your GUINO approach. The application only shows the setup bar on the left side nothing else. <br>I tried older versions of Processing still it didn't work. <br> <br>I'm using an Arduino Duemilanove (ATmega128). Might that be the cause? <br> <br>Any help would be highly appreciated. I really wanna get this running!
i meant ATmeaga168 of course.
It should work. Sound like something is wrong with the serial communication. Wrong port comes to mind. I am not sure.

About This Instructable




Bio: IMPORTANT: Please do not message me personally with technical questions. Use the comments in the respective instructables. I really love sharing and helping people makes ... More »
More by madshobye:Guino: Dashboard for your ArduinoMaking noise machinesMaking sound (noise) machines
Add instructable to: