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 :)
What is the clock speed for this type of setup? Are you limited to the standard midi speed of 31kbaud, or can you use the full speed of USB?
ReplyDeleteBottleneck is that the arduino-side of the usb-midi converter sends/expects data at 31250baud. If it's in some way possible to write your own firmware and upgrade the converter, it may be possible to use higher speed, but that will not be an easy task.
DeleteThis works really well. I've done it with two different products now. I followed the information provided above exactly. Here are the two models I modified:
ReplyDeletehttp://m-audio.com/products/en_us/Uno.html
http://www.amazon.ca/MIDI-Cable-Converter-Music-Keyboar/dp/B001LJUVO4
Both work very well with no noticeable latency.
The Teensy does do Midi directly. You can set it to show up in windows as a midi device using the Arduino IDE. Then, it has some Teensy specific commands to punch out out midi data directly over the usb. Here is some info that Teensy provides
http://www.pjrc.com/teensy/td_midi.html
And yes, you can do potentiometers, pushbuttons, touch strips, etc...
This comment has been removed by a blog administrator.
ReplyDeletehello, nice work!
ReplyDeleteI'm trying to do the same project but I have some problems.
If i use a 330ohm resistor instead of a 220 what can happen?
I connected to the Arduino with this code http://arduino.cc/en/Tutorial/Midi?action=sourceblock&num=1
but it does not work.
When I connect it to the computer the midi chip emits a steady red light.
My computer recognizes it as "USB MIDI interface" and I tried to play sounds with fl studio 11 but does not work..
what am I doing wrong?
Thanks
however the chip that i bought is a little bit different than your, i've 5 pins on midi-side which are called "in+ in- G O+ O-" i connect arduino Vin to the "in-", arduino GND on "G" and arduino TX on "in+". is that correct?
DeleteBe careful that (too) cheap midi usb interface just aren't supported on any of the three major OSs i've tried. I had to buy another (branded,m-audio) one.
ReplyDeleteMy chip is a little different to the one on the pictures / schematic.
ReplyDeleteThe MIDI / Arduino side pins are labeled, there's only 5 and they might be in a different order:
0-
0+
G
in+
in-
Which connections do they correspond to?
I've accidentally found this post online:
Deletehttp://www.arvydas.co.uk/2013/07/cheap-usb-midi-cable-some-self-assembly-may-be-required/
Turns out our chip is missing some parts that need to be added to the board...
This is way too much for me, so I think i'll try the HIDuino option:
http://www.instructables.com/id/Turn-your-Arduino-Uno-into-an-USB-HID-Mididevice/
You CAN use the Arduino Uno's on-board USB port to send MIDI data to your computer. While you can send ordinary "Communications" serial data, it IS also possible for your computer to recognize this as MIDI messages IF you change the Arduino Uno's ATMEGA16u2 FW.
ReplyDeleteE.g. see: https://github.com/ddiakopoulos/hiduino
(Hiduino has a couple of bugs, but simple Note On/Off things seem to work.)
Beware. I bought one of these, and they will work for basic stuff. But once things like Midi Time Code come through to them they get confused and note on/note off start to not correspond - stuck notes and really weird stuff. Find if you are just playing around, but these cheap adapters can really bite you if you do anything more advanced.
ReplyDeleteWorks a charm. :)
ReplyDeleteHi!
ReplyDeleteThanks for the great idea, already got the parts and about to give it a shot.
One question: On the schematic you provided there are no markings on the midi side pins of the chip.
The markings I have are:
0+
0-
G
in+
in-
So the ground from the Arduino goes to G,
but where does the Tx wire from the Arduino go?
and Where does the 220 Resistor from the Vin go?
Thanks for the tutorial!
Eran.
great solution - will try it
ReplyDeletehttp://www.looping.me.uk/arduino-infra-red-midi-control/
I really like this idea, but there are some things I don't understand.
ReplyDeleteI don't understand why you have to remove any of the wires. Can't you simply plug the usb end of the coverter directly into your computer? I don't understand why you have to use a usb B plug.
Also, couldn't you plug the midi end of the converter into a female midi adapter that is connected to the arduino via breadboard?
I tried it this way, but couldn't get it to work. Please let me know if this makes any sense :D
Careful, I bought 2 of this MIDI to USB adapter cables and worked only one of them (20 euro), the othe, cheaper, is missing some components, example the optocoupler, 1 resistor and a diode. All is explained from this guy
ReplyDeletehttp://www.arvydas.co.uk/2013/07/cheap-usb-midi-cable-some-self-assembly-may-be-required/
This comment has been removed by the author.
ReplyDeleteVery clever solution - thanks! The USB-MIDI dongle that I've gutted is a slightly different version (same as shown in the post from Süleyman above), and the pins on the MIDI side are labelled IN-, IN+, GND (2 pins), D+ and D-. Are you able to advise to which of these pins the VIN (via 220 ohm resistor) is connected [IN- or D-?] and to which of the pins the TX is connected [IN+ or D+?]. Many thanks for any advice you can offer. I'm only looking for my device to be able to send out some MIDI sequences.
ReplyDeleteGreat idea, thanks! I just wondering why you don't put a 220 ohm resistor between tx of the arduino, and the adapter, like for a din connector...
ReplyDeletehola que componentes necesitaria para hacer esa pequeña placa?
ReplyDeleteWikindly | Trending Female Celebrities Biographies
ReplyDeleteI curious more interest in some of them hope you will give more information on this topics in your next articles. https://etcher.download/
ReplyDeleteYour style is very unique in comparison to other folks I ave read stuff from. Many thanks for posting when you have the opportunity, Guess I all just book mark this page. 메이저사이트
ReplyDeleteNice Article. Thanks for sharing this informative article to us. Keep sharing more related blogs.
ReplyDeleteVirginia DUI Attorney