Update: a much more thorough explanation of this project is available from Make Magazine. It might be easier to follow their instructions, and I think their code is more up to date.
The basic goal here was to make a 3D hand-position sensing system that most people can build, while still preserving some semblance of functionality. To get an idea of possible applications, check out the demo video. If you think you can build one that is simpler and equally accurate, or slightly more complex and more accurate, share in the comments!
DIY 3D Interface: Tic Tac Toe from Kyle McDonald on Vimeo.
Remove these ads by
Signing UpStep 1: Materials
Tools
- Arduino
- Processing
- Wire cutters
- Soldering iron
- Box cutter
Materials
- (3) 270k resistors
- (3) 10k resistors
- Solder
- Wire
- Aluminum foil
- Cardboard
- Tape (e.g.: scotch)
- Shielded wire (e.g.: coaxial cable, ~3')
- (3) alligator clips
- 3-pin header
- Zip-tie
- Shrink wrap tubing or hot glue













































Visit Our Store »
Go Pro Today »




--------------------------------------------------
Arduino : UNO [haven't tested this with Leonardo yet]
Processing version : 1.5.1 [as a must ,
because there is a part of the code is not compatible with the newer versions , maybe if you can replace it something is ok with for newers , then newers is ok ;) ]
________________________
I done it without shielded wires , but because the wires are not shielded , a capacitance between the wires and my body is created (same as between my hand and the plates) which is already mentioned earlier by Kyle, and that will disturb the readings and make controlling the ball a little harder ( I have to keep my body away from the wires) and from there the importance of shielding is shown up (beside stopping the antenna effect as well) ;).
I have some how solved the problem and I a sure with the solution with only 38% (since I don't really know what EXACTLY was wrong with it).
What I did is
[/\]Opening the serial port and check the values coming out of Arduino
[/\]and as mentioned in the previous comment, I had only one number coming out then stops sending numbers.
[/\]then I Removed all the connections from the Arduino pins while watching the serial monitor.
[/\]Nothing changed yet , but when I tried putting a wire (one of the wires that should be connect to the Arduino I/O pins in this instructable :8,9 and 10) on one of the three pins (8,9 and 10) and then take it off fast and doing the same with same wire with the other pins , in and out , in and out .
[/\]Then I FINALLY Saw the Numbers coming out of Arduino to the Serial (maaaan , how I was happy back then) after that,when I ran processing, the ball started responding and moving(finally).
I know it might seem as if I am telling a story , but here is what I did so you can get clue to fix your situation with (My opinion is that maybe the three pins were some sort of "stuck" at the beginning).
Best of Luck :) .
To all of you who has the "Not Moving Ball" problem , I know the starting point of the debugging :
I checked the Arduino's "Serial Monitor" and I found that Arduino does send NOTHING in the serial line ( except for a number that shows up one time at the beginning)
And thats WHY (I Assume with 99%) the ball in processing Does Not Move.
So all of you (including me =3 ) start debugging from there.
GoodLuck ;).
I did everything, but the box is not moving. what’s the problem??
Can you help me please??
I made 220K ohm by two 100k series with two 10k ( behind each other) … do you think this is the problem?
I'm trying to make this work, and it isn't working.
I loaded the code to arduino, and i load the processing code and run it, and all i get is a blank white screen. Please tell me what im doing wrong!
#define resolution 8
#define mains 50 // 60: north america, japan; 50: most other places
#define refresh 2 * 1000000 / mains
void setup() {
Serial.begin(115200);
// 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);
startTimer();
}
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)
count++;
total++;
}
startTimer();
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;
}
serial = new Serial(this, Serial.list()[serialPort], 115200);
Please help =) thank you!!
at TicTacToe3D.setup(TicTacToe3D.java:57)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)
this is what it said at the bottom of the processing
I installed processing and arduino software. I upload sketch to arduino and copied Tic Tac Toe 3D to sketch folder in processing. I'm running processing and I can see window with dimensions of 7x7cm, however I don't see any any points inside the square and I'm not sure how to initialize it. Could you pls help me out? Am I missing something? Thanks a lot for any help!
its exactly the same
I have
[0] "/dev/tty.usbmodemfa131"
[1] "/dev/cu.usbmodemfa131"
[2] "/dev/tty.Bluetooth-PDA-Sync"
[3] "/dev/cu.Bluetooth-PDA-Sync"
[4] "/dev/tty.Bluetooth-Modem"
[5] "/dev/cu.Bluetooth-Modem"
from Processing.
I upload to /dev/tty.usbmodemfa131 in Arduino successfully and get good numbers out of the serial monitor there.
When I use a [0] variable for the serial port in Processing however, I get a lot of interference on the serial monitor - not gobbledygook, just weird strings of numbers if varying lengths. I just see the grey cube and nothing else happens.
When I use a [1] variable i get the following error:
RXTX Warning: Removing stale lock file. /var/lock/LK.012.018.043
gnu.io.PortInUseException: Unknown Application
and lots more.
Am I doing anything wrong?
Nice work!
I have some problems with the step 5:
I have a _3Dinterface.ino loaded in my arduino
Here if I open my serial monitor I only can see letters running
Then I open Processing program and then I open the TicTacToe3D.pde and the other 2 opens automatically. then I export my application and this creates an application with the name TicTacToe3D, when I open the app I can only see a grey screen with anything.
I'm using a Macbook pro with Mountain Lion
Can you help me please?
Thank you very much!
that's a really great example, thanks a lot!
I am trying to control 2 such controllers from one arduino, I changed interface3D.ino by adding to void loop() 3 additional lines (without really understanding, what they mean). Serial monitor now shows 5 parameteres, but the sixth one not. What does that binary number means and how could I make it work with 6 plates?
Here is the code:
void setup() {
Serial.begin(115200);
for(int i = 2; i < 14; i++) {
pinMode(i, OUTPUT);
digitalWrite(i, LOW);
}
for(int i = 8; i < 14; i++)
pinMode(i, INPUT);
startTimer();
}
void loop() {
Serial.print(time(8, B00000001), DEC);
Serial.print(" ");
Serial.print(time(9, B00000010), DEC);
Serial.print(" ");
Serial.print(time(10, B00000100), DEC);
Serial.print(" ");
Serial.print(time(11, B00001000), DEC);
Serial.print(" ");
Serial.print(time(12, B00010000), DEC);
Serial.print(" ");
Serial.println(time(13, B00100000), DEC);
}
Thanks for your answer!
it will be very kind from you if you respond me actually i have done all steps thanks god and i upload the code to arduino and i am now in calibarating step i try more than one time but no response it this may be because of iam using small aliigator clips= less contact area ???
the contact area between the clips and the plates shouldn't matter. they just need to be touching.
you might want to also check this tutorial, which is for the same system but rewritten more clearly http://makeprojects.com/Project/A-Touchless-3D-Tracking-Interface/2233
serial = new Serial(this, Serial.list()[serialPort], 115200);
Has anyone solved this yet?
If you were getting that error from the serial line, you have to make sure that the serial variable at the top is the correct serial port. If you look above the error, it should show the serial port that you are using. Mine was com4 so it showed:
[0] "COM4"
Therefore in my situation I had to change the serial variable to 0.
I also got that error randomly sometimes when I would run the program. I think that came from the board sending data before the program starts receiving it and then the program starting halfway through a line. To fix this I just made sure to hit the reset button at the same time I hit run on the processing code and it solved my problem.
Hope that helped :)