Introduction: DIY 3D Controller

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.

Step 1: 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

Step 2: Make the Plates

This sensor will work using simple RC circuits, with each circuit sensing distance in one dimension. I found that the easiest way to arrange three capacitive plates for this purpose is in the corner of a cube. I cut the corner of a cardboard box into an 8.5" cube, and then cut some aluminum foil to fit as slightly smaller squares. Tape on the corners keeps them in place.

Don't tape down the entire perimeter, we'll need it later for attaching the alligator clips.

Step 3: Make the Connectors

To connect the Arduino to the plates we need some shielded wire. If the wire isn't shielded, the wires themselves act more obviously as part of the capacitor. Also, I've found that alligator clips make it really easy to connect things to aluminum -- but there are probably plenty of other ways, too.

  • Cut three equal lengths of shielded cable. I chose about 12". The shorter the better. Coaxial cable works, but the lighter/more flexible the better.
  • Strip the last half inch or so to reveal the shielding, and the last quarter inch to reveal the wire.
  • Twist the alligator clips to the wires onto the wires and solder them together.
  • Add some heat shrink tubing or hot glue to keep things together.

Step 4: Make the Circuit

The "circuit" is just two resistors per piece of aluminum. To understand why they're there, it helps to know what we're doing with the Arduino. What we'll do with each pin, sequentially, is:

  • Set the pin to output mode.
  • Write a digital "low" to the pin. This means both sides of the capacitor are grounded and it will discharge.
  • Set the pin to input mode.
  • Count how much time it takes for the capacitor to charge by waiting for the pin to go "high". This depends on the values for the capacitor and the two resistors. Since the resistors are fixed, a change in capacitance will be measurable. The distance from ground (your hand) will be the primary variable contributing to the capacitance.

The 270k resistors provide the voltage to charge the capacitors. The smaller the value, the faster they'll charge. The 10k resistors affect the timing as well, but I don't completely understand their role.

We'll make this circuit at the base of each wire.

  • Solder the 10k resistor to the end of the wire opposite the alligator clip
  • Solder the 270k resistor between the shield and the wire (plate). We'll shield the wire with the same 5 V we use to charge the capacitors

Step 5: Finish and Attach the Connector

Once the 3 connectors are finished, you might want to add heat shrink tubing or hot glue to insulate them from each other, because you'll be soldering the shielding/5 V points together.

For me, it was easiest to solder the two outermost connectors together and then add the third.

Once you've soldered the three connectors, add a fourth wire for supplying the shield/5 V.

Step 6: Connect and Upload Code

  • Plug the connector into the Arduino (pins 8, 9 and 10)
  • Snap the alligator clips onto the plates (8:x:left, 9:y:bottom, 10:z:right)
  • Provide power by plugging the fourth wire (my red wire) into the Arduino's 5 V
  • Plug in the Arduino, start up the Arduino environment
  • Upload the code to the board (note: if you are outside North America, you will probably need to change #define mains to 50 instead of 60).
The Arduino code is attached as Interface3D.ino and the Processing code is attached as

Step 7: Do Something Cool!

If you look at the serial window in the Arduino environment, you'll notice it's spitting out raw 3D coordinates at 115200 baud, at approximately 10 Hz = 60Hz / (2 full cycles * 3 sensors). The code takes measurements as many times as possible on each sensor over the period of two cycles of the mains power frequency (which is suprisingly stable) in order to cancel out any coupling.

The first thing I did with this was make a simple 3D Tic Tac Toe Interface. If you want to start with a working demo, the code is available here, just drop the folder "TicTacToe3D" in your Processing sketches folder.

Three helpful things that the Tic Tac Toe code demonstrates:

  • Linearizes the raw data. The charge time actually follows a power law relative to distance, so you have to take the square root of one over the time (i.e., distance ~= sqrt(1/time))
  • Normalizes the data. When you start up the sketch, hold the left mouse button down while moving your hand around to define the boundaries of the space you want to work with.
  • Adding "momentum" to the data to smooth out any jitters.

In practice, using this setup with aluminum foil I can get a range of the largest dimension of foil (the biggest piece I've tested is 1.5 square feet).

Step 8: Variations and Notes


  • Build massive sensors
  • Optimize the resistors and code for things that vibrate quickly, and use it as a pickup/microphone
  • There are probably other tricks for decoupling the system from AC hum (a huge capacitor beteween the plates and the ground?)
  • I've experimented with shielding the plates on the bottom, but it only seems to cause problems
  • Make an RGB or HSB color picker
  • Control video or music parameters; sequence a beat or melody
  • Large, slightly bent surface with multiple plates + a projector = "Minority Report" interface


The Arduino playground has two articles on capacitive touch sensing (CapSense and CapacitiveSensor). In the end, I went with an inversion of a design I stumbled across in a friend's copy of "Physical Computing" (Sullivan/Igoe) describing how to use RCtime (the circuit had the capacitor and one resistor fixed, and measured the valueof a potentiometer).

The microsecond timing was accomplished using some slightly optimized code from the Arduino forums.

Again: just from starting at tons of theremin schematics I don't completely understand, I'm well aware there are better ways to do capacitive distance sensing, but I wanted to make something as simple as possible that's still functional. If you have an equally simple and functional design, post it in the comments!

Thanks to Dane Kouttron for tolerating all my basic electronics questions and helping me understand how a simple heterodyne theremin circuit works (originally, I was going to use these -- and, if tuned correctly, it would probably be more accurate).


PrasadM11 made it!(author)2017-01-05

I completed this project. I also made some additional programs with this same setup like a musical instrument, hand controlled 3D camera, drawboard (which recognizes touch input).
Most importantly I was able to register touch using this same setup.So, it acted like a motion and touch tracking interface. One advice to people attempting to make this please add an extra ground plate as shown in the image and use this place during calibration only it helps improve accuracy.
Check out the code and explanation at:

Cardboard Cube.jpgDRAWBOARD.pngIMG_20160304_143449.jpgUFO Game.png
SrinivasP25 made it!(author)2017-02-20

to which pin have you connected the ground plate to..

ultra2301 made it!(author)2017-02-14

In arduino serial port I am always getting only 0 0 0 values even after moving my hands, Does it mean that connections are faulty or some other problem.


I used your code and little bit of schematics for my project of theremin on arduino

%E5%87%B1%E6%96%87%E9%84%AD made it!(author)2015-02-04

Hey guys,

I used this awesome system making something fun which is a abduction game of sucking people by UFO. You can move your hand to control the UFO position.

Here is project's github. Enjoy it!:

Screen Shot 2015-02-05 at 3.11.31 PM.png
PrasadM11 made it!(author)2017-01-05

I used your code of UFO game in my project. Thanks and keep up the good work.

adjectives made it!(author)2016-10-15

That's sweet.

Hesgoy made it!(author)2016-07-30

Sir, I have an error " sensors cannot be resolved to a variable" wat to do to clear this error

venkatesh111 made it!(author)2016-05-12

sir the link you have provided for the code is not opening. can you plz provide me the code to the mail

MdZaheerHasan made it!(author)2016-07-01

The .ino file? If you're not opening with the arduino software have you tried opening with a text editor like Notepad or Wordpad? That should also show you the code.

MdZaheerHasan made it!(author)2016-06-30

The link for make magazine wasn't working. I think this is what you meant to link:

SrivishnuT made it!(author)2016-03-26

I made it but the pressing sct\etch does not move the ball, i see the cubes but not the ball

blah1 2.jpeg
MohamadN5 made it!(author)2015-10-01

i did it

but the machine didn't show me my hand position

what's wrong ?

show the picture i added,,,

SrivishnuT made it!(author)2016-03-26

I have the same problem too

smartmiltoys made it!(author)2015-02-25

Nothing will EVER be better than the keyboard and mouse. Nobody wants to
hold their arms out for minutes at a time. Nobody who actually does
anything productive on their computer, that is.

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

Sorry, were you looking for a better-engineered mouse, or were you looking for a neat, feasible, applicable project and demonstration of physics and electrical engineering at work?
Don't knock cool projects just because they are not good for daily use.

rami2013 made it!(author)2013-12-30

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

PetraC6 made it!(author)2016-02-02

You have 3 Serial.print instructions, which print data from all 3 pins.

You should replace this code from the loop function:

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

With this code:

Serial.println(time(8, B00000001), DEC);
soeren made it!(author)2015-10-21

Hi, I'm trying to downscale this to a 2D module (X and Y), but simply removing the third pin from the code everywhere - doesn't seem to work. It just sends out 0 0 from the arduino. Do you have any advice on how to do this? That would be much appreciated. Thank you. Regards, Søren

VirajT made it!(author)2015-09-03

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

do i need to connect arduino while runing processing software??

This is my 1st time working on processing software.

thut6 made it!(author)2015-09-03

hey this is cool !
but can this DIY 3D Controller work with android phone?

DangerousTim made it!(author)2014-08-15

why don't you use the capsense library? It's quite good, and you'll need only one resistor per foil...

SIM-Tech made it!(author)2015-08-26

the extra R is for just incase shock go back to Receive pin it will bring voltage down, cap library ur talking about uses one becasuse is a smmall foil

firobug made it!(author)2014-12-26

could you improve this size by additional pannels... you said something about the largest you being able to do was only a foot or so and i think that may be just because of the limits of the capacsitance of the aluminum if we add say another set of say 9 panels could we make this a 2 foot cube and better yet could it be extended by using strips i could glue to my walls and ceiling to give me a full 3d cube to interact in...maybe add streamers to get me a 3d display with projectors.....

SIM-Tech made it!(author)2015-08-26


SIM-Tech made it!(author)2015-08-26

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

5 add second jumper.PNG
skern1 made it!(author)2015-06-18

the processing software keeps showing errors ArrayIndexOutOfBoundsException:

AniketS3 made it!(author)2015-06-13

Can you please explain the math in the code? I want to use this a bit differently, it will be a great help! Thanks! And thumbs up for the project!

iltabhai made it!(author)2015-05-21

This project only works on the processing 1.5.1.

WaleedR made it!(author)2015-05-11

ArrayIndexOutOfBoundsException: 2 is the error and the TicTacToe 3d is not responding.

WaleedR made it!(author)2015-05-10

hey when i upload the code in processing it says can not find anything named "sensors"

ajcracker08. made it!(author)2015-04-21

Has anyone been able to figure out the problem where the grid shows with the ball in the top back cube? It says its calibrating but nothing .

Csaub001 made it!(author)2015-01-19

When I run TicTacToe on processing I get a white screen... Processing highlights this line

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

any ideas?

vova.ziniak.9 made it!(author)2015-03-11

try to write "int serialPort = 0"

phammer made it!(author)2012-09-10

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?

czeslawniemen made it!(author)2015-01-21

It's been quite a long time since you built this, propably. But did you figuered it out? I still got the same "problem". Quite nice to move objects with this controller. But i want to fully finish this project and hammer the "I Made it!". Thanks

returner made it!(author)2014-07-01

guys i m really new to this stuff and i want to learn on how to do this... i have no idea why i cant run this program??? my tic tac toe prog shows me that its not responding every time.. help please?!

thanks in advance.

returner made it!(author)2014-07-01

i changed my serial port to 0, "int serialPort =0;" , and sensor to sen and i still cant get it to run. help anyone?

imaginei made it!(author)2015-01-07

did u ever get this to work? i have the same problem.

firobug made it!(author)2014-12-27

could you improve this size by additional pannels... you said something about the largest you being able to do was only a foot or so and i think that may be just because of the limits of the capacsitance of the aluminum if we add say another set of say 9 panels could we make this a 2 foot cube and better yet could it be extended by using strips i could glue to my walls and ceiling to give me a full 3d cube to interact in...maybe add streamers to get me a 3d display with projectors.....

devansh.agrawal.5 made it!(author)2014-12-14

I cant seem to get it to work :(

The sketch runs and in Processor i can see that it says "defining boundaries" whenever I left mouse click

But nothing after that!


(I am using Make:'s code btw)

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

Awesome project! I love it

JenniferG2 made it!(author)2014-10-06

I followed the Make instructions that used 220K resistors and if I watch the Serial Monitor, all I get are 0 0 0. Is anyone else having this problem? I'm not sure if the resistors are the problem or something else.

RobertGoldring made it!(author)2014-08-20

i'm still unsure what this is, can some one explain please?

anandsd made it!(author)2014-06-26

sir can u pls send me the tit tac toe code to this email:

i have made the senser cube and finished the connection but i dont have the program.

XYZAidan made it!(author)2014-05-31

When I run the processing program, the window is brought up. It has the cubes and the sphere, but the sphere is in the upper back cube, and my hand doesn't affect it, even if I calibrate. Anyone have a solution?

rgreen10 made it!(author)2014-06-24

Did you ever get it figured out? I am having the same problem.

Ramzeez100 made it!(author)2014-02-04

Hi, I realize this comment may be a bit late, but I'm a bit new to Arduino and I was trying to get this to work. I'm using an Arduino Uno, which Make Magazine used, and I fixed the processing code and got everything uploaded and running. When I run the TicTacToe3D program from processing I am able to see the grey cubes and the red ball, but when I place my hand in while left click holding the window, nothing happens except for the program saying "defining boundaries". Any help?

mwezel made it!(author)2014-04-21

look to the video

rgreen10 made it!(author)2014-06-24

If their problem is the same as mine, the video's instructions do not work. The "defining boundaries" message shows up, yet the ball never moves.

About This Instructable




More by kylemcdonald:Structured Light 3D ScanningNandhopper 1-Bit Noise SynthLo-fi Arduino Guitar Pedal
Add instructable to: