← Block library

Debounced Button

@electrace/debounced-button@1.0.0 · CC-BY-4.0
vcc 1.8–5.5 Vt_debounce 1 ms
The actual schematic inside this block — every part is explained below.

Debounced Button

A button doesn't close once — it chatters. The contacts physically bounce, making and breaking dozens of times in the first millisecond. To your code that looks like a user pressing the button twenty times. This block makes one press read as one press.

  • R1 (10 k) — pulls the line to VCC: released = HIGH, defined, no floating input.
  • SW1 — shorts the line to ground when pressed. Active-low is the convention because pulling down through a switch is the oldest, most noise-robust trick in logic design.
  • C1 (100 n) — the actual debouncer. The capacitor can't change voltage instantly, so the chatter becomes one smooth glide: on press it discharges through the switch fast but monotonically; the bounces just interrupt a slide that never reverses enough to re-cross the logic threshold. One press, one edge.

The time constant R1×C1 ≈ 1 ms swallows typical tact-switch bounce. The hidden bonus: C1 discharging through the switch also makes the contacts arc a tiny bit less than a bare GPIO wiring would — gentle on both sides.

Exposes: vcc, out (HIGH = released, LOW = pressed), gnd.

⚠ Disable your pin's internal pull-up when using this block — two pull-ups in parallel shift the RC timing and waste current. And if your firmware ALSO debounces (most frameworks do), pick one place for the job, not two fighting timers.

Exposed nets

vccin · power · 1.8–5.5 V
gndin · gnd
outout · signal

Inside this block

SW1
tact
the button — mechanically it doesn't close once, it chatters dozens of times in the first millisecond
R1
10k
pull-up — defines the idle-HIGH level and recharges C1 after release
C1
100n
the debouncer — the RC lag glides through the contact chatter so OUT crosses the logic threshold exactly once

Limits & gotchas

polarity.note 0OUT idles HIGH and goes LOW when pressed (active-low). Read it with the pin's internal pull-up DISABLED — the external 10k is already doing that job.
timing.note 0R1×C1 = 10k × 100n ≈ 1 ms — right for tact switches (0.1–1 ms of bounce). A big clicky toggle can bounce for 10 ms+: scale C1 up to 1µF, or debounce the rest in firmware.
Use this block in a real design
Drop it on a canvas, wire it up, and watch the live checks — free, no card.
Start designing →
This page is generated from the block's source — the same content powers the editor's explanations and live checks.