Buttons & LED Wiring
User interface components: control buttons and status LED
8 min read
15-20 min work
User Interface Components
Start Button
Initiates folding sequence
Stop Button
Emergency halt/reset
Status LED
Visual feedback indicator
Button Wiring (with Internal Pull-ups)
✨ Simplified Wiring: The Raspberry Pi Pico has internal pull-up resistors, so you only need 2 wires per button (no external resistors required).
Start Button
GPIO Pin: GP16 (Pin 21)
- • One terminal → GP16 (Pin 21 on Pico)
- • Other terminal → GND (any ground pin)
When pressed, button connects GP16 to GND (reads as LOW). When released, internal pull-up keeps it HIGH.
Stop Button
GPIO Pin: GP17 (Pin 22)
- • One terminal → GP17 (Pin 22 on Pico)
- • Other terminal → GND (any ground pin)
Same logic: pressed = LOW (connected to GND), released = HIGH (internal pull-up).
LED Wiring (with Current-Limiting Resistor)
⚠️ Important: LEDs need a current-limiting resistor to prevent damage. Use 220Ω-330Ω resistor (standard values that work with most LEDs at 3.3V).
Status LED Circuit
GPIO Pin: GP18 (Pin 24)
- 1. GP18 → Resistor (220Ω or 330Ω)
- 2. Resistor → LED Anode (long leg, positive)
- 3. LED Cathode (short leg, flat side) → GND
LED Polarity
- • Anode (+): Longer leg
- • Cathode (−): Shorter leg, flat edge on LED body
Resistor Values
- • 220Ω: Brighter LED (~10mA)
- • 330Ω: Dimmer but safer (~7mA)
Wiring Summary
| Component | Pico Pin | GPIO | Connection |
|---|---|---|---|
| Start Button | Pin 21 | GP16 | Terminal 1 → GP16, terminal 2 → GND |
| Stop Button | Pin 22 | GP17 | Terminal 1 → GP17, terminal 2 → GND |
| Status LED | Pin 24 | GP18 | GP18 → 220Ω resistor → LED+, LED− → GND |
Testing Buttons & LED
- 1. Visual Check: Verify button orientation and LED polarity before powering
- 2. LED Test: Run
status_led.on()- LED should light up - 3. Button Test: Run
print(start_button.value())- should show 1 (not pressed) or 0 (pressed) - 4. Interactive Test: Create simple loop that turns LED on when button pressed