An everyday explanation · 2 min read

How a keyboard finds the key you pressed

In a switch-matrix keyboard, each key connects one row wire to one column wire when pressed. The controller checks the rows in turn and reads the columns. The row being checked and the responding column together identify the key.

A mechanical keyboard with one keycap removed to show the coral switch underneath.
Original AI-assisted editorial illustration. The explanatory drawing below is a separate, source-checked schematic.

Look a little closer

See the mechanism

How one key appears during a matrix scan

Open switchesAt an open intersection the crossing row and column are separate conductors.Switches openR2C2No connection
Open switches. At an open intersection the crossing row and column are separate conductors.
Read the diagram steps

Open switches. At an open intersection the crossing row and column are separate conductors.

One addressed switch. When the key at R2 and C2 closes, C2 responds while R2 is driven low.

Original conceptual matrix convention: hollow circles are open switch positions, and a solid marked intersection connects the selected row to the sensed column.

Diagram basis: AN3407 — Using Matrix Keypad with AVR Devices, 2 Theory of Operation.

Sources: Microchip Technology

Two groups of wires identify many switches

Under a keycap, a physical switch can connect two conductors. A matrix arranges those conductors in shared rows and columns, with a switch between one pair at each key position. Pressing a key connects its own row to its column.

A controller can reuse the same row and column connections across many keys. Each switch has its own pair even though the individual wires are shared.

Sources: Microchip Technology

One selected row makes the column meaningful

In one active-low scanning method, the controller drives one row to a low voltage and reads the column inputs. A column normally held high can read low if a switch in that row has closed. The controller knows which row it selected, so the low column completes the key address.

Then the controller selects the next row and checks again. A key in a different row can use the same column wire, and it will respond on its own row’s turn.

Two key scans both register column C2. One draws a connection to row R1 and the other draws a connection to R2.
Two keys can share the same column wire. The controller can tell them apart because C2 responds during a different row’s turn in each case.

Sources: Microchip Technology

Sources: Microchip Technology

The address becomes a key event

The electrical address identifies a physical switch position. The keyboard’s mapping lets its controller associate that position with the intended key. The visible character can also depend on modifiers and layout. What the matrix itself reports is a change in connection between two conductors.

Sources: Microchip Technology

The thing to remember

A closed switch makes a column respond during one row’s scan, giving the controller a two-coordinate key address.

What this example leaves out

Simple physical switch matrix with one driven row at a time. Other sensing methods and multi-key isolation schemes vary.

Sources & further reading

Source access dates are listed below. Manufacturer descriptions and patents support the specific constructions described, not every product.

  1. AN3407 — Using Matrix Keypad with AVR Devices, 2 Theory of Operation ↗

    Microchip Technology · Retrieved 2026-11-26 · Switch closes a row/column connection. Controller can drive one row at a time and read other-axis wires to identify switch positions.
    Simple physical switch matrix. Not all keyboards scan this way, and multi-key handling varies.

How we use sources and handle corrections

Keep the question going

Read this next.

Compare another construction in this part of the library: Under the glass, an electrode grid detects an electrical change near your fingertip. Follow the parts and the stated limits in each explanation.

Everyday machines · 2 min read

How a capacitive touchscreen detects a finger

Continue reading