USB devices are so common nowadays, wouldn’t it be nice to use one with your homebrew electronics projects? I wanted to use my compact USB-MIDI keyboard with my homebrew synth circuits. It seemed a simple enough prospect at first – listen to the data output, press buttons, note the changes, and then program a microcontroller to turn those changes into something I could use (like basic serial MIDI data).
After a little investigating, I learned a bit about how USB works and that I’d need some extra hardware capable of playing the role of “USB Host” (a job normally left to a full computer) in order to properly work with my keyboard. Enter the USB Host Shield from Circuits@Home. This Arduino compatible shield uses a MAX3421E peripheral/host controller + supporting code library chip to quickly solve my ‘USB-without-a-computer’ problem.
I used the examples included with the shield’s Arduino library to gather some info from my USB-MIDI keyboard (an Akai LPK25) and then plugged those values into one of the included demo sketches. After figuring out what messages I was receiving, I redirected those bytes to an outgoing serial connection, and voilÃ – a USB-MIDI to MIDI converter was born!
I did run into a few hiccups in the process, but once I was able to actually read the output from the keyboard’s USB port, I simply applied the basic hacking technique of pressing buttons and observing results. HexDecBin came in very handy for the many binary to decimal conversions I made along the way.
Update: Almost forgot – the sketch I wrote for use with the LPK25 can be found here