Introduction: MIDI TO ARDUINO
This is already part of some of my Instructables, but probably hard to find via the search function.
It is used in the following Instructables:
Micro Timelapse Dolly with DC motors:
The advanced Micro Timelapse Dolly with cheap steppers:
The cable dolly project:
The fritzing is pretty much self explaning, you can use any arduino you want.
Be sure to unplug the line to the TX pin on the arduino while uploading programs, i made a small button that i press while uploading on my midi shield.
Step 1: PARTSLIST
1x 5pin DIN/MIDI socket
1x 4n35 optocoupler or matching type
1x diode, or matching type
1x 220 Ohms resistor
1x 560 Ohms resistor (i used a 220 and a 330 in series and it worked)
1x bread or stripboard, as you prefer
1x Arduino (clone) obviously
1x MIDI cable
1x a MIDI source, the shield will work with ever device that sends MIDI protocol
Step 2: THE CIRCUIT
Its pretty easy to connect, depending on the type of board and MIDI-plug you got, you have to solder wires to it.
Make sure the diode is in the correct direction.
What the circuit does is decoupling the MIDI line from the Arduino.
The reason why you have to do this, is because the device that sends the MIDI signal, for example a keyboard, also "powers" the MIDI communication.
That means that it provides the 5V that "are" the MIDI signal.
If you would connect the MIDI plug with your Arduino directly you would most possibly kill the Arduino Input Pin, especially if there is some faulty wireing in the keyboard or sequencer you use.
As the name implies, the optocoupler is coupling by light, and therefore the MIDI host and the Arduino are not connected electrically.
Mechanically its a small LED and a photoresistor that has (nearly) no resistance when its exposed to light, and a very high resistance when its in the dark.
So everytime the MIDI host sends a HI the lamp flashes on, the resistor is no resistor anymore, and the arduino gets a HI on the inpout too.
The diode in the circtuit protects everything against false polarity.
This all is based on the MIDI standard, and the original schematic can be found here: http://www.midi.org/techspecs/electrispec.php
Step 3: THE CODE
This is the basic MIDI CALLBACK script.
It checks if a NoteOn is coming in and then jumps to the position in the script.
On this position you can put your code in, like read the velocity of that note and map it to a servo motor.
Step 4: THE POSSIBILITIES
As MIDI can be automated in DAWs and this MIDI tracks can be saved with your projects,The main possibilities i saw in this project are audio related.
To name a few:
Automated Microphone Stand.
Imagine re-amping, with a remote controlable microphone stand, saveable with your projects.
Automated Microphone Stand in a
Same Idea taken a bit further
Acoustic Drum Machine
Servos, Motors, a drumkit, a pair of spoons, an experimental acousic drum machine
Everything Timelapse related
As MIDI sequencers put out values in a 16/16 grid, and you can control and sync the tempo, its ideal for timelapse.
Also easy speedramping would be an option.