The BIG Arduino Piano! Use Pulse Width Modulation to Dance like Tom Hanks
This BIG piano will help exercise the mind and body! All you need is a few buttons, a speaker, and some dancing shoes.
- Arduino Uno
- CUI 8 ohm speaker
- x8 pushbuttons
- x8 10k resistors
- x1 220 ohm resistor
- Jumper wire
- Foamboard or cardboard
I was watching the movie Big the other day and I realized I wanted to dance just like Tom Hanks. With no fortune teller or genies nearby to help make this keyboard big, I knew I needed to get to thinking. With some quality foamcore board lying around and other miscellaneous art supplies, I got to prototyping and came up with an easy-to-follow recipe for a giant, pushbutton-activated piano!
I wanted to keep this project simple so I figured most viewers have more pushbuttons lying around than force-sensitive-resistors, so I glued my extra buttons to the bottom of the keys. In an ideal world, adding FSRs to the keys instead would make for a softer touch, but I’ll leave that modification to you guys.
The foamcore board isn’t necessary as this project can be simply assembled on a breadboard. The video covers the basics of measuring, cutting, and attaching the pushbuttons, so I’ll just stick to the technical details here. If you don’t have the proper number of components, you can follow along with just one pushbutton, some resistors, and a speaker.
If you’ve used an Arduino before, you’ve most likely used a pushbutton and understand the importance of a pulldown resistor. A pulldown resistor “holds the logic signal near zero volts when no other active device is connected”, (Arduino Playground). This helps ensure reliable and accurate readings from our pushbuttons.
Basically, we have eight pushbuttons connected to pins 2-9, respectively. Each button requires 5V power, a 10k pulldown resistor, and a signal line to the input pins. Within our program, we assign each of these buttons a specific square-wave frequency to play whenever the button is pressed (logic HIGH). These are specific frequencies that help create musical scale.