DIY Time Part 1: Arduino USB Midi Converter

In the last couple of years I’ve become aware of the huge boom in DIY music equipment. The internet provides a massive (and free!) repository of interesting and inspiring projects to try. A great many of these projects are built on the Arduino platform, an open-source board which will do pretty much whatever you program it to. Not being a coder by any stretch of the imagination, I had wondered whether or not I’d have the skills to make anything useful using an Arduino. It turned out my fears were unnecessary- this project can be realised by a total novice.


I was looking to get a small midi controller, but found myself frustrated by the fact that most of the smaller, cheaper ones were USB only. Fair enough – there are issues with the amount of space to fit a MIDI port on a small controller, and they are marketed mainly at computer musicians. However, a bit of googling led me to this discussion on a V-Guitar forum, which suggested that using a USB Host shield and an Arduino could translate USB Midi to a ‘regular’ 5-pin Midi output, as well as providing power to the controller itself. So I took the plunge and ordered the two boards. Total cost was around £21, so even if it didn’t work, I hadn’t spent a bomb.


Now- important disclaimer: I am not the author of any of the code here, the credit must firstly go to Collin Cunningham for writing the code (way back in 2010). Yuuichi Akagawa’s updates on Github made it possible to use multiple devices via USB Hub (more on that later), and “Spider” over on the V-Guitar forums provided the invaluable step by step guide to making it work. This is the beauty of open-source and the internet, and really the point of this post: anyone can get the info and do-it-themselves!

The picture below shows what I ended up with (click for larger version)


As per Spider’s instructions, the TX port of the Arduino shield connects up to the Midi out socket, with a 220 ohm resistor inbetween, along with the ground and 5V pins. The small piece of breadboard holds a 6N137 optocoupler for the Midi input. This, it later turned out, was unnecessary. My advice would be to stick to a one-way conversion- USB Midi in to hardware midi out, but more on that later.


So far so good. While I was at home over Christmas, my Dad offered to case the thing up (having a much better selection of tools, not to mention a lot more practical skill!). The resulting device is not much bigger than two packs of playing cards.





Here you can see it at home in a portable synthesizer rig I constructed over the Christmas break. This is completely standalone from any sort of computer, and runs off just two plug sockets. The little Akai keyboard (MPK Mini mk1) is great for this setup, as it has different presets which allow you to switch between controlling the two synthesizers- each of which is set to a different midi channel. In the example shown, the Mutable Instruments Midipal provides a midi clock for both instruments, but I did try it out as a channel splitter, which enabled the entire thing to be played as a 4 voice synth (albeit with a very cramped keyboard!).


So the converter works, and works well. It runs quite happily on USB bus power, any generic USB plug adaptor that you might get with a mobile phone, or a 9v DC supply. However there are a couple of things that it currently won’t do.

You can’t currently convert midi from your computer to hardware midi using this device. The way I see it- it isn’t designed for that. It acts in place of a computer in hosting the USB device, and is therefore more suitable for stand-alone operations.

I failed to get the hardware midi in port to work at all. The biderctional_converter (sic) example specified in Spider’s guide would not compile, no matter what I tried. This may just be an issue with my particular computer, and I’m hopeful that at some point in the future a modified code will appear. The beauty of the Arduino platform is that it’s so easy to change the program running on the chip, so this isn’t a dealbreaker. I now think of the midi in port as ‘for future expansion’!

I did however test running multiple USB inputs via a generic (unpowered) USB hub. This worked fine with two USB devices, and I couldn’t make it “choke” by sending multiple CCs. Adding more than two devices may be possible, but I was unable to test it out.


Thanks to the generosity of technically-minded folks such as those mentioned above, it’s easier than ever to get into DIY projects like the one detailed here. For such a minimal amount of money, I’m really pleased with this little black box. The fact that it runs on an open source platform means that it’s endlessly customisable (with the right code, of course). For a first time toe-dipper in the world of Arduino, it’s extremely encouraging. In the words of Alec Baldwin: “Go and do likewise, gents*!”

*and ladies, Alec.


18 thoughts on “DIY Time Part 1: Arduino USB Midi Converter

  1. Thanks for posting this. Forgive me if I am a little dense, but I need some clarification. I have a Casio Keyboard with just a usb out, which is intended to be directly connected to a computer. I would like to connect said keyboard to the midi in (5 pin) of another synth keyboard Will this project accomplish this goal? I can do the Arduino hardware stuff easy, but the midi signal stuff eludes me. Thank you for your time!

  2. Hi Robert- in a word, yes, it should work- provided that the keyboard sends midi over USB and is class compliant. Feel free to post the model of keyboard here if you’re unsure.

    • I followed your guide and everything worked like a charm. I did get the bidirectional_converter to work, I downloaded the latest midi library from and it compiled. The only thing I have to add at this point is that coding in a midi activity LED seems super helpful. I’ve been reading up on how to code this and I think I’m just about there. Thanks again for your guide, it’s the most straight-forward one I’ve found on the net.

      • Hi
        I’m in the same situation that you were and would like to know which board have you bought since on this site it shows two boards. All I want to do is have the same setup example you mentioned first.Thank you

  3. Hi
    This is new to me. This seems to be exactly what I’m looking for although you’ve got two USB and two MIDI ports on yours. All I need is to connect my controller with USB to a module with 5-pins. So which board must I buy.Thank you in advance.

    • In this instance- you need both an Arduino and a USB Host shield. The finished product will have two USB Ports- one to power or program the Arduino, and one ‘host’ port to connect your USB device to. If you only need the MIDI DIN output, only connect one DIN socket as described in Spider’s pdf. Hope that makes sense.

  4. Say i have a drum machine that spits out clock though midi. Would i be able to take that midi clock and use it as a sync signal for another midi device to run them in tempo? Or does it just work with Note on/off messages? I truly hope that the tempo clock follows…
    Cheers, cool guide.

    • In your example, I’m not sure where the USB converter is supposed to sit. If you’re just looking to convert USB midi signals to a 5 pin DIN midi output, then clocks should work as well as notes. It does depend a lot on the midi spec of each instrument though.

  5. Thanks for sharing the project! I am planning to buy QuNexus midi keyboard, do you think would this work with it?

  6. Hi, great tutorial! But i have a question. I have the two boards (Arduino and USB shield) but I dont understand how the two boards are connected. The USB shield is slightly different to the red one you have. I think that should work but I cant see in spider’s guide how to connect both of them. Can you help me? I guess that some pin number reference will be ok. Thanbks in advance!.

    • The shield I use stacks on top of the Arduino board. It may be that you need to solder some stackable headers to the top board. Have a search for ‘Arduino Stackable Headers’ and that should point you in the right direction.

  7. Have you to modifi the code? I’m going step by step and reading the V Guitar forum and I get an error in Arduino IDE. “MIDI was not declared in this scope” Any ideas? Thanks!

  8. Thanks for your answer! Libraries ok! I’m trying to control my korg kronos through a Novation Launchkey controller via the MIDI USB Host. I have all connected and when Uploading is done some CC is sent through the novation beacuse the instrument in the kronos changes and one note is played but then when I play the novation it doesnt work. Have you faced somthing like this? I’ve tried the other sketches and is the same.

  9. Hi and thanks for the tutorial. I followed it and made it working. Its really a joy, the same ready-made thing in market costs way too high. Only thing is that the MIDI-IN of Arduino. Most sites about Midi forces to install Opto coupler / isolator I.C in Rx Port for safety. Compulsory ,otherwise the RX port of Arduino is damaged. Can you please tell me which is the best Opto-coupler/isolator that works with arduino?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s