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.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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.

Tech Contest

Participated in the
Tech Contest

1 Person Made This Project!


  • CNC Contest

    CNC Contest
  • Make it Move

    Make it Move
  • Teacher Contest

    Teacher Contest

34 Discussions

ultimate virus

2 years ago

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??


2 years ago

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 ?

1 reply

Reply 2 years ago

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 !


3 years ago

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.


3 years ago

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.


3 years ago

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 !


2 replies

Reply 3 years ago

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...


Reply 3 years ago

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 !


3 years ago

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

1 reply

Reply 3 years ago on Introduction

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)


Reply 4 years ago on Introduction

I assembled device, Win7 defined and put the driver, but when I look through MIDI messages to MIDI OX, are continuous errors and incorrect messages, tell me what's wrong?


Reply 4 years ago on Introduction

After we made several experiments with this interface, I noticed that do not work well with SoftwareSerial and MIDI Arduino libraries...

I have used MIDI library only with hardware serial...Perhaps there is a solution ... but should be reviewed/analised code for: MIDI library, Software Serial, MidiShield, and main Arduino program (sketch)...

So, for further experiments I give up using MIDI library. Instead I make my (little)code for sending MIDI messages with this interface.

This interface works well for experiments/projects which I am working... (I have no other MIDI USB interface).

You can read this instructable: where I successfully used this interface. (not with MIDI library)

You can read also this article where I read 15 rotary encoders with Atmega1284 and this interface... and I manage to make a small MIDI controller in this way...

also I use this interface in other project with CD4067 and 32 (up to 128) potentiometers and Atmega32. I also tested with Arduino Mega2560 and SoftwareSerial (and hardware serial).

This is the code that I use to send midi messages:

voidSendMIDIControl(bytechannel,bytecontroller,bytevalue){//0= channe l; 1=channel 2; ...
//midi data first bit allways 1, + 011 control change command + midi channel
//midi data first bit allways 0
//midi data first bit allways 0
// write midi data in order: channel, controller, value

... here in comment is not too readable, but you can read the two articles above... and there you will find the code.

And if the problem persists, do not hesitate to contact me again.

Good luck!


Reply 4 years ago on Introduction

Sad about this. It must be popular request and i didn't found any ready-to go device. Do you will release toolbox and/or library based on your code?


Reply 4 years ago on Introduction

I just returned from a long journey... I'll go back with an answer in a day or two


4 years ago on Introduction

hello! I tried to make this project with an atmega8a, but it doesn't work: if I connect the shield to pc I don't see any device. I can program the microcontroller with the usbasp (in slowclock mode) and checked all the connection... thanks in advance

1 reply

Reply 4 years ago on Introduction

I don't think that has to do with differences between ATmega8 and ATmega8A... If you are sure the connections are correct / according to the scheme... I don't see a cause for that... You set fuse bits for 16MHz? I put here fuse values which are read exactly from a functional module(I use it for over 6 months
for other experiments with different MIDI modules).



Setting fuses is mandatory in order to run at 16Mhz... hex file is compiled for that speed...

After that ... if not working: Check that you have correctly
identified pins from USB socket... especially D+ And D -



Amazing Instructable!

I made one and programmed atmega8. Everything worked just fine but when I connect my usb module to computer, it shows usb device not recognized(code 43 error). How to solve that problem? What could be the probable error? Please Help!


5 years ago

the only avr available in my place are 88 168 and 328 can i use 88 instead??

1 reply

Reply 5 years ago on Introduction

I do not have handy an atmega88, so I worked "blinded". Pinout is the same but I have to recompile and change some code in project.

This should work but I can not guarantee until do a real test. You have to try.

Download zip file attached to this comment, locate the file MidiShield1.hex andwrite it in atmega88. Still use 16MHz quartz.

And please tell me if it worked. :) If ok I will update the article.