Introduction: Arduino USB to Legacy MIDI Converter

This project allows sending MIDI signals from a USB-only keyboard or controller to a device that only has 5-pin MIDI IN. I'm not the first to do this - I think it was first hacked by my secret idol, the famous Collin Cunningham, back in 2010. However, the way I did it is perhaps different enough to be worth sharing, or maybe someone knows a better way to do this now and will school me.

MIDI is a protocol that musical instrument controllers like keyboards, keytars, electronic wind instruments, or any old thing can use to talk to devices that produce sound - such as other keyboards with built-in sounds, synthesizers, computers, etc. Like rubes, we used to use these clunky 5-pin DIN cables to carry MIDI, but now the slick way to do it is MIDI over USB. Many newer controllers only have USB, which they use for both power and MIDI. This is a problem if you want to talk to something that only has a 5-pin jack for MIDI IN. This is true for most keyboard synths (why build a USB host into it?) and for may DIY synths one might build (legacy MIDI is a lot easier to DIY). I specifically wanted to control my nice Nord synth with my keytar, which has a little wireless USB receiver.

Here is a list of parts I used in this build:

You'll need general soldering tools and supplies of course, as well as some good perfboard (love this stuff). A couple special tools you'll need:

  • a small hobby knife (e.g. X-Acto knife)
  • an FTDI cable (USB to Serial cable) - for programming the Arduino. I find this one very useful for the separated pins.

For power you'll need a source of 5 Volts - a phone charger with a USB A to B cable will do, or a computer USB port. You may also want a more permanent enclosure - I used a small cardboard box something else came in because I was in a hurry to use this at a gig (video evidence above) and it looks punk.

Step 1: Mod the USB Host Shield

The USB Mini Host and Arduino Pro Mini both run on 3.3V. Out of the box, the USB Mini Host will provide this 3.3V to the VCC pin of the USB port. My MPK mini mkII seems to work fine on this voltage - as you can see in the pics the panel buttons are just a bit dimmer. I assume other devices will work too; however, the wireless dongle for the keytar would not. Fortunately, Mazurov made it possible to provide 5V to the USB port fairly easily.

First, use a hobby knife to cut the VBUS jumper, shown in the image above. Be careful you don't cut anything else important - it takes less force than you probably think. Magnification helps. Check that there is no connection across the jumper using your trusty multimeter. Now, solder a wire to the VBUS pad. Try to avoid shorting the pad to the USB jack shield. I failed at this - too much solder maybe - but I was able to fix the short by scoring between the shield and wire with the hobby knife. Solder wick or sucker would probably have been less careless, but things still worked for me afterward. Now you can provide 5V directly to the USB port, and the USB Mini Host will keep the 3.3V to itself.

The USB Host can sit on top of the Arduino or vice versa. My 5V wire was in the way, so Host got to be on top. Insert some 0.1" male breakaway header (some came with my USB Host, but if you've bought any electronics kit in the past you probably have piles of it) through the top side of the pin holes along the long edges of the Arduino, so that the long ends of the pins stick down through the board. These will go into your perfboard when you build the complete circuit. The six pins on the short edge are for programming. It might be nice to be able to access them once your project is complete, so put headers in them with the long ends sticking up. You may want to angle these out a bit so they're easier to slide connectors on once you have the USB Host in place. Solder the pins in place on the underside of the board. Place the USB Mini Host on top of the Arduino - the pins match up exactly - and solder it in place.

Step 2: Programming the Arduino

If you don't already have the Arduino IDE on your computer, download and install it. You will also need to download the following libraries:

The program you will actually compile and install on the Arduino is one of the examples in the last library, which depends on the other two. To install libraries, simply copy the contents of the zip files downloaded above into Arduino's "libraries" folder. This is created when you first run the IDE (on Windows it's usually %HOMEPATH%\Documents\Arduino\libraries).

Connect the Arduino Pro Mini to your computer using the FTDI cable - use the diagram above to match the programming pins on the Arduino with those on your cable. Figure out which port the cable is using - on Windows you can open Device Manager and look in the 'Ports' section for a 'USB Serial Device'. Run the IDE and go to File -> Examples -> USBH_MIDI and open the USB_MIDI_converter example. In the Tools menu of the IDE, set the correct port for your FTDI cable, set the Board to 'Arduino Pro Mini', and set the Processor to 'ATMega328 (3.3V, 8MHz)'. Now choose 'Upload', and the sketch will be compiled and sent to the Arduino.

Step 3: Build the Circuit

Assemble the circuit according to the schematic above. I've included a couple images to help you identify the correct pins on the Arduino and on the MIDI plug (I always have a hard time with those). I suggest assembling the thing on breadboard before soldering everything to perfboard, to make sure everything's working properly and as a sanity check that you know which pins are which. You should be able to plug in a power supply, connect a controller, and see the LED light up when you press keys or twist knobs.

An astute person looking at the MIDI spec may point out that the circuit shouldn't need a buffer chip (the inverter), since that should be present in the MIDI IN circuitry of whatever device you're connecting to. I thought so too, but the circuit wouldn't work without the buffer. I can only guess that the voltage levels out of the Arduino's TX pin must be too wimpy to register in my keyboard. Also, it may seem odd that we are sending MIDI data to pin 4 of the 5-pin DIN connector and VCC to pin 5, when the spec says these should be the other way around. This is because we are sending the signals out one port, over a cable, and into a second port which will thus be the mirror image of ours - so data will go in to pin 5 of that port.

Step 4: Prototyping and Enclosure

Solder your project into some perfboard to make it a bit more permanent and sturdy. If you don't want to condemn your Arduino and USB Host Mini to this project for all eternity you could make a makeshift socket for it by soldering some female header strips into the perfboard first. I was all in, so directly to the board it went. I usually stick the components into my perfboard first to try and figure out the best arrangement so that I won't have to add tons of jumper wires - but as you can see I had some spaghetti anyway. Oh, well - if it works its beautiful.

You probably want to put this in some kind of enclosure - this one looks about right - but I was in a hurry so I went green. I scrounged up a little cardboard box that something else came in, and found that it miraculously had the same footprint as my perfboard. I used the hobby knife to stab out some holes in approximately the right locations for the ports, as well as a small hole for the LED, added some box art, and had my finished product.

To use this, connect a 5V power supply to the USB-B jack, connect your class-compliant MIDI controller to the USB-A port, and connect your MIDI keyboard/synth/DIY project to the 5-pin connector. The MIDI port requires a bit of force - you may want to secure it to your enclosure to reduce strain on the solder joints (cardboard doesn't quite do it). Have fun rocking!


CarraN made it!(author)2017-03-14

yes, got it! Thank you very much!


JohanB12 made it!(author)2017-01-04

An easier and cheaper way to do it: Use the Hobbytronics USB Midi Host Board. Hook up the MIDI jack directly via the 220 ohm resistors. No Arduino needed, just a 5V power supply.


CarraN made it!(author)2017-03-14

Hi Johan! Do you know where can I find the pinout of this little guy?



JohanB12 made it!(author)2017-03-14

Hi! You referring to the Hobbytronics USB Host Mini board?

There's a pinout picture if you click the "Additional Images" tab.

albedozero made it!(author)2017-01-06

Totally just bought a USB host chip off HT for version 2 of this build - seems there's always a better +/- cheaper way

JohanB12 made it!(author)2017-01-07

Excellent! I'm going to buy more of those too. Glad to be of help :)

JoeB394 made it!(author)2017-02-03

Now even easier is:

About This Instructable




Bio: Physics professor, keyboard player, pizza chef, coffee enthusiast
More by albedozero:AVR/Arduino Flashing With Raspberry Pi5V/3.3V Breadboard Power SupplyMetal Foil Tape Parallel-Plate Capacitor
Add instructable to: