Control Interface Wiring
Wire control buttons and status LED to Raspberry Pi Pico
Learn how to wire buttons and LED for user control and feedback.
User Interface Components
The control interface consists of 4 pushbuttons for selecting and programming folding sequences, plus 1 status LED for visual feedback during programming mode and system operation.
4 Control Buttons
- • Short press (<3s): Execute stored motion plan
- • Long press (≥3s): Enter programming mode
- • Active-low with internal pull-up (no external resistors needed)
- • 60ms debounce filtering in software
Status LED
- • Blinks during long button press (0.2s intervals)
- • Indicates programming mode active
- • Flashes on startup (3 blinks)
- • Requires current-limiting resistor (220-330Ω)
Button Wiring (Simple 2-Wire Connection)
✨ Simplified Wiring: No External Resistors Needed
The Raspberry Pi Pico has built-in pull-up resistors on GPIO pins. Each button requires only 2 wires: one to GPIO pin, one to ground. When pressed, the button connects GPIO to GND (reads LOW). When released, the internal pull-up keeps it HIGH.
Button Pin Assignments
| Button | GPIO (Pin) | Motion Plan | Notes |
|---|---|---|---|
| Button 1 (Green) | GP2 (Pin 4) | Motion Plan 1 | Active-low, internal pull-up |
| Button 2 (Blue) | GP3 (Pin 5) | Motion Plan 2 | Active-low, internal pull-up |
| Button 3 (Yellow) | GP4 (Pin 6) | Motion Plan 3 | Active-low, internal pull-up |
| Button 4 (Black) | GP5 (Pin 7) | Motion Plan 4 | Active-low, internal pull-up |
How It Works (Active-Low Configuration)
- • Button Released: GPIO reads HIGH (3.3V via internal pull-up resistor)
- • Button Pressed: GPIO connects to GND, reads LOW (0V)
- • Software: Detects falling edge (HIGH → LOW) to trigger action
- • Debouncing: 60ms delay filters out mechanical bounce
Status LED Wiring
⚠️ Current-Limiting Resistor Required
LEDs will burn out if connected directly to GPIO pins without a resistor. Always use a 220-330Ω resistor in series to limit current to safe levels (~7-10mA).
LED Circuit Connection
| Component | Connection | Notes |
|---|---|---|
| GP6 (Pin 9) | Resistor (220Ω–330Ω) | Signal pin → resistor → LED anode |
| Resistor | LED Anode (+) | Limits current (~7–10mA) |
| LED Cathode | GND (Pin 3 or 38) | Connect cathode (short leg) to ground |
LED Polarity Reference
Longer leg
Connects via resistor to GP6
Shorter leg, flat edge on body
Connects directly to GND
Resistor Value Guide
💡 Recommended: 330Ω for best balance of brightness and safety
📷 LED Wiring Diagram Placeholder
Schematic showing LED circuit with resistor will be added here
Complete Interface Wiring Table
| Component | Pico Pin | GPIO | Connection Details |
|---|---|---|---|
| Button 1 (Green) | Pin 4 | GP2 | Terminal 1 → GP2, Terminal 2 → GND |
| Button 2 (Blue) | Pin 5 | GP3 | Terminal 1 → GP3, Terminal 2 → GND |
| Button 3 (Yellow) | Pin 6 | GP4 | Terminal 1 → GP4, Terminal 2 → GND |
| Button 4 (Black) | Pin 7 | GP5 | Terminal 1 → GP5, Terminal 2 → GND |
| Status LED | Pin 9 | GP6 | GP6 → 330Ω Resistor → LED Anode (+), LED Cathode (−) → GND |
Physical Layout Recommendations
Control Panel Mounting
- • Mount buttons on front panel for easy access
- • Arrange in horizontal row or 2×2 grid
- • Space buttons 20-30mm apart (center-to-center)
- • Use color-coded buttons matching wire colors
- • Mount LED visible from front (near buttons or on top)
Wiring Tips
- • Use 22-24 AWG wire for buttons and LED
- • Keep wires short (15-30cm) to reduce noise
- • Solder connections or use Dupont connectors
- • Label each wire with button number
- • Route away from high-current servo power cables
Testing the Control Interface
Test 1: LED Functionality
- 1. Connect Pico to computer via USB (no other wiring yet)
- 2. Upload Fabrica code to Pico
- 3. On startup, LED should blink 3 times rapidly
- 4. If LED doesn't light, check polarity and resistor connection
Test 2: Button Detection
- 1. Open serial console (115200 baud)
- 2. Short-press each button (<3 seconds)
- 3. Console should display "Button X short press" messages
- 4. Verify correct button number appears for each press
Test 3: Long Press & LED Blink
- 1. Hold Button 1 for 3+ seconds
- 2. LED should start blinking at 0.2s intervals while held
- 3. Release button: LED stops, console shows "Entering config mode"
- 4. Repeat for all 4 buttons
Troubleshooting
Problem: Buttons don't respond
- • Check button wiring (GPIO pin and GND connections)
- • Verify button is not damaged (test with multimeter continuity mode)
- • Confirm GPIO pin numbers in config.py match physical wiring
- • Try pressing button harder (some tactile switches need firm press)
Problem: LED doesn't light
- • Verify LED polarity (longer leg = anode = +)
- • Check resistor is present (LED will fail without it)
- • Test LED separately with battery to confirm it works
- • Measure voltage at GP6: should be 3.3V when code sets LED.on()
Problem: Wrong button detected
- • Verify BUTTON_PINS array order in config.py: [2, 3, 4, 5]
- • Check you wired GP2→Button1, GP3→Button2, GP4→Button3, GP5→Button4
- • Buttons colored green/blue/yellow/black should match index 0/1/2/3
Code Configuration
Button and LED settings are defined in config.py:
# Button Configuration
BUTTON_PINS = [2, 3, 4, 5] # GPIO pins for buttons 1-4
LONG_PRESS_TIME = 3.0 # Seconds to hold for programming mode
DEBOUNCE_TIME = 0.06 # Button debounce delay (60ms)
# LED Configuration
LED_PIN = 6 # GPIO pin for status LED
LED_BLINK_INTERVAL = 0.2 # LED blink speed (seconds)
# Button Functions
BUTTON_LABELS = [
"Motion Plan 1 (Green)",
"Motion Plan 2 (Blue)",
"Motion Plan 3 (Yellow)",
"Motion Plan 4 (Black)"
]Modify LONG_PRESS_TIME to change programming mode activation time, or DEBOUNCE_TIME if buttons are too sensitive.