Real AI agent use cases, with sources and setup prompts
How to build hardware projects with AI agents
Short answer: Pick a common board (ESP32 for Wi-Fi/Bluetooth, Arduino for simple sensors, Raspberry Pi when you need Linux), describe the device in plain words, and let Claude Code or Codex write firmware in small milestones. Install the free Arduino CLI or PlatformIO so the agent can compile, upload and read the serial log itself. Test logic first in the free Wokwi simulator, and give the agent a check script that builds the firmware and runs it in Wokwi from the terminal so it can prove each change works before you flash anything, then wire from a pin-by-pin table (watch 3.3 V vs 5 V), flash over USB and paste serial output back to the agent. When the breadboard works, use free KiCad for a schematic and PCB — and have a person check voltages, currents and footprints before you order boards.
Real builds where people paired a coding agent with hardware: ESP32 voice boxes and usage meters, Wokwi firmware tests, KiCad schematics, desk satellite trackers and agents that power-cycle boards overnight. 24 matching use cases below, each with a public source.
Runs your compiled firmware in Wokwi's cloud simulator from the terminal and exits with pass or fail, so the agent can test without a board. Free MIT skills teach Claude Code, Codex and Cursor to use it; it also has an experimental MCP server.
Free CLI; CI simulation time is 50 min per rolling 30 days on the free plan (200 Hobby, 500 Hobby+, 2,000 Pro)
Install the Arduino CLI. Use Homebrew on macOS, or the official install script on Linux and macOS:
shell
# macOS / Linux (Homebrew)
brew install arduino-cli
# or the official script
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
arduino-cli version
Add ESP32 board support. This adds Espressif's board package index and installs the ESP32 core.
Find the board's port. Plug the board in over USB. The port looks like /dev/ttyUSB0 or /dev/cu.usbserial-… on Mac/Linux, or COM3 on Windows.
shell
arduino-cli board list
If nothing appears, install the USB-serial driver for your board (often CP210x or CH340) and try another cable — charge-only cables fail silently.
Create, compile and upload a blink test.esp32:esp32:esp32 is the generic ESP32 Dev Module FQBN. Run arduino-cli board listall esp32 to find your exact board.
Read the serial log. Match the baud rate to Serial.begin() in the code (usually 115200). Paste this output back to the agent — most fixes come from it.
Hand the loop to Claude Code or Codex. Open the agent in the sketch folder and paste the "Build the firmware step by step" prompt below. Tell it the FQBN, port and wiring table, and require a compile + serial read after every milestone.
Path B — ESP32 with PlatformIO
A good fit when the agent manages the whole project, because the board, libraries and build flags live in one platformio.ini file. See the PlatformIO Core install docs.
Install PlatformIO Core. Or install the PlatformIO extension in VS Code, which includes the same CLI.
shell
python3 -m pip install -U platformio
pio --version
Create the project.esp32dev is the generic ESP32 board ID. Find yours in PlatformIO's board list.
shell
mkdir my-gadget && cd my-gadget
pio project init --board esp32dev
Build, upload and monitor. The agent writes code in src/main.cpp, then runs:
shell
pio run
pio run -t upload
pio device monitor -b 115200
Simulate first in Wokwi (optional). Paste the same sketch into a new ESP32 project on Wokwi to test logic and wiring virtually before you touch real parts. Several builders below let agents flash and test firmware on virtual chips first.
Keep secrets out of git. Put Wi-Fi SSIDs, passwords and API keys in include/secrets.h (or PlatformIO build_flags from a local file) and add that file to .gitignore before the first commit.
cpp
// include/secrets.h — DO NOT COMMIT
#pragma once
#define WIFI_SSID "your-ssid"
#define WIFI_PASS "your-password"
Path C — Raspberry Pi over SSH (Linux gadgets)
Use this when you need a full OS: Python GPIO, cameras, a local LLM, Home Assistant or a desk gadget that talks HTTPS. The agent SSHs in and edits files on the Pi.
Flash and boot the Pi. Use the official Raspberry Pi Imager to write Raspberry Pi OS, enable SSH in the imager's settings, and put the Pi on your network.
Connect from your computer. From the machine where Claude Code or Codex runs:
Prefer SSH keys over passwords. Do not paste your Pi password into the chat.
Give the agent a project folder on the Pi. Clone or create a repo the agent can edit, then open Claude Code / Codex with SSH access (or mount the folder). Start with a GPIO blink or a tiny Flask/FastAPI status page before any fancy hardware.
Let the agent iterate on-device. Paste the "Raspberry Pi gadget" prompt below. Require the agent to run the script, show stdout/stderr, and only then change wiring or buy parts. For Home Assistant gadgets, see our [Home Assistant + AI agent guide](/how-to/how-to-connect-an-ai-agent-to-home-assistant.html).
Path D: let the agent test its own firmware in Wokwi (no board needed)
Agents write firmware fast but can't see an LED blink. This path gives them a single command that builds the code, runs it in the Wokwi simulator, presses virtual buttons and fails on a crash. Example: an ESP32 with an LED on GPIO2 and a button on GPIO4, built with PlatformIO (Path B). We compiled this project and checked every pass and fail branch of the script on Nov 28, 2026.
Install the Wokwi CLI and set a token. Create a token on the Wokwi CI dashboard. A valid token starts with wok_ and is 44 characters long. Put it in your shell profile, not in the project.
shell
curl -L https://wokwi.com/ci/install.sh | sh
# Windows PowerShell: iwr https://wokwi.com/ci/install.ps1 -useb | iex
wokwi-cli --version
export WOKWI_CLI_TOKEN=wok_your_token_here # add to ~/.zshrc or ~/.bashrc
Point Wokwi at the PlatformIO build.wokwi.toml sits in the project root next to platformio.ini. Wokwi doesn't compile anything; it runs the file pio run produces. (wokwi-cli init can write this file for you.)
toml
[wokwi]
version = 1
firmware = '.pio/build/esp32dev/firmware.bin'
elf = '.pio/build/esp32dev/firmware.elf'
Describe the circuit in diagram.json. This is the virtual breadboard: the board, a 220 Ω resistor and LED on GPIO2, and a button from GPIO4 to ground. Run wokwi-cli lint to catch wrong part names or pins.
The firmware under test. Prints READY at boot and toggles the LED on each button press. Your agent replaces this with your real project; keep the READY line so the test knows it booted.
Write a scenario test. Scenarios press buttons, set sensor values and check pins and serial output. Save as button.test.yaml. Scenarios are in alpha, so check the scenario docs if a step name changes.
Add the one-command check. Save as check.sh and run chmod +x check.sh. It exits 0 only if the build passes, the board boots and prints READY without a crash ("Guru Meditation"), and every *.test.yaml passes. A hang ends with exit code 3 instead of running forever.
bash
#!/usr/bin/env bash
# check.sh - build the firmware, then run it in the Wokwi simulator.
# Exit 0 = pass. Anything else = fail; the agent must read sim.log and fix the code.
set -uo pipefail
cd "$(dirname "$0")"
mkdir -p build
: "${WOKWI_CLI_TOKEN:?Set WOKWI_CLI_TOKEN (create one at https://wokwi.com/dashboard/ci)}"
echo "== 1/3 build =="
if ! pio run > build/build.log 2>&1; then
tail -n 30 build/build.log; echo "FAIL: build"; exit 1
fi
echo "== 2/3 boot test (must print READY, must not crash) =="
wokwi-cli . --timeout 10000 --expect-text "READY" --fail-text "Guru Meditation" \
--timeout-exit-code 3 --serial-log-file build/sim.log -q
rc=$?
if [ $rc -ne 0 ]; then tail -n 30 build/sim.log; echo "FAIL: boot (exit $rc)"; exit 2; fi
echo "== 3/3 scenario tests =="
for t in *.test.yaml; do
[ -e "$t" ] || continue
wokwi-cli . --timeout 20000 --scenario "$t" --fail-text "Guru Meditation" \
--timeout-exit-code 3 --serial-log-file "build/${t%.yaml}.log" -q
rc=$?
if [ $rc -ne 0 ]; then tail -n 30 "build/${t%.yaml}.log"; echo "FAIL: $t (exit $rc)"; exit 2; fi
echo "pass: $t"
done
echo "PASS: build + simulation"
Make the agent use it. Add these lines to CLAUDE.md (Claude Code) or AGENTS.md (Codex, Cursor) in the project root.
markdown
## Firmware rules
- After every code change run ./check.sh. A task is not done until it prints PASS.
- If it fails, read build/build.log or build/*.log, fix the cause, and run it again.
- For each new feature, add a *.test.yaml scenario that proves it works.
- Never edit check.sh or delete a test to make it pass. Ask me first.
- Only flash the real board (pio run -t upload) after ./check.sh passes, and ask before you do.
Optional: Wokwi skills and MCP for Claude Code. The free Wokwi agent skills teach the agent to decode ESP32 crash backtraces, find memory leaks and screenshot-test displays. The experimental MCP server lets it start a simulation, read serial and press buttons step by step. Run the first two lines inside Claude Code, the last one in your terminal.
shell
/plugin marketplace add wokwi/skills
/plugin install wokwi@wokwi-skills
# MCP server (needs WOKWI_CLI_TOKEN set in your shell)
claude mcp add --transport stdio --env WOKWI_CLI_TOKEN=$WOKWI_CLI_TOKEN wokwi -- wokwi-cli mcp
Optional: run the same test on every GitHub push. Add the token as a repository secret named WOKWI_CLI_TOKEN, then save this as .github/workflows/firmware.yml. It uses the official wokwi-ci-action.
Written for this setup. Replace anything in [brackets] before you send it.
1. Plan my hardware project
Start here, before buying parts.
I want to build: [describe what it does, where it lives, how it's powered]. I already have: [boards, sensors, tools]. Budget: [amount].
Give me: the board you recommend and why; a parts list with exact part types; a pin-by-pin wiring table with voltages (flag any 5 V part on a 3.3 V pin); the power budget and expected battery life if it runs on battery; and the main risks. Don't write code yet.
2. Build the firmware step by step
Use in Claude Code or Codex in the project folder, with the board plugged in.
Build firmware for this project: [paste the plan and wiring table]. Use [Arduino CLI with FQBN esp32:esp32:esp32 / PlatformIO with board esp32dev] on port [port].
Work in small milestones: 1) serial print and blink, 2) read one sensor, 3) add the display or network, 4) add power saving. After each one, compile, upload, read the serial monitor and show me the output before moving on. Ask before installing any library. Never hardcode my Wi-Fi password; put it in a secrets header that's ignored by git.
3. Check my wiring before power-on
Send a clear photo of the breadboard plus your wiring table.
Before I plug this in, check my wiring. Photo: [attach]. Intended wiring table: [paste]. Board: [model]. Look for: wrong voltage on any pin, shorts between power and ground, missing ground connections, pull-up resistors for I2C, the right current-limiting resistors for LEDs, and pins that are input-only or used during boot on this board. List every problem you can see, and say which wires you can't see clearly.
4. Debug from the serial log
When it compiles but doesn't work.
My [board] project compiles and uploads but [what goes wrong]. Here is the serial output from boot: [paste]. Here is the code: [paste or point to files]. Wiring: [table]. Find the most likely cause, explaining what each error or reset reason in the log means. Suggest the smallest change or test to confirm it before rewriting anything.
5. Simulate it in Wokwi first
Before you buy parts or while waiting for shipping.
Turn this plan into a Wokwi ESP32 project I can paste into wokwi.com: [paste plan + wiring]. Give me: the diagram.json wiring, the sketch that proves the logic (serial prints for every state), and a short test checklist. Flag anything Wokwi can't simulate (exact RF, battery life, some sensors) so I know what still needs real hardware.
6. Turn the prototype into a KiCad board
When the breadboard version works.
My breadboard prototype works: [wiring table, parts list, photo]. Help me turn it into a KiCad schematic and a two-layer PCB. List every component with a footprint suggestion, flag parts that are hard to hand-solder, add decoupling capacitors and a programming header, and give the board size and mounting holes for a [case or enclosure]. Point out anything I should test on the prototype before ordering boards. Do not claim the board is ready to manufacture until I have reviewed voltages and footprints.
7. Raspberry Pi gadget
Path C, with SSH to the Pi.
I have a Raspberry Pi at [host] with SSH key access. Project folder: [path]. Goal: [desk meter / voice box / camera gadget / HA bridge].
Write a small Python app using gpiozero (or the Pi camera stack if needed). Create a venv, a README with pin wiring, and a systemd user service so it starts on boot. Run it, show me the logs, and stop if anything needs root or exposes a port to the whole LAN — ask me first. Keep secrets in a chmod 600 env file, not in the repo.
8. Set up the self-test loop
Once per project, in Claude Code or Codex, before writing features.
Set up Wokwi testing for this PlatformIO project so you can check your own work without my board. Board: [esp32dev]. Parts and pins: [paste wiring table].
1) Write wokwi.toml pointing at .pio/build/[env]/firmware.bin and .elf.
2) Write diagram.json with the same parts and pins as my wiring table, then run wokwi-cli lint and fix every error.
3) Make the firmware print READY at the end of setup().
4) Create check.sh that runs pio run, then wokwi-cli with --expect-text READY --fail-text "Guru Meditation" --timeout-exit-code 3, then every *.test.yaml scenario.
5) Run ./check.sh and show me the output. Don't flash the real board.
9. Write a scenario test for each feature
After the agent adds a feature such as a button, sensor threshold or menu.
Write a Wokwi scenario file named [feature].test.yaml that proves this feature works: [describe the behaviour, e.g. when temperature goes above 30 C the fan pin goes HIGH and serial prints FAN ON].
Use wait-serial for messages, set-control to press buttons or change sensor values, delay with units (e.g. 200ms), and expect-pin on the board pin. Then run ./check.sh. If the test fails, fix the firmware, not the test, unless the test itself is wrong; if so, explain why before changing it.
10. Fix a crash from the backtrace
When serial shows "Guru Meditation Error" or the board keeps rebooting.
My ESP32 crashes. Here is the full serial output, including the Backtrace line: [paste]. The ELF file is .pio/build/[env]/firmware.elf.
Decode the backtrace into function names and line numbers (use xtensa-esp32-elf-addr2line from the PlatformIO toolchain, or pio's esp32_exception_decoder monitor filter). Tell me the root cause in one sentence, fix it, add a scenario test that reproduces the crash, and run ./check.sh until it passes.
11. Plan battery life and deep sleep
Before you put the gadget on a battery.
This gadget will run on [battery type and capacity, e.g. 2,000 mAh LiPo]. It needs to [wake every X minutes, read the sensor, send over Wi-Fi]. Board: [model]. Other parts: [list].
Estimate the current in each state (active, Wi-Fi transmit, deep sleep) with your source for each number, then the battery life. Change the firmware to use deep sleep between readings, turn off anything not needed, and list the hardware changes (power LED, regulator choice) that would matter most. Mark every estimate that I should measure with a USB power meter.
12. Review my board before I order it
Before you upload KiCad Gerbers to a PCB maker.
Review this KiCad project before I order boards: [attach the .kicad_sch and .kicad_pcb, or paste the netlist and BOM].
Check: every IC has the right supply voltage and a decoupling capacitor near its power pin; no 5 V signal goes to a 3.3 V-only pin; footprints match the exact parts in the BOM (package size, pin order); trace widths suit the current; the USB, antenna and mounting holes have clearance; ERC and DRC are clean. Give me a numbered list of problems, worst first. Don't change any files.
Safety checklist
Check voltages before you power on. Many boards use 3.3 V logic, and 5 V on the wrong pin can destroy them.
Mains voltage (110–240 V) can kill. Use certified modules and don't let an agent design mains wiring.
Lithium batteries need a proper charger and protection circuit. Never leave a new battery build charging unattended.
Keep Wi-Fi passwords and API keys out of code you share or push to GitHub — use a gitignored secrets header.
Motors and heaters need a separate power supply and a way to cut power fast.
Only flash boards you can recover. Prefer Wokwi or a blink test before anything that talks to the network or moves.
Keep your WOKWI_CLI_TOKEN out of the repo: put it in your shell profile locally and in a GitHub Actions secret for CI.
A passing simulation doesn't prove the real circuit is safe. Wokwi doesn't model current draw, heat or wrong voltages, so still check them with a multimeter before power-on.
Blueprint is a free tool that works like a coding agent for electronics. You describe the Arduino or Raspberry Pi project you want and it returns wiring diagrams, a parts list and step-by-step assembly instructions.
Chiplab is an MCP platform that lets agents compile, simulate and validate firmware on the actual target chip without physical hardware, for testing, porting to a new chip or debugging a HardFault.
Konnect is a KiCad 10 plugin that lets Claude and other assistants design schematics and PCBs over MCP: 228 tools for schematic capture, layout, routing, ERC/DRC checks, JLCPCB part search and manufacturing exports, with skills that teach Claude KiCad conventions.
A maker built a physical voice interface for his own AI agent on an ESP32, powered by Hermes Agent from Nous Research, and documented the build in a 16-part thread.
His ESP32-S3 desk display shows his Claude Code and Codex 5-hour and weekly usage when idle. The PC pushes the numbers over Wi-Fi so credentials stay on the PC, and it backs off when rate-limited.
A maker added a MOSFET to switch 48V power to each port under firmware control and asked Claude Code to review the circuit. Its feedback found real problems and he had to add more components.
With Grok Bot he built a tiny desk satellite tracker: an ESP32-S3 shows the ISS and 6 other satellites live over a world map, with a radar for the next pass over his city, in a 3D-printed case.
For OS development on an x86 board, he built a harness with two ESP32s, one for the serial terminal and one driving a servo taped to switches to power-cycle the board.
His Grok Bot runs in the cloud and could not reach his Roborock robot vacuum on the home network, so he installed Home Assistant OS on an old Raspberry Pi 4 as a local hub: the bot sends the request, Home Assistant talks to the vacuum locally and data stays at home.
Building a home robot, a hobbyist vibe-coded an 8-layer board but every autorouter failed; FreeRouting left 350 connections unrouted after 4 hours. He asked Fable and GPT-6 Astra to write a router, had a working draft the next day and kept agents improving it 24/7.
With no hardware background, he built Hans, a local AI beaver: you type on a keyboard and Hans answers on a screen, powered by Google's Gemma 4 running on a Raspberry Pi 5. Claude Code wrote it.
A weekend project: he had Claude Code add every IoT device in his household to Home Assistant running on a Raspberry Pi 5, including closed-off devices like his Dyson robot vacuum, and designed the dashboard with Mobbin and the Paper MCP.
A Chinese builder wired a small ESP32 desk robot to a gateway on his computer. Call it by one nickname and the question goes to his local Claude Code; call it by another and it is routed to a Gemini model. He plans the same name-based wake-up for each of his Grok Bots.
Without writing code, he chatted with Grok Bot to build his own TV home screen with live game-day scores, a family dashboard, a finance dashboard and a daily Kindle newsletter for the house, run by a small team of bots.
The PS5 has no developer mode, so instead of touching the console he had Claude Code build everything around it: a DNS blocker on an always-on Raspberry Pi or mini PC that blocks promo and tracking domains for the whole house, wake-from-phone, streaming to a laptop, and Home Assistant showing the console status and putting it to sleep at 1am.
Bokko is a pendant prototype: hold a button, speak a task to Hermes Agent on your Mac, read the conversation on its 1.47-inch display and hear replies from the Mac. It uses Bluetooth, an 800 mAh battery and a 3D-printed case.
A developer built computer use for iPhone: a small iOS app streams the screen to a server, the server offers MCP tools to Codex, and an Arduino acting as a mouse taps the phone wherever Codex points.
A builder making his own JARVIS had Grok write the code for an MCP server on his TV, so Grok Bot can read the screen and drive it like he would. Next he plans a Raspberry Pi that runs the whole house.
With no earphones or phone mount on his two-wheeler, a builder used Claude Code to reverse-engineer a cheap boAt smartwatch's Bluetooth protocol so Google Maps turns arrive on his wrist as dots and dashes.
A retro fan plugged a Raspberry Pi into an old TV and pointed Claude at it. It now runs his own cable network with internet streaming, live weather and movies from his NAS, plus a phone remote he built.
How do you build hardware projects with AI agents?
Pick a common board (ESP32 for Wi-Fi/Bluetooth, Arduino for simple sensors, Raspberry Pi when you need Linux), describe the device in plain words, and let Claude Code or Codex write firmware in small milestones. Install the free Arduino CLI or PlatformIO so the agent can compile, upload and read the serial log itself. Test logic first in the free Wokwi simulator, and give the agent a check script that builds the firmware and runs it in Wokwi from the terminal so it can prove each change works before you flash anything, then wire from a pin-by-pin table (watch 3.3 V vs 5 V), flash over USB and paste serial output back to the agent. When the breadboard works, use free KiCad for a schematic and PCB — and have a person check voltages, currents and footprints before you order boards.
Can AI write Arduino or ESP32 code?
Yes. Coding agents such as Claude Code and Codex write, compile and debug Arduino and ESP32 firmware when they can run the Arduino CLI or PlatformIO and read the serial monitor. Give them your exact board and parts, and paste serial output back when something fails.
Do I need electronics experience?
It helps, but many builders below started as beginners. Ask the agent for a pin-by-pin wiring table with voltages, start with one component at a time, and check voltages before powering on. Use Wokwi to prove the logic before you buy parts.
Can AI design a circuit board?
Agents can draft KiCad schematics and board layouts and suggest footprints — builders below do this, and some even edit KiCad live through its API. A person still needs to check voltages, clearances, footprints and the BOM before you order boards.
Arduino CLI or PlatformIO — which should I pick?
Arduino CLI is simpler if you already think in sketches. PlatformIO is better when the agent owns the project long-term, because board, libraries and flags live in one `platformio.ini`. Both are free; pick one and stay consistent.
ESP32 or Raspberry Pi?
ESP32 (or Arduino) when you want a cheap, low-power gadget with Wi-Fi or Bluetooth firmware. Raspberry Pi when you need Linux, Python, a camera, a local model or Home Assistant. You can mix them: an ESP32 sensor talking to a Pi.
Is it safe to let an agent flash my board?
Only flash boards you can recover (USB bootloader, spare blank chip). Start with blink + serial print. Never let an agent design or wire mains (110–240 V). Keep lithium battery charging on a proper protection circuit, and keep Wi-Fi passwords out of shared repos.
Can an AI agent test firmware without the real board?
Yes. Give it the free Wokwi CLI and a token, and it can build the firmware, run it in Wokwi's simulator, press virtual buttons, set sensor values and check pins and serial output from the terminal. Path D above shows a check.sh that exits 0 only when everything passes. You still test on the real board before you trust it.
Does Wokwi simulate Wi-Fi and Bluetooth?
Wi-Fi yes, Bluetooth no. Wokwi's ESP32 docs list Wi-Fi as simulated on the ESP32, S3, C3, C5, C6 and P4, and Bluetooth as not implemented. Test Bluetooth features on real hardware.
How much does Wokwi testing cost?
The simulator on wokwi.com is free for public projects. Running it from the CLI or CI uses simulation time: 50 minutes per rolling 30 days on the free plan, 200 on Hobby (€5.6/mo yearly), 500 on Hobby+ (€8.1/mo) and 2,000 on Pro (€20/seat/mo). Free and Hobby sessions are capped at 5 minutes each, so keep tests short with --timeout.
Does Wokwi keep my firmware?
Wokwi says the CI server receives your firmware binary, simulates it and deletes it when the simulation finishes. If you can't upload firmware to a cloud service, Wokwi offers on-premises CI by request.
Which AI tools do people use to build hardware projects?
Across the 24 sourced use cases in this guide, the most used tools are Claude Code, ESP32, Grok Bot, Claude, Home Assistant.
How much does it cost to get started?
5 of the 24 use cases can start on a free plan. The most common paid starting price is $17/mo (7 use cases). Prices come from each tool's official pricing page.
How long does setup take?
4 of the 24 use cases list a setup time of an hour or less. Each card shows the setup time the builder reported.
Are these real examples?
Yes. Every use case links to its public source (an X post, a Hacker News thread or a GitHub repo) with the author and date, so you can check it yourself.
The Daily 5
Liked this guide? Get five new use cases tomorrow morning
Five new real AI use cases every morning. Free. Unsubscribe any time.