Introduction: Keyboard Piano
In this project we will show you how to make a piano with some common materials.
Step 1: Obtain Parts and Materials
You'll first want to obtain all of the parts you will need for the project:
• An Arduino (or Arduino-compatible) microcontroller board. • Any Arduino board should work:
.• Eight 2.2 Megaohm (2.2 MΩ) resistors • Anywhere between 1 MΩ and 4.7 MΩ should work
• You need one resistor per piano key
• A 2.2 MΩ resistor has a color code of Red-Red-Green or Red-Red-Black-Yellow• A piezo buzzer• Some spare wires or jumper cables• Aluminum foil
• A foot or two should do• Tape• A surface to tape your keys to
• We used a scrap piece of cardboard, but it can be anything you like, even the tabletop itself!Equipment that you may need:• Soldering iron and solder
• You can probably get by without an iron by wrapping wires together instead of soldering, but the connection will not be as reliable• Scissors to cut aluminum foil and tapee
Step 2: Creating of the Keys
Out of your aluminum foil, cut a few shapes to be your piano "keys". Any shape will do, but we took the simple route and made squares. Each key should be somewhere between 2"x2" and 4"x4", but most other sizes will work as well.
Step 3: Assembling the Key Circuitry
Each touch-sensitive "key" on the piano is going to require one resistor and two wires/cables. Solder one wire to each leg of the resistor, but make sure to leave part of the leg sticking out. The leg will be used to connect to the foil in the next step. Make as many of these as you plan on having piano keys
Step 4: Connect the Foil Key
- Take the extra bit of leg you saved and poke it through a corner or side of one of your aluminum foil squares.
- Fold the leg over the edge back towards itself to make the connect hold more strongly.
- assemble all of your keys like this
Step 5: Attach the Keys
Using your tape, attach each key to your surface, (leave some of the foil exposed.)
It's okay to tape over the resistor, but be sure to remember which wire is attached to the side of the resistor that is touching the foil and which wire is not
Step 6: Finish Wiring Up
After attaching all of your keys to the surface, take the wire that is connected to the resistor and connect to the the same side of the resistor on the adjacent key.
Basically, we want to connect all of the non-foil-sides of the resistors together. These can be soldered or just connected with tape.You will have one wire left over that is not connected to anything; this will be our "common send" wire.
Step 7: Hook Up the Arduino
- Connect the "common send" wire left over from the previous step to Pin 2 on the Arduino.
- Then, connect the "key" wires to Pins 3-10, starting with the left-most key on Pin 2 and ending with the right-most key on Pin 10.
- Take your buzzer and connect the pin marked negative (-) to a ground (GND) pin on the Arduino.
- Connect the pin marked positive (+) to Pin A4 on the Arduino.
Step 8: The Code
Obtain and install the CapSense Arduino library if it is not already installed. This can be downloaded from Github here. If you do not know how to install third-party Arduino libraries in you version of the Arduino IDE, reference this guide on Arduino.cc.Attached below, you will find a zip file that contains the Arduino code for the Capacitive-Touch Arduino Keyboard Piano. Download it and unzip it somewhere on your computer. Open CapSensePiano.ino in the Arduino IDE and upload the code to your Arduino.
Make sure that the libraries you need are uploaded and stored
Step 9: Play!!!!!
You should now be able to tap on the foil keys and hear the corresponding notes played through the buzzer. If the keys are not very responsive, or are trigger without being touch, you can adjust the CAP_THRESHOLD value in the Arduino sketch to set what value that the keys are triggered at. Lower values will cause the keys to be easier to trigger, and higher values will reduce the number of keys that are mistakenly triggered.You can also change the scale that is played by increment one of the few scales included, or make your own scale! If you make your own piano, please comment and show us some pictures and videos. We'd love to see some creative instruments!