Learning path

Full curriculum

Full curriculum

Unit content

Switch bounce and debouncing

A mechanical switch does not usually change from open to closed in one ideal transition. Its contacts can make and break several times over a short interval before settling. This is switch bounce.

If firmware treats every observed edge as a separate event, one physical press can appear as several presses.

Debouncing rejects those transient transitions. A software approach can wait until the input remains stable for a chosen interval before accepting the new state. Another approach samples periodically and changes the logical state only after enough consistent samples.

Hardware filters or dedicated debounce circuits can perform the same role before the signal reaches the digital input.

The debounce interval must exceed ordinary contact bounce while remaining short enough for the required response time.

Debouncing illustrates a general embedded principle: physical signals often need temporal interpretation before they can be treated as clean logical events.