Suggestions on modifying M-Audio Keystation 49es with Arduino

I am working on what I am probably wrongly thinking is a fairly basic first project, an integration of an Arduino controller and a “dumb” midi keyboard controller. I started looking into this last year but I was being overly ambitious and when it came time to actually start turning the ideas into reality I realized I had absolutely nothing but ridiculous pipe dreams.

Now that I have done a good bit of research and honed in on one thing to start with, my idea is to take the keyboard and mount two rows of LEDs (Green and Red) so each key has two lights above it. Stage one of this project is going to be just to this, wire up the lights to the Arduino and then write a program that would let me select a chord somehow (either a screen with very basic choose a chord, choose a scale selections) and the lights above the first chord would turn green and the next chord up and down from it would light the red lights. Pretty simple code wise but I want to get to this point to know I can do it and then add some additional components in the next round.

The programming part I am not worried about and fortunately I even found some projects others have done that I can use as the base for mine. Where I am looking for some guidance is on the hardware side mainly for the LEDs. Since there will be so many of them, 98 total, I am assuming I will be getting into multiplexer territory? Or is there a better solution when working with a large set of LEDs like this? As for wiring all of it, is there a wire harness or ribbon cable out there that would make this more manageable? Fortunately the controller case has tons of room in it if I end up having to rely strictly on running lots of wires but in the interest of keeping things tidy I would want to section off the keyboard by octave or something... Suggestions are welcomed here!

Last question I am curious about is if it would be worth salvaging the controllers existing connections somehow. It has a USB 2.0 port which would be super swell to tie into the Arduino for quick programming access since the actual controller is going to be mounted under the deck for the keys and won't be easy to get to without lots of case modifications. It is powered via 9v ac adapter and the actual port is as standard as they come. I need to get a good multimeter reading of what the controller draws by itself but assuming my mod doesn't bring the power draw above 9v I could just tie into this for power right?

I'm sure I'll run into more questions add I go, but for now if anyone has some thoughts or suggestions on getting the LEDs wired up in a manageable fashion I would be greatly appreciative! Thanks!

Edit: forgot to mention that when I removed the key deck, it uses a ribbon cable that connects back to the power supply and the USB midi connections. Is there a way I could tap into this harness and capture the key strokes on the way to the midi output in order to manipulate it?

Or is there a better solution when working with a large set of LEDs like this?

Yes, use addressable LEDs.
Normally these come in a strip but you can get them in individual packages like normal LEDs.
However do not use the Neopixel ones, use the ones known as Dot Star, these are Adafruit names for a specific group of LEDs.

The reason not to use Neopixel ( WS2812b types ) is that it takes precise timing to delver the data to them and this requires that the libiary doing the data transfer turns off the system interrupts. This in turn stops MIDI data being received so MIDI messages are missed. The dot star type do not suffer with such a problem as their data transfer can be interrupted with no ill effect.

Any keyboard with a USB MIDI interface is hard to connect to the Arduino as you need a USB host shield. Keyboards with a 5 pin MIDI interface are simple because these are just serial signals.

Is there a way I could tap into this harness and capture the key strokes on the way to the midi output in order to manipulate it?

There may be but it depends on the entire circuit of the keyboard which I suspect you do not have. However it is doubtful because the USB connector will not contain MIDI data on it, in a form you can pick up with the Arduino.

Thank you for your time! A couple follow ups;

The addressable LEDs look perfect and much easier to work with. I'm looking on Amazon for some non neopixel ones, hopefully they have something.

As for the midi data, the controller has a standard midi output which is where I am thinking of inserting my Arduino to hijack the outgoing midi data stream. If it's possible, I would want to send the existing connections from the keys to the Arduino and then create a connection from the Arduino back to the midi out port so I could still use it to transfer the data with whatever I inject into it from the Arduino.

That being said, as I'm typing, your comment about the USB data suddenly made sense in terms of how I would be receiving midi data... However, it would be very simple to wire up a din input to the Arduino itself and bypass the USB altogether. I didn't want to use the existing USB port anyways as my intention is to wire it directly to the Arduino to use it as a connection for that and bypass the USB controller inside of the keyboard.

Hopefully that stream of consciousness I just wrote makes sense

Actually the further I am thinking about this, I may need to hold off on the LEDs and just focus on reading the midi steam from the keys to start. There is a lot of possibilities in that and it's probably more useful than even bothering with idea I had for the LEDs as I could add some potentiometers and switches to do arpeggios and control the tempo, etc.

However, it would be very simple to wire up a din input to the Arduino itself and bypass the USB altogether.

Would it?
I remain to be convinced of that, it is not the way things usually work.
Anyway if it is simple to do this then try it.

I could add some potentiometers and switches to do arpeggios and control the tempo,

Yes I cover all that in my book:-

Grumpy_Mike:
Would it?
I remain to be convinced of that, it is not the way things usually work.

Prior to seeing your response I actually found a midi breakout board for the Arduino and ordered that so I didnt have to mess with octocouplers and all that jazz. Worst comes to absolute worst, I can leave the internals of the keyboard in tact and mount the midi breakout board I/O on the back of the keyboard and take the existing output to the new input and then out again from there to whatever I want to control. That should help simplify the controller portion so I can focus on getting the code completed and the additional interface components that I want to incorporate. The book looks interesting, I feel more confident with the next couple steps having the midi data flow in a more manageable condition so we will see how it goes with the breakout board.

Worst comes to absolute worst, I can leave the internals of the keyboard in tact and mount the midi breakout board I/O on the back of the keyboard and take the existing output to the new input and then out again from there to whatever I want to control.

Like I say I am not convinced but that would be great if it worked.

Let us know how you get on when it arrives.

Where is your concern at with it? Using it like I mentioned would be the same as just leaving the keyboard to act as a controller since it would just be going midi out to midi in or am I wrong in thinking that? I read that Arduino is more than capable of doing midi and from other projects I have seen it seems like a valid avenue here. Are you trying to hold out so i buy your book? Lol

Are you trying to hold out so i buy your book?

No.

Where is your concern at with it?

I don;'t think any manufacturer worth his salt would generate a serial MIDI signal and then encode that as a USB HID MIDI separately. That is I don't think the serial MIDI stream is available like you think with a keyboard with only a USB output.

If the keyboard has a 5 Pin MIDI socket AND a USB output then you should have no problems but you have not mentioned this so far.

It does have both I apologize that must have been where the confusion was at

Hey Mike,

I got my midi shield in today and I was getting ready to wire it up it dawned on me... since the controller board of the keyboard already has the din midi out connector and I want all midi notes to be routed to my arduino could i instead of using a midi cable to go from controller midi out to shield midi in just wire the midi out port directly to the shield input? It would save wasting space on the back of the controller and it SEEMS like the simple solution here.

Also, I checked out the sample pages of your book and it looks excellent! Once I get to the coding phase I will pick up the digital copy as I already found samples that will come in handy!

Yes you could even wire the MIDI out direct to the Serial in if you like, it wouldn't be MIDI standard but you are not going anywhere else with it.