Arduino UNO USB MIDI firmware

I've put together a basic USB MIDI driver for the UNO's atmega8u2. I've tested it using the demo sketch below with GarageBand and it seems to be working well. By flashing this firmware onto your UNO's atmega8u2 you can turn the UNO into a USB MIDI device. See my earlier posts on how to load the firmware via DFU mode.

The MIDI driver expects to receive a serial message with the following format:
Byte Description
0 Command: E.g. 0x90 Note On, 0x80 Note Off.
1 Channel: 1 to 16
2 MIDI data byte 2. Depends on Command, for 0x80 and 0x90 this is the Pitch values 1-127
3 MIDI data byte 3. Depends on Command, for 0x80 and 0x90 this is the Velocity values 1-127

The serial port should be configured for 115200 baud.

Here's the firmware files, source, and example sketch to send 5 notes to the host.

Download file "Arduino-usbmidi-0.1.hex"
Download file "Arduino-usbmidi-0.1-mega2560.hex"
Download file "arduino-usbmidi-0.1.tar.gz"
Download file "midi_usb_demo.pde"

More detail on the MIDI messages can be found here at

More detail on the MIDI USB interface standard can be found in the MIDI 1.0 Specification.

You can download a copy the USB Serial firmware here: Arduino USB Serial firmware. You'll need to replace the MIDI firmware with this whenever you want to upload a new sketch. Flash this by putting the board in to DFU mode and using dfu-programmer or flip.


gopiballava (unauthenticated)
Apr 5, 2011

Wow! That worked! Thank you! My iPad now sees my Arduino :)
I tried to get the toolchain stuff working, but there were so many different "make some changes, they're not documented" style comments that I was about to give up.

One thing I was thinking might be interesting: iPad MIDI "transparent, but not" mode. By default, it behaves just like normal. However, you send a special command, and it maps MIDI commands into standard serial commands, and the reverse.

You have a library on the iPad which mangles the bytes you want to send and encapsulates them into MIDI message.
eg: If I want to send "Hello, World" out the serial port, I send a specific sequence of MIDI key events. The reverse would also be true.

This would allow for an iPad app to do generic bi-directional serial I/O with an Arduino - and would also let an app program new sketches.

(MIDI devices can be used without Made For iPhone licensing / certification...hence the workaround)

gopiballava (unauthenticated)
Apr 5, 2011

Is it bi-directional? The RX LED seems to be constantly glowing, and it doesn't seem to have any data when I try to send MIDI commands out.

Apr 5, 2011

Hey gopiballava, good to hear that its mostly working for you. I haven't done anything for the rx direction - the firmware just receives the data and drops it. I'll see if I can get something put together tonight that would be usable.

As far as loading sketches goes, I'm not sure that that will work without some additional support in the MIDI firmware.

Apr 5, 2011

Gopiballava, I have a hex file that should work bi-directionally, I can't test it until I get my Arduino back from my coworker tomorrow. If you send me your email address I'll send you the hex file to try out. My email is darran [at] hunt [dot] net [dot] nz.

I will show this on my next Ardunio Workshop for musicans. (unauthenticated)
Jun 6, 2011

Thanks for the great work. Will show this idea during my next Arduino Workshop to give a view into the future...

Victor (unauthenticated)
Jun 9, 2012

Hi, so where are we today? Is it possible to make Arduino a usb device?

Magic (unauthenticated)
Jul 1, 2012

Thanks Darren ! This was the easiest way for me to get the arduino to appear as a MIDI USB device.

Jul 9, 2012

Hey Magic, cool that its working for you. Let me know if you do a write-up on your project.

fxw (unauthenticated)
Jul 12, 2012

Hi, and Thanks !
arduino uno r3 appear as a MIDI USB device. But, when i try to send midi data (0xB0, 0x01, 0xVV), arduino send something like that : 0xB0, 0xB0, 0x01, 0xB0, 0xVV, 0xB0, 0xVV....

here is the code i sent (very simple !) :

void setup() {

void loop() {
for (int VC = 0x00; VC < 0x7F; VC ++) {



nan (unauthenticated)
Sep 29, 2012

Disable MIDI thru in midi.h

Soranne (unauthenticated)
Jan 1, 2013

Any version for the Atmega 16U2 (arduino uno r3) ?

Jan 20, 2013

The 8U2 version will work on the 16U2 also.

Ranko (unauthenticated)
Mar 28, 2013

Hello it effectively works with the 16U2 on W7 as a midi device but WITH XP it works like an audio device so the midi don ' t appears..

John M (unauthenticated)
Jul 23, 2013

Any chance of getting this working with MIDI SysEx (more specifically MIDI NRPN messages)?

Karím (unauthenticated)
Aug 4, 2013

Does it work with the ATmega32U4 of the Arduino Pro Micro? Great work btw! Thank you.

Alex K (unauthenticated)
Jan 15, 2014

Hi Darren.

Did we get the Bi-Directional code working?


chrisbee (unauthenticated)
Mar 6, 2014

i can't get it working. i loaded the .hex file (both hex files above are the same by the way) onto the 8u2 with my stk500 programmer but i don't know if i should change the fuses, and the computer does not recognize it as a USB device. help?

big emlak (unauthenticated)
Apr 19, 2014

Expert5th (unauthenticated)
Aug 24, 2015

Thanks for all your information, Website is very nice and informative content.

Expert5th (unauthenticated)
Aug 24, 2015

This article is really fantastic and thanks for sharing the valuable post.

Expert5th (unauthenticated)
Aug 24, 2015

Thanks for post this helpful post - Please visit for More information about -