I thought this would be a quick little project that I could do in a day or so, but a lot of that time was debugging etc., you could build this in a couple of hours depending on your soldering skill and patience (mainly patience, building the LED strip is a bit annoying).
Here is a (not particularly good) video demonstrating the project:
For some reason Instructables is not letting me embed the video so here is a YouTube link: http://www.youtube.com/watch?v=LfwVIxyaxYY
Step 1: Circuit Design
The first schematic gives a rough idea of how I wired the LED matrix to light individual keys, although my final matrix didn't quite turn out like this so you may need to edit the Arduino script to match your matrix configuration (as long as the matrix works it doesn't matter what LED lights a key as that is fully configurable in software, you will see what I mean in the next step).
The second schematic is taken from the Arduino Playground page for the MAX72xx range, where you will also find a guide to choose a value for the current limiting resistor RSet.
Step 2: Arduino Code
All the parts of the code are found at the top of the code, this includes pin configurations, transpose settings and LED indexes for each hardware key:
- Button pin configuration (lines 4 and 5)
Set these to the pin which is connected to your transpose buttons, these pins are pulled high by the Arduino and should be pulled to ground by the buttons.
- MAX7219 pin configuration (lines 6 to 9)
Set these to the respective pins on the MAX7219: DATA_PIN should connect to pin 1 of the MAX IC, CLOCK_PIN to 13 and LOAD_PIN to 12.
- Transpose settings
First set the transposeMax and transposeMin to their correct values, this is the number of valid times you can transpose the keyboard in each direction (e.g. my M-Audio keyboard lets me transpose +/- 4 octaves) (note transposeMax must be positive or 0 and transposeMin must be negative or 0).
Secondly set the midiStartPoints to match your transpose settings, this is an array of integers corresponding to the MIDI note which is produced by the leftmost key at each transpose setting (note this array must be of size transposeMax-transposeMin+1).
- LED indexes
This is an array which defines the row and column for each LED, ordered by keys from left to right (note the size of this array must be equal to the number of keys on your keyboard and each element must be an array of size 2).
- MIDI channel
By default the Arduino is set to pick up note messages on all channels, however you may change channel used to listen on on line 100 of the sketch.
Step 3: LED Strip
Looking back I should have really made a video showing the process of soldering this, let me know if you want me to try to explain this better.
Step 4: Driver Shield/PCB
You do not have to use a IC holder if you don't wat, but it makes it easier if you decide you need the MAX IC for another project, even if you have to make do with a 28 pin IC socket like I did.
I did consider using .1" pin headers to connect the LED strip to the driver sheild, however did not think this had a lot of benefits, although it would allow you to use it as a generic matrix driver shield if you wanted. All I ended up doing was soldering the wires form the LED strip directly to the driver shield.
The MIDI socket I claimed form my MIDI accordion project (it would be easy to put a new port on the accordion), it is just a panel mount one but you could use a PCB mount one and have it soldered directly on the driver shield if you like (this is probably a better solution) .
Step 5: Assembly and Test
For initial testing I just connected the input of the Arduino to the output of the keyboard, this will allow you to properly test the key configs, when doing this expect a key to light up when it is pressed. If all is good here then have a go playing using the prompt lights, you may or may not find it easier, I suppose this type of prompt would be useful for some but not for others, but it is an interesting project to build it anyway.