2690932438_0be84a1759.jpg
Make a 3D interface using an six resistors, aluminum foil, and an Arduino. Take that, Wii.

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 adsRemove these ads by Signing Up

Step 1: Materials

2690918640_257b724fba.jpg
2690118127_ae3d9c2d2c.jpg

Tools

Materials

  • (3) 270k resistors
  • (3) 10k resistors
  • Solder
  • Wire
  • Aluminum foil
  • Cardboard

Optional:

  • 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
1-40 of 221Next »
schmitta says: May 17, 2013. 12:23 AM
The shielded cable/ center conductor is the capacitor. The foil just takes away current from the shield capacitor. The hand forms a capacitor with the body being ground and current flows from the foil to the hand electrostatically robbing current from the shield capacitor's center conductor. The center conductor is first grounded through the 10k resistor when the logic zero is written to that port. Then when the port is made an input it is at a high impedance (cmos) and little current flows through the 10k to the port. The shield is at 5 volts. The center conductor of the shielded cable is at ground and charges through the 270k resistor until it reaches 2/3 of Vcc. Then a logic 1 is triggered. The foil is passing current to the hand and robbing current from the center conductor causing a longer time until the 2/3 Vcc is reached. The closer the hand is to the foil the higher the capacitance value of the hand/foil capacitor and the more current is robbed from the charging center conductor extending the charge time of the center conductor. Alvin....
fanak says: May 6, 2013. 3:03 PM
An interesting application would be to make this as a controller for a mechanical arm
NehadTabl says: May 1, 2013. 7:44 AM
Hi Kylem!!

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?
hornedCapybara says: Apr 23, 2013. 4:24 PM
Hi,
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!
Newermore says: Apr 20, 2013. 12:46 AM
Hi kylemcdonald. Firstly I want to say how much this project interests me, so I want to make it by myself and use it as a school project to show possibilities of Arduino. But I'm not so good at programming and do not understand whole program, that you have made for the Arduino. Can you please e-mail me to kasanickyfilip@gmail.com what program does step by step? I will be very grateful.

#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;
}

mindlelle says: Apr 17, 2013. 10:07 AM
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~
cantona says: Apr 4, 2013. 11:27 AM
Any ideas on how to make this emulate a mouse using the Arduino leonardo ?
Thaimicrosystem says: Mar 23, 2013. 12:36 PM
Great
CrimzonKing says: Mar 19, 2013. 6:21 PM
Hey I believe I've done everything in the instructions right. I built it all correct, there's no shorts. I've uploaded the _3DInterface into the Arduino. When i try to use the TicTacToe it only comes up with a whit screen and an error (ArrayIndexOutOfBoundsException: 1). It highlights a part of the script
serial = new Serial(this, Serial.list()[serialPort], 115200);
Please help =) thank you!!
CrimzonKing says: Mar 19, 2013. 9:52 PM
Hahaha yes i got it to work, i had to change there serial number at the top to zero. since my arduino is in com 5
CrimzonKing says: Mar 19, 2013. 9:14 PM
Exception in thread "Animation Thread" java.lang.ArrayIndexOutOfBoundsException: 1
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
TomB22 says: Mar 15, 2013. 4:54 AM
Hi
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!
The nerdling says: Dec 29, 2012. 3:07 AM
i only get a white screen nothing shows up, i get stuff through the serial port though
The nerdling says: Dec 29, 2012. 3:08 AM
i am using processing 2.0b3
hilukasz says: Jan 28, 2013. 7:00 PM
throw up a gist of what you entered for the code.
The nerdling says: Feb 16, 2013. 2:58 PM
https://github.com/Make-Magazine/3DInterface

its exactly the same
The nerdling says: Dec 29, 2012. 2:30 AM
how could i use an arduino leonardo to make this into a mouse?
royshearer says: Dec 21, 2012. 4:37 AM
Does the serial port numbering array work in the same way in mac OSX?
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?
royshearer says: Dec 21, 2012. 4:58 AM
I switched to the earlier v1.5 of Processing and that seemed to fix my problem. Greta fun now!
royshearer says: Dec 21, 2012. 4:58 AM
I can use either [0] or [1] as serial port variables
TheGreatS says: Dec 19, 2012. 4:53 PM
All I'm getting the the serial window is gibberish symbols like ÿ, ñ, and ö. It looks like all the electronics are checking out, no short circuits and everything is where it should be. What can I do?
TheGreatS says: Dec 19, 2012. 5:07 PM
oops, made the same mistake as arovira bosh, its working now! SO AWESOME!
arovira bosch says: Dec 18, 2012. 9:53 AM
Ops sorry I changed my serial monitor to 115200 and I think that now it's working because appears 3 columns with numbers arround 6000 changing when i put my hand in the cube. But i'm still with the other software problem. Thank you!
arovira bosch says: Dec 18, 2012. 9:02 AM
Hi!

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!
tespi says: Dec 5, 2012. 6:14 AM
HI,


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!
kylemcdonald (author) says: Dec 10, 2012. 4:02 PM
the binary number is a bit mask, it controls which pin is tested. i don't remember what the exact corresponding arduino pin would be, but you generally have things set up correctly. if the sixth one isn't working, you might need to dig deeper into the relationship between the low level PINB constant and the bit masks. sorry i can't provide any more details, i haven't worked on this in a while :) you might get more help by checking out the more up-to-date tutorial i mention on the first page.
simmel65 says: Nov 24, 2012. 12:34 AM
Just built this. When I look at at the Arduino IDE serial monitor it shows all 0's. When I use a multimeter I can go from any plate to any pin. Seems wrong, but not sure. The foil is not touching, btw. Any ideas?
mashcon5 says: Oct 13, 2012. 2:13 PM
When i try to run the program, I keep getting an error message that says my font cannot be found. Any suggestions?
kylemcdonald (author) says: Oct 14, 2012. 10:46 AM
it just means the font is missing or can't be parsed. try using createFont instead of loadFont. read the processing documentation for more info http://processing.org/reference and try asking on the processing forums if you have more questions
phammer says: Sep 10, 2012. 9:45 AM
Hi I have got the thing up and running with the problem that when running the processor the gray box appears instead of the cubes and when I move my hand the grey box moves with my hand instead. Any solution for this?
satar says: Aug 24, 2012. 11:46 PM
hi kylem

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 ???
kylemcdonald (author) says: Aug 25, 2012. 12:31 PM
unfortunately, i'm not sure what's wrong from your description.

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
avillanueva1 says: May 20, 2011. 5:10 PM
I had problems with the code, the processing tell me that i have an error ArrayIndexOutOfBoundsException 2, am i doing something wrong?
jimmy dean says: Jun 11, 2011. 8:47 AM
I am also getting the same error. It is pointing to this line in setup:

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

Has anyone solved this yet?
jimmy dean says: Jun 11, 2011. 9:11 AM
Ok, I figured it out.

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 :)
Account1212 says: May 21, 2012. 11:07 PM
Hey, i know it's been awhile, but i am having a related issue, and i thought you might know how to fix it. See i switched the variable to 0, and it works, but 0 is for com1, and my arduino is plugged into com3. Com3 is 1, but whenever i change the variable to 1, the code doesn't run.
TopherT1 says: Aug 11, 2012. 3:45 PM
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. In your case COM3 is "2".
TheHammer827 says: Aug 11, 2012. 2:46 PM
Is it possible to use this to search the internet?
kelseymh says: Aug 10, 2012. 10:13 AM
This project has been implemented (with credit to you), on Make:Projects.
jonRomero says: Feb 5, 2012. 1:13 AM
i just finished building the circuit and made sure nothing short circuited, but nothing is changing even when i press the Space button. The arduino code is fine and the Processing code too is good to go. However The only warning message i get is


WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2
[0] "COM3"

Does anyone know how to fix the RXTX Version mismatch ???
1-40 of 221Next »
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!