Cheap DIY MIDI To USB Adapter

[Joonas] became frustrated with cheap but crappy MIDI to USB converters, and the better commercial ones were beyond his budget. He used a Teensy LC to build one for himself and it did the job quite well. But he needed several converters, and using the Teensy LC was going to cost him a lot more than he was willing to spend. With some tinkering, he was able to build one using an Adafruit Pro Trinket which has onboard hardware UART (but no USB). This lack of USB support was a deal killer for him, so after hunting some more he settled on a clone of the Sparkfun Pro Micro. Based on the ATmega32U4, these clones were just right for his application, and the cheapest to boot. He reckons it cost him about $5 to build each of his cheap USB MIDI adapters which receive notes and pedal data from the keyboard’s MIDI OUT and transmit them to a computer

Besides the Pro Micro clone, the only other parts he used are a generic opto-coupler, a couple of resistors and a MIDI connector. After testing his simple circuit on a bread board, he managed to squeeze it all inside an old USB dongle housing, stuffing it in dead-bug style.

The heavy lifting is all done in the firmware, for which [Joonas] used LUFA — the Lightweight USB Framework for AVR’s. He wrote his own code to handle MIDI (UART) to USB MIDI messages conversion. The interesting part is his use of a 32.15 kbps baud rate even though the MIDI specification requires 31.25 kbps. He found that a slightly higher baud rate fixes a problem in the AVR USART implementation which tends to miss consecutive bytes due to the START edge not being detected. Besides this, his code is limited in functionality to only handle a few messages, mainly for playing a piano, and does not have full-fledged MIDI capabilities.

We’ve featured several of [Joonas]’s hacks here over the years, the most recent being the Beaglebone Pin-Toggling Torture Test and from earlier, How to Turn A PC On With a Knock And An ATTiny.

The Perils Of Cheap MIDI Adapters

MIDI

[Arvydas] recently bought a Rock Band 3 Wii keyboard thinking it would be an excellent and very inexpensive (£9.99) MIDI controller. The keyboard has a proper DIN-5 MIDI out port, so theoretically the only thing needed to plug this into a computer is a USB to MIDI adapter. Unlike the keyboard, the MIDI adapter was a cheap piece of Chinese cruft, but given some ingenuity and a handful of components, he was able to get everything working.

The 30-year-old MIDI specification includes a few schematics on how to properly connect MIDI devices together. The most important part of these schematics is an optoisolater on the MIDI in, a valuable addition considering early MIDI keyboards cost thousands of dollars. It seems [Arvydas]’ MIDI to USB adapter didn’t include this vital component, instead replacing it with a simple resistor. Anything to keep costs down, right?

To get the MIDI adapter working, [Arvydas] headed over to Maplin and bought an optioisolator, With everything wired up on a breadboard, he got it to work and eventually transplanted the circuit to the adapter’s PCB.

It’s a great piece of work to get this MIDI adapter functioning, especially since it’s doubtful the cheap adapter would have worked with any MIDI device.