Button module (pull-down)
The button module is a 6 × 6 mm push button with a 10 kΩ pull-down resistor already fitted, so the output never floats. It costs $1.50 and is for every project that needs a human: start, stop, count, reset. Wire VCC to 3.3 V, OUT to a GPIO and GND to ground; OUT reads 1 while the button is pressed and 0 the rest of the time.
What's inside
| Part | Qty | Price each |
|---|---|---|
| Push button | 1 | $0.50 |
| Resistor | 1 | $0.25 |
| Total | 2 | $0.75 |
- The push button is a momentary contact: it joins its two sides only while held.
- The 10 kΩ resistor is the pull-down — it holds
OUTat 0 when the button is released, which is the whole reason an input does not read noise.
| Exposed pin | Inside the kit |
|---|---|
| vcc | btn:A1 |
| out | btn:B1 |
| gnd | r:2 |
VCC feeds one side of the button; OUT is the other side, which the resistor ties to GND until the button is pressed, at which point it sees 3.3 V. Because the pull-down is fitted, pull_up=False tells gpiozero what it already has.
Wiring it in circuit.py
from wiring import *
pi = Pi()
button = kits.ButtonModule()
pi.V3_3 >> button.vcc
pi.GPIO27 >> button.out
button.gnd >> pi.GNDDriving it in main.py
from gpiozero import Button
from time import sleep
button = Button(27, pull_up=False, bounce_time=0.02)
while True:
print("pressed" if button.is_pressed else "released")
sleep(0.2)Why buy the kit
The loose button and 10 kΩ resistor cost $0.75 in total — $0.50 + $0.25 — against $1.50: 75¢ for the correct pull-down soldered in place. Hand-wiring a pull-down is the step beginners skip, and skipping it makes an input read randomly; the module cannot float.
Simulator vs real hardware
- The pull-down is a real 10 kΩ resistor in the simulation, and the contacts still bounce for a few milliseconds; keep a small
bounce_timein gpiozero (the datafeed's bounce knobs can make it dirtier). - Click and hold the button on the canvas while the simulation runs; the module's cap is the target.
Button(27, pull_up=False)configures the Pi's internal pull-down as well — harmless in parallel with the module's resistor, but the external one is doing the work on a real bench.
Further reading
- gpiozero: Button —
pull_up,bounce_time,when_pressedandis_pressed.