← Wiki · Component

Push button

A tactile switch closes a contact while pressed. Wired to GND with a pull-up, it reads 1 when released and 0 when pressed.

What it does#

A tactile button connects its two sides while held down. The 4-leg parts have two pairs that are always connected; the symbol shows just the switch. On a board it is usually a user input, a RESET (on EN or RUN) or a BOOT button (on a strapping pin).

Wiring#

Connect the button between the GPIO and GND, and pull the GPIO up to 3V3, with a 10 kΩ resistor or the chip’s internal pull-up. Released: 1. Pressed: 0. Wiring to GND is preferred: the risk of shorting the supply is gone and every microcontroller has internal pull-ups.

Example circuit: R1 pulls BTN up to 3V3, SW1 pulls it to GND when pressed. C1 (100 nF) is optional hardware debouncing.
R1 pulls BTN up to 3V3, SW1 pulls it to GND when pressed. C1 (100 nF) is optional hardware debouncing. Open the button_pullup example from this page in PCB Canvas: “Insert into my schematic”.

Debouncing#

Contacts bounce for a few milliseconds: one press can read as several. Fix it in firmware (ignore changes for 5–20 ms) or with an RC filter: the 10 kΩ pull-up and 100 nF give τ = 1 ms. Firmware alone is the usual choice.

Pitfalls#

  • Pressing BOOT changes how the chip starts. Buttons on strapping pins (GPIO9 on ESP32-C3/C6, GPIO0 on ESP32-S3) are read only at reset.
  • 4-leg footprints: pins 1–2 and 3–4 are internally joined on most 6 × 6 mm parts; check which pair is the switch.

Footprint#

  • Hand soldering: 6 × 6 mm through-hole, the breadboard classic.
  • JLCPCB: TS-1187A 5.1 × 5.1 mm SMD (C318884), basic part.