I made a xylophone that uses an Arduino Mega to detect when a note is struck, and generate MIDI output. This project is wondeful because I essentially made a xylophone, a drumkit, and any other MIDI controlled sound instrument, with one tool. The following steps will outline what I used to make this xylophone.
Step 1: You will need...
(x1) Arduino Mega 2560 (Radioshack #276-127)
(x12) Piezo Element (Radioshack #273-073)
(x12) 1M Ohm resistors (Radioshack #271-1356)
(x1) Single Core wire (Radioshack #278-1221)
(x1) Printed Circuit Board (Radioshack #276-170)
(x1) USB 2.0 Cord (Radioshack #26-714)
(misc) Electrical Tape (Radioshack #64-2373)
(misc) Heat shrink (Radioshack #55048444)
The housing for the xylophone was easy to build. I used:
1/8" acrylic sheeting
1/4" vinyl tubing
1 1/2" long machine screws.
2" masking tape
small flat head screw driver
Step 2: Free the Piezos, then solder longer leads.
By gently pressing around the edges with my fingers, you could hear the glue crack apart from the plastic, I loosened the bottom of the casing. Carefully, I insterted a precision flat-head screw driver, and popped the bottom of the case off.
The piezo element could then be removed from the outside of the housing.
Because I am using an Arduino Mega Board, I could have up to 16 Analog inputs, or 16 Piezos. I decided to just include an octave & a half, 12 notes, so I used 12 piezos.
After they were free from their case, I soldered longer wires to each piezo element, to prepare them to be inserted into the xylophone. When I was done soldering longer leads on to each piezo, I wrapped my solder points with heat shrink or electrical tape.
Step 3: The Bars and Housing.
The acrylic bars were each 10x2 inches. Each bar has two holes in them that will guide a machine screw through the bar, and mount to the top panel of the wooden housing.
The wooden housing I designed is 10.5x30x3 inches. It forms a shallow box that supports the electronics embedded within it. I used woodglue and a cotton swab to secure all of the corners, and allowed 24 hours to cure before I sanded down all of the edges.
The CorelDraw file for the base housing is attached to this step.
Step 4: Attach the Piezos to the Bars
Step 5: Attach the Bars to the top Panel.
To prevent excessive shake or vibration on each bar, I decided to use vinyl tubing as a shock absorber on each machine screw. With 12 bars, I used 24 machine screws and nuts, and 24 3/4" lengths of vinyl tubing. Thread the machine screw through the bar, then the vinyl, and slip it into the paneling. When the screw was through the panel, I was able to twist on the nut to fully secure it to the panel.
All of these should only be finger-tight, to avoid stress on the paneling, or on the bar.
Step 6: Build the circuit.
After I soldered the resistors into place, I ran a small jumper wire from one end of the resistor, to the longest rail on the PCB, and designated it my ground rail. Next, I soldered all of the piezos' ground wires into place, in line wtih the same end of each grounded resistor. The positive lead from the piezos is soldered in to the same rail as the other end of each resistor.
I cut 12 lengths of green wire to be my "signal wire" to the Arduino. Each signal wire is soldered into the same positive resisted rail of the piezo.
The fritzing diagram file is attached to this step.
Step 7: Connecting to the Arduino
All remaining Analog ports must be grounded! Otherwise it will affect your serial output from the arduino. I used 4 black wires, running from the ground rail of the PCB directly to the open analog ports of the Mega board. (A12, A13, A14, and A15)
When you have completed your circuit, you can load the xylophone program, or sketch, onto the Arduino board from the Arduino Developing Environment.
Here is the sketch I used.
Step 8: Power and communication.
I drilled a second hole to hold my mallots.
Step 9: Serial to Midi
Note: Disable the bridge while trying to update the sketch on the Arduino board. You cannot have the bridge running while trying to communicate to the board from the Arduino software.