How is keyboard scanning implemented in the CLP810s piano?
We find similar elements as those used to scan the keyboard in a personal computer:
A scanner integrated circuit
A matrix of row and column wires
A switch plus a diode in the intersection of each row and column in the matrix
The scanner is a YMZ702D integrated circuit by Yamaha. It has 15 output pins and two sets of 6 input pins. 15 outputs times 6 inputs gives a matrix of 90 cells, which accommodate the 88 keys of the piano. The second set of 6 inputs forms an additional 90 cell matrix, because each key uses two switches: This allows to determine the velocity at which the key is pressed, by measuring the delay between the closing of each switch.
Each output pin drives a group of 6 contiguous keys, formed alternatively by keys G through C or C# through F#. Each each input pin is connected to one of the keys in each group. The first input pin connects to the G and C# keys in all the groups, the second input pin connects to all the G# and D keys in all groups, and so on.
The four spare cells are used to identify the keyboard type by the presence or absence of a jumper. A jumper is like a note that is always pressed.
For more information about the YMZ702D integrated circuit, check the unofficial specification that Paul Banks made.
The scan of the 15 groups of keys is done in about 120 microseconds by the scanner circuit, by doing these steps on each output pin:
Turn on the output pin for about 8 microseconds
Read the on/off state of the 12 input pins while the output pin is on.
Each output pin has high impedance when off, it sinks current to ground when on. Each input pin is connected to a 10 Kohm pull up resistor that goes to 5V, and to the anode a diode (See point A below) whose cathode is connected to the switch of the key. The other side of the switches on each group go to the corresponding output pin of the scanner. The model below is for a switch when the corresponding output is active:
The voltage at A is 5 V if the switch is open. If the key switch is closed, the voltage at B will be near 0 and the voltage at A will be the diode forward voltage, between 0.5 and 0.7 V, which will be read as logic 0.
The key switches are implemented by a long soft rubber strip that spans the whole keyboard range, from the lowest key to the highest key. It has rod-shaped contacts that cover each key group, the rods are covered by a black conductive material, and each rod is isolated form its neighbor rods by a gap. When a piano key is played, it presses the contact rod under it against conductive-covered traces in the printed circuit board to make the electrical connection.