Swiclick

Contact Bounce and Debounce in Mechanical Switches

Contact bounce is the rapid sequence of unintended open and closed transitions that can occur when mechanical switch contacts first meet or separate. A human sees one button press. A fast digital circuit may see several edges. Debouncing is the process of ensuring that the system accepts the mechanical action as one valid state change.

The correct debounce method depends on the switch waveform, input circuit, response-time requirement, and failure mode. A fixed delay copied from another product is not a substitute for measuring the actual switch.

Why Mechanical Contacts Bounce

A switch contact has mass and elasticity. When the moving contact reaches the fixed contact, the mechanical system does not necessarily stop at the first impact. The parts can rebound before settling.

Timing waveform comparing a raw bouncing switch signal with multiple edges and the same press after debouncing to a single clean transition

Analog Devices defines contact bounce as the brief repeated making and breaking that occurs before the contacts reach a stable state. See Analog Devices Contact Bounce.

Würth Elektronik describes the same problem in its application note on switch debounce and shows why the effect matters when a tact or detector switch feeds a fast electronic circuit. See Würth Elektronik Contact Debounce Support Note.

Bounce is therefore not automatically a defective switch. It is a normal electromechanical behavior that must remain within the requirements of the switch and the receiving circuit. For component-level selection, Swiclick maintains separate Tact Switch and Micro Switch category pages so bounce requirements can be evaluated alongside the correct switch family and load conditions.

Why One Press Can Become Several Digital Events

A microcontroller samples voltage far faster than a person can operate a button.

If the input changes from high to low and then oscillates several times before settling, an interrupt routine or counter can interpret those edges as multiple presses.

Typical symptoms include:

  • A menu moving two or three positions from one press
  • A counter incrementing several times
  • A relay command toggling twice
  • A start button producing an intermittent state
  • A rotary or detector input generating false events

The slower the application logic, the less visible the problem may be. A lamp circuit can ignore a few milliseconds of bounce because the lamp response is much slower. A microcontroller interrupt may react to every transition.

Bounce Time Is A Part Specific Parameter

Do not assume every mechanical switch has the same bounce duration.

Bounce depends on contact geometry, spring design, operating speed, contact material, age, temperature, and the way the actuator is driven. Honeywell notes in its precision switch application guidance that contact bounce time and pattern are inherently variable and that successive actuations do not produce identical waveforms.

This is why a production design should use the manufacturer limit for the exact switch and then verify the system behavior with real samples.

Several current Swiclick tact switch models specify bounce at or below 10 ms under the stated model conditions. For example, the KAN0652 through-hole tact switch lists bounce at or below 10 ms for ON and OFF together with its model-specific operating force, travel, and life data. That value should not be generalized to every mechanical switch family.

Hardware Debounce

Hardware debounce conditions the signal before it reaches the digital input.

Three hardware debounce circuits side by side showing an RC filter an RC filter with a Schmitt trigger and a dedicated debounce IC

RC Filtering

A resistor and capacitor can slow the transition so that short bounce pulses do not cross the logic threshold repeatedly.

The time constant is:

τ = R × C

A larger time constant filters longer bounce but also increases response delay.

An RC network works best when the receiving input has a well-defined threshold. If the RC waveform moves slowly through an ordinary logic threshold, noise can still create repeated transitions.

RC Filter With Schmitt Trigger

Adding hysteresis after the RC network gives the circuit separate rising and falling thresholds. This is a common way to convert a slow filtered edge into a clean digital transition.

Dedicated Debounce IC

Dedicated switch debounce devices can provide defined timing and additional protections. They are useful when the input must be deterministic without consuming firmware resources.

Hardware debounce is attractive when the signal must be conditioned before it reaches digital logic. Safety-related functions still require system-level validation beyond the debounce method.

Software Debounce

Software debounce allows the microcontroller to decide when an input state is valid.

Flowchart of a stable state timer software debounce routine that accepts a new input only after it stays unchanged for a set time

Fixed Delay After First Edge

The controller detects the first transition and ignores additional changes for a defined period. This is simple but can block other work if implemented poorly and can add unnecessary latency.

Stable State Timer

The new input state must remain unchanged for a defined time before the controller accepts it. This is usually more robust because the timer resets if the input changes again.

Sample Based Filtering

The controller samples the input at regular intervals and accepts a change after several consecutive identical samples.

State Machine Debounce

A state machine tracks transitions without blocking the main loop. This is useful when multiple switches must be handled efficiently.

QMK keyboard firmware documents several software debounce strategies and shows how defer and eager methods trade response speed against noise rejection. See QMK Debounce Documentation.

Hardware Or Software

Requirement Hardware Debounce Software Debounce
No firmware available Strong choice Not possible
Lowest component count Adds components Strong choice
Multiple keys Can become component-heavy Efficient
Fast deterministic edge into hardware Strong choice Depends on architecture
Adjustable timing after deployment Fixed unless redesigned Easy to tune
Noise filtering Strong with proper circuit Depends on sampling and algorithm
Safety function Must be part of full safety design Must be part of full safety design

Many products use both. A small hardware filter limits very fast noise while software decides when the state is valid.

Do Not Use Debounce To Hide A Bad Switch

Debounce is intended to handle normal contact behavior. It should not hide:

  • A damaged contact system
  • Intermittent wiring
  • Excessive vibration-induced chatter
  • A switch operated outside its travel range
  • Severe contamination
  • Unstable power or ground
  • EMI coupling into the input line

If the required debounce interval keeps increasing during life testing, investigate the mechanical and electrical root cause rather than extending the delay indefinitely.

Swiclick discusses snap-action behavior in What Is a Snap Action Switch. Snap-action mechanisms can reduce dependence on actuator speed, but they do not make every switch bounce-free.

How To Measure Bounce On The Bench

A practical measurement requires more than pressing a button while watching a multimeter.

  1. Use the actual switch and production mounting condition.
  2. Apply the intended pull-up or interface circuit.
  3. Observe the contact waveform with an oscilloscope or logic analyzer.
  4. Trigger on the first transition.
  5. Measure time until the signal remains stable.
  6. Repeat multiple press and release operations.
  7. Test at temperature and after life cycling if the application is sensitive.
  8. Use the worst credible measured behavior to set system timing with margin.

Press and release bounce may differ, so measure both when both edges have functional meaning.

What To Put In A Switch Specification

If bounce matters to the system, include it in the component requirement.

Specify:

  • Maximum bounce time
  • ON and OFF requirement if both matter
  • Test voltage and current
  • Actuation speed or method
  • Sample condition
  • Life point
  • Temperature if relevant

Then define the system debounce separately. Component bounce and firmware debounce are related, but they are not the same specification. For low-energy switching conditions, also review Minimum Applicable Load and Dry Circuit Switching.

FAQ

What Is Contact Bounce

Contact bounce is the rapid unintended opening and closing that can occur immediately after a mechanical switch contact changes state.

How Long Does Switch Bounce Last

There is no universal value. The duration depends on the switch design, operating conditions, age, and test method. Use the limit for the exact part and verify it on real samples.

Is Software Debounce Enough

Often yes for microcontroller inputs. Hardware filtering may still be useful when the input is noisy, needs deterministic timing, or feeds hardware directly.

Does A Snap Action Switch Eliminate Bounce

No. Snap action makes contact transfer less dependent on actuator speed and can improve repeatability, but contact bounce can still occur.

Can A Long Debounce Delay Create Problems

Yes. It can make the user interface feel slow or hide a deteriorating contact system. Measure the real bounce and use enough margin without masking faults.

Engineering Takeaway

Treat contact bounce as a measured interface requirement. Characterize the actual switch waveform, separate mechanical bounce from EMI and wiring faults, then choose hardware, software, or combined debounce based on response time, architecture, and reliability requirements.

Leave a Reply

Your email address will not be published. Required fields are marked *