About: I'm a 36 year old DIY enthusiast from Vienna Austria with a strong background in mechatronics/automation. My DIY field is mainly video/audio/motion control. If you want to see what i do between posting it ...

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.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.


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


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.


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.

Be the First to Share


    • Assistive Tech Contest

      Assistive Tech Contest
    • Reuse Contest

      Reuse Contest
    • Made with Math Contest

      Made with Math Contest

    19 Discussions


    Question 6 months ago on Step 3


    I do not understand the pinouts shown in the photo, pins 4,5 and 6 on the optoisoolator appear to be wired wrong appear to be wrong?
    Pin 4 and 5 appear to be swapped and pin 6 does not appear to be connected.
    I am am obviously looking at it wrong or am I?



    10 months ago on Step 3

    Very nice project!!! What comes to my mind with this, is having an array of buttons that will send different midi control messages to my midi device!!!


    Question 1 year ago

    Hay can you tell me what a 4n35 is and what it can do?

    1 answer

    Reply 1 year ago

    Hi, yes its an optocoupler.


    A few words on optocouplers/isolators :


    Basically its a light dependend switch together with a light diode in a housing.

    By turning on the LED on the input side you switch the output side.

    You use it to secure inputs of microcontrollers.
    Lets assume you put 12V on the input by accident, if you wouldnt have an optocoupler installed you would burn the microcontroller. with an optocoupler you burn the coupler instead of the chip :)

    Take a read of the wiki article, and also: honestly google stuff up if you wanna know about them, most often its easier than posting a question and waiting for someone to explain it ;)

    Also you learn more from reading articles and datasheets than from random people on the internet ;)

    Thats all part of beeing a developer.


    2 years ago

    I'm confused by the diagrams.

    In the breadboard diagram, you
    show PIN 4 going to ground, PIN 5 going to RX on the Arduino as well as
    to 5v through a resistor, and nothing on PIN 6.

    But in the
    schematic, it looks like PIN 4 goes to RX on the Arduino as well as to
    5v through a resistor, PIN 5 going to ground, and PIN 6 to 5v.

    PINs 4 and 5 happen to be reverse labeled on the schematic? And maybe
    PIN 6 is only needed if implementing a MIDI Through jack?

    1 reply

    Hi, sorry i just read this message. I am about to build a few of those over the next few days. I will come back and change the graphics if i find some errors.


    2 years ago

    Thanks for this!

    I would like to know with what did you model the picture on the top?

    1 reply

    2 years ago

    Hello dear, I would like to know if there is any way to go through the midi port in receiving the messages of edrums, add messages of electrical piezo and all send it to the port midi out.

    The intention is to make a trigger for edrums.

    2 replies

    ok, sorry, i just saw this is the midi-out tutorial.

    well if you want to input analog values and output midi messages, this is the wrong tutorial.

    This tutorial is about reading midi messages to output values

    Hi, yes i guess so.

    To read signals off of piezos or edrums/triggers you would need a way to read as much analog values as you plan to include drum pads.

    I think you would also need an optocoupler or some way to protect the analog ins from to much current.


    Reply 2 years ago

    add this under include midi.h



    4 years ago on Introduction

    Do you have any thoughts on Cycling74's Max software? It seems to be geared for Arduino / Midi Instruments, but not sure if it's worth checking out.

    2 replies

    Ah ok "the" MAX :) didnt know the company is called cycling74 :)

    but i dont see how midi should fit in, i use MIDI to control the arduino, i guess MAX uses USB. My main idea was to control a microphone stand via midi from my DAW. Also i want it to be as open as possible, so i will stick to midi for that project.

    sorry never heard of it :) but i will check it out.

    I use it with touchOSC and my ipad, also tested it wi the elektron machindrum.

    If the device or app uses the standard midi protocol it should run with this Instructable