docs/book/src/hardware/index.md
ZeroClaw's hardware subsystem lets the agent control microcontrollers, SBCs, and peripherals directly. Enable with --features hardware.
| Target | Protocol | Page |
|---|---|---|
| STM32 Nucleo (F401RE, others) | Serial / OpenOCD | STM32 Nucleo |
| Arduino Uno Q | Serial / USB | Arduino Uno Q |
| Raspberry Pi | GPIO / I2C / SPI (via /dev/gpiochip*, /dev/i2c-*, /dev/spidev*) | Covered by peripherals design |
| Aardvark I2C/SPI host adapter | USB | Aardvark |
| Android (via Termux) | Serial-over-USB / Bluetooth | Android |
| Generic boards | Peripheral trait | Adding boards & tools |
See Peripherals design for the architecture.
At compile time:
cargo build --release --features hardware
Or, if you want only specific boards:
cargo build --release --features "hardware board-nucleo board-arduino"
With the feature enabled, the agent gains these tools:
gpio_read / gpio_write — digital I/Oi2c_read / i2c_write — I2C bus accessspi_transfer — SPI transfersadc_read — analogue reads (where supported)peripheral_probe — discover attached boards and sensorsperipheral_flash — flash firmware to a connected microcontrollerAll tool invocations go through the same security policy as any other tool. Restrict device access via:
[security.sandbox]
allow_devices = ["/dev/gpiochip0", "/dev/i2c-1", "/dev/ttyUSB0"]
The most common hardware target. A minimal setup:
# install
curl -fsSL https://raw.githubusercontent.com/zeroclaw-labs/zeroclaw/master/install.sh | bash
# add yourself to hardware groups (re-login after)
sudo usermod -aG gpio,spi,i2c $USER
# install as user service (ensures hardware group membership is inherited)
zeroclaw service install
The stock systemd unit sets SupplementaryGroups=gpio spi i2c.
Hardware tools can brick things. Real, expensive things.
peripheral_flash writes firmware — a bad image can brick the board. The tool requires operator approval at Supervised autonomy regardless of autonomy level; there's no way to auto-approve it.i2c_write / spi_transfer to device addresses the agent doesn't know can damage sensors.For production deployments with untrusted channels exposed, disable hardware tools per channel:
[channels.public-discord]
tools_deny = ["gpio_write", "i2c_write", "spi_transfer", "peripheral_flash"]
Per-board pin maps and electrical characteristics:
See Adding boards & tools for the step-by-step. TL;DR: implement the Peripheral trait from crates/zeroclaw-hardware/src/, add a board-specific feature flag, write a probe routine that identifies the board from USB descriptors or serial handshake.