Debounce Time Explained Through Four Switch Types
Two ways to deal with a key that registers twice. One is to let the firmware handle it silently, which is what almost every board does and what almost nobody thinks about. The other is to look at what the firmware is actually waiting for and how long it waits, because that waiting period is added to every single press you make. The first approach costs you nothing to think about. The second costs an afternoon and explains a lot of otherwise mysterious behaviour.
Debounce exists for a physical reason. A mechanical contact does not close cleanly; it bounces for a short time as the metal settles, and a fast controller would read that bounce as several presses. The firmware waits until the signal has been stable for a set window, then reports one event. The size of that window is the debounce time, and it is pure added latency.
Why does a switch need debouncing at all?
Because the contact is metal on metal, and metal springs. When a leaf closes, it can separate and re-close several times over a short interval, and a controller sampling quickly enough would see each of those as a distinct press. Without debounce, one keystroke could produce a handful of characters, which is a defect users notice immediately.
The bounce is not a fixed property of the switch alone. It depends on how hard the key is pressed, how worn the contact is, and how the circuit is wired. That variation is why debounce windows are usually set generously rather than tightly, and why a conservative setting can feel slower than the hardware requires.
How does debounce differ across switch families?
A linear switch closes its leaf in one continuous motion, and the bounce tends to be short and predictable. A tactile switch has a bump partway through the stroke, which can add a small hesitation before the leaf closes, and the bounce pattern becomes slightly less regular. A clicky switch adds a separate click mechanism, and that extra element produces a distinctly noisier contact event.
We logged all three and the pattern was consistent: the more mechanical complexity in the switch, the wider the bounce distribution, and the more a firmware engineer is tempted to set a long window. That temptation is where the latency comes from, and it is not evenly spread across switch types.
What does the measurement look like for a linear switch?
Short and tidy. Our linear samples settled quickly, with a narrow spread and few late events, which means a short debounce window would have been sufficient. The factory setting on the boards we tested was noticeably longer than the data required, and that difference was added to every press.
Reducing the setting to match the observed bounce produced an immediate improvement in the end-to-end figure, with no increase in double presses over a long typing run. This is the clearest case in the set: the hardware was capable, and the default was simply cautious.
And for a tactile switch?
The distribution widens. Because the stroke passes through a resistance bump, some presses close the leaf cleanly and others hesitate, which produces a longer tail in the bounce data. A window tuned to the average would miss those tail events and produce occasional double characters, so the correct window has to cover the tail rather than the middle.
Our tactile samples needed a window meaningfully longer than the linear ones before double presses disappeared. That is a real cost of the tactile design, and it is worth knowing if you are choosing a switch on feel alone and care about latency.
What happens with a clicky mechanism?
The click jacket introduces a second moving part, and the contact event becomes the noisiest in the set. Bounce duration varied more from press to press than on either of the other two families, and the tail extended further. The firmware on the boards we measured compensated with the longest windows of the group.
Interestingly, the click itself is audible before the leaf closes on some designs, which creates the impression that the key has registered when it has not. That perceptual gap is separate from debounce but compounds it, and it is part of why clicky boards feel slower in practice than their numbers suggest.
Is there a fourth case worth measuring?
Yes: an optical or magnetic switch, which has no metal contact to bounce. These still carry a debounce window in firmware, because the same code path is reused, but the physical justification is much weaker. Our samples showed a settling behaviour that would have supported a very short window indeed.
Where firmware allows the setting to be changed, this is where the largest saving is available, and where the risk of double presses is lowest. Where firmware does not allow it, the board is simply giving away latency it did not need to give away.
How do you tune the setting safely?
Lower it gradually and type a lot between each step. The failure mode is a double character, and it appears under fast repeated presses on the same key rather than in normal typing, so test the way you would actually stress it. If a long session produces no duplicates, the setting is safe for you.
Keep in mind that wear changes the answer. A switch that tolerates a short window when new may not tolerate it after months of use, so leaving a small margin is sensible. A window that is too tight today may need attention later, and that is a reasonable trade for most people.
What does this mean for choosing a board?
It means the debounce default is worth checking before the switch name, because it can contribute more latency than the difference between two switch families. Where a board exposes the setting, that is a meaningful advantage. Where it does not, you are inheriting somebody else’s caution.
Why do two samples of the same switch bounce differently?
Manufacturing tolerance is wider than most people assume. Leaf shape, contact plating and spring tension all vary within a batch, and each of those influences how the signal settles. Measuring a dozen samples of the same part produced a spread that no single sample would have predicted.
This matters when setting a debounce window. A value tuned on one key may be wrong for the key next to it, and firmware applies one value across the board. The safe setting has to cover the worst sample rather than the average one, which is why factory windows look generous.
Can firmware measure bounce instead of guessing it?
It can, and some designs do. Adaptive debounce watches the actual settling behaviour and shortens the window when the signal is clean, which recovers latency without accepting double presses. Our samples that implemented it showed a narrower distribution than fixed-window designs.
The trade-off is complexity. An adaptive scheme that misjudges a noisy contact produces intermittent duplicates, which is far more annoying than a slightly slower board. Where the implementation is conservative, the benefit is smaller but the behaviour is predictable.
Does the key’s position on the board matter?
Slightly, because of wiring length and matrix position. Keys at the far end of a long trace can behave a little differently from those near the controller, and keys that share a row with a heavily used neighbour can see more electrical noise. The differences are small but measurable.
We saw the largest position effect on boards with long, thin traces and minimal filtering. On a well-designed board the variation across the layout was small enough to ignore, which is itself a sign of decent engineering.
What should a buyer take from all of this?
That debounce is a setting, not a fact of nature, and that its default value is chosen for safety rather than speed. Boards that expose the setting give you the option to trade a little margin for a little latency, and boards that hide it make the choice for you.
The second thing to take is that switch type and debounce interact. A clicky mechanism needs a longer window than a linear one, so comparing two boards by switch name alone misses a slice of latency that belongs to the contact rather than the feel.
Is there a way to see the bounce itself?
Yes, and it is the most convincing part of the whole exercise. Logging the switch line with a fast capture shows the contact closing, opening, and closing again over a short interval, which is exactly the behaviour the debounce window exists to absorb. Seeing it once makes the rest of the topic obvious.
The shape varies by press. A light press can produce a different bounce pattern from a firm one, which is why a window that works for your typing may not work for someone else’s. That variation is the reason manufacturers choose conservative defaults.
The next question is what happens to that window as the switch wears, since the bounce distribution is not static. Measuring the same board after a few months of use is the natural follow-up, and it usually shows the safe window drifting upward.
Photograph: snuci (Public domain) ยท Wikimedia Commons
