MIDI to USB interface

Hello everyone,
How can a MIDI to USB interface (for a keyboard) be made using Arduino ATMEGA 8 board?

Teensy 2.0 uses ATMEGA32U4 and has a reconfigurable native USB port which can be set to be USB-MIDI. Add two DIN sockets, an optocoupler and some resistors for MIDI In and Out, connect these to its USART serial (which is not shared with the USB, unlike official Arduino boards) and you are all set.

While it might be fun to make your own, it is probably cheaper to just buy one:

(Click the "midi only" on the right sidebar.)

A related question...

I have a relatively new Uno (Rev 3 with Mega 16u2)...
In order to use as a usb device (midi) I need to reprogram the 16u2 yes?

Then, if I want to modify the sketch and want to upload changes, I need to reset the 16u2 code first?

Would this alternative work: (using two unos)
I could program uno A as the usb midi device and use uno B as the programmer for the AMEGA328.. that is upload the new/editerd sketch?

Also...
I just need the new HID library, I don't need a shield of any type?

MikeOToole:
In order to use as a usb device (midi) I need to reprogram the 16u2 yes?

Yes.

MikeOToole:
Then, if I want to modify the sketch and want to upload changes, I need to reset the 16u2 code first?

Yes, if you want to upload code over USB. Or you could program the Uno using an ISPprogrammer (as you mention, that could be another Arduino). Or you could use an Arduino-compatible that doesn't require you to flash and reflash a USB controller chip all the time, because you simply select the type of native USB device you want from the IDE. (Hence my suggestion of a Teensy, in the post above).

MikeOToole:
I just need the new HID library, I don't need a shield of any type?

Yes.

Thanks Nantonos... Don't have a credit card so I need to buy everything locally... haven't found a supplier for the Teensy in Ireland... ;(

You can get a Teensy from the Netherlands, using Paypal.

http://www.pieterfloris.nl/shop/category.php?id_category=45

Programming the 16u2 chip is possible, but quite difficult. With the 16u2, you need to work with non-Arduino software that's quite complex (eg, LUFA) and you can't use Serial.print().

With Teensy, you just select MIDI from the Tools > USB Type menu. It's just like use an Arduino, except it's a USB MIDI device. While working on your sketch, Serial.print() still works perfectly fine to the Arduino Serial Monitor, because it emulates a serial channel for you to make things as easy as you'd expect using the Arduino software.

"Franky" is currently working on Version 4.0 of his great Midi Library : https://github.com/FortySevenEffects/arduino_midi_library/tree/release/4.0 ... This will enable SoftSerial (so you can use almost any digital pin for Midi on all Arduino Boards) and also USB/Midi is planned / in development ...

greets,
Bruce