A keyboard matrix circuit is a type of keyboard that has a grid-like array of horizontal and vertical wires connecting the key switches. If the keyboard features 8 rows and 8 columns of wires, for instance, it can support up to 64 keys. The switches are located at the intersection of these wires. Keyboard matrix circuits contain a scanner or sensor that monitors these wires and is constantly scanning the grid determining which key has been pressed. The main advantage of using a matrix circuit design is the reduction of required wires.
The matrix arrangement allows for current to flow backwards through part of the circuit, which can lead to phantom keys. Keyboard matrix circuits usually require diodes at the intersections of the wires to prevent phantom keys. Phantom keys, also known as “ghost keys” occur when the keyboard thinks that a key is pressed when it is actually not pressed at all. The diodes are typically placed in series with each switch (before or after).