In this project, we will look at how to build a portable capacitive touch piano with
- an Arduino,
- a Capacitive Touch Shield for Arduino using the MPR121,
- a piezo buzzer,
- copper foil tape with conductive adhesive (cut in the shape of piano keys),
all enclosed in a clear acrylic enclosure (ProtoStax for Arduino) with the capacitive touch keys stuck on its top surface. This makes it a nice compact little piano that you can carry out and jam with and code up new tunes!
Adafruit's 12 x Capacitive Touch Shield for Arduino uses the MPR121 to provide capacitive touch sensing for up to 12 inputs. Coupled with the Adafruit_MPR121 library that makes it easy to detect and respond to touches on copper foil tape cut in the shape of keys that represent the 12 semitones of an Octave.
You can also program in your own touch sequences ("Secret Keys" or key combinations) to play any random tunes that can include as many octaves as you like (limited only by the power of your ear to hear the notes, or your piezo/speaker to play it!).
For the output, Arduino's tone library plays the sound through a Piezo buzzer. You can also use a speaker - just remember to use a resistor with it to restrict the current to that which can be provided by the Arduino's pin!
Copper foil tape with conductive adhesive make up the piano keys. It is important to get copper tape with conductive adhesive as you are going to stick the tape onto the wire that's connected to the shield.
With ProtoStax for Arduino, not only does it fit any of a whole range of Arduino boards (from Uno/Leanardo to Mega/Due), but there was enough room to fit not one, but two Shield inside (with some minor adjustments) - giving you protection for your entire project and not just your Arduino, and giving you a finished-looking project that you can actually display and use!
Ok, let's dive right in! You can find the tutorial with complete instructions, link to the GitHub repository for the code as well as ideas for how to take the project even further at
Sridhar (and the ProtoStax Team 😊)