2
\$\begingroup\$

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 10x8 (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.)

\$\endgroup\$
  • \$\begingroup\$ We aren't here to just give you a link to another source. We are also not designed for open ended brainstorming. But with that said I think there is enough here that it can stay open for now. \$\endgroup\$ – Kellenjb Dec 24 '11 at 13:45
1
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ I see. I guess I'm going to reevaluate my 18F decision. It was the library [dis]organisation that threw me off. I'd thought so many chips would have USB support by now that my prejudice wouldn't be that much of a problem. \$\endgroup\$ – aib Dec 24 '11 at 22:48
  • \$\begingroup\$ @aib - Sure, lots of ICs do have usb support. USB is still a PITA, though. \$\endgroup\$ – Connor Wolf Dec 25 '11 at 3:44
  • \$\begingroup\$ USB is a large and complex subject, and can take quite a while to get up to speed with. Having said that Microchips stack/examples are pretty good as offerings go. If you are not doing something too "different" then you can often just adjust one of the examples to get started. I just took a look on my laptop (latest application libraries) and there is a MIDI example MPLAB project for 18F4550 and a few other 18F's. Here is the link for the stack/examples. \$\endgroup\$ – Oli Glaser Dec 25 '11 at 7:25
4
\$\begingroup\$

If easy is what you're after then I would seriously recommend the Arduino UNO and an ICSP programmer. The Atmel 8U2 chip that powers the USB can be re-flashed with a firmware that emulates a MIDI device (available here).

The number of IO lines can be expanded using any number of methods including simple shift registers, or SPI solutions like the Microchip 23S17 16-port IO chip, or things like 4-to-16 decoders (ideal for "scanning" matrix lines).

\$\endgroup\$
2
\$\begingroup\$

There is a project called V-USB-MIDI, based on Atmel AVR ATMega16 and Objective Development's software-only USB firmware.

The latter I've tried myself in a few simple projects (using ATMega chips, e.g. ObDev's Metaboard and a few custom devices). It is fairly simple to use V-USB if emulating USB HIDs, like mice and keyboards.

The former, however, I haven't tried personally yet. I do have a broken synth keyboard lying around, so it'd be swell if you posted the results, independent of your final choice. :)

\$\endgroup\$
  • \$\begingroup\$ I'm going the 18F way because I've used PICs in the past and nothing else seems to be much easier while dealing with USB. I'll post the results. \$\endgroup\$ – aib Dec 27 '11 at 6:26
1
\$\begingroup\$

If your idea of an "easy USB interface" excludes the 18F PICs, then a 'ready made' USB chip (something like an FT232RL) seems the only solution. Add a microcontroller of your taste and start programming. 1 MHz is peanuts for all modern microcontrollers, and USB provides 5V to run your uC (unless you want a 3V3 chip, in that case add an MCP1702 or the like).

\$\endgroup\$
  • \$\begingroup\$ Can a FT232RL be set up to enumerate as the MIDI class (if there is such a thing, if not, then it doesn't matter)? I know that chip has configuration EEPROM, but didn't think it was that flexible. \$\endgroup\$ – Olin Lathrop Dec 24 '11 at 20:48
  • \$\begingroup\$ AFAIK not, but I did not read in the question that that was a requirement. If it is, the guy definitely needs an USB uC. But he has decided that an 18F is out of the question, and I don't see how any other uC would be easier. \$\endgroup\$ – Wouter van Ooijen Dec 24 '11 at 22:37
  • \$\begingroup\$ I think I'm going to go with 18F after all (see my comment to @Olin Lathrop's answer for the rationale). But thanks for the FT232R suggestion, I'll look it up for future projects. \$\endgroup\$ – aib Dec 24 '11 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.