Raspberry Pi Pico Setup

Pin assignments and connections for the Raspberry Pi Pico 2W microcontroller

Watch this step-by-step guide on connecting and configuring the Raspberry Pi Pico 2W for the cloth folding robot.

About Raspberry Pi Pico 2W

The Raspberry Pi Pico 2W is the brain of Fabrica. It features the RP2350 dual-core ARM Cortex-M33 processor, built-in WiFi/Bluetooth, and ample GPIO pins for interfacing with buttons, LEDs, and I2C devices.

Key Specifications

  • • RP2350 dual-core @ 150 MHz
  • • 520 KB on-chip SRAM
  • • WiFi 802.11n & Bluetooth 5.2
  • • 26 GPIO pins (3.3V logic)

Our Usage

  • • I2C communication (GP0, GP1)
  • • 4 input buttons (GP2-GP5)
  • • 1 status LED output (GP6)
  • • Power distribution via VBUS/GND

GPIO Pin Assignments

⚠️ Important: 3.3V Logic Levels

The Raspberry Pi Pico operates at 3.3V logic. Do not connect 5V signals directly to GPIO pins. The PCA9685 is 5V-tolerant on I2C lines, making them compatible.

Pin #GPIOFunctionConnectionNotes
I2C Communication
Pin 1GP0I2C0 SDAPCA9685 SDAData line
Pin 2GP1I2C0 SCLPCA9685 SCLClock line
Control Buttons (Active-Low, Pull-Up Enabled)
Pin 4GP2Button 1 InputGreen ButtonMotion Plan 1
Pin 5GP3Button 2 InputBlue ButtonMotion Plan 2
Pin 6GP4Button 3 InputYellow ButtonMotion Plan 3
Pin 7GP5Button 4 InputBlack ButtonMotion Plan 4
Status Indicator
Pin 9GP6LED OutputStatus LED (via resistor)Programming mode indicator
Power Distribution
Pin 363V3(OUT)3.3V OutputPCA9685 VCC (logic power)Max 300mA total
Pin 40VBUS5V Input/OutputOptional: PCA9685 V+ (if USB powered)500mA max from USB
Pin 3, 38GNDGroundCommon ground (all components)Multiple GND available

Pico Pinout Reference

Raspberry Pi Pico 2W Pinout Diagram

Physical Pin Numbers

Pin numbers are counted from top-left (Pin 1) going down the left side (1-20), then continuing at bottom-right (Pin 21) going up the right side (21-40).

GPIO Numbers

In code, we reference GPIO numbers (GP0-GP28), not physical pin numbers. Example: GP2 is on physical Pin 4.

Wiring Best Practices

✅ Recommended

  • • Use color-coded wires for easy identification
  • • Keep I2C wires short (<30cm) and twisted together
  • • Use female-to-female jumper wires with headers
  • • Label wires with tape or heat-shrink markers
  • • Test continuity before powering up

❌ Avoid

  • • Connecting 5V signals to GPIO inputs
  • • Using power supply >5V for VBUS
  • • Running I2C lines parallel to servo power cables
  • • Forgetting common ground connections
  • • Hot-swapping connections while powered

Code Configuration

Pin assignments are defined in config.py:

# I2C Configuration
I2C_CHANNEL = 0       # I2C bus number
SDA_PIN = 0           # GPIO 0 (Pin 1)
SCL_PIN = 1           # GPIO 1 (Pin 2)
I2C_FREQ = 100000     # 100 kHz

# Button Configuration
BUTTON_PINS = [2, 3, 4, 5]  # GP2-GP5

# LED Configuration
LED_PIN = 6           # GPIO 6 (Pin 9)

# PCA9685 Address
SERVO_CONTROLLER_ADDR = 0x40

Only modify these values if you change physical wiring or need different I2C addresses.