Introduction: Arduino Uno Xylophone
This xylophone uses the Arduino Uno and a multiplexer to identify when one of eight keys are struck, and play that sound via midi sound on a computer. An optional part of the instructions also allows each key to light up with two LED lights at the same time the xylophone is struck. These steps outline what I have done.
Step 1: Necessary Parts
- Arduino Uno
- 9 V battery with Arduino adaptor
- Arduino to USB connector
- 8 piezo disks
- 8 1 M Ohm resistors
- Terminal Connectors
- Strips of acrylic and a box (or something to make the xylophone with)
- PLENTY of wire
- Arduino Environment
- Hairless Serial to Midi Converter
- Max MSP
- Max Patch (Attached, from Amanda Ghassaei)
- Arduino Midi Library
For LED Compatibility:
- 16 LED lights (two for each bar, cannot be more than two)
- Suitable resistor (I used 220 Ohms)
Step 2: The Basics
The multiplexer is key to this project, as it allows you to take 8 analog ins or outs, as opposed to the 6 on the Uno. Using one analog in and three digital ports on the Arduino, the multiplexer runs through each input and reads any changes. In this case, the multiplexer reads any change in the piezo disks. (Picture is courtesy of Jenna Deboisblanc)
Step 3: The Protoboards
You will need two separate protoboards. One connects the multiplexer to the inputs both of the piezo and the Arduino Uno, and the other deals solely with the piezo disks.
Protoboard 1: Multiplexer
On the photo of the front of the board, the multiplexer connects to the 8 different positive inputs of the piezo disk on the top Terminal Connector. The side Terminal Connector connects the S0, S1, S2, A1, +5V, and Ground to the Arduino Uno. The back of the board is seen in the second picture (the piezo inputs are now on the bottom, and the Arduino connections are now on the bottom).
Protoboard 2: Piezos
Each piezo has a positive and a negative. The positive connects to a resistor which connects to ground, and the negative connects directly to ground. The mutual ground is connected to the same ground as on the multiplexer protoboard, and separate wires are soldered to each of the positive piezo wires and fed into the mutliplexer board.
Step 4: Assembly
When you have your box and acrylic strips, you can begin assembly. First, put the protoboards delicately into the box, making sure metal does not touch. Then, begin attaching piezos to the acrylic strips with tape, and attach the strips onto the box, making your xylophone. You will likely want to put a steady object below the piezos to make the force of each hit stronger.
A note: be very careful with the Piezo disks. The attachment wires come off the plates easily, I would suggest soldering on new wiring.
Step 5: Attach to Arduino Uno
When you are done connecting all the piezos to the strip, connect the wires to the Arduino Uno and prepare to have some fun!
If you plan to use LED lights, you can connect them in parallel, with the resistor leading to ground, and the positive end leading to any digital output you would like. Connect these lights wherever you would like on your xylophone.
Step 6: Code and Computer Programs
Open the attached code and upload it to the Arduino Environment, making sure you have the Arduino MIDI Library installed.
Then, open Hairless, MAX patch, and some either the "Audio MIDI Setup" on a Mac or create a loopMIDI virtual port. I used a Mac, so I will focus on this, but you can find more info about the Windows setup on the Hairless website's FAQs.
For Mac: After opening Audio MIDI Setup, go to Window-->Show MIDI Window. Make the selections shown in the second photo in the IAC Driver Properties window, assuring that "Device is online" is checked.
Return to Hairless, find your Arduino in the left-hand drop down window, unselect "Serial <-> MIDI Bridge On", and choose the two options in the photo for the MIDI In and Out. Arduino will not be able to upload anything to the Arduino Uno if the "Serial<->MIDI Bridge On" option is checked, and your computer will likely crash, so this step is very important.
Upload the code above (has comments for if you would like to add LEDS to your project).
Participated in the