The matrix, the diode, and the three keys that break it
A keyboard scans its keys in a grid instead of wiring each one to its own pin — an efficient design choice that opens one specific, well-understood failure mode. A diode per switch closes it. A second piece, NKRO firmware, closes the related failure that diodes alone can't touch.
Press the wrong three keys on an undiodeded keyboard and a fourth key appears on screen that nobody touched. That isn't a software bug. It's electricity finding a path nobody designed for it, through a wiring scheme almost every keyboard uses for a good reason — and understanding that reason explains why a hot-swap PCB's spec sheet bothers to mention diodes and NKRO at all.
Wiring a grid instead of a wire per key
A microcontroller has a small, fixed number of input/output pins. A full-size keyboard has 104 switches. Wiring every switch directly to its own pin, plus a shared ground, would mean a controller with well over a hundred usable pins — far more than the cheap microcontrollers running almost every keyboard actually have. QMK's own explainer puts it plainly: "Without a matrix circuit, each switch would require its own wire directly to the controller."
The fix is to wire by row and column instead of by switch. Lay that same 104-key board out as 8 rows by 13 columns — 8 × 13 = 104, so every switch still gets a unique address — and the controller needs only 21 pins: eight for the rows, thirteen for the columns. Scanning happens by elimination: the firmware drives one column at a time and reads which rows receive the signal. QMK describes the loop as sending "a logical 1 to the columns, one at a time, and read from the rows, all at once." A pressed switch at that column/row intersection closes the circuit between them, and the firmware logs a keypress at that address. Repeat for every column, dozens of times a second, and the pin count scales with the square root of the key count instead of the key count itself.
The matrix is a pin-count optimization, not an acoustic or feel decision — the same row/column scanning runs calculator keypads and car-stereo buttons. It's also, by the shape of how it reuses wires, the reason three keys pressed in the right pattern can produce a fourth reading that was never physically pressed.
The three-key rectangle that creates a ghost
Picture two rows and two columns: four switches at the four intersections. Press the switches at row 0/column 0, row 0/column 1, and row 1/column 0 — three real keypresses forming three corners of that rectangle. Current driven down column 0 passes through the first switch into row 0; from row 0 it can reach back up through the second switch into column 1; from column 1 it can travel back down through the third switch into row 1. The controller, scanning column 1 and reading row 1, now sees a closed connection where no switch was pressed — the fourth corner. Wikipedia's rollover article names the pattern directly: "Key ghosting occurs on matrix keyboards for certain combinations of three keys" when "three corners of a rectangular set of switches are closed." The reported fourth key is "the ghost." QMK's own matrix walkthrough works the identical example and reaches the same conclusion: with no diodes, the scan reads all four positions as pressed, "since we only have 3 keys pressed down, not all 4."
This is a property of the grid, not of any individual switch. Any three switches occupying exactly three corners of a shared rectangle in the layout can trigger it, which is why ghosting shows up unpredictably — it depends on which physical keys happen to share a row or column inside the PCB, a detail no typist ever sees.
A diode blocks the backflow — and creates its own tradeoff
The fix is one component per switch: a small signal diode, commonly a 1N4148 or equivalent, wired in series between the switch and its row. Per Deskthority's wiki definition, a diode is an "electronic circuit component that only passes current in one direction." Placed correctly — QMK's convention orients the banded end toward the row — current flows from column to row through a pressed switch, but cannot flow backward through an unpressed one. That one-way gate is exactly what the three-key ghost needs to exist: a backward path from row 0 into column 1. Cut that path at every switch and it's unavailable for any key combination. Run the same three-key press through a fully diode-protected matrix and the fourth position reads correctly as not pressed — QMK's walkthrough confirms it: "Things act as they should!"
Without a diode at every switch, a keyboard has two unpleasant options: let ghosts through, or have the firmware watch for combinations that could produce one and refuse to register the newest key — a deliberate, defensive drop. Wikipedia names it precisely: the firmware "will ignore the third key... known as jamming, as the first two keys jam the third." Deskthority calls the same workaround "blocking." Either label describes the same symptom: a real keypress that silently fails, with no phantom key even signaling that something went wrong — arguably worse than a ghost, which is at least visibly a glitch.
A diode matrix removes the need for that suppression, because the ghost it defended against can no longer occur. But a diode matrix alone doesn't guarantee a keyboard can report an unlimited number of simultaneous keys — that depends on what the firmware puts in its USB report. The standard USB HID boot protocol can describe at most six non-modifier keys pressed at once, regardless of how clean the matrix is. Deskthority flags this exact gap: a board can be "NKRO inside but... limited by the variant of the USB protocol it uses," a condition usually labeled 6KRO. Diodes fix the circuit-level fault. The USB report format is a separate ceiling sitting on top of it.
NKRO is the firmware half of the handshake
N-key rollover names the combined result: a keyboard that, per Wikipedia, "can correctly detect input from each key on the keyboard at the same time... regardless of how many other keys are also being pressed." Getting there takes both halves together — a fully diode-protected matrix so no key combination can produce a false reading, and firmware reporting over a USB descriptor sized for far more than six keys. Diodes without NKRO-aware firmware still cap out at 6KRO; NKRO-capable firmware on a diode-less or partial matrix still has ghosts or jammed keys to report cleanly in the first place. It's also why QMK and VIA keymaps reference row and column positions directly — a keymap.c file is, underneath the readable key names, a map of matrix addresses, with NKRO reporting layered on top of that same grid.
Why this is rarely a real problem on a hobbyist board
A full diode matrix paired with NKRO firmware is close to the default assumption for custom and enthusiast boards, which is why "can't press three keys at once" essentially never comes up in that part of the hobby. A representative hot-swap build log — an 87-key board on an RP2040 controller, documented on JLCPCB's build blog — lists "one diode per key (column-to-row orientation) for full N-key rollover (NKRO)" as a baseline design choice on an ordinary 6-row-by-14-column matrix, not a premium feature. QMK ships NKRO as a firmware option nearly every keymap can enable. That's why a hot-swap PCB spec sheet calling out "full NKRO" is a real, specific hardware-plus-firmware claim rather than marketing filler — and why rollover genuinely breaks mostly on cheap rubber-dome boards with nowhere to mount a diode, or pre-diode-era gaming boards that wired only a handful of frequently used keys, like WASD and the arrow cluster, leaving the rest of the grid exposed.
What to watch
The two halves of this fix — one diode per switch, firmware that reports beyond the USB boot protocol's six-key ceiling — are settled enough to read as boring infrastructure rather than a marketed feature. The more interesting open question sits upstream of diodes entirely: hobbyist firmware communities have reported experimenting with "duplex matrix" wiring that replaces the diode at each switch with a pull-up resistor per column, tested on RP2040-based QMK boards — trading one through-hole component for another rather than eliminating the per-switch part altogether. Whether that moves from community experiment to a wider standard, or stays a niche hand-wiring technique, is worth watching the next time a board's PCB files get published. It won't change the underlying contract, though: whatever sits at each junction, a keyboard still needs something there blocking the backward path, and firmware still needs to say more than six keys' worth in its USB report, for the three-key problem to stay solved.
Keep reading
- Deep Dives
Shortened Travel: The Lever Builders Keep Confusing With Spring Weight
A switch can feel punchier without its spring getting any heavier. The trick is cutting how far the stem has left to travel after it fires — a geometry change, not a force change, and the two get conflated constantly.
thock8 min read - Deep Dives
Four Switches, One Mechanism: What Stem Geometry Actually Changes
The Durock T1, the Boba U4T, the Holy Panda X, and the Gateron Lanes have spent four separate deep-dives citing each other as comparison points. None of those pieces stopped to say the obvious thing: all four generate their bump the same way. The leg geometry is the whole story.
thock11 min read - Deep Dives
What a TMR sensor is actually measuring under a magnetic switch
Keychron's Q16 HE 8K and Cherry's XTRFY TMR boards get covered as a new switch generation. The real change sits a few millimeters below the magnet — a tunnel junction reading field strength through resistance instead of voltage, with a noise floor low enough to matter at the shallow end of the stroke.
thock11 min read - Deep Dives
PCB flex cuts, explained: a flex budget milled straight into the board
No plate change, no gasket, no case redesign — just a slot routed through the fiberglass near a switch hole. Flex cuts are the cheapest lever a designer has for adding give to a board that otherwise has none, and the cheapness is exactly why they show up where they do.
thock10 min read