Electronic – Converting old organ keyboard to MIDI

microcontrollermidi

I have a very old keyboard, a CASIO MA-100 that I want to convert to a MIDI keyboard:

CASIO MA-100 Keyboard

Being a programmer and a digital electronics enthusiast, I know how to do it, but I could use some help to save time.

I guess the biggest issue is choosing a µC. Something with a USB interface* would be great, something that can also be powered by USB, even better. Then there's the issue of talking MIDI or MIDI-over-USB. I don't know how hard they would be, but I could probably do with some already written code there, too. (Unless they're very simple and don't need much testing.)

I looked around some electronics project sites this morning, trying to find some open source MIDI or MIDI-over-USB controller firmware, but couldn't.

I did find some Arduino projects, but a prototyping board seems a bit overkill for such a simple project.

The key matrix is 10×8 (10 select in * 8 data out), simple boolean logic, no velocity data. (Though two select lines are easily expendable.)

So I guess my simplest option would be a ~1 MHz µC with 8 input, 8 output pins and a serial buffer (+I/O pins) for MIDI. My best would be a project called "USB MIDI device firmware for Make SeriesXX microcontrollers."

Any ideas?

*: An easy USB interface, i.e. not PIC18. (Edit: This was a simple prejudice arising from the state of the organisation and documentation of the PIC USB framework a few years back. I guess it's time to break it.)

Best Answer

Sounds like a PIC 18F2550 is just the thing, or maybe a 18F4550 if the extra I/O lines are needed. I don't know why you say a PIC 18 is not easy. You say you are a programmer, so I don't see what you're afraid of. Perhaps nobody has done a MIDI USB interface ready for you to add the keyboard scanning code to, but certainly there are various examples of the basic USB driver out there. Microchip has some code, and so do I. My 18F USB firmware is available from the downloads page, and fits into our PIC development environment.

I've never done a MIDI device, but I sortof vaguely remember there is a USB class standard for that. If so, then it's really easy since you don't have to write a host driver and it will work with any OS that implements that USB class. All you have to do is look at the class definition, fill in the right enumeration data in the include file for that purpose, then send/receive data over the appropriate endpoints according to the standard.

Any other microcontroller will require something similar. Again, short of finding free USB MIDI firmware out there (which you say you can't find), you need to do pretty much what I said above regardless of what flavor microcontroller you use. USB is USB, so all the USB device peripherals in microcontrollers do pretty much the same thing with only a few details different.