Wednesday, July 9, 2014

From Casio to Modular - Pt. 2

The Service manual for the Casio CTK 150 is not available online, but it looks like the CTK 100 is! Obviously the two have very different CPU's and very different circuits, but the two also have the same number of keys and are in the same series of keyboards at least. Both keyboards have 4 octaves plus one key for a total of 49 keys. Here is the supplied key nomenclature picture:

It applies to both the CTK 100 and CTK 150. There are several methods of reading a key matrix, but clearly this is a multiplexed matrix because of all of the diodes. Wiring a multiplexed matrix to a microcontroller, or keyboard CPU in this case, is as simple as this:

With some specially wired buttons and diodes, you can read a massive number of button inputs, as many as the columns times the number of rows. This brings me to my next point: the logic table of the matrix. The logic table visually illustrates where a button lies in respect to the columns and rows which are the Inputs and Outputs. The picture below shows the table for the CTK 100, which after much probing and inspection is the same as the CTK 150. I have removed the unimportant choices, but only because I cannot use them in my own circuit. There are 15 pins that I had to trace back and name according to the table below:

At long last, I came up with the following; this is the pinout of the 15-pin ribbon cable to the key PCB in the CTK 150:

1. KO0
2. KO1
3. KO2
4. KO3
5. KO4

6. KI2
7. KI3
8. KI4
9. KI5
10. KI6
11. KI7

12. KO5
13. KO6
14. KO7
15. KO8

Each input has to have a pull up resistor, but arduino for example has programmable pull up resistors built in. All you have to do is activate them via software. With pull up resistors, every time you read a row, you will read 1 and if you write a 1 to your outputs, all inputs will still read 1. To read a button press, you must write 0 to a column and read all inputs. When 0 shows up from a column to a row, you find your "note" or button press. The idea behind multiplexing is writing and reading very quickly so that you get the illusion that you can read all buttons at once. It would be common practice to rotate a single 0 and all 1's to your outputs and read the inputs repeatedly.

Arduino supports PORT manipulation, so I will be using two ports to multiplex the inputs. The IN port will have only 6 pins and the OUT port will have to be made up of an 8-bit port and two other Digital inputs. I will demonstrate this later on. One more thing to note before I go is that KO8 (or the 9th row) has five blank spots. This row uses a whole input for only 1 button instead of 6 which means by adding five more buttons and 5 more diodes, I can add 6 more user definable inputs without using any extra GPIO's! Since I am out of musical keys, the buttons could be used for other variables like holding gate open, changing the waveform or anything else. I could even use two buttons as an octave up and octave down selection to expand the range of sound I can make with only 49 keys. After the hardware is designed, anything can be done with software.

Check back for part 3 when I write some code and hook it up to an arduino of some kind.

EDIT: Apparently I lost this in a move at some point. There will be no part three...sry

No comments:

Post a Comment