What Is Debouncing? Filtering Mechanical Contact Noise in Embedded Systems

Emre Ceylan
3 August 2026

What is debouncing? In short, it is a software or hardware technique that filters brief bounce signals when a mechanical switch, button or relay contact closes, so software can reliably detect a single transition. Without debouncing in embedded systems, one press can generate dozens of false triggers.

On Revan Technology’s industrial control boards, debouncing is part of the design from HMI buttons to emergency-stop inputs at every mechanical contact point.

what is debouncing

What is debouncing?

Debouncing reduces the millisecond-scale high/low transitions (bounce) seen on a GPIO pin while a mechanical contact settles to one stable state. Hardware may use an RC filter or Schmitt-trigger input; software may use timers, counters or edge detection with delay.

The goal is to keep the rule “one press = one event” and eliminate wrong counts, double triggers and safety risks.

Why does it matter?

  • Prevents multiple commands or counter increments from a single press.
  • Reduces false triggering on critical inputs such as emergency stop, limit switches and safety interlocks.
  • Preserves user experience and data consistency on HMI and panel buttons.
  • Provides margin against increased noise as contacts age on long-life field devices.

How does it work?

1. The GPIO input is read or an edge is captured via interrupt.

2. The signal must remain stable for a set period (typically 5–50 ms).

3. When the period ends, the final state is accepted as a valid press or release.

4. With hardware debouncing, an RC threshold or Schmitt-trigger input filters bounce at the pin level.

In software, periodic polling with a delay counter or timeout after an interrupt are the most common approaches. Too fast or too slow debounce either misses real presses or fails to filter bounce completely.

Typical use cases

  • Physical buttons on industrial panels and HMIs
  • Limit switches, proximity triggers and conveyor sensor inputs
  • Emergency-stop and safety interlock circuits
  • Setting pots and mode-selector mechanical switches
  • Reset and configuration buttons on low-cost IoT nodes

Common mistakes

  • Using a fixed 1 ms debounce without measuring from the datasheet or in the field.
  • Relying only on rising-edge interrupts; ignoring falling edge and hold scenarios.
  • Leaving long cables and high-impedance inputs exposed to EMI without an RC filter.
  • Reading the same button in both interrupt and a busy loop, creating race conditions.
  • Confusing debouncing with “softening” on safety inputs and extending real response time.

Selection / design checklist

  • Is contact type and expected bounce duration (ms) defined?
  • Is hardware RC / Schmitt-trigger needed, or is software sufficient?
  • Is debounce time aligned with worst-case bounce plus EMI margin?
  • Are hold, double-press and long-press behaviours tested separately?
  • For interrupt-based debouncing, are shared counters and critical sections safe?
  • Are field cable length and filtering included in the EMC plan?

FAQ

What is debouncing in one sentence?

Filtering contact bounce signals so software detects one reliable transition.

Should hardware or software debouncing be preferred?

Software is often enough for short bounce and low cost; hardware filters add a layer for long cables, high EMI or safety inputs.

What is a typical debounce time?

For most buttons and limit switches, 10–30 ms is common; relay contacts and heavy mechanisms may need 50 ms or more.

Can debouncing be used on safety inputs?

Yes, but the delay must stay below the safety response target; debounce delay and safety timeout must be designed together.

Conclusion

Debouncing is a reliability layer that is common in embedded systems but easy to overlook. With the right timing, appropriate hardware filtering and consistent software logic, false triggers disappear and panels, machines and field devices behave predictably. Planning debouncing at the start of design on any board with mechanical contacts reduces hard-to-diagnose field fault reports.


🔗 Get in touch with us:
Phone/WhatsApp: +41 76 212 8248
📧 E-Mail: info@revantechnology.ch

For detailed information about our services in electronics development & PCB design:
Revan Technology – Your partner for professional electronics and PCB development

What Is Debouncing? Filtering Mechanical Contact Noise in Embedded Systems

Other GEO Posts