Overview
Example Key Matrix
The matrix is connected to the MPU by “select” lines, which are MPU outputs, and “data” lines, which are MPU inputs.To monitor the keyswitch states, the MPU sends a brief pulse to each select output, one-at-a-time. Each pulse “selects” a group of adjacent keys. Any closed keyswitches in the group will allow the pulse to pass thru to the data lines, which are “read” by the MPU. All of the keys are read continuously, many times per second. This allows the MPU to respond almost instantly to keyswitch state changes.In a “scan high” keyboard, the state of each data line is low (0V) by default. The select signal is a 5V pulse.In a “scan low” keyboard, the state of each data line is high (5V) by default. The select signal is a 0V pulse. Figures 1 & 2 below are examples of simple keyboard matrices. Each is a “2/2″ select/data configuration for a 4-key keyboard. In practice, keyboards will have a larger number of select & data lines. Typical 32-key configurations are 4/8, 8/4, or 6/6. 49-key keyboards often use a 9/6 matrix. The maximum number of keys supported by a matrix configuration is governed by the following equation:
k = s * d
Where k is the maximum number of keys, s is the number of select lines, and d is the number of data lines. Note that each keyswitch is accompanied by a series diode. This diode prevents a potentially damaging short-circuit between select outputs. It also allows the MPU to accurately detect the key states when multiple keyswitches are closed.
Figure 1: “2/2 Scan High” Keyboard Matrix and Select Signals
Example Keyswitch States and Data Waveforms
MIDI Retrofit: “Faking” the Data
To trigger a note, the UMR2 monitors the select signals of the host keyboard’s MPU. When a select pulse occurs, the UMR2 injects a corresponding “faked” keypress signal into the data lines. To the host MPU, this signal is indistinguishable from a manual keypress. Installing the UMR2 therefore involves identifying the select & data lines in the host keyboard, determining which select scheme is used (“scan-high” or “scan-low”), and connecting the UMR2 accordingly. For many keyboard models, the connections have already been tested and documented. For other models, installation may be possible after a bit of inspection as described below. Please visit the UMR2 forum for more information.
Identifying a Keyboard’s Matrix Scheme
A keyboard’s select & data lines are typically connected from the main PCB to the keyswitch PCB via a ribbon cable. With a help of a continuity tester, the pins of the ribbon cable can be traced to the contacts of the keyswitches. Select lines are typically tied to groups of adjacent keys. Each data line will be connected to one keyswitch in each group. A few keyboard models differ from this convention. When in doubt, it is wise to use an oscilloscope to identify the select and data lines with certainty.
The keyswitch PCB of the Casio MT-210 is used as an example below. The diodes in Figure 9 serve the same function as the diodes in the schematics above. Their polarity provides a clue to the scanning scheme used: review the connection of the diodes in figures 1 & 2, with respect to the data lines. The keyswitch PCB of the Casio MT-210 is shown in figures 10-13 below. 8 select lines are connected to groups of 6 keys each. The 9th select line is connected to a single key. Note the keyswitch diodes on the underside of the PCB. The anodes are connected to the data lines. This indicates a scan-low configuration. If observed with an oscilloscope, the select waveforms will appear similar to those shown in Figure 2. The UMR2 is configured accordingly.










