This guide describes how to build a capacitive dance pad for PC-based games like StepMania. The total cost of materials is about $25 (less if you already have some components), there are no mechanical parts involved, and the construction requires no tools whatsoever. The design has two drawbacks worth mentioning: You cannot use the pad with shoes (but you can wear socks), and you cannot trigger more than two arrows at once (no hands).
What is a capacitive sensor?
A capacitor is a device that stores energy. When power is sent to a capacitor, it takes a certain amount of time for it to charge up to the desired voltage. The amount of time it takes is a product of resistance (provided mostly by resistors), and capacitance.
As the human body is electrically conductive, it can be used as an additional capacitor by touching a piece of metal connected to the circuit. This increases the capacitance, which in turn increases the amount of time it takes to fully charge the capacitor. The difference in time can be measured to determine if the metal surface is being touched or not. The same principle used to detect steps on this pad is also used in the touchscreens of modern smartphones.
This YouTube video by SparkFun explains the concept much more clearly.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials
Almost any Arduino model should work, but if you don't already own one, the Leonardo is the cheapest one that'll get the job done. Clones work fine, and you can buy them at countless places for as little as $10. Make sure to get one with headers (tiny plugs on top of the pins), or you'll have a harder time wiring everything.
- Conductive arrow panels
These are the surfaces you will be stepping on. Each arrow should be about 28x28 cm / 11"x11", and any reasonably conductive metal will work as a surface. I used copper sheets for my pad, but if you don't have access to cheap metal, you'll have to get creative. One idea is to cut arrows out of plywood and cover the front in copper tape; you can get a roll of double-conductive tape on Amazon for $7. Aluminium foil technically works, but will rip apart very easily unless it's covered with a protective layer like plastic (capacitive sensing works through other materials). You can also save some money by making the panels shorter, as you'll mostly be stepping on the inside of the arrows.
- Resistors: 330, 4.7k, 5.6k & 6.8k ohms
You'll probably only need four for the final circuit, but a resistor costs 2 cents, so you're better off buying at least a dozen of each type to experiment with. The wattage/material is not important; if you're confused by the options, look for 0.25W carbon film resistors. Keep in mind that electronics are cheaper in bulk; 25 resistors may be cheaper to buy than 10.
- Copper cable
Get at least 5m / 16". You won't need all of it, but like resistors, copper cable is extremely cheap. It helps if you have a wire stripper, but with a bit of fiddling, they can be stripped with a regular knife or a pair of pliers.
- Solderless breadboard (optional: universal PCB)
This is what you'll use to connect everything. A small breadboard with ~200 points should cost no more than $3. A PCB can be used for the final circuit, but you'll still need a breadboard to test out capacitors first.
- Jumper wires (M/M)
Buying at least 10 of these cables will make things a lot easier. They can be used to connect everything but the arrow panels.
- Electrical tape or solder
- Duct tape
Step 2: Construction
Take your arrow panels, and place them on the floor. Alternatively, if you want a portable setup, you could place the arrows on top of a plywood panel. Take some copper cable, cut it into the pieces illustrated above, and strip the ends. Attach each cable to an arrow using electrical tape (or alternatively, a soldering iron). Make sure the arrows are not touching each other. You only need four cables, one for each arrow. See picture 1.
The next thing you'll need to do is connect everything. If you don't know how a breadboard works, the five pins on each row are connected to each other, while every individual row on the board is separated. By plugging two cables into the same row, you can bridge the two without the need for soldering.
Using the Arduino and the breadboard, create the circuit seen in pictures 2 and 3. The photo included is just an example; it doesn't matter which rows on the breadboard you use. 5.6kohms of resistance is used here, but the exact resistance required for your pad will vary (more on that under testing).
Picture 4 shows the same circuit soldered onto a universal PCB, with a Molex connector for the arrow pads. If you know how to solder, you might want to go back and do this after testing the circuit on a breadboard.
Once you've confirmed that everything works in the testing stage below, you can tape the arrows into position using duct tape. You may also want to tape down the cables, to avoid tripping over them.
Step 3: Testing the Arduino
To use the pad as a controller, you'll first need to download the software pack attached.
It contains three things: An Arduino script that detects capacitance, a virtual joystick driver called vJoy, and a feeder application that lets vJoy detect dance steps.
Flashing the Arduino is the first step. You'll need the Arduino IDE for this, which can be found here. Copy the "CapacitiveSensor" folder to the "libraries" folder found in Arduino's install directory. Once it's in place, you should be able to compile and upload ddr_serial.ino to your board. Note the parameters (8,A*) used in CapacitiveSensor: These correspond to the send and receive pins used on the Arduino, and you'll need to change these if your setup differs from the one described in step 2. Also note the name of your Arduino's serial port (should be something like COM4); you'll need this later.
Once it's been uploaded, open the Serial Monitor. If everything works properly, you should see the following string printed hundreds of times a second:
When you step on an arrow, one of the four values should jump from 0 to 30. If it doesn't change, either the resistance is too low, or the arrow connection is faulty. If the arrows are always stuck on 30, the resistance is too high. If stepping on two arrows causes both of them to jump from 30 to 0, the resistance is slightly too low. The exact resistance required will vary depending on the material and size of the arrow pads, but should be in the ballpark of 5000 to 7000 ohms per arrow, with the same resistance on each arrow. At 7000, it should be sensitive enough to trigger by touching the bare copper wire with your fingers.
The only way to find the right resistance for your specific arrows is to experiment with different resistors. The arrows themselves add their own resistance; how much resistance they provide depends on the material and amount of metal involved, and will affect how much resistance you'll need on the breadboard. Keep in mind that resistors can be connected in serial: If you put a 330ohm resistor in front of a 5.6kohm one, the total resistance will be the sum of the two (5930 ohms). This way, you can fine-tune the value by combining a large resistor with a small one.
If any of the values are above 1000, the circuit is not closed, which likely means you've made a mistake somewhere in the wiring. The Arduino can sometimes freeze when experimenting in the Serial Monitor; simply unplugging it and plugging it back in will solve this.
Step 4: Joystick Driver
Once you've found a resistance that works, you should be able to step on two arrows at a time and see two values jump up in the serial monitor. At this point, all that's left to do is install the driver.
Included in the software pack is a simple application called DDR_ArduinoFeeder. It takes the output sent by the Arduino, and uses it to trigger button presses in a virtual joystick driver called vJoy. The source code is included for anyone who's curious how it works.
Install vJoy, and launch Configure vJoy. Make sure device 1 exists, and that it has at least four buttons. Once this is done, launch DDR_ArduinoFeeder, enter the name of your Arduino's serial port (should be something like COM4; see the Arduino IDE), and click on Connect. As long as the feeder application is running, you will be able to use the pad as a standard controller. You only need to enter the serial port once; on subsequent launches, it connects automatically.
1 Person Made This Project!
TahRobin made it!