This is a guide to figuring out how to interface with the cable ribbon of a key matrix.
A thorough run-down of what a key matrix is and how it works can be found in this PCB Heaven article: http://pcbheaven.com/wikipages/How_Key_Matrices_Works/
Here are a few hints to help you determine what keys map to which wires and where a cable ribbon of a key matrix is split into its input and output wires.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Count the Number of Wires and Keys
I'll be using an example key matrix here which is actually the keys to a piano keyboard.
So in this example, I have a keyboard with 61 keys, and 17 wires (count the number of solder joints if the wires are too difficult to count).
From this first clue, we can tell that the scan matrix is organized in any one of the following matrices:
- 6x11 = 66 key combinations max
- 7x10 = 70 key combinations max
- 8x9 = 72 key combinations max
Step 2: Find Groups of Keys
By inspecting the board, we can sometimes see groupings of the keys. In this example, we can see groupings of 6 keys per group. The keys of each group are connected together, and a break separates each group.
Counting the groups for this board, there were 10 groups of 6 keys and 1 group of 1 key. So this tells us that the matrix is organized in 6x11.
Step 3: Finding the Split
Now our goal is to find out where the split between the input and output wires are. We start by putting our meter in continuity testing, then attach the two leads to the opposite ends of the ribbon cable.
Hit all the keys to see if we get a reading. If we do, then mark down the one key that causes the reading to occur, and the direction of current (ie, which one is the input wire, and which one is the output wire).
Step 4: If No Reading?
If none of the keys give a reading, then our current needs to flow in the opposite direction (because the diodes used in the matrix limits the current to a single direction). So swap the two leads and try again.
Step 5: Finding the Next Key
Once we have narrowed down our first key, move one of the leads (either left or right) 1 wire inward, then hit all the keys again to narrow down the next key.
If the second key is adjacent or close to the first key, then we are likely moving along the keys of the same row (ie, keys in the same "group" from previous step). Otherwise, we are moving along the columns of the matrix.
In this example, the second key happens to be adjacent to the first key, so we can make a guess that the ribbon is split into 6 output wires on the left and 11 input wires on the right.
On the other hand, if the second key was far apart from first key, then it is likely that the ribbon is split into 11 output wires on the left and 6 input wires on the right.
Step 6: Repeat
Keep moving the leads inward and testing to confirm your observations. Sometimes the ribbons can be scrambled, but with enough testing, a pattern will appear.
That's all! Hope this helps!
You can check out my other projects at: www.evankale.blogspot.ca