A lot people use arduinos as a starting point for diy midi controllers. A perfectly reasonable assumption many of them make is that you can use the on board usb port to send midi data to your computer. While you can send serial data, it is not possible for your computer to recognize this as midi messages right out of the box.
One popular way around this is to have a piece of software running on the computer which listens for incoming serial data from the arduino and passes the midi data on to the appropriate places. Various methods exist ranging from running a Max patch listener to writing and installing custom drivers. There is a lengthy thread on the arduino forum explaining the issue in depth as well as what poeple have done to get thier projects to work.
I wanted my devices to be able to work on any machine without first having to install special drivers or running separate programs.. It seems cleaner and more straight forward that way.. plus I am lazy and installing drivers is boring.
While looking for options, I stumbled on this ridiculously cheap midi-usb converter cable and got the bright idea to just embed the whole thing in the controller.
The set up is pretty straight forward... you basically just need to bypass the cables and wire the arduino directly to the circuit board inside. The final product is plug and play, powers the arduino, and fits nicely inside your enclosure.
To begin, pry open the enclosure and disconnect the cables. You could make your life easier by leaving the usb cable connected and just have the cord sticking out of your project, or remove it and wire up a usb socket. Either way, the important part is that little green board in the center. Midi data goes into one side and midi-over-usb magic comes out the other. The chip on board will be recognized as a usb midi device when its connected and use your computer's native midi support. Neat-o.
As far as the arduino is concerned, it is just sending straight midi, so the circuit is the same as if you were just connecting a midi socket. Of course, instead of connecting to a socket, you connect to the midi side of the board like so:
The darker lines are all thats needed if you are going to leave the usb cable attached. Note the line from the usb side reaching over to the arduino Vin for power. The rest are if you want a usb socket instead of the dangling cable (the rectangle on the right is a type b usb socket shown from the top).
Thats about it. This is set up just to provide midi out from the arduino, although midi-in would just involve another wire from the board to the Arduino's Rx pin.
To test everything out, load up the midi example that comes with the Arduino environment, plug in the usb and let it rip. If it doesn't work, you probably messed something up.. good luck.





I'm going to give a go as soon as the cable arrives. I have been fiddling with a drivers and such (on linux) to do this with some success (ttymidi) but everything is still too finicky for me......if this just works then I will be a happy man.
ReplyDeleteThanks for the how to.
Graham
I don't suppose you would be able to use the new midi cable as the programming cable for the arduino as well? I imagine that if possible it would require a little more trickery?
ReplyDeleteyou can use a spdt on on switch (thats the kind with 6 pins, its basically 2 switches in the same housing side by side)with the white and green data lines from the usb that goes out to the computer on the middle two pins of the switch so in one position they connect to the internalized midi board and in the other they connect to the arduino's usb port. and of course the power wires can be connected to both simultaneously no switch needed
DeleteIs the line from the USB to Vin used to power the Arduino?
ReplyDeleteThanks,
Ben
Graham:
ReplyDeleteI couldn't figure out a way to do that.
Ben:
Yea, the arduino is powered off the usb.
Thanks very much for this information. Tom.
ReplyDeletethank you!!!!!
ReplyDeletedude, that's genius! I need to keep this article in some safe place for my next DIY project
ReplyDeletevery interesting!! but does it only work for "on/off" signals or can i build a midi potentiometer to control volume with it?
ReplyDeletebye!
stefano
minidex@hotmail.it
So what would happen if I did this with a Teensy and connected the power line to the Teensies 5v?
ReplyDeleteWhy is the vin needed for power anyways? Would the 5v not work?
ReplyDeleteThanks for helping me out :)
this is so ridiculously straightforward....brilliant idea, thanks a lot!
ReplyDeleteStefano,
ReplyDeleteWhat data you choose to send is up to the hardware and your code.. Hooking a pot up to one of the arduino's analog ins and converting the 0-5v reading to a 0-127 value would do the trick.
Ben,
I'm not too familiar with Teensies, but I thought that they could do direct midi over usb without all this mess..
The vin is used to power the arduino from the USB. You don't need to plug the arduino in.
Thanks for the comments.. I have some more projects to share pretty soon..
Nate
Hey, i'm trying to set up my arduino to use a photosensor as a Midi CC sending it using your contraption above to the computer, to hopefully use with Live. can anyone help me out with a sketch for this?? i suck at coding.
ReplyDeleteany help would be awesome!
cheers
Bodie
Currently I'm trying just one potentiometer. And the code works great but when I turn my potentiometer all the way to the off position the whole board turns off. I was wondering if you have run into that problem?
ReplyDeleteBy the way I have the whole thing wired up how your diagram depicts it. My potentiometer has one terminal plugged into the 5V terminal on the arduino, the middle one is on the analog in pin, and the other one is connected to ground.
Thanks
Can you please share you're code on this one? Cheers!
ReplyDelete"midi-in would just involve another wire from the board to the Arduino's Rx pin"
ReplyDeleteWhich pin on the midi-usb converter gets connected to Rx?
This is great. I have seen other projects which involve re-flashing the USB controller on the Arduino to do class-compliant MIDI but this would allow the built-in USB to stay unaffected. I assume you could also wire a real MIDI IN/OUT connector and handle duplicating incoming MIDI messages to both the physical and this USB MIDI port. Nice possibilities.
ReplyDeleteIs there an issue with wiring up a physical MIDI port in parallel to this adapter?
Thanks! Glad you liked it. A parallel midi port works fine as far as I could tell.
ReplyDeleteSo cheap and simple! Thanks for the guide! I've gone and picked one up from ebay for $7AUD :D
ReplyDeleteI've got my arduino controller sending midi notes via serial so your little trick should remove the need for the serial-midi software I've been using.
Thanks again!
Superevensteven
can u mail me the shemetric of the above circuit????
ReplyDeleteharishaq@msn.com
Helped me a lot with my midi-controller! Thanks!
ReplyDeletesuch a good idea, glad you posted this. Thanks!
ReplyDeletehi,
ReplyDeletei am using this http://starfiretech.wordpress.com/2009/12/08/simple-arduino-midi-controler/
and for midi transmission i am using your exemple, but when i do midi learn its not working very well, can you help me plz?
Awesome Awesome Awesome !!!
ReplyDeleteThe simplest solutions are usually the best
Thanks for this :)