Arduino USB MIDI Interface





Introduction: Arduino USB MIDI Interface

A few weeks ago I started working on a MIDI controller using Arduino and ATmega32. I did not completed projected yet. It is under development.

You can read the whole story here

But during experiments I realized that interface module can be a stand-alone project and can be used by those who are already working on similar projects.

The project was designed to use easy to find components.

Step 1: Components

  1. Atmega8 microcontroller
  2. Socket DIP28
  3. USB-B connector
  4. Polarised capacitor 10uF ~ 50uF
  5. Connector 5x2 pins (optional)
  6. Connector 1x4 pins
  7. Quartz 16Mhz
  8. Ceramic capacitors 33pF
  9. Resistor 2k2
  10. Resistors 68 ohm
  11. Zenner Diodes 3V6
  12. Proto board

Step 2: Schematic

Circuit diagram is simple.

It is a standard schematic used for implementing USBasp programmer.

The difference is in the firmware that we will put in ATmega8.

Step 3: ​Installing the USB Connector

To mount the USB connector we need to make two holes of 2-2.5mm.

Step 4: Mounting Resistors

Step 5: Mounting Zener Diodes

Step 6: Mounting DIP28 Soket

... and capacitors and 16 MHz Quartz.

Step 7: Module Completed

Module is finished after installing 4pins connector.

From left to right:

  • Pin 1 - Gnd
  • Pin 2 - Vdd
  • Pin 3 - Rx
  • Pin 4 - Tx

I have not mounted connector 5x2pin ISP because I already had the possibility to write the firmware on a module made previously.

If you can't write the firmware outside the project will have to mount the ISP connector(5x2pin) and make connections according to schematic.

Step 8: Burning Firmware

To write the firmware for ATmega8 we need a programmer. The one in the image is a USBasp. Of course you can use any other compatible programmer. contains only hex file. contains entire AVR Studio 4 project.

The firmware is a slightly modified version of MOCO/MICO – USB to MIDI Converter.


Step 9: Using With Arduino

Now we can make connections between the Arduino board and USB module..

In fact it is simple. Just plug the serial ports of the two microcontrollers and GND:

  • RX from Atmega8 to TX of Atmega32 (or TX of Arduino)
  • TX from Atmega8 to RX of Atmega32 (or RX of Arduino)
  • GND from Atmega8 to GND of Atmega32(Arduino)

In my set-up I am not connected VCC because USB interface is powered by USB port(or HUB) and Arduino(Atmega32) is powered separately.

Now we can make first test with the Arduino IDE. As you can see it works with the standard example File>>Examples>>Communication>>MIDI.

void setup() {
// Set MIDI baud rate: Serial.begin(31250); } void loop() { // play notes from F#-0 (0x1E) to F#-5 (0x5A): for (int note = 0x1E; note < 0x5A; note ++) { //Note on channel 1 (0x90), some note value (note), middle velocity (0x45): noteOn(0x90, note, 0x45); delay(100); //Note on channel 1 (0x90), some note value (note), silent velocity (0x00): noteOn(0x90, note, 0x00); delay(100); } } // plays a MIDI note. Doesn't check to see that // cmd is greater than 127, or that data values are less than 127: void noteOn(int cmd, int pitch, int velocity) { Serial.write(cmd); Serial.write(pitch); Serial.write(velocity); }

You can also install this library: It is very helpful for making a MIDI controller with Arduino.

Step 10: Screenshots

After I burned the firmware in ATmega8 and made connections, I connected the USB cable to the computer.
Windows immediately detected the device and installed the standard drivers. No other drivers is required (tested on Windows7-64bit and WindowsXP-32bit).

I also did tests with Fl Studio and Traktor.



  • Science of Cooking

    Science of Cooking
  • Pocket-Sized Contest

    Pocket-Sized Contest
  • Spotless Contest

    Spotless Contest

We have a be nice policy.
Please be positive and constructive.




as fer as i know i solder the connections correctly. also set the fuse bit CE,D9. [Atmega8a] install the hex file with ISP, using 16MHz crystal as shown.

but when i try to connect with pc. usb malfunctioned. any suggestion??

Hi, thank's for your nice work. I have an CP1202 and I don't find how to program my Atmega8 with this hex, do you have a link where I can learn how to do please ?

CP1202 is a usb to serial/uart converter. You can use this to program an Atmega 8 after you burn a bootloader with a "real" programmer... like USBASP.

But in this case, this project it is not made compatible with a bootloader. So you will need a proper programmer anyway.

At you will find usbasp with price starting at $1.20 with free shipping ... (which is amazing)

Here are some links about usbasp and avrdude:

:) ...have fun !

Note that USB specification is very strict when it comes to voltages and timing. This can easily explain the unreliable and unexpected results that are mentioned in some prior comments.

Note that USB specification is very strict when it comes to voltages and timing. This can easily explain the unreliable and unexpected results that are mentioned in some prior comments.

Amazing ! but...just one question, please. How can I send one note, yes, just one note to a programlike FL Studio and others, through a simple push button ? can you help how to make something like this , please ?

Very nice tutorial, thank you !


Thank you for comment! At step 9 is an example taken from Arduino IDE which is exactly what you need ... send one note to PC.

you can also look here: I used this interface to send commands to FL Studio.

by the way... I also tested this interface with Linux and FLStudio with WINE... and it's working also with LMMS: in windows and linux...

also I managed to read 15 rotary encoders with atmega1284 and this interface... latest results here:

This last article is the core for a new instructable that is not published yet...

Thanks for the quick response. I apologize, because I had tried the example from step 9 , and I do not communicated to you, sorry. This example from step 9, is making the notes follow automatically. I wanted something I even pressed the button and the note was played. I'll see your other instructable. I believe it will help me a lot.

Thank you very much !

Hi. If i don't have diode 3.6v. Can i use diode 3.3V 0.5W or diode 3.6V 1W??

I think is better to stick with 3.6V, anyway at first tests that I made a few years ago I use 3.3v diode and it worked (somewhat unstable)