Bridges Claude to PicoCalc hardware running MicroPython over USB serial. Exposes file operations (push, pull, diff), REPL execution with 30 second timeouts, and safe eject sequences. Same tooling that powers the web dashboard, now accessible directly from AI conversations. Useful when you're iterating on MicroPython scripts for the device and want Claude to write code, deploy it to flash or SD card, run test commands, and check diffs without switching windows. Works alongside the code-skills repo which teaches Claude the hardware APIs and app patterns. Requires mpremote and a connected Pico 2W running the custom firmware.
A MicroPython firmware and script collection for the Clockwork Pi PicoCalc handheld device, powered by the Raspberry Pi Pico 2W. Features:
MicroPython/firmware/picocalc_micropython_pico2w.uf2 to that drive.The easiest way -- a local web UI that handles everything:
python3 MicroPython/tools/dashboard.py
This opens a browser dashboard where you can:
.py files to uploadFirst run will prompt to install
mpremoteif needed. Requires Python 3.7+.Adding new files: Scripts in
modules/andsd/py_scripts/are auto-discovered by the dashboard. Root-level files (likeboot.py) must be added toFILE_MAPindashboard.pyto appear.
Let your AI coding assistant talk directly to the PicoCalc -- write code, push it, test on device, iterate, all from the AI conversation.
MCP Server (Recommended)
MCP gives AI tools native access to the device with no dashboard running. Install from PyPI:
pip install picocalc-mcp
Then add to your .mcp.json or Claude Desktop config:
{
"mcpServers": {
"picocalc": {
"command": "picocalc-mcp"
}
}
}
Or run directly from the repo: "args": ["/path/to/PicoCalc/mcp/mcp_server.py"]
Works with Claude Code, Claude Desktop, Cursor, and any MCP-compatible tool. Full setup guide: MCP_README.md
See it in action: MCP & Dashboard Demo
Claude Code Skills (Optional)
For Claude Code users, the code-skills repo provides PicoCalc-specific skills that teach the AI how to write correct apps, use the hardware APIs, review code, and handle device operations. The MCP server gives the AI hands to interact with the device; the skills give it the knowledge to build for it.
# With skill-deployer installed, just paste a URL:
"install this skill https://github.com/LofiFren/code-skills/tree/main/skills/picocalc-app"
Dashboard REST API (Legacy)
If you already have the dashboard running, AI tools can also use its HTTP endpoints:
curl -s http://localhost:8265/api/device # Device status
curl -s -X POST http://localhost:8265/api/exec -H 'Content-Type: application/json' \
-d '{"code": "print(1+1)"}' # Run Python on device
curl -s -X POST http://localhost:8265/api/push -H 'Content-Type: application/json' \
-d '{"file": "sd/py_scripts/my_app.py"}' # Push file to device
curl -s "http://localhost:8265/api/diff?file=sd/py_scripts/synth.py" # Diff local vs device
curl -s -X POST http://localhost:8265/api/eject # Safe disconnect
All endpoints: /api/device, /api/exec, /api/push, /api/pull, /api/files, /api/diff, /api/local/tree, /api/eject, /api/reset, /api/cleanup
Use Thonny, mpremote, or rshell to copy files to the Pico's internal flash.
Copy these to the Pico root (/):
MicroPython/boot.py --> /boot.py
MicroPython/main.py --> /main.py
MicroPython/modules/ --> /modules/ (entire directory)
Copy SD card scripts:
MicroPython/sd/py_scripts/*.py --> SD card /py_scripts/
Do NOT copy these to the device (they run on your computer, not the PicoCalc):
tools/ <-- Dashboard web UI (runs on your computer)
picocalcdisplay/ <-- C source, compiled into firmware
vtterminal/ <-- C source, compiled into firmware
firmware/ <-- UF2 images and Dockerfile
py_scripts folder on the SD card..py files from MicroPython/sd/py_scripts/ into that folder.Or use the Dashboard -- click Deploy Scripts to push all scripts to the SD card over USB.
Power cycle the PicoCalc. The boot splash shows initialization progress, then the main menu appears with arrow-key navigation.
MicroPython/
|-- boot.py --> Copy to device /
|-- main.py --> Copy to device / (launches menu)
|-- boot_thonny.py --> Deploy as /boot.py for Thonny users
|-- boot_dev.py --> Deploy as /boot.py for dev mode (REPL only)
|-- cleanup.py --> (Optional) one-time cleanup, or use dashboard Cleanup button
|-- modules/ --> Copy to device /modules/
| |-- picocalc.py Hardware abstraction (display + keyboard)
| |-- vt.py VT100 terminal emulator
| |-- py_run.py Menu system with arrow-key navigation
| |-- enhanced_sd.py SD card initialization
| |-- picocalc_system.py System utilities
| |-- sdcard.py SD card driver
| |-- checksd.py SD card verification
| |-- pye.py Built-in text editor
| |-- colorer.py Terminal color support
| |-- default_style.py Syntax highlighting styles
| |-- highlighter.py Code syntax highlighting
| |-- flush.py Module cache flushing
| \-- mkdir.py Directory creation utility
|-- sd/py_scripts/ --> Copy contents to SD card /py_scripts/
| |-- tetris.py Tetris with sound effects
| |-- snake.py Snake with high scores
| |-- synth.py 4-instrument synthesizer with piano keyboard
| |-- ProxiScan.py BLE proximity scanner & fox hunt tool
| |-- WiFiManager.py WiFi scanning & connection manager
| |-- picocalc_ollama.py Local LLM client (Ollama)
| |-- picocalc_claude.py Remote Claude client (Anthropic API)
| |-- brad.py WiFi utility library
| |-- demo.py Visual display showcase (grayscale, animation)
| \-- editor.py On-device file browser + code editor
|-- firmware/ Prebuilt UF2 firmware images
| |-- picocalc_micropython_pico2w.uf2 (v1.25.0, stable)
| |-- picocalc_v127_pico2w.uf2 (v1.27.0, patched)
| |-- picocalc_v128_pico2w.uf2 (v1.28.0, native USB)
| |-- Dockerfile Build for v1.25.0
| |-- Dockerfile.v127 Build for v1.27.0 + USB fix
| |-- Dockerfile.v128 Build for v1.28.0 (no USB patch)
| \-- USB_REGRESSION_FIX.md RP2350 USB bug report
|-- micropython.cmake Top-level build config for C modules
|-- picocalcdisplay/ C display driver (compiled into firmware)
| |-- picocalcdisplay.c
| |-- picocalcdisplay.h
| |-- font6x8e500.h
| \-- micropython.cmake
|-- vtterminal/ C terminal emulator (compiled into firmware)
| |-- vtterminal.c
| |-- vtterminal.h
| |-- font6x8.h
| \-- micropython.cmake
|-- tools/ Development tools
| |-- dashboard.py Web UI server (run this!)
| |-- bottle.py Vendored web framework (zero install)
| \-- static/
| |-- index.html Dashboard frontend
| \-- vendor/ CodeMirror editor (vendored, offline)
mcp/ MCP server for AI assistants
|-- mcp_server.py MCP server (pip install picocalc-mcp or run directly)
\-- MCP_README.md Full setup guide
| App | Description |
|---|---|
| Tetris | Classic Tetris with 7 pieces, ghost piece, sound effects, level progression |
| Snake | Snake with high score tracking, speed levels, sound |
| Synth | 4-instrument synthesizer (Piano, Organ, Strings, Synth) with QWERTY piano keyboard, ADSR envelope, arpeggiator, 16-step sequencer, LFO effects, presets |
| ProxiScan | BLE proximity scanner, fox hunt tool with compass, signal tracking, competition timer, waypoints, antenna calibration |
| WiFiManager | WiFi scanner with VT100 UI, signal bars, channel analysis, signal monitor |
| SSH Client | Secure shell client -- ECDH-SHA2-NISTP256 key exchange, AES-128-CTR + HMAC-SHA2-256 encryption, RSA host key verification (TOFU), saved connection profiles with PIN-encrypted passwords, interactive VT100 terminal (53x40) |
| SSH Server | SSH into the PicoCalc for a MicroPython REPL -- ECDH-SHA2-NISTP256 key exchange, ECDSA-nistp256 host key, AES-128-CTR + HMAC-SHA2-256, password (salted-hash) and public-key (authorized_keys) auth |
| Ollama Client | Chat with local LLMs over WiFi via Ollama |
| Remote Claude | Chat with Claude (Anthropic API) over WiFi -- streaming replies, multi-turn, API-key or Max/Pro OAuth auth, PIN-encrypted credential. Default model claude-opus-4-8 |
| Demo | Visual display showcase: grayscale palette, bouncing boxes, scrolling gradient, device info |
| Editor | On-device file browser and code editor -- browse, create, edit, delete scripts without a computer |
The SSH client supports modern OpenSSH 10.x servers (which dropped legacy DH key exchange) via ECDH-SHA2-NISTP256, with automatic fallback to diffie-hellman-group14 for older servers. Key exchange completes in ~1.3 seconds on the RP2350.
Required files:
sd/py_scripts/ssh_client.py -- the SSH client applicationsd/py_scripts/secure_creds.py -- PIN-based credential encryption librarysd/wifi.json -- WiFi credentials (created by WiFiManager)Auto-created on first use:
/sd/ssh_profiles.json -- saved connection profiles (passwords encrypted)/sd/ssh_known_hosts.json -- trusted host key fingerprintsUsage:
ssh -p 2222 user@<ip> command for SSHing back intop, you may need to press Ctrl+C rapidly a few times since the keyboard is polled between SSH packetsRun SSH Server to log in to the PicoCalc from another machine and get a live MicroPython REPL over the network. Reuses the SSH client's transport/crypto and adds the server side: an ECDSA-nistp256 host key, key-exchange signing, and password + publickey authentication.
Connect from your computer:
ssh -p 2222 <user>@<pico-ip> # password auth
ssh -i ~/.ssh/id_ecdsa -p 2222 <user>@<pico-ip> # public-key auth
The app's status screen shows the exact command (with the device IP) and the host-key fingerprint. Default port is 2222.
Files (on the SD card):
sd/py_scripts/ssh_server.py -- the SSH server application/sd/ssh_host_ecdsa.json -- ECDSA host key (auto-generated on first run)/sd/ssh_server.json -- username + salted password hash (set on first run)/sd/authorized_keys -- optional OpenSSH-format public keys (one per line) for key authNotes:
ecdsa-sha2-nistp256 and ssh-rsa/rsa-sha2-256. Ed25519 client keys are not yet supported -- use an ECDSA/RSA key or password auth.eval/exec with output streamed to your terminal); exit() or Ctrl-D disconnects.Remote Claude talks directly to the Anthropic Messages API (api.anthropic.com) over HTTPS and streams the reply token-by-token. Multi-turn conversation. First-run setup includes a model picker -- Opus 4.8 (default, most capable), Sonnet 4.6 (balanced), Haiku 4.5 (fastest/cheapest), or any model id you type -- and you can switch any time with /model. Requires WiFi (run WiFiManager first) and firmware with ssl/mbedtls (the v1.27/v1.28 builds include it).
Two ways to authenticate (chosen on first run):
| Mode | Header | When to use |
|---|---|---|
| API key (recommended) | x-api-key | Static credential, pay-as-you-go. Get one at console.anthropic.com. Best default for a handheld -- paste once, no expiry. |
| Max/Pro OAuth (experimental) | Authorization: Bearer + anthropic-beta: oauth-2025-04-20 | Use your Claude.ai subscription instead of API credits. Tokens are short-lived -- generate on your computer and re-paste via /auth when it stops working. |
Why API key is the default: the OAuth token expires and needs a refresh flow that's awkward on a headless device, whereas an API key is a static credential you paste once.
Getting a Max/Pro OAuth token (the setup screen also prints these steps):
brew install anthropics/tap/ant # or use Claude Code (logs in the same way)
ant auth login # sign in with your Claude subscription
ant auth print-credentials --access-token # copy the sk-ant-oat... value
Paste that token into the OAuth setup. It expires after a while -- refresh it the same way and re-enter via /auth.
The app is Claude-themed throughout: it opens with an orange sunburst intro on black (a temporary palette swap to true Claude clay #D97757), and the chat carries the same theme -- an orange Claude> label, light-orange prompt, and dim command hints -- restoring the default palette on exit.
Files (on the SD card):
sd/py_scripts/picocalc_claude.py -- the app/sd/claude.json -- auth mode + credential (PIN-encrypted via secure_creds when a PIN is set) + modelIn-chat commands: /models pick from a menu, /model <id> set a specific model, /reset clear history, /auth re-enter credentials, /help, /quit.
The main menu uses arrow-key navigation:
| Key | Action |
|---|---|
| Up/Down | Navigate script list |
| Enter | Run selected script |
| ESC | Exit to REPL |
| R | Reload script list |
| F | Flush module cache |
| M | Show memory/storage info |
| T | File management tools |
The prebuilt UF2 files in firmware/ are ready to flash -- building from source is not required. Only do this if you want to modify the C display/terminal drivers or experiment with different MicroPython versions.
Requires: Docker Desktop.
Stable, known-good USB. Used by the prebuilt picocalc_micropython_pico2w.uf2.
# 1. Build the Docker image (one-time, ~5 min)
docker build -t picocalc-build MicroPython/firmware/
# 2. Compile firmware with PicoCalc C modules (~3 min)
docker run --rm \
-v $(pwd)/MicroPython:/picocalc \
-v $(pwd)/MicroPython/firmware:/out \
picocalc-build \
bash -c "make BOARD=RPI_PICO2_W USER_C_MODULES=/picocalc/micropython.cmake -j\$(nproc) && \
cp build-RPI_PICO2_W/firmware.uf2 /out/picocalc_micropython_pico2w.uf2"
Newer MicroPython with BLE pairing APIs enabled. Includes a two-line patch for the RP2350 USB regression (see firmware/USB_REGRESSION_FIX.md).
# 1. Build the Docker image (one-time, ~5 min)
docker build -t picocalc-v127 -f MicroPython/firmware/Dockerfile.v127 MicroPython/firmware/
# 2. Compile firmware (~3 min)
docker run --rm \
-v $(pwd)/MicroPython:/picocalc \
-v $(pwd)/MicroPython/firmware:/out \
picocalc-v127 \
bash -c "make BOARD=RPI_PICO2_W USER_C_MODULES=/picocalc/micropython.cmake -j\$(nproc) && \
cp build-RPI_PICO2_W/firmware.uf2 /out/picocalc_v127_pico2w.uf2"
MicroPython v1.28.0 fixes the RP2350 USB-CDC regression upstream, so no USB patch is needed -- USB enumerates natively. This build keeps the BLE pairing APIs. Recommended if the patched v1.27 build fails to enumerate on your USB host (see issue #11).
# 1. Build the Docker image (one-time, ~5 min)
docker build -t picocalc-v128 -f MicroPython/firmware/Dockerfile.v128 MicroPython/firmware/
# 2. Compile firmware (~3 min)
docker run --rm \
-v $(pwd)/MicroPython:/picocalc \
-v $(pwd)/MicroPython/firmware:/out \
picocalc-v128 \
bash -c "make BOARD=RPI_PICO2_W USER_C_MODULES=/picocalc/micropython.cmake -j\$(nproc) && \
cp build-RPI_PICO2_W/firmware.uf2 /out/picocalc_v128_pico2w.uf2"
| File | MicroPython | Notes |
|---|---|---|
picocalc_micropython_pico2w.uf2 | v1.25.0-preview | Stable default, all apps work |
picocalc_v127_pico2w.uf2 | v1.27.0 (patched) | BLE pairing APIs, manual USB wrap (marginal on some hosts) |
picocalc_v128_pico2w.uf2 | v1.28.0 | Native USB (no patch), BLE pairing APIs -- recommended |
Dockerfile | v1.25.0-preview | Standard build |
Dockerfile.v127 | v1.27.0 + patches | USB fix + BLE security enabled |
Dockerfile.v128 | v1.28.0 + BLE patch | Native USB, BLE security enabled |
USB_REGRESSION_FIX.md | -- | Bug analysis and patch details |
| Component | Details |
|---|---|
| Display | 320x320 ILI9488 LCD, SPI1, 4-bit grayscale |
| Keyboard | Membrane keypad, I2C MCU at 0x1F |
| SD Card | SPI0, FAT32, mounted at /sd |
| Audio | PWM stereo, GPIO 27 (right) + GPIO 28 (left) |
| WiFi/BLE | CYW43 via Pico 2W |
| MCU | RP2350 (Raspberry Pi Pico 2W) |
"no module named 'picocalc'" after flashing new firmware:
picocalcdisplay/, vtterminal/) may be on the device filesystem, shadowing the C modules compiled into firmware. Delete them from the device -- they should only exist in the repo, not on the Pico./modules/ directory with picocalc.py is on the device.Boot doesn't auto-run:
boot.py is at the root of the Pico filesystem (/boot.py)./modules/ contains all .py files.SD card not mounting:
Display blank but REPL responds:
USB REPL not connecting (no serial port appears):
BOARD=RPI_PICO2_W. Default RPI_PICO is the wrong chip.--wrap=dcd_event_handler patch, but that workaround is marginal on some USB host controllers (see issue #11). v1.28.0 fixes the regression natively -- if v1.27 fails to enumerate, use picocalc_v128_pico2w.uf2. The v1.25.0-preview firmware also has no regression.ls /dev/tty.usbmodem* (macOS) or ls /dev/ttyACM* (Linux).Thonny shows KeyboardInterrupt traceback on connect:
main.py's menu loop. You'll see a traceback followed by >>>. This means Thonny connected successfully.Thonny shows "Unexpected read during raw paste":
boot_thonny.py as /boot.py on the device (meaning rename boot_thonny.py as boot.py). This skips os.dupterm() which conflicts with Thonny's raw paste protocol. The PicoCalc screen and keyboard still work for apps and the menu -- only REPL output moves to Thonny's shell panel instead of the device screen.boot.py as /boot.py.boot.py and don't need the Thonny variant.ssh -p 2222 user@pico-ip)claude-opus-4-8 default, and a choice of API-key or Max/Pro OAuth auth with the credential PIN-encrypted on the SD cardfirmware/Dockerfile.v128). The patched v1.27.0 build remains available as an alternative.enhanced_sd.initsd() retries the mount with backoff and validates capacity, so a slow card on first boot no longer comes up as internal flashpython3 MicroPython/tools/dashboard.py) with FTP-style dual-pane file manager, in-browser editor, REPL, drag-and-drop deploy, file diff, and macOS junk cleanupbeginDraw() blocks Core 1 during screen clear to prevent white flash artifactsboot_thonny.py variant for Thonny users (skips dupterm)Built on PicoCalc-micropython-driver by zenodante (LCD driver, keyboard logic, original 1.0 UF2 image).