USB MIDI from scratch, how?

I've learned that Leonardo works great with USB MIDI. I have built two instruments that play nicely from a computer MIDI DAW. The DAW, be it Reaper or Musescore, sees the Leonardo as an external MIDI device.
I've also learned that same doesn't work with UNO. Leonardo has something that UNO doesn't have. But how does it actually differ? On what level? Is it a hardware thing that can't be accomplished with some software tricks? Like PWM can be accomplished with any pin, not only the ~ pins, with clever programming.
Sure any microcontroller can work with a proper MIDI shield, but I'm interested in the USB MIDI thing.

the difference is in the way the USB is managed. The Leonardo uses the ATMEGA32U4 and the UNO does not. (The Arduino Micro does if you are looking for another form factor)

the ATmega32U4 has built-in USB communication, eliminating the need for a secondary processor. This allows it to appear to a connected computer for example as a mouse and keyboard, in addition to a virtual (CDC) serial / COM port ➜ in your case it's used to appear as a MIDI device

If you really want to do this with UNO, you might want to look into vusb.

Your topic was moved to its current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

It will help you get the best out of the forum in the future.

Thank you

But note you loose the ability to upload code without re flashing the boot loader so it makes development a lot of a pain.

Here’s another one but consider @Grumpy_Mike warning

Really? It's been a long time since I last played with it, but I don't remember having to deal with all that!

It was gnawing at my brain, so I had to go check:

I downloaded the repository I linked above, and added it to Arduino IDE 2.1.0.
Without any modification, this library's implementation of VUSB does not work. The usbconfig.h file has the D+ and D- pins defined backwards. If you go to your Arduino\libraries\V-USB_Arduino_port\src directory and swap the D+ and D- pin definitions, it seems to work as intended.

I uploaded the MidiTest example sketch to my UNO, and connected the "2nd USB port" to my computer. Windows detected the device. I then opened up "MIDI-OX" to monitor the incoming midi messages. All the messages from the sketch seemed to be arriving as expected.

I then went back to the IDE and changed the code in the loop() method of the example. The changed code uploaded to the UNO with no issues. I then connected the "2nd USB port" again, and opened MIDI-OX. The new messages from the new sketch were appearing as expected.

As one final test, I opened the Blink example sketch and uploaded it to the UNO. There were no issues, and the LED is blinking as normal.


  • I'm not sure if the boot-loader issue discussed is explored with this quick test, but I didn't notice anything abnormal.

  • The library I linked earlier doesn't appear to work without manual modification.