Raspberry Pi Pico 2 W robot code for the PicoBot competition server at https://limetka.fei.tuke.sk/picobot-contest/.
Repository layout
main.py Entry point — imports and runs picobot_main
PicoBot/
picobot_config.py WiFi + server credentials (EDIT THIS FIRST)
picobot_main.py Main loop: web server + periodic status reporting
picobot.py PicoBot class: motors + arm (with no-hardware stub)
picobot_motors.py Motor driver (PCA9685 over I2C0)
picobot_arm.py Arm servo driver (PCA9685 over I2C1)
pca9685.py Low-level PCA9685 PWM chip driver
catch_boot.py Upload tool: catches Pico boot window and uploads all files
upload_to_second.py Same as catch_boot.py but waits for a specific replug event
Hardware
- Board: Raspberry Pi Pico 2 W (RP2350)
- Firmware: MicroPython v1.28.0 for RPI_PICO2_W (download)
- Motor board: PCA9685 PWM chip on I2C0 (GP20 SDA / GP21 SCL)
- Arm board: PCA9685 PWM chip on I2C1 (GP2 SDA / GP3 SCL)
- Testing without hardware: works —
_NullHardwarestub is used automatically
Quick start
1. Flash MicroPython
- Hold BOOTSEL on the Pico and plug in USB — it mounts as
RPI-RP2350. - Copy
micropython-pico2w.uf2onto the drive. - Pico reboots into MicroPython automatically.
2. Configure credentials
Edit PicoBot/picobot_config.py:
WIFI_SSID = 'YourNetworkName' WIFI_PASSWORD = 'YourPassword' REPORT_URL = 'https://limetka.fei.tuke.sk/picobot-contest/picobot/status' REPORT_AUTH = 'your-competition-bearer-token' REPORT_DELAY = 2 # seconds between status POSTs SERVER_ENABLE = True SERVER_BRAKE = False # True = motors locked unless competition is running
Get the bearer token from the competition page (/picobot-contest/competition → Token field).
3. Upload code
See UPLOAD_GUIDE.md for full details.
Short version — run from this directory:
python3 catch_boot.py # then unplug and replug the Pico
The script catches the 1-second boot window before main.py runs and uploads all seven files over raw REPL.
Competition server protocol
Every REPORT_DELAY seconds the robot POSTs:
{
"mac": "aa:bb:cc:dd:ee:ff",
"ip": "192.168.1.42",
"servo_base": 90,
"servo_arm": 90,
"servo_claw": 90,
"uptime_ms": 12345
}
with Authorization: Bearer <token>.
The server returns a single integer:
| Value | competition_ready | competition_running |
|---|---|---|
| 0 | False | False |
| 1 | True | False |
| 3 | True | True |
Verifying the robot is connected
# Dashboard shows all registered robots
curl https://limetka.fei.tuke.sk/picobot-contest/
# Test endpoint with your token
curl -X POST https://limetka.fei.tuke.sk/picobot-contest/picobot/status \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"mac":"aa:bb:cc:dd:ee:ff","ip":"1.2.3.4","servo_base":90,"servo_arm":90,"servo_claw":90,"uptime_ms":1000}'
# Should return: 3 (if competition running) or 1 (ready) or 0