[Robson Couto] recently found himself in need of MIDI interface for a project he was working on, but didn’t want to buy one just to use it once; we’ve all been there. Being the creative fellow that he is, he decided to come up with something that not only used the parts he had on-hand but could be completed in one afternoon. Truly a hacker after our own hearts.
Searching around online, he found documentation for using an ATtiny microcontroller as a MIDI interface using V-USB. He figured it shouldn’t be too difficult to adapt that project to run on one of the many USBASP programmers he had laying around, and got to work updating the code.
Originally written for the ATtiny2313, [Robson] first had to change around the pin configuration so it would work on the ATmega8 in the USBASP, and also updated the USB-V implementation to the latest version. With the code updated, he programmed one of the USBASP adapters with a second one by connecting them together and putting a jumper on the J2 header.
He had the software sorted, but there was still a bit of hardware work to do. To provide isolation for the MIDI device, he put together a small circuit utilizing a 6N137 optoisolator and a couple of passive components on a piece of perf board. It’s not pretty, but it does fit right into the programming connector on the USBASP. He could have fired up his PCB CNC but thought it was a bit overkill for such a simple board.
[Robson] notes that he hasn’t implemented MIDI output with his adapter, but that the code and the chip are perfectly capable of it if you need it for your project. Finding the schematic to hook up to the programmer’s TX pin is left as an exercise for the reader.
If you don’t have a USBASP in the parts bin, we’ve seen a very similar trick done with an Arduino clone in the past.