Over the weekend, I turned a Dance Dance Revolution dance pad into a keyboard input device. The pad will be used as part of a larger project at the NYC Resistor 2013 Interactive Show. Here is how I did it.
The pad itself is one of those metal arcade style Dance Dance Revolution pads. The only output was a 15 pin D-Sub connector, much like a VGA cable.
Fortunately for me, a fellow Resistor already went through the arduous task of figuring out the pinout for this particular pad. A little further research based on the pinout revealed that this particular model was a TX-1000. The full pinout can be found here.
The next task was to wire the connector to a microcontroller and try to read input from the board. I decided to go with a Teensy as it already has a library that supports keyboard output. In order to have the Teensy be recognized as a HID by a computer, you have to change the USB type. This can be done by changing Tools -> USB Type to “Keyboard + Mouse + Joystick”.
Now I needed to write some code to read the input from the dance pad and convert it to keyboard output. First, I had to define the input pins in the setup function of the Teensy code. This was done with pinMode using pullup resistors.
pinMode(leftPin, INPUT_PULLUP); // Left arrow
The next step was to read the input from the control pad and send the corresponding keyboard character when a pad was pressed. Fortunately, Teensy offers a Bounce library which makes debouncing switches easy. First you declare a Bounce object on your input pin.
Bounce leftButton = Bounce(leftPin, 400);
Next, poll the pin in the loop() method for state changes. Once a state change is detected, send the corresponding keyboard key.
if (leftButton.update()) { if (leftButton.fallingEdge()) { Keyboard.set_key1(KEY_LEFT); } }
Once everything was wired up and the Teensy code was running, everything seemed to work… except the right arrow. Unfortunately, this meant that it was time to take the pad apart!
After a bit of investigating and a few false starts, I found that the wires were easily accessible under the up arrow. Thankfully, the wires for each button were a different color so it was easy to determine which wires to test. Testing with a multimeter showed that the right signal wire in the cable was not working. After running a new signal wire for the right pad (and soldering everything else I cut), everything worked as expected! I then used a solderable D-Sub connector and enclosure from RadioShack to make a connector for the pad.
I could then hook the dance pad connector to my homemade connector and then a mini USB to USB cable from the Teensy to my computer. There is nothing more satisfying than navigating your computer by dancing!