Arduino UNO MIDI USB version 0.2

I've added MIDI IN support to the USB MIDI driver so now the UNO can send and receive MIDI messages from the host PC. The format of the data is the same as that described in the earlier post for the MIDI firmware.

The example sketch shows how to send and receive MIDI message.

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


morecat_lab (unauthenticated)
Apr 14, 2011


Just for your information/reference, I wrote a MIDI firmware for Arduino Uno, named 'Moco for LUFA' . The firmware just bridges serial midi to USB midi and vice versa. It works just as a bridge and thus is compatible with existing serial arduino MIDI library.


projectgus (unauthenticated)
Apr 15, 2011

Hi darran & Yoshi,

Do either of you think there is potential for a firmware which supports concurrent serial (or at least HID debug) & MIDI USB endpoints on a single 8u2? Are there enough resources on the little chip?

It'd be neat if the 8u2 could start up passing through serial, enabling normal serial programming, but switch to/from MIDI mode from the Arduino side (by sending particular character sequences) after startup.

I haven't had time to actually go and look at how plausible this is, myself, so I thought I'd ask. :)

- Angus

Apr 15, 2011

Hi Yoshi,

I added a link for MocoLUFA on the arduino playground here: I think we should create a page dedicated to LUFA firmware with links to help people find and use it.

Very cool that your solution works with the arduino MIDI library.


Apr 15, 2011

Hi Angus,

the problem with trying to make a combined firmware is that with DFU mode there is only 4KB of flash space available in the atmega8u2 for the firmware. The single purpose firmware takes up most of that. It might be able to be done if the full 8KB is used but the problem there is that you would lose the DFU firmware and not be able to update the atmega8u2 without resorting to an ISP programmer. I'm not sure if all three (DFU, serial, device) could be fit into 8KB, but its probably worth a look.

Nathan (unauthenticated)
Apr 9, 2012

Hi Darran,
Trying to load this onto my arduino uno r3, and cannot even seem to get my device to register, apparently DFY Programmer doesn't register atmega16u2? Do you have a suggestion for how to get this midi firmware on the r3 board?

Apr 11, 2012

Hi Nathan, you need to patch dfu-programmer to add support for the atmega16u2. Just two additional lines of code. I've posted some directions here:,92148.msg692133.html.

RANKO (unauthenticated)
Mar 28, 2013

Hi all, i 've load the usbmidi 0.2. hex on my uno 16u2 r3 wich is is recognized as midi device on W7 but not on XP( it appears like Generique audio driver and don t run as a midi device)
Do you have a suggestion, thanks a lot

Apr 21, 2013

Hi Ranko,

did you work out what was wrong? I have no problems running the usbmidi firmware with Windows 7, OSX 10.6 and 10.8, and Ubuntu linux 10.04 and 12.04.

RANKO (unauthenticated)
Apr 27, 2014

Well i work on W7 definitly, and i have finished a very complete control surface for cubase 7.5
Thank a lot DARRAN for this firmware ARDUINO MIDI. 0.2 HEX. It's perfect for my project.

Garth (unauthenticated)
May 29, 2014

Hi Ranko,

Im still very new at this. If you dont mind me asking, What controller did you make and what code did you use for the arduino ide ?

Thanks Darran for the valuable info

Garth (unauthenticated)
Jun 1, 2014

Hi... Does this code work for the new 16u2 uno board?

Lawrence (unauthenticated)
Aug 14, 2014

hi Darren,
if you want to print the MIDI message to an LCD what should the command be - lcd.print(midiMsg); ?

This is my sketch to do program change via usb-
void SendMIDI(byte number)
t_midiMsg midiMsg;
midiMsg.msg.command = MIDI_COMMAND_PROGRAM_CHANGE; = number; // Data 1
midiMsg.msg.data2 = 0; // Data 2
midiMsg.msg.data3 = 0;
Serial.write(midiMsg.raw, sizeof(midiMsg)); /* Send MIDI Message */

Marten (unauthenticated)
Nov 20, 2014


How can you change the velocity in the code using a distance sensor??

Hello (unauthenticated)
Feb 22, 2015

I have MIDISPORT 1-in/1-out MIDI interface also,
i have flexsensor that attached with arduino and data that come out from from arduino i want to send to MIDISPORT 1-in/1-out MIDI interface than to Computer ..
i have read so many codes but i did gt it ?

Please if u any how please sure with me
i am also new user for arduino

thank you so much!

Jens (unauthenticated)
Apr 8, 2015

I´m new into Arduino, and I have an Pro Micro that I want to use for a Guitar Rig Midi controller.

Can I use this bootloader?

Thanks in advance!

Jens (unauthenticated)
Apr 8, 2015

Sorry, I ment firmware :-D