Now that you're up to speed on using Arduino's inputs and outputs, this Instructable will give you everything you need to get started using sensors to trigger MIDI notes from Arduino. This post is the last installment in a series of workshops I led at Women's Audio Mission. The first two classes are Intro to Arduino and Working with Arduino Inputs and Outputs.
(1x) usb cable Amazon
(1x) breadboard Amazon
(1x) jumper wires Amazon
(1x) 220Ohm resistors Digikey CF14JT220RCT-ND
(1x) led Digikey C503B-RCN-CW0Z0AA1-ND
(1x) 10kOhm resistor Digikey CF14JT10K0CT-ND
(1x) tact button Digikey 450-1650-ND
(1x) tilt switch Adafruit 173
(1x) 10kOhm potentiometer Digikey PDB181-K420K-103B-ND
(1x) light sensitive resistor Digikey PDV-P8103-ND
(1x) 33kOhm resistor Digikey 33KQBK-ND
(1x) 1MOhm resistor Digikey 1.0MQBK-ND
(1x) piezo sensor Sparkfun SEN-10293
Step 1: Serial to MIDI converter
In this class we'll be using the Ardiuno's USB connection to send Serial messages to you computer, then we'll run an app like Hairless MIDI to convert this the Serial messages to MIDI and route them to other applications on your computer (Ableton, Garageband, etc). I chose this software solution because it is easiest and cheapest to setup for an entire class, you could also use a 5 pin MIDI plug and a MIDI cable to plug directly into other MIDI instruments. There are a few things you will need to be aware of with this setup:
Be sure that the baud rate you specify in Serial.begin() in your Arduino sketch is the same number selected under Hairless MIDI >> Preferences >> Baud Rate (I used 9600 so I used the command Serial.begin(9600) in all example Arduino sketches, see the first two images above). If you choose to wire up a 5 pin MIDI plug you have to set the baud rate to 31250, but if you're connecting via USB to a Serial to MIDI application, you can use whatever baud rate you like.
To use Hairless MIDI you will need to select your board (something like usbmodemfd121) from the Serial Port menu and select the MIDI channel that you would like to send or receive MIDI to/from. Make sure you have the same MIDI channel selected in the preferences of whatever other MIDI applications you are running on your computer. I sent my MIDI to IAC Driver Bus 1, and then setup Garage Band or Ableton to receive MIDI on this same channel. If you do not see any MIDI output options in Hairless MIDI, scroll down to the FAQ and troubleshoot your setup.
You cannot program the Arduino while it is connected to Hairless MIDI, because the two applications are competing for the same port (see the error in the second image). A quick way to bypass this without needing to quit Hairless MIDI each time you want to change your code is to select a different Serial Port from the Hairless MIDI interface, upload your new Arduino code, and then set the Serial Port in Hairless MIDI back to the correct one.