Make: Projects

A Touchless 3D Tracking Interface

Create a 3D computer interface using little more than an Arduino, six resistors, and some aluminum foil!

  • By
  • Time Required: 2 hours
  • Difficulty: Moderate
A Touchless 3D Tracking Interface

In this project, we’ll take a very simple idea — the length of time it takes a capacitor to charge — and make something rather amazing with it: a 3D interface that can track the position of your hand. The original implementation of this project comes from media artist Kyle McDonald.



Step #1: Making the sensor cube.

A Touchless 3D Tracking InterfaceA Touchless 3D Tracking InterfaceA Touchless 3D Tracking InterfaceA Touchless 3D Tracking Interface
  • For this project we'll need some cardboard squares (mine are approximately 12" square, but anything from about 8-12" is fine), alligator clips, an Arduino, shielded wire, aluminum foil, spray glue, and some wide tape. (3) 10KΩ and (3) 220KΩ resistors are also required (not shown).
  • Additionally, we'll need a soldering iron to connect the resistors to the cable.
  • Spray the glue onto the cardboard and smooth the foil onto one side. Work slowly and try to leave a small gap around the edge of the foil. It is important that the foil plates do not touch each other when we tape the three sides together. In a pinch you can use a glue stick.
  • I cut a small notch in the inside edge of the rightmost plate to make it easier to connect the alligator clips later on (see second photo).
  • Using tape, assemble the plates to form one half of a cube (see the third photo).

Step #2: Prepare the wires.

A Touchless 3D Tracking InterfaceA Touchless 3D Tracking InterfaceA Touchless 3D Tracking InterfaceA Touchless 3D Tracking Interface
  • Next we need to prepare the wiring. I bought a 6' shielded audio cable for this. It is important to use shielded wire so that the cable itself doesn't act as an antenna and skew the sensor readings.
  • Cut the wire into 3 pieces of equal length (2' or so) and strip off the outer and inner insulation (second photo).
  • On one end, trim off the shielding wire and connect just the inner signal wire to an alligator clip (third photo).

Step #3: Adding the resistors.

A Touchless 3D Tracking InterfaceA Touchless 3D Tracking InterfaceA Touchless 3D Tracking InterfaceA Touchless 3D Tracking Interface
  • On the other non-alligator end of the cables, twist together the 3 shield wires and solder them. The shield will be connected to the 5V pin on the Arduino. This will minimize the antenna effect of the cable on the circuit.
  • Referring to the schematic, connect the resistors to the three inner wires of the cables as shown and connect this to the ends of the three wires. The 220KΩ resistors all connect between the inner wire of the cable and 5V. The 10KΩ resistors will each be connected between the end of the cable and a pin on the Arduino. The circled area indicates that this wire should be shielded, with the shield connected to +5V.
  • Use a small piece of jumper wire to make the connection between the shield wires and the 5V output pin on the Arduino, as shown in the third photo.
  • In the picture, I have used some blue heat shrink tubing to hold the three wires together. You could also just tape the wires together.

Step #4: Connecting the Arduino.

A Touchless 3D Tracking InterfaceA Touchless 3D Tracking InterfaceA Touchless 3D Tracking Interface
  • Connect each of the 10KΩ resistors to pins 8,9, and 10 respectively. Connect the red wire to the +5V pin on the Arduino.
  • Attach each of the alligator clips to a foil plate. The clips should be attached in the following order: pin 8=left plate (x), pin 9=bottom plate (y), pin 10=right plate (z). Make sure that each clip is making good electrical contact with the foil and is only touching one plate.
  • When troubleshooting, check the connection between the plate and the pin with a multimeter to make sure the alligator clip is making a good electrical contact.

Step #5: Using the software.

A Touchless 3D Tracking InterfaceA Touchless 3D Tracking InterfaceA Touchless 3D Tracking Interface
  • Download the Arduino sketch and Processing sketch from GitHub. If you haven't previously installed Processing, get it here.
  • From the Arduino IDE, upload the sketch to the Arduino. Keep the USB cable connected to the Arduino, then install and load the Processing sketch.
  • It is important that your computer is plugged into the wall for this to work properly. If the circuit isn't connected to earth ground (at least indirectly though your computer) you may find that your computer itself will affect the circuit.
  • The next thing to be done is calibrate the software. With the Processing sketch running, hold down the left mouse button. Then move your hand from the far outer diagonal corner (i.e., the invisible corner of the cube closest to you) to the inner corner. Don't touch the foil, just move your hand through the space defined by the cube. Now release the mouse button. The path your hand traveled gives the software a chance to detect the range of motion your hand will make inside the cube.
  • Now move your hand around inside of the cube. There should be a sphere on the screen through which you can control and move to touch all 27 cubes inside the computer model. Pressing tab will change the color of the cubes.
  • This is the simplest form of capacitive sensing available. In the final section, we'll look at some alternative solutions and options to improve the system.

Step #6: Possible improvements.

A Touchless 3D Tracking Interface
  • Increasing the resistor values - the 220KΩ resistors form part of the RC network and it's worth experimenting with different values. Typical values are 200KΩ to 500KΩ. The responsiveness of the system will be affected by these values. You can also tweak the values in the "Normalize" tab of the Processing sketch to calibrate your particular configuration.
  • A more solid connection with ground. Since the Arduino is connected to the computer, and the computer is connected to the wall socket ground, this is generally good enough to provide a consistent reference to ground. If you have a house ground connection available you might want to connect this to the Arduino ground pin and see if that improves the response.
  • If you decide to connect anything to the house wiring, be very sure that it really is a ground. A good earth ground would be a water pipe.
  • The CapSense library is an excellent capactive sensing library for Arduino. The page includes some good information on configuring capacitive sensing circuits.
  • Terry Fritz (a well regarded Tesla Coil experimenter) put together a neat "vision" system for robotics called ThereminVision. It uses tuned oscillators and heterodyning to implement a theremin circuit. Definitely worth a look.


In this guide, we introduced the concept of capacitive sensing. Nearly all sensing of this kind depends upon how long it takes a capacitor to charge (known as the time constant). Placing an object within the electric field of a capacitor will affect the capacitance value and the corresponding time constant. See the RC time constant entry on Wikipedia for more information.

We hope you appreciate the cleverness of this project as much as we did and how relatively easy it is to get a very 21st century interface (however crude) out of some aluminum foil and a cardboard box! We'd love to hear of your experiences with the build (in the comment section below).

Steve Hobley

Steve Hobley

This week, I have been mostly working on...

I've been tinkering around with bits of technology since I was five years old. I used to take the telephone apart at home, just to see how it worked.

After a couple of years I could even put it back together again - and sometimes it would continue to work.

  • Michael

    You have to have all 3 files in a folder called “TicTacToe3D”. Bring up TicTacToe3D in processing and run it. It should behave as described in the instructions.

    The easiest way to download all of the files from GitHub is to click the “Downloads” link (upper right corner, about 3rd line from the top) then the “Download as Zip” button. That way you get all of the files in the right structure to load into the tools.

    • Chris

      when i open the processing tic tac toe, it has the three other files tabbed but when i run it it shows a blank cube. Why is that?

      • onders

        I as well am having the same problem. Could someone please offer assistance. Thanks in advance

        • emarinkovic

          I found that changing the value of the comport in the following snippet of code from TicTacToe3D seemed to help bring up the image of the cube

          “import processing.serial.*;
          import processing.opengl.*;

          Serial serial;
          int serialPort = 0; // << Set this to be the serial port of your Arduino – ie if you have 3 ports : COM1, COM2, COM3
          // and your Arduino is on COM2 you should set this to '1' – since the array is 0 based

          I am still struggling to get it to work properly though. Hope this helps

      • Brandon

        Hey you should run 1.5.1 i had the same problem and i was really upset but when i switched from 2.0.1 to 1.5.1 it worked. Hoped this helped if it didn’t i have a few other ideas.

    • Shane

      I have the processing and everything done that is needed, but I dont understand how to get the processing to work and show me the cubes. I could not find the download button you talked about and I am lost at the moment.

  • Brian

    and where is processing? sorry for the total noobage im just getting started! and thanks ill change the values!

  • Steve Hobley

    You don’t need to use the analog ports as this is measuring the time taken to charge to “full” (HIGH) rather than measuring individual levels.

    Processing is available from

  • quang nguyen

    I have the same error…

  • Michael

    Download processing, if you have not found it already (step 5 first bullet above)

  • Steve Hobley

    Although I don’t have the code with me right now I suspect it’s because the serial port you are using to connect to your Arduino is set incorrectly. IIRC there is an array that needs to point to the correct serial port. I think I made a comment in the code about it.

  • fe13ar

    This is great!
    Would this also work on another mc like AT89c51?
    If yes, will major changes be required in the code?

  • mohamed

    i have the same do you found a solution ?

  • Shawn Wallace

    Hi Sean:
    Take a look at the Arduino Leonardo; that will let you use this as a (very crude) mouse.

    • Nehad

      I opened the processing and appeared to me an empty box… is that normal

  • Shawn Wallace

    Hi Mohamed:
    What error are you getting, exactly? Can you post the output here?

  • Shawn Wallace

    Rebooting is odd, but could be an indication of a short circuit that is pulling too much current from your USB port. Your Mac should be able to shut the USB port down in a case of a current overload, but maybe not in this case. I would try to troubleshoot by narrowing it down to getting a single plate working. Make sure your power to the Arduino is connected to the wall; they powering it from a separate wall wart first.

  • Shawn Wallace

    Either one is fine. The their behind the DIL version is that students who keep trying to drive motors directly from an Arduino pin can easily replace the chip when it fries (at least, when the pin fries). So, I guess the DIL version is more robust in that sense.

  • Andraz

    (Sorry for late reply, I didn’t found the “reply” button :-)

  • Kyle Luiten

    im having the same problem!!! do i need a driver for the arduino or something?

  • Kyle Roberts

    The name Kyle must be cursed o_O

  • Clark Dalton

    In the same boat as Alfred. Anyone got any ideas?

  • Shawn Wallace

    I think there may be a problem with the code and Processing 2.0. Can you try it with Processing 1.5?

  • Shiva Nathan

    I solved the previous problem. Make sure that you’re using the most STABLE interface of Processing:
    DO NOT use version 2.0.3.

  • Shiva Nathan

    @ Kyle Roberts:
    Go to Terminal and type in the commands:
    sudo mkdir…sudo chmod

    This is for Mac, by the way.

  • Kyle Roberts

    I just fixed the problem… Try using a 32bit pc for it… i was using mac

  • Steve Hobley

    It still sounds like you have some issues with the Processing installation. Have you tried running some other sketches? Do they run OK?

  • omar ahmed

    ya the processing runs fine but the TicTacToe3D sketch says theirs an error cannot find class normalize the processing program runs fine im pretty sure its in the code

  • omar ahmed

    OK two of the sketches have error Normalize and TicTacToe3D on normalize it says- (nested type normalize cannot hide an enclosing type) and TicTacToe3D says- (cannot find classs or type “Normalize”)

  • felix

    did you ever fix this? i get similiar errors…

    Display 0 does not exist, using the default display instead.
    WARNING: RXTX Version mismatch
    Jar version = RXTX-2.2pre1
    native lib Version = RXTX-2.2pre2
    [0] “/dev/tty.usbmodem3a21”
    [1] “/dev/cu.usbmodem3a21”
    [2] “/dev/tty.Bluetooth-PDA-Sync”
    [3] “/dev/cu.Bluetooth-PDA-Sync”
    [4] “/dev/tty.Bluetooth-Modem”
    [5] “/dev/cu.Bluetooth-Modem”

    and nothing happens on calibration (the ball drops into the centre but thats it)

  • felix

    Nice!,,, i cant get this working with processing but i really want to tweak the arduino code to feed into Max MSP as a musical interface kind of thing, any tips or code you can send my way just to get some useful reading from each axis???

  • omar ahmed

    oh what you do is make sure you have all the codes: TicTacToe3D, Normalize, MoumentumAverage. all i one window

  • Roy

    Would love to see that code if you can post it!

  • zephyrin JG

    how could i do that?

  • Pritesh

    Today, I am trying with processing v1.5.1 but, it still shows,
    Display 0 does not exist, using the default display instead.
    WARNING: RXTX Version mismatch
    Jar version = RXTX-2.2pre1
    native lib Version = RXTX-2.2pre2
    And executes showing the boxes, but, doesn’t calibrates, shows just yellow ball at the top last corner and doesn’t shows any movement..
    I am using ATmega328 (duemilanove), will it supports?

  • Yash Kudale

    ya i am having the same problem did you find any solution ?

  • Yash Kudale

    dude just use older version of the software 1.5.1 (with java) and it worked

    • Pritesh

      @Yash Kudale
      Thanks for reply!
      But, still I got the same error!

  • Austin

    Use Processing version 1.5.1 instead of the latest version. I can get the other cubes to show up when I do this. I’m having trouble calibrating though.

  • Jim

    Got this working but also having trouble calibrating — getting very limited range of movement on the display. Any tips on that?

  • jake

    I get this in 64bit pc with processing 1.51 and arduino 1.5.2

    Display 0 does not exist, using the default display instead.
    WARNING: RXTX Version mismatch
    Jar version = RXTX-2.2pre1
    native lib Version = RXTX-2.2pre2
    [0] “COM3”
    Exception in thread “Animation Thread” java.lang.ArrayIndexOutOfBoundsException: 2
    at TicTacToe3D.setup(
    at processing.core.PApplet.handleDraw(Unknown Source)
    at Source)

  • jake

    also what do i fill in here:
    int sen = 3; // sensors
    int div = 3; // board sub divisions

  • Nehad

    I have an arduino processing 1.5.1. Do I have to download the processing that is on ‘’??

  • Nehad

    The processing is not working on 64 bit . Is there an updated version??

  • Charles

    Which of the sketches do we add to the arduino breadboard. 3DInterface or TicTacToe3D

  • timmy

    where is the code and the progeam

  • I am not able to download code… :(
    How to do it???

  • MatteoITA

    I’m really impressioned and I would like to adapt the software to a pic, where can i find the source code? Thank you ;)

  • Jason

    Can someone help me out on step #5, point 2: “From the Arduino IDE, upload the sketch to the Arduino. Keep the USB cable connected to the Arduino, then install and load the Processing sketch.” I was able to upload the sketch to the Arduino, but I don’t get the “install and load the Processing sketch” part. (I do have Processing) I have been stuck on this part for a while now. Help will be greatly appreciated.

    • Kelly

      Just wondering if you ever figured it out? I have the cube up but cannot get it to move. I suspect it is because I have done a step wrong.

  • Hey guys, great tutorial. I can’t seem to find the Arduino Sketch though? The link is not working here, as in it is not even active…?

  • I am having the issue with normalize as well when I use this code: How many different files of code do I need to copy into the Processing?

    Note: I am using Processing 1.5.1

  • Paul

    I’m using Processing 1.5.1 and my Arduino is connected via COM3, but I’m getting the following error when running the TicTacToe3D program ArrayIndexOutOfBoundsException: 1. The Processing run screen appears, but it remains white. Any help would be appreciated, thanks.

    • Nicko

      I have the same issue. Did you find a solution?

  • Min

    Hi, I have done everything and I see TicTacToe3D screen with boxes and orange ball. but the problem is that the ball doesn’t move at all. It doesn’t react. Any advice? What could be a problem? Help me~

    • Robin

      I’ve got similar problem. The only difference is, the ball’s movin ariound in random directions

    • Kelly

      I am having the same problem. Did you figure out what was causing it? Thanks!!

      • Demece

        You can download the arduino sketch and the 3 processing
        Version 1.5 sketches off github. Search under
        3D Interface. You alsp need a mouse to calibrate
        the software, we have not been successful with
        a trackpad. Hope this helps!

  • Newermore

    Can anyone please write me what program this does step by step, i realy need this for my school project. Please e-mail me to [email protected] . I will be very gratefull.

    #define resolution 8
    #define mains 50 // 60: north america, japan; 50: most other places

    #define refresh 2 * 1000000 / mains

    void setup() {

    // unused pins are fairly insignificant,
    // but pulled low to reduce unknown variables
    for(int i = 2; i < 14; i++) {
    pinMode(i, OUTPUT);
    digitalWrite(i, LOW);

    for(int i = 8; i < 11; i++)
    pinMode(i, INPUT);


    void loop() {
    Serial.print(time(8, B00000001), DEC);
    Serial.print(" ");
    Serial.print(time(9, B00000010), DEC);
    Serial.print(" ");
    Serial.println(time(10, B00000100), DEC);


    long time(int pin, byte mask) {
    unsigned long count = 0, total = 0;
    while(checkTimer() < refresh) {
    // pinMode is about 6 times slower than assigning
    // DDRB directly, but that pause is important
    pinMode(pin, OUTPUT);
    PORTB = 0;
    pinMode(pin, INPUT);
    while((PINB & mask) == 0)
    return (count << resolution) / total;

    extern volatile unsigned long timer0_overflow_count;

    void startTimer() {
    timer0_overflow_count = 0;
    TCNT0 = 0;

    unsigned long checkTimer() {
    return ((timer0_overflow_count << 8) + TCNT0) << 2;

  • Andrew
  • Nehad

    I did everything, but the box is not moving. what’s the problem??
    Can anyone help me please??
    I made 220K ohm by two 100k series with two 10k … do you think this is the problem?

  • Nehad

    It worked thanks god.
    but the sensitivity is poor, it is not sensing my hands well.
    is there any suggestions????????

  • Abd El-Rahman

    please I want the link of the arduino sketch

    • Nacho

      have you got it? the arduino sketch?

  • Nacho

    I cant download the sketch for my arduino board, pls someone help me.

  • Nehad
    • Nacho

      thx a lot, i really appreciate it

      • Nehad

        You Welcome :)

  • Jazmin

    im trying to do this with labview using an Ni daq, i really hope it works, I`ll do all the programing instead of downloading it since i wont be using the arduino But before I start, is the Al foil sensitive enough?? cause if it isnt, itll be hard to see the variations first off.

  • Moises Mejia

    i cant seem to be able to open he sketch, im using a mac book pro. can someone help me out

  • Rohtih

    i got 3d cubes in processing..but it is STATIC not moving.. can some pls held to trubleshoot this problem….

    • Nehad

      1-check the arduino ports with the arduino program, they must be the same.
      2-And change number of bits per second: control panel-> Device Manager->ports->double click on arduino-> port settings-> Bits per second=115200

  • Joshua All

    Hello everyone, I was curious about the possibility of increasing the size of the squares to 7 feet by 7 feet, and how would that work with this idea? Any help would be appreciated. Concurrently, what inside the hand is charging the compositors of the squares, and what else could be used besides a hand?

  • Somesh

    Pls can some one explain me the exact procedure….. I am unable to understand most of the part in here….. is the code given above ….the 3D tic tac toe correct???
    If not pls upload the one that runs correctly ASAP please

    • Brandon

      no the code is wrong when you run it the program says cant find sensors change the words sensors to sen hope this helps.

  • Damodharan

    Pls help me.
    How can i move mouse in windows using this project ?

  • George

    It says in Processing that sensors cannot be resolved to a variable what should I do??

  • Casey

    The links to download the program aren’t working for me. Could anyone tell me the url to the download page?

  • rashomon

    Hello everybody
    I’m using processing 2.0 and it seems is not working well?
    Do I need to use processing 1.5.1 with java 6?

    • George

      You need to use processing 1.5.1 processing 2 has errors.

  • Ahmed Zacky

    Using a MEGA 2560 – as a 3d controller?
    Hi, I dont have a leodardo but successfully (or maybe not?) finished all my budget on this. But alas! I really want to know whether i can use this as a (maybe crude) interface for a 3d game made in unity, or better, a 3d controller for 3d programs like maya or 3dmax (or blender/cinema4d) I Would really like to know as soon as possible because i have to submit a project on thrusday and im clueless. Thank you. Any help would be appreciated!!

  • George

    My screen in processing keeps freezing on the center corner help!!!!

    • George

      I’m talking about the invisible corner.

      • George

        Also what type of jumper wire do you need? Mine is acting like a sensor instead of a wire.
        Any suggestions?

        • Ahmed Zacky

          Coaxial cable.. the one which you put to backyard antennas? (skew out the aluminium covering inside.)
          While calibrating, do not touch the ICSP, it will cause it to get stuck there :D

          • George


  • cwelsh

    does this project actually work, because some of the comments say otherwise.

    • Nehad

      Yes it works

  • Frank

    Hello everyone, I need help where can I download the sketch and I don´t know if its necessary any library from arduino, thanks

  • zalino

    please i’m cameroonian ,how to get arduino module for make it ?it is possible to facilitate me to get it?my Email:[email protected]

  • Demece

    Please link github files for Arduino and Processing tic tac toe 3D. Cannot find files in github. Have already made repo. Thanks…

  • Kelly

    Got it to work, what a cool project. I am going to use it in my middle school classroom as a fun way to talk about 2D vs 3D and coordinates. THANKS!!

  • Robert14

    Does it work on 64 bits?

  • I get the error I’ve posted below on Processing 1.5.1 when I run the sketch. It opens the window with the cubes and stuff. I hold down the button on the mouse and it comes up saying defining boundaries which is good. But after I’ve done that part I can’t get the sphere to move, would appreciate any help :) Thanks

    WARNING: RXTX Version mismatch
    Jar version = RXTX-2.2pre1
    native lib Version = RXTX-2.2pre2
    [0] “/dev/tty.Bluetooth-PDA-Sync”
    [1] “/dev/cu.Bluetooth-PDA-Sync”
    [2] “/dev/tty.Bluetooth-Modem”
    [3] “/dev/cu.Bluetooth-Modem”
    [4] “/dev/tty.usbmodemfa1311”
    [5] “/dev/cu.usbmodemfa1311”

  • jeffekind

    Where can i find the download???? plz help me!

  • Demece

    Please input link for the right Arduino and Processing (1.5.1) sketches – Github does not have the right ones for Mac. Please???

  • Brian De Guire

    When i hit go on the processing it says that it cant find a class or type named “Normalize” if anyone could tell me what to do that would be great.

    • Newermore

      Have you installed drivers for arduino ? Because this seems as no program is in it.

      • Brian De Guire

        I tried to do so but it wouldn’t let me. I have a macbook and it says that the driver is from the internet and that it won’t open it unless it is from the app store. any suggestions?

        • Newermore

          I have finished this project on windows 7 so im afraid that i cant help you with this. But i have found this video guide that might help you.

          • Brian De Guire

            thx for your help.

  • Pingback: Hard Copy World | A Touchless 3D Tracking Interface()

  • Where are the links for the sketches? I see what looks like should be Links in step 5 but they are not click enabled. Is there another way I can receive them?

  • Sketches are at:

    I’ve got this built. I have the right serial port selected in the TicTacToe3D sketch, I changed the mains constant in the arduino sketch to 60. In an attempt to ensure proper ground, I have a DC adapter plugged into the board.

    I’ve checked resistance through the whole system with a multimeter to ensure I don’t have a bad connection, including touching the foil.

    The only output I get from reading the serial port is always 0 0 0. Maybe I don’t have the right port? Seems strange. It is the 1.5.1 version of processing. The Arduino board is working according to the blinking_LED sketch. I’ve even loaded the empty setup and loop sketch to ensure things are cleared out, and then put the 3d interface back in.

    I’ve also ensured my com port (COM5) is set to 115200 speed.

  • daniel

    are you running the processing app in android or java mode?

  • Kevin

    How can i know in which position my hand is, to transmit that position to an transmiter RF?
    For example: for each position of the hand it makes a different action like turning on a led in 3x3x3 cube full of leds.

  • What’s your opinion on making this project life size, and making the box 5 feet by 5 feet by 5 feet. Would it be posssible?

  • Daniel

    for some reason every time i try to run the sketch on my mac it just stays in one position but when i run it from windows it runs perfectly, any idea why?

  • juan

    Hi, when I try to run the processing sketch I get this message: “The function readStringUntil(char) does not exist”. that function is in the next line of code “String cur = serial.readStringUntil(‘n’);”. I asume that such function should be in the serial library but i don´t know what the problem is. I need your help plis.

    • chos

      You need to use processing 1.5
      that command has change in the latest edition

  • Pingback: Weekend Projects HOA – Touchless 3D Tracking Interface Live Today at 3:30pm PT/6:30pm ET | MAKE()

  • rami

    Hi all,
    I’m testing this with just one panel and using the test program (_3DInterface)
    if I’m shorting pin 8+9+10 it’s working but reports three outputs,I would like just one output and that pins 9 and 10 (on the arduino) will be disconnected.
    tried changing line for(inti=8;i<11;i++) pinmode(i,input), to for(inti=8;i<9;i++) pinmode(i,input)
    but it didn't work, each time i remove the short line between pins 8+9+10 the output stops.

    Please advise

  • Pingback: Il futuro ... | Th3graphicsTh3graphics()

  • Oscar Espinosa

    Hi, Im interesting in the proyect that you did, I want to try it, but I don’t know the order of the Processing programs, if you can help me I will appreciate :)

    Oscar Espinosa

    • Hello Oscar, all that you need to do is put the three different programs in three different processing tabs, and run the 3d tic tac toe program and they should work.

      Good luck.

  • Đỗ Minh Quốc

    Hi It looks very interesting, I would to build my own program like this, I want to know how you read the signal data, did you use ADC pin? And how to determine the position in 3D?
    Hope you help me answer these above question.
    Minh Quoc

    • Đỗ Minh Quốc

      You use like the capture feature and measure the time to get the rising edge or falling edge signal to determine the position, is this right?

      • Jahaal Mordeth

        Check out the code. Essentially he does the following (not exactly but here’s the gist):

        pinMode(pin, OUTPUT);
        digitalWrite(pin, 0);
        pinMode(pin, INPUT);
        unsigned long init = micros();
        while(digitalRead(pin) == 0){}
        unsigned long end = micros();
        Serial.print(end – init);

        Put that code into your void start(){} method. Make sure you connect the wires properly and choose a value for “pin” (you’re using the GPIO pins. 8, 9, and 10 are good bets). Connect a capacitor to the piece of the schematic that is supposed to go to the plate. Connect the ground lead to the ground pin on your Arduino. The serial monitor should then display how long it took for this capacitor to charge. He’s essentially doing this repeatedly.

  • Farid Lopez

    Hello, I am running MacBook Pro (2013) OS X Mountain Lion. I pull up the sketches for Normalize and MomentumAverage just fine but the TicTacToe3D will not run. Processing returns an error message “Can not find class or type Normalize” (it also highlights the line where a call to the Normalize sketch is. I comment out this line and the calls to the other sketches return the same error message, any ideas why?

  • chetan mistry

    hey i want to use this touch less interface as my project topic. but i want some application that i can build using this. as it is a one year project please suggest me some topics in which i can use 3d interface

  • Evan Greally

    Hi I was just wondering would it be possible to send this data to Pure Data

  • Adrian Santillan

    it says “Cannot find a class or type called “Normalize” and some else in the forums said something about three programs, isn’t processing and arduino the only ones?

  • Guest

    Hi I have been working on a code that i took from the internet and I have been getting this same error ” ArrayOutOfBoundsException” no matter what COM port I change to. Please help me I have been stuck of this problem for weeks.Anyone?
    import processing.serial.*;
    import processing.opengl.*;

    Serial serial;
    int serialPort = 1; // << Set this to be the serial port of your Arduino – ie if you have 3 ports : COM1, COM2, COM3
    // and your Arduino is on COM2 you should set this to '1' – since the array is 0 based

    int sen = 3; // sensors
    int div = 3; // board sub divisions

    Normalize n[] = new Normalize[sen];
    MomentumAverage cama[] = new MomentumAverage[sen];
    MomentumAverage axyz[] = new MomentumAverage[sen];
    float[] nxyz = new float[sen];
    int[] ixyz = new int[sen];

    float w = 256; // board size
    boolean[] flip = {
    false, true, false};

    int player = 0;
    boolean moves[][][][];

    PFont font;

    void setup() {
    size(800, 600, OPENGL);

    font = loadFont("TrebuchetMS-Italic-20.vlw");

    serial = new Serial(this, Serial.list()[serialPort], 115200);

    for(int i = 0; i < sen; i++) {
    n[i] = new Normalize();
    cama[i] = new MomentumAverage(.01);
    axyz[i] = new MomentumAverage(.15);


    void draw() {

    void updateSerial() {
    String cur = serial.readStringUntil('n');
    if(cur != null) {
    String[] parts = split(cur, " ");
    if(parts.length == sen ) {
    float[] xyz = new float[sen];
    for(int i = 0; i < sen; i++)
    xyz[i] = float(parts[i]);

    if(mousePressed && mouseButton == LEFT)
    for(int i = 0; i < sen; i++)

    nxyz = new float[sen];
    for(int i = 0; i < sen; i++) {
    float raw = n[i].choose(xyz[i]);
    nxyz[i] = flip[i] ? 1 – raw : raw;
    ixyz[i] = getPosition(axyz[i].avg);

    float cutoff = .2;
    int getPosition(float x) {
    if(div == 3) {
    if(x < cutoff)
    return 0;
    if(x < 1 – cutoff)
    return 1;
    return 2;
    else {
    return x == 1 ? div – 1 : (int) x * div;

    void drawBoard() {

    float h = w / 2;
    h + (cama[0].avg – cama[2].avg) * h,
    h + (cama[1].avg – 1) * height / 2,
    w * 2,
    h, h, h,
    0, 1, 0);


    // Due to a currently unresolved issue with Processing 2.0.3 and OpenGL depth sorting,
    // we can't fill the large box without hiding the rest of the boxes in the scene.
    // We'll use a stroke for this one instead.
    stroke(0, 40);
    translate(w/2, w/2, w/2);

    float sw = w / div;
    translate(h, sw / 2, 0);

    float sd = sw * (div – 1);
    axyz[0].avg * sd,
    axyz[1].avg * sd,
    axyz[2].avg * sd);
    fill(255, 160, 0, 200);

    for(int z = 0; z < div; z++) {
    for(int y = 0; y < div; y++) {
    for(int x = 0; x < div; x++) {
    translate(x * sw, y * sw, z * sw);

    fill(255, 0, 0, 200); // transparent red
    else if(moves[1][x][y][z])
    fill(0, 0, 255, 200); // transparent blue
    else if(
    x == ixyz[0] &&
    y == ixyz[1] &&
    z == ixyz[2])
    if(player == 0)
    fill(255, 0, 0, 200); // transparent red
    fill(0, 0, 255, 200); // transparent blue
    fill(0, 100); // transparent grey
    box(sw / 3);


    if(mousePressed && mouseButton == LEFT)
    msg("defining boundaries");

    void keyPressed() {
    if(key == TAB) {
    moves[player][ixyz[0]][ixyz[1]][ixyz[2]] = true;
    player = player == 0 ? 1 : 0;

    void mousePressed() {
    if(mouseButton == RIGHT)

    void reset() {
    moves = new boolean[2][div][div][div];
    for(int i = 0; i < sen; i++) {

    void msg(String msg) {
    //using 'text(msg, 10, height – 10)' results in an exception being thrown in Processing 2.0.3 on OSX
    //we're going to use the console to output instead.

    • Garrett Davidson

      I had the same problem at first. I realized that even though my port was listed as COM3, I only had one port set up on my computer. Thus, I changed the serialPort to 0 and everything worked fine.

      Hope this helps somebody.

    • Mohammad Zaheer Hasan

      It might be that you have the arduino using the same port as processing. Disconnect your arduino and close the software, connect your usb cable, turn on the arduino software and load your sketch. Then close out of the software and open processing (keep usb plugged in). In the 5th line where it says serial = 1, try changing it from 0 to 3 and see which works. Anything else will come as out of bounds. That’s how it worked for me. I hope it helps.

  • Ocker Olivier

    Why am I getting the error? The nested type MomentumAverage cannot hide an enclosing type?

  • daivya

    hey,I’m like to do the project you did. Can i know the purpose of this project??

  • Jennifer

    I Can’t seem to get this to work. The coordinates sent are just 0 0 0. Is anyone else having this issue?

    • Jahaal Mordeth

      Yeah I’m having that issue as well. Did you ever find a fix?

      • Søren Andreasen

        it seems extremely shaky here as well… getting 0 0 and then some large random number for the last coordinate

        • Mohammad Zaheer Hasan

          I had the same problem. Turns out I connected the resistors wrong and inserted the 5 volts at the wrong spot too. After fixing the configuration it worked.

    • Mohammad Zaheer Hasan

      That means the cables aren’t configured correctly. Check that everything is connected as shown in the instructions.

  • Pingback: Electonic stuff. | computothought()

  • Zoom

    Hey where can i download the code ?

    • Mohammad Zaheer Hasan

      Step 5, first bullet point; there’s a link.

  • Lysia

    Hi I am trying to make this project . A newbie to Arduino and coding .

    I don’t get it , which code should I use ? Just 3DInterface.ino ?
    And why do they have a 3d tic tac toe code too ?

    • Sumit

      u need to upload the 3D interface code into Arduino. Then run the processing app and open the 3d Tic TacToe code in that.

  • Yuri Kravchik

    You can use simpler and cheaper way to get better results

  • Giulio Ammendola

    doesn’t work. the serial is sending 0 0 0 values hence processiong is doing nothing. any fix?

    • Mohammad Zaheer Hasan

      The cable isn’t configured right then. Use a multimeter to check if there is a connection from the aluminium plates to the end of the signal wire. Then check that you hooked up the resistors and shield correctly. I had the same issue with the first 2 columns. I realized my connection was wrong and after fixing that it worked.

  • rama krishna

    plz help me solve the java.runtime.exeption ….which i have faced while running the processing sketch of 3d interface…….

    • Malvino

      Hello rama krishna .i got the same problem.can u help?
      can u tell me wat u did to remove this error??

      • Mohammad Zaheer Hasan

        Look above.

    • Mohammad Zaheer Hasan

      You likely have 1 COM port and this is set to look at your 2nd. Go to line 5 and change the serial = 1 to serial = 0.

  • Mihai Gînța

    This is a complete bullhist, you cannot measure the charge/discharge time as long as the 5V pin is always on (and it is)

    • Søren Andreasen

      I had zero reaction at all until I removed the 5v connection on the shields… what’s up with that?

  • Pingback: Best of 2012: Weekend Projects - Make: | Make:()

  • Schaune Hannibal

    Hi, a group of us are trying to build the touchless 3D tracking interface. Its a very cool project that we are trying to get done for a school project. We ran into the problem where we were only getting a white screen for the process part but we got that resolved. Now it showing the image of the tic tac toe with the squares and the ball but the ball is stuck at the back corner when we run the process program trying to calibrate it. We saw that some other people have had this problem but I haven’t seen any post how they have got this resolved. Can some please inform me as to what we can do to solve this please.

    • Adam White

      did you ever find a solution? I am having the same problem.

      • Sumit

        same here…
        did u get any fix???

        • Mohammad Zaheer Hasan

          See my comment above.

      • Mohammad Zaheer Hasan

        Look at my comment above.

    • Mohammad Zaheer Hasan

      It’s likely that the cables aren’t configured correctly. After loading the Arduino sketch, open the serial monitor (Ctrl+Shift+M). Change to 115200 baud. You should see 3 lines of serial data flowing. I initially had 2 columns of zeros and the 3rd column with data. In processing my ball was stuck to one side. I realized I made a mistake in connecting the resistors and fixed it. Then I got a flow of data in all 3 columns. I went into processing and now it works!

  • Malvino

    hi i have been working on this experiment. it is awesome.but i can run the processing tictactoe3d.i am getting this error.can anyone help me,please?

    • Mohammad Zaheer Hasan

      What are the steps you took? Try reading some of the new comments. I made some suggestions there.

  • so nice admin your site is so good and all of the data is organized in a well way i really appreciate you. so thanks. well done keep it up…thanks admin again for such a nice info.keep up
    avira crack

  • Alex


    Congratulations! Is a great project!

    I have a question about it:

    I would like to use it to track my hand in labview. The software gives the X,Y,Z values of the position?

  • Frank’s Desig’Nature

    can someone tell me what roll does the shield wires plays in this? seem unnecessary as it is not being connected from one end

    • Mohammad Zaheer Hasan

      One role it plays is that it protects the the circuit from other RF interference. It says in the instructions that connecting it to 5 volts also minimizes the cable’s antenna effect.

  • Søül

    I am getting error in the processing software keeps showing me this.

    Error :– “type string[] of the last argument to method println(object….) doesn’t exactly match the vararg parameter type. cast to object[] to confirm the non-varargs invocation, or pass individual arguments of type object for a varargs invocation.’
    I am just new to processing software. So, i dont know much about it.

    Can plz anyone help ??

    • Aakash Jaiswal

      I am also getting the same error.
      Could you please tell me how to remove this error.

      • Søül

        The code is completely perfect. The problem is with the com ports of the pc/laptop.
        As for all pc/laptop or due to different brands. So u just have to just know which com work for u.
        Connect ur arduino to ur pc or laptop then go to TicTacToe3D.pde.
        In that go to 4th line that is “int serialPort = 1” change that 1 to any value from 0 to 4.
        For me com 0 worked. Hope this will help.

        • Aakash Jaiswal

          Thanks for the help. My code is now working fine. I changed the value to 0 and used Processing 2.2.1 instead of Processing 3.0b3.

          • Søül

            Ur welcome.

  • Pingback: Control 3D visuals touchless with Arduino | Linux: music, rt-kernel, and microcontrollers()

  • alok b

    which is the shield wire & signal wires in shielded wire?? also i cut out an old laptop charger wire will it work? i can see a red & a white wire, which do i use as signal wire & shield wire?

  • محمد صلاح الدين

    What wronge with this please help me

    • Mohammad Zaheer Hasan

      It says your COM port is busy. You might be doing something else on it. Try reloading the code. Disconnect and close all the software. Connect and upload the arduino sketch, keep the usb connected and exit the software. Open processing and try now. If it doesn’t work and you get a different error message and the new screen is just stuck, you may have the wrong COM port, so go to line 5 and change serial = 1 to a number from 0 to 3 until one works. That should do it.

  • Ganesh Hosur

    i dont get any results when i move my hand into the x,y,z axes boards. But when i take my hand closer to the arduino board the the serial monitor shows up some readings and the cube moves only till it reaches the center.


    hey i am working on this project… will someone give me code for 3-D tic tac toe plzz

  • Abel Ramos

    Can you do with the tights?

  • Harshit

    The code for prpcessing sketch given in the link above is showing errors. My operating systemis windows 10. can anybody fix this for me please

    • Mohammad Zaheer Hasan

      What kind of errors are you seeing? Did you exit the arduino software before starting Processing? You might also have to change the serial port in the 5th line in Processing. Try numbers from 0 to 3.

  • arjun

    where is the codes for this project

    • Mohammad Zaheer Hasan

      Look at step 5. It links to their github. Download as a zip file from there.

  • Prayag Agrawal

    from where can I get the code…
    please help me

    • Mohammad Zaheer Hasan

      Go to Step 5, first bullet point; there’s a link.

  • Wu Ziyou

    Hi, I’m really interested in your project, but the recognition of the position of my hand is not very accurate.There are always points jumping in the screen. Can you give us some tips or improvements for the device?

  • Nadav

    Hi, I want to build this project for class… but I don’t have the shielded cable as shown and I was wandering if it is really necessary and if it would make any difference if I would just use a normal jumper?
    This project is for tomorrow so I really need an answer!
    Thank You.