Skill Development

m5-onboard

A Claude Code skill from the cwc-makers plugin that automates first-time setup of an M5Stack ESP32 device (Cardputer, Cardputer-Adv, Core, CoreS3, Stick). It detects the board on USB, flashes UIFlow 2.0 firmware, and installs the Claude Buddy MicroPython app bundle.

Last verified: write-up checked

brew install python@3.13
m5-onboard — illustration

What it is

m5-onboard automates the full cold-start workflow for an M5Stack ESP32 device. It detects the device on USB, identifies the model, flashes UIFlow 2.0, and pushes a MicroPython app bundle onto /flash/ so the device boots into user software. The bundled apps are a custom launcher, Hello, the Claude Buddy BLE client and Snake. They talk over BLE or USB. The workflow runs on macOS, Linux and Windows. It was developed against an M5Stack Basic v2.6 (CH9102 bridge, ESP32-D0WDQ6-V3, 16 MB flash) and then generalized to cover the rest of the Core family. The current default target is the Cardputer-Adv (ESP32-S3, native USB), and onboard.py defaults to --variant cardputer-adv. The skill ships as part of the cwc-makers plugin for reference. The executable scripts and the buddy/ app bundle live in a local clone of https://github.com/moremas/build-with-claude, which the /maker-setup command creates. The main orchestrator, scripts/onboard.py, runs the stages in order and handles the handoffs between them: - detect.py: finds the port and identifies the chip, using a factory-partition signature or an I2C scan. - fetch_firmware.py: gets firmware from the M5Burner manifest API, caching and MD5-verifying it. - flash.py: wraps esptool, at 460800 baud on UART bridges or --no-stub at 115200 on native USB. - install_apps.py: uploads apps through the paste-mode REPL. - smoke_test.py: an optional check of I2C, the LCD, the speaker and the buttons. Several hard-won gotchas are built into the scripts: - Native-USB ESP32-S3 boards need a physical BtnG0+BtnRST button press to enter download mode. There is no software path for this. - NVS writes must use set_str rather than set_blob. - Native-USB boards reboot through repl_reset, not through DTR/RTS. - Cardputer-Adv BLE apps need NVS boot_option=2 plus a custom main.py. Without them, UIFlow's Flow-pairing advertise wedges the NimBLE controller. The skill also tells Claude how to run the long flash from the Bash tool: in the background, with a tee'd log that it monitors. It also requires Claude to relay the physical button steps to the user.

Who it's for

  • Makers provisioning a freshly plugged-in M5Stack ESP32 board (Cardputer, Cardputer-Adv, Core, CoreS3, Stick)
  • Event attendees setting up Cardputer-Adv devices with the Claude Buddy app bundle
  • Users who want to flash, re-provision, reset or refresh apps on an M5Stack device
  • Users who want to pair an M5Stack device with Claude Desktop's Hardware Buddy over BLE

Requirements

Requirements

  • Python 3, which Claude detects with python3 --version / python --version and installs via the native package manager if it is missing
  • A local clone of https://github.com/moremas/build-with-claude, created by the /maker-setup command (git optional: it falls back to curl+tar)
  • esptool, a pip dependency declared in requirements.txt and auto-prompted for install on first run
  • pyserial 3.5, which is vendored under scripts/vendor/ and needs no install
  • An M5Stack ESP32 device connected over USB
  • On Linux: membership in the dialout group (Debian/Ubuntu/Arch) or uucp group (Fedora) for serial port access
  • On Windows, for UART-bridge boards only (Basic, Fire, Core2, StickC): a manually installed CH9102 USB-UART driver

Setup

  1. Create the local clone of build-with-claude

    The scripts and buddy/ bundle live in a local clone of https://github.com/moremas/build-with-claude, which the /maker-setup command creates. Run every scripts/*.py invocation from inside that clone's onboard/ directory.

    text
    /maker-setup
  2. Check Python is installed

    Python must exist before the skill can do anything. Detect it by running the version check. If it fails, install Python with the host's package manager.

    bash
    python3 --version
  3. Install Python on Windows (if missing)

    This takes about 30 seconds and shows no UI. If the shell can't see python afterwards, close and reopen the terminal.

    powershell
    winget install -e --id Python.Python.3.13 --silent --accept-source-agreements --accept-package-agreements
  4. Install Python on macOS (if missing)

    Python 3 is usually pre-installed as /usr/bin/python3. If it isn't, use Homebrew. If Homebrew itself is missing, install it only after the user confirms.

    bash
    brew install python@3.13
  5. Install Python on Linux (if missing)

    Use the distro package manager. This is the Debian/Ubuntu command. On Fedora use sudo dnf install -y python3 python3-pip. On Arch use sudo pacman -S --noconfirm python python-pip.

    bash
    sudo apt-get update && sudo apt-get install -y python3 python3-pip
  6. Install esptool

    onboard.py's preflight prompts to install esptool if it is missing. Non-interactive callers get this hint instead. Inside a venv, --user is dropped.

    bash
    python -m pip install --user esptool
  7. Linux: grant serial port permissions

    Without group membership, the flash step can fail with Permission denied or Could not open port. Log out and back in afterwards, because the group change only applies to new sessions.

    bash
    sudo usermod -aG dialout $USER

هالسكيل بيعمل كل خطوات تجهيز جهاز M5Stack ESP32 جديد من أولها لآخرها: بيكتشف الجهاز على الـUSB، وبيفلّش عليه UIFlow 2.0، وبينزّل عليه تطبيقات Claude Buddy. بتستعمله لما توصّل الجهاز وبدك تفلّشه أو تجهّزه أو ترجّعه لأوله، أو لما تقول "m5-onboard go".

Examples

Trigger phrase

Prompt
prompt
m5-onboard go

Expected output: Saying this phrase invokes the skill to run the full onboarding workflow.

Default provisioning command

bash
bash
python3 scripts/onboard.py --apps buddy

What it does: Provisions a fresh Cardputer-Adv end-to-end: detect, identify, flash UIFlow 2.0, then install the buddy app bundle.

Background launch and log monitoring from Claude Code

bash
bash
# Launch (background, tee log):
python3 scripts/onboard.py --apps buddy 2>&1 | tee /tmp/m5-onboard.log

# Monitor (surfaces key events without drowning in byte-progress spam):
tail -f /tmp/m5-onboard.log | grep -E --line-buffered \
  "^====|heartbeat|Heads up|Enter download mode|download mode!|rebooted into UIFlow|Manual reset|DONE|ERROR|Error|Traceback|FAIL|failed|No USB|not detected|Attempt [0-9]|Device already in download|Download mode port|Post-flash port|Waiting for device"

What it does: The command runs for 2–3 minutes, so it must run with run_in_background: true and a tee'd log. The log is then monitored so stage banners and button prompts reach the user in real time.

Install or refresh apps without re-flashing

bash
bash
python3 scripts/install_apps.py --port <PORT> --src buddy

What it does: Pushes the buddy bundle onto an already-provisioned device. <PORT> is whatever detect.py printed, for example /dev/cu.usbmodem1101, /dev/ttyACM0 or COM3.