Configuration

Customize Fabrica settings for your specific hardware setup

Understanding config.py

The config.py file contains all customizable settings. It is designed to be edited directly to match your robot's physical construction.

Key Sections

Hardware I/O
  • • I2C Pins (SDA/SCL)
  • • PCA9685 Address
  • • Button GPIO Pins
  • • LED Pin
Servo Calibration
  • • SERVO_MIN_PULSE
  • • SERVO_MAX_PULSE
  • • PWM Frequency
Motion Plans
  • • Default folding sequences
  • • Parallel vs Sequential steps
  • • Number of motors
System Tweaks
  • • Garbage Collection interval
  • • Logging enable/disable
  • • Startup initialization

Hardware Settings

Pins & Buses

Configure the GPIO connections for your Pico 2W.

# I2C Bus Configuration
I2C_CHANNEL = 0 # Bus 0
SDA_PIN = 0 # GPIO 0
SCL_PIN = 1 # GPIO 1
I2C_FREQ = 100000 # 100kHz

# Button Configuration
BUTTON_PINS = [2, 3, 4, 5] # Active-low buttons on GPIO 2,3,4,5
BUTTON_DEBOUNCE_MS = 60 # Anti-noise delay

# LED Configuration
LED_PIN = 6 # Status LED

Servo Calibration

Servos use Pulse Width Modulation (PWM). You define the pulse lengths (out of 4096) that correspond to 0° and 180°.

# Servo Calibration (12-bit PWM values for PCA9685)
SERVO_MIN_PULSE = 102 # Pulse for 0° (~500µs)
SERVO_MAX_PULSE = 512 # Pulse for 180° (~2500µs)
PWM_FREQ = 50 # Standard 50Hz for servos

⚠️ Tuning Tip: If your servos buzz or get hot at limits, adjust these values slightly. Increase MIN or decrease MAX to reduce the range.

Default Motion Plans

These plans are loaded if no motion_plans.json file exists on the device.

# Motion Plans
# Format: [ [Step1_Channels], [Step2_Channels], ... ]
MOTION_PLANS = [
  # Button 0: Sequential 0→1→2→3
  [[0], [1], [2], [3]],

  # Button 1: Reverse 3→2→1→0
  [[3], [2], [1], [0]],

  # Button 2: Pairs (0+1) then (2+3)
  [[0, 1], [0, 1], [2, 3]],

  # Button 3: All Together
  [[0, 1, 2, 3]]
]

Advanced Settings

System

# Memory Management
GC_COLLECT_INTERVAL = 100

# Logging
ENABLE_LOGGING = True

Startup

# Boot Behavior
INITIALIZE_SERVOS_ON_STARTUP = True
# (Moves all to 0° on boot)

✅ Configuration Complete

Once configured, upload the new config.py to your Pico.

Next: Learn how the software works internally in the Code Architecture section.