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