Introduction: CustomKeys

CustomKeys is a customizable, Arduino-based, polyphonic synthesizer. The CustomKeys keyboard uses capacitive touch sensing - each key is made of a conductive material which, when touched, signals the synthesizer to emit a tone from the speaker. The CustomKeys library allows the user to choose an 8-note musical scale for the keys. Furthermore, users have a creative choice on the body design of their CustomKeys synth - users can use a provided laser cutter template or use any other material long as the basic requirements for the system to function are met. 

Special thanks to:
- Joe Marshall, whose code for the Arduino Octosynth (http://www.cs.nott.ac.uk/~jqm/?p=605) is the basis of the CustomKeys library
- Instructables user blinkyblinky for documenting how to assemble the Arduino Octosynth https://www.instructables.com/id/The-Arduino-OctoSynth/

Step 1: Materials

You Will Need:
- The CustomKeys Arduino library - updated 05/15/13 (download below)
- 8 bits of conductive material for the keys (paperclips, brads, conductive tape, etc.)
- Colorful card stock paper (unless you're going the laser cutter route)
- A soldering iron
- A boxcutter or x-acto knife
- Stick glue
- Wire clippers and strippers
- A set of 8 male header pins 
- Electrical wire
- An Arduino ( I used the Uno)
- A USB for the Arduino
- A breadboard
- An 8 Ohm speaker

If you have access to a laser cutter:
- 16" x 20" birch board with 1/8" thickness
- The box template (download below)*

Optional:
- Jumper cables (preferable to wires, but wires work just fine)

You may find that the output sound is too quiet with the speaker alone.
In this case, you may want to build an amplifier circuit. Here are the parts you will need: 
- An n-type MOSFET (I used an IRF9530)
- Two 100 Ohm resistors
- A 1.2K Ohm resistor
- A .47uF film capacitor
- A 220 uF electrolytic capacitor

*Part of the box template was made with Rahul Bhargava's BoxMaker http://boxmaker.rahulbotics.com/

Step 2: Keyboard Assembly (Without Laser Cutter Template)

If you're using the laser cutter template, please skip to step 4. 

Make a cool keyboard design using the colorful pieces of card stock. I like to fold my paper in half along the short edge, then along the long edge. Then, while it's still folded, I cut my paper down the fold I made along the short edge (refer to the images for clarification). This yields two greeting card shaped pieces of paper. I only use one of them.Next, I take another color of cardstock, cut little rectangular shapes for the keys, and glue them onto one side of the card shaped paper (refer to the images). 

Feel free to be creative with this part. Make a monster, a garden of flowers, or an original creation with card stock shapes. Try to make a design that will look nice with the conductive items that you will use for keys. **The folded part of the card shaped paper will be the top of the synth, so please plan your design accordingly. **


Step 3: Keyboard Assembly (Without Laser Cutter Template)

1.Solder wire to each piece of conductive material you will use for a key. Each wire should be at least 6" long. In this example, I am using paper clips for my keys.

2.With an exacto knife or thick needle, make a hole in the card stock immediately above each key, and also above each key along the fold of the card stock.

3. Thread the wire for each key through the hole immediately above the key location, underneath the card stock, and out through its respective hole at the fold. 

4. If necessary, use a hot glue gun to secure your keys to the card stock. 

Step 4: Keyboard Assembly (With Laser Cutter Template)

If you are using the laser cutter template, be sure to engrave, rather than cut, the keyboard design on the top part of the box (the red lines in the image), and cut everything else. Refer to the image for clarification. This tutorial assumes that you already know how to use a laser cutter. 

I recommend using a 16"x20" piece of Birch wood with a thickness of 1/8". Here are the settings I used for cutting and engraving, but they may differ from machine to machine:

Cut
Power = 100%
Speed = 2%
PPI = 500

Engrave
Power = 10%
Speed = 6%
PPI = 500


Step 5: Soldering the Key Wires

1. Take a set of 8 male header pins and split it into a set of 2 and 6. 

The key-to-pin assignments are as follows:
- The leftmost key goes to Arduino pin 6
- The second to left key goes to pin 7
- Key 3 and onward go to pins A0-A5 in order. 

2. Solder the right 6 key wires to the header pin of 6 in order, and then solder the remaining two wires to the header pin of two. Remember that the positions of the two leftmost keys will essentially be swapped on the Arduino. 

Step 6: Amplifier Assembly

Assemble the amplifier circuit according to the provided schematics*. Be sure to look up the pins of the MOSFET to ensure you are connecting the drain, source, and gate to the right parts of the circuit. 

*The schematic with images was made with Fritzing http://fritzing.org/
* I found the other schematic on an Arduino forum thread and modified it. Credit goes to user CrossRoads: http://forum.arduino.cc/index.php?topic=22678.0

Step 7: Putting It All Together

1. Connect the set of 6 header pins to pins A0-A5 on the Arduino, ensuring that the third key from the left is connected to A0. Connect the header pin of 2 to pins 6 and 7 of the Ardiuno, ensuring that the leftmost pin is connected to 6. 

Using wire or jumper cables,

2. Connect 5v from the Arduino to the power rail of the bread board.

3. Connect ground from the Arduino to the ground rail of the bread board.

4. Connect the amplifier input to pin 11 of the Arduino.

Step 8: The Finished Synth!

1. Install the Arduino library and open the provided example.
Instructions on installing an Arduino library: http://arduino.cc/en/Guide/Libraries

2. Connect the Arduino to your computer with the USB cable and upload the provided example code (File>Examples>CustomKeys>CustomKeys_Example) onto the Arduino.

3. Wait for the synthesizer to calibrate (do not touch any of the keys until the calibration tune ends).

4. Your CustomKeys synth is now ready to play!

Bonus:
Change the scale of the keys by modifying the code according to the instructions provided in the example!