DDR DIY: How to build your own dance game with a Raspberry Pi

Jump up, jump up, and get down.

Those who lived through the 1990s may remember the craze of dance games in the amusement arcades. People would throw themselves around a miniature stage trying to time the movement of their feet to the arrows scrolling up the screen. From a distance, it might even look like they were dancing.

To relive this experience or enjoy it for the first time (without buying a full game or console), you can use a Raspberry Pi and a microcontroller to duplicate the features of the game.


  • Time: 2-3 hours
  • Material cost: $100-$140
  • Difficulty: moderate



  • USB (Type A) keyboard
  • USB (Type A) mouse
  • Crimp tool (or pliers)
  • Internet connection
  • Soldering iron and solder
  • Sewing needle


1. Set up your Raspberry Pi. To do so, you’ll need to plug the keyboard and mouse into it and connect it to the monitor with the Micro-HDMI cable. Copy the Raspbian Buster operating system onto the SD card, ensuring you use the one that includes a desktop—you’ll need it to use StepMania. Insert the SD card into the Raspberry Pi and plug in the USB-C power supply. Follow the instructions to install the operating system and to connect to your Wi-Fi network.

  • Note: Once the project is complete, you’ll be able to manage without the mouse and keyboard, as their functions will be fulfilled by the Circuit Playground and dance mat.

2. Install StepMania. Start a terminal session using the >_ icon at the top of the screen. From here, enter the following commands to install the software:

cd ~
git clone https://github.com/SpottyMatt/raspbian-stepmania-arcade/
cd raspbian-stepmania-arcade
  • Note: StepMania has been ported to the Raspberry Pi by Matthias Rozensztok.

3. Reboot the Raspberry Pi. Once you do, StepMania will start automatically.

  • Note: See StepMania for Raspberry Pi for advice on using alternative sound cards, mapping for different controllers, and performance benchmarks.

4. Boost the sound. The Pi’s sound capability is a little lacking, but it can be improved by an add-on. The Adafruit speaker bonnet can run two small speakers. Solder in the two screw connectors that came with the bonnet kit and screw the speaker wires into the connectors.

5. Separate the bonnet and the Pi. Without space between them, the bonnet may contact the pins on the Pi, potentially damaging one or both pieces of hardware. To avoid this, connect a GPIO riser or a ribbon cable between the two.

  • Note: Having a cable to mount the bonnet gives you the option of adding a heatsink. The Pi will slow down if it gets too hot. If you find this happening, you can buy small, stick-on heat sinks to keep the temperature below 176 degrees Fahrenheit (80 Celsius).

6. Install the driver software for the bonnet. Use these commands:

curl -sS
https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/i2samp.sh/ | bash
two speakers connected to an Adafruit speaker bonnet and a Raspberry Pi 4
Once you’ve connected the speakers, your project should look like this. Andy Clark

7. Ensure the sound comes out of the bonnet. Installing StepMania will configure the Pi to have USB sound by default. To remove this and get the sound to come out of your speakers, run the following commands:

sudo rm /etc/modprobe.d/usb-audio-by-default.conf
rm ~/.asoundrc

8. Reboot the Pi to get the sound working properly.

9. Set up the Arduino software. Start a terminal session with the >_ icon and install the software with the following commands:

sudo apt-get update
sudo apt-get install arduino
  • Note: There are two variations of the Circuit Playground board. This project uses the cheaper “classic” board, but will also work with the newer “express” board. The classic board uses the C programming language and can be coded using the Arduino Integrated Development Environment (IDE).

10. Install the Adafruit Circuit Playground library. Launch the Arduino IDE and choose Tools > Manage Libraries. In the library manager, search for Circuit Playground. Install it.

11. Load the Dance Controller software. The controller software is written in C. The disco lights are provided by its onboard multi-colored LEDs and the dance mat contacts use the board’s touch sensors. Use a terminal session to download the code as follows:

cd ~
git clone https://github.com/Workshopshed/DanceController/

Then, plug the Circuit Playground into the Pi with the Micro-USB cable. Open the DanceController.ino file in the Arduino IDE and click the right-facing arrow near the top-left corner of the IDE to upload the compiled code to the Circuit Playground.

a DIY homemade dance mat for a dance arcade game, made of fabric and tape, with conductive thread
When your dance mat is done, it should resemble the “stage” you’ve seen at arcades or at your friends’ houses. Andy Clark

12. Make the dance mat. Because you’ll be stepping all over it, you’ll want to use a square of tough material such as upholstery or denim. Choose a contrasting color for the triangles. Stitch the triangles in place using a needle and regular thread.

  • Note: If you’d like, apply a black and yellow “caution-style” tape border along three sides of your mat, leaving the edge that faces the screen untaped so it doesn’t interfere with any wires. There’s no real functional advantage to the tape, but it will make it look nicer.

13. Using the conductive thread, make large stitches all over the triangles. The aim is to ensure that wherever the dancer steps, they’ll make contact with the thread. We used a catch stitch—a herringbone-shaped stitch that covers a large area with a small number of stitches. Feed the ends of these areas of conductive stitching out to the edge of the mat.

14. Connect the conductive thread to the Circuit Playground. Use solder tags or crimp-on ring connectors screwed into a terminal block and tie the thread onto the loops. Add varnish or nail polish to provide insulation and to stop the knots from coming undone. You can use the same tags or crimps on the other ends of the cables, and use the 2.5-millimeter bolts to connect these to the pads of the Circuit Playground.

  • Note: The code is configured so that pin 0 is up, pin 1 is down, pin 2 is right, and pin 3 is left. Ensure you connect the right pads to the right pins.

15. Play the game. Connect your Pi to a suitable monitor and connect the bonnet and the Circuit Playground via USB. Turn on the Pi, and if it’s all working, it should boot straight into StepMania.

  • Note: You might need to adjust the settings to configure the game to use your entire screen. Navigate the menu with the up and down arrows; use the left button on the Circuit Playground to select and the right one to exit.