This fun and easy project shows you how to create a simple input device with little more than a cheap piezo sensor, an old mousepad, and an Arduino board. Using household supplies and a few passive electrical components, you can create a basic physical-computing game input device for your Arduino.

Project Steps

Introducing the drum pad input device and game

The drum pad is used to input “beats” into the Arduino system. The Arduino is able to read the beats from from the drum pad through the piezo sensor.

The object of the Processing game is to get as many “beats” as possible in a 5-second time frame. Currently 33 beats is my high score!

Trace the CD outline onto your mousepad material.

Cut the traced circle out. You should now have a circular piece of mousepad. This will become our drumpad.

Attaching the piezo sensor

Solder two wires to the two discs of the piezo sensor (as shown in the first image).

Make sure that the solder joint on the outer disk of the sensor does not touch the inner disk of the sensor.

Tape the piezo sensor to the CD or DVD with the solder joints facing up (see second image). Make sure that you center the piezo sensor accordingly.

Putting your drum pad head together.

Glue the CD or DVD onto the mousepad with regular white (Elmer’s) glue.

Use a few heavy books to keep pressure on the mousepad while it dries.

Let sit for at least 10 to 20 minutes.

Creating the drum pad base

Trace the CD or DVD onto the packing foam just as we did with the mousepad.

Cut out the foam along your traced line.

Now you should have a circular piece of packing foam that will serve as the base for the drum pad head.

Putting the whole thing together

Glue the cut-out packing foam to the CD or DVD with white glue.

Put some books on top of the drum pad again and wait.

Allow 10 – 30 minutes of drying time.

While waiting, you can go ahead and start creating the circuit (see next step).

Building the circuit on a breadboard

Insert the piezo sensor leads into the breadboard.

Depending on the wire you used to connect the sensor, you might need to tin the wire or solder it to a male .100″ header.

Connect the Arduino to your computer.

Open the Arduino IDE and note your serial port for the Arduino.

Paste in the code from the Arduino sketch attached to the “Files” section of this project and upload it to the Arduino.

You can also download the Arduino code here.

Open the Processing sketch (Drum Game)

Change the SPORT varible in the sketch to match your Arduino’s serial port (which you noted in the previous step).

In OSX it will look like /dev/cu.usbxxx

In Linux is will be something like /dev/sttyUSB0

In Windows it will be something like COM3

You can download the Processing sketch and Arduino firmware here.

Play the game!

Run the Processing sketch to start the game. Make sure you have closed the Arduino IDE. From here, once you start the game you need to click anywhere on the screen to begin. After clicking, you will have 5 seconds to hit the drum pad to register as many “beats” as possible. That’s it! However, there is much room for improvement.

There are a few deliberate shortcomings included in the Processing sketch as well as the Arduino firmware. For example…

I included a rocket ship in the Processing sketch. Perhaps, you could extend this sketch by making the ship “blast off” if you got a high enough score?

You could change the Arduino code so that the Arduino will read the force of the tap and then use that as a multiplier for the total score.

Conclusion

Using this simple-to-construct piece of hardware, you can create a cool input device that will allow you to control all sorts of fun software you can create, from a drum-practice application to drum-beat-controlled video games. If you do code any apps for this project, please tell us about them in this project's Notes.

For more beginner's information about Arduino and Processing, check out Getting Started with Arduino and Getting Started with Processing.

Also, take a look at our bi-weekly Codebox column (about using Processing) on Make: Online.

And, to access our front door to all things Arduino on MAKE, see our Make: Arduino page.