Introduction: Touche for Arduino: Advanced Touch Sensing.

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:
http://www.pronine.ca/coilcal.htm
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:

http://boolscott.wordpress.com/2010/10/23/sneak-preview-of-my-open-source-project/

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:
https://www.dropbox.com/sh/jxkno1vgka7yisf/MZe8m3G4br

Follow the instructions here to upload it and run the guino interface:
https://www.instructables.com/id/Guino-Dashboard-for-your-Arduino/

Hope it helps.

Comments

author
honsey made it!(author)2017-07-19

This is so cool — Thanks for sharing this!

Stumbled upon this because I right now fail in a – what seems to be – simple task: Battery powered electronics; mounted within a metal knob; want to find out if that metal knob is touched and light up an LED.

Tried dedicated AT42QT1010 touch IC. Tried CapSense library (using a ATSAMD21) but with no success. It works when connected to my computer, stops working when running of battery.

Guess the "amount" of ground is just to little, compared to that large metal electrode :(

Did someone try to run this project of batteries?

Thanks in advance,

Hans

author
chris134 made it!(author)2017-04-25

Could someone please try to troubleshoot with me? I'm somewhat of a beginner.

I'm trying to take the barebones of this code and strip away all UI and graph elements. I am attempting to implement just the actual touchsensing into an already existing sketch where I have Firmata uploaded to the Arduino and am interpreting Knock data in Processing. Any help would be very much appreciated!

author
MetabolicG made it!(author)2015-03-20

Thanks for this wonderful instructable! I hope someone is still reading the comments, as the last one is 2 years old...

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?

See attached images for the board and graph outputs.

bottom.jpgtop.jpgtouching.PNGnothing.PNG
author
Wendy+KatherineG made it!(author)2017-03-02

Hi, I tried to do the same project but, I do not know why at the time of complicating, in the graph does not show any signal, I do not know if you can help me with this problem, thank you very much.

author
MetabolicG made it!(author)2017-03-02

Sorry, I never found a fix for this. I eventually swapped it out with one of these; https://www.adafruit.com/product/1602 - which works perfectly fine for my purposes (and was a lot cheaper in the end than assembling 8 of these boards)

author
BHAVNATOR made it!(author)2015-06-04

Was anyone able to find a solution to this problem? I am running into the same thing.

author
haroldbo made it!(author)2015-03-20

I'm also having the same problems. The different states couldn't be distinguished.

Screenshot 2015-03-20 22.04.48.pngIMG_20150320_220212.jpg
author
Wendy+KatherineG made it!(author)2017-03-02

Hi, I tried to do the same project but, I do not know why at the time of complicating, in the graph does not show any signal, I do not know if you can help me with this problem, thank you very much.

author
hygy made it!(author)2017-01-19

Anybody tried to use it as a notebook touch screen device? (With absolute positioning?)

author
prabu_venkat made it!(author)2017-02-04

I am interested in this too.. any suggestions/pointers ?

author
dSteinel made it!(author)2015-01-17

Thanks a lot for this very nice instructable!

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?

author
RicardoB108 made it!(author)2017-01-25

Hello, I was wondering how you managed to make this LED be controlled by the Touché sensor. I can't seem to get it right. I hope you see this message! Any response would be highly appreciated. Thanks in advance!

author
dSteinel made it!(author)2017-01-25

Hello,
I connected the LED to the arduino. So it was not physically attached to the same circuit. In the arduino code, I switched the LED on when the sensor reading was higher than a specific value.

I can look if I am able to find the code on my computer and send it to you if you are interested (I didn't use the processing part / no graph)

author
araiza444 made it!(author)2015-02-02

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.

author
chonigman made it!(author)2016-04-30

This is an amazing tutorial. I made this several years ago during my MFA in Music Technology and had great success with.

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.

https://github.com/KingWalrus/SweepingCapSense

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.

http://www.nime.org/proceedings/2014/nime2014_515....

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.

Mads and DZL thanks for this work, it was super inspiring and obviously very influential.

SweepingCapSense.mov
author
WillP22 made it!(author)2016-09-28

Hi, this looks great! Will read through the paper properly this evening. I'm currently wondering how to use this mechanism for many sensors to be used in large scale group interactive installations. Have you been able to setup the circuit to use the multiple timers accessible in the library? Thanks

author
chonigman made it!(author)2016-09-29

Yes the library can bet set up to use one or all the timers at once. In my case I had 16 sensors 4 to each timer on the Mega. I did not do any tests to see if that improved accuracy and speed, but it seemed like too many sensors on one timer would cause issues. The README in the library explains how to use with one or all timers (with single object). You could also make multiple objects for each of the timers.

author
WillP22 made it!(author)2016-09-29

Thanks, this is all very useful. I was also wondering if you'd have any pointers on setting up the circuit on the Mega to have multiple sensors with their individual clocks. Say if I wanted 4 separate sensors grabbing values at once. Cheers

author
WillP22 made it!(author)2016-09-28

Brilliant tutorial! Managed to setup a liquid musical interface over summer that turned out really well. I'm now wondering how I'd go about sensing multiple object on one Arduino board? Is it possible to chain the circuit to take many inputs. Thanks

author
BryanL65 made it!(author)2016-06-23

This was a great project, thanks! I have implemented a serial reader for this in Unity and had such problems in the past, I decided to spend some time fixing up to have the serial port play nicely with Unity. So, based on the Processing sketch (which seemed buggy) I re-implemented that in C#. The input runs on it's own thread, so performance is good. Here's the project on Git: https://github.com/bryanrtboy/ArduinoSerialThreadi...

Anyone having problems with Arduino serial port reading might benefit by taking a look at this implementation.

author
guzforster made it!(author)2016-05-03

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?

author
GonzE made it!(author)2016-04-22

Do you think you can help me to do the circuit in a virtual breadboard? :D

author
PPP134 made it!(author)2016-04-20

portName= Serial.list()[PortSelected];
In this line error is coming in Processing
ArrayIndexOutOfBoundEception: 1

author
CeriM made it!(author)2016-02-10

I'm getting the error message

/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

When uploading. Any thoughts?

author
CeriM made it!(author)2016-02-10

I'm getting the error message

/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

When uploading. Any thoughts?

author
daralthus made it!(author)2016-02-03

Sweet, now i just need an svm! Thanks for the help!

Screen Shot 2016-02-04 at 00.23.20.png
author
UmangS5 made it!(author)2015-10-20

Hi,

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.

Corrections done in processing:

int PortSelected=0; (I did this and it gave output in serial of the com ports)

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.

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).

Run it again and the screen won't be white anymore.

Regarding the units on x & 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-

http://playground.arduino.cc/Main/CapacitiveSensor?from=Main.CapSense

author
BHAVNATOR made it!(author)2015-06-04

What are the units for the x & 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?

author
Njackson619 made it!(author)2015-06-03

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 "present" the display graph the screen comes up blank. It seems like I'm missing a step that lets the Arduino Communicate with Processing.

author
Njackson619 made it!(author)2015-06-03

any ideas?

author
nicholasmoignard made it!(author)2015-06-02

Mate, really appreciate your work here! Awesome upload. looking forward to trying this over the holidays

author
Sebastien23 made it!(author)2015-04-29

Hi there, which exactly of the Adruino Proto shields are you using for this?

author
PetervdPol made it!(author)2015-04-26

....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.

I hope this helps others; I am on top of the world :-)

author
PetervdPol made it!(author)2015-04-26

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!

author
PetervdPol made it!(author)2015-04-25

Ok, I solved it....

author
PetervdPol made it!(author)2015-03-03

:( 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:

sketch_mar03a.ino: In function ‘void loop()’:

sketch_mar03a.ino:82:28: error: ‘PlottArray’ was not declared in this scope

Can someone help me?

author
haroldbo made it!(author)2015-03-20

Transfer the code from 'SendingData.ino' to 'Arduino_sensing.ino', then compile and test it back.

author
PetervdPol made it!(author)2015-03-24

Thank you! This worked. Can you give me a hint on the Processing part as well? There are three files at Github:

GraphClass.pde, Processing_Graph.pde and SerialLink.pde

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 "Com port" I tried this in ProcessingGraph.pde:

change "PortSelected=3; " in PortSelected=/dev/ttyACM0; which does not work. I also tried this, from another Processing sketch that works:

//PortSelected=0;

myPort = new Serial(this, "/dev/ttyACM0", 115200);

What to do???

author
TWP49 made it!(author)2014-02-12

We get "PlottArray was not declared in this scope" 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.

author
PetervdPol made it!(author)2015-03-03

Hi there! I am getting the same; did you find a solution?

author
markijzerman made it!(author)2015-02-08

Yes! It worked on the breadboard, immediately soldered it to a prototyping board. Thanks loads for this tutorial! :)

image1.JPGschaar_Touche.MOV
author
Cannonball2134 made it!(author)2012-06-17

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?

author
madshobye made it!(author)2012-06-18

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.

author
fedde83 made it!(author)2015-02-03

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.

author
davidbarcomb made it!(author)2014-11-30

Very nice. Thank you for sharing

author
clemniem made it!(author)2014-05-06

Is it possible to use the Touche on another Pin then Pin 9?
I'd love to use it with the Mozzi library to create output Sound. But they both use Pin 9.
Thanks in Advance,
Clem

author
polory+pisano made it!(author)2014-11-08

Hi ! Same thing for me !! It woulfd be wonerfull if someone could solve this :-)

author
RCH6 made it!(author)2014-08-13

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

author
RCH6 made it!(author)2014-08-13

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

author
RCH6 made it!(author)2014-08-13

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

About This Instructable

139,311views

356favorites

License:

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: