The Approach

Describe physical behavior. AI writes the firmware.

The same principle as vibe coding — but with hardware in the loop. Your job is to specify what should happen physically: what triggers it, what responds, how it feels. AI handles `digitalWrite`, timing, and state machines.

01

Describe physical events, not code structure.

"When the PIR sensor detects motion, the servo sweeps to 90° and holds for 3 seconds, then returns slowly." That's a spec AI can act on. "Use a for loop to sweep the servo" is an implementation choice you haven't earned yet.

Name the trigger, the response, and the timing. Let AI handle the loops and registers.
02

Specify your hardware precisely.

Board model, component names, pin numbers. Ambiguity in hardware descriptions produces firmware that almost works — which is the hardest possible thing to debug. "A sensor" can mean fifty things. "DHT22 on GPIO 4" means one.

"ESP32 DevKit v1. DHT22 temperature sensor on GPIO 4. SSD1306 OLED on I2C (SDA GPIO 21, SCL GPIO 22)."
03

Simulate before you wire.

Test your firmware logic in a browser simulator before connecting real hardware. A logic error found in simulation costs seconds. The same error found after soldering costs an hour and possibly a component. Simulation is not optional — it's the cheapest test you'll ever run.

Wokwi runs Arduino and ESP32 in the browser, free. Simulate first, always.

Paste a hardware specification like this at the top of every firmware prompt. Precision here removes an entire category of AI error.

Board:Arduino Uno / ESP32 DevKit v1 / Arduino Nano 33 IoT / etc.
Inputs:Component name, model if known, pin number(s), protocol (digital/analog/I2C/SPI).
Outputs:Component name, pin number(s), type (LED/servo/motor/display/speaker).
Libraries:Any libraries already installed, or "use standard Arduino libraries only."
Behavior:What should happen, when, in response to what — in plain language.
Feel:How the physical response should feel: snappy / gradual / weighted / playful / urgent.
Tools

Six tools across the microcontroller workflow.

AI generates your firmware. Development environments upload it. Simulators let you test it before touching hardware. Know which tool belongs at which stage.

Screenshot
Claude — hardware spec + behavior description → firmware
Claude
Free + Pro
Firmware generation · behavior-to-code · explanation
The strongest tool for generating firmware from a physical behavior description. Paste your hardware spec and describe what should happen — Claude writes commented, readable code and will explain every section on request.
How to start
  1. Paste your hardware specification template
  2. Describe the physical behavior in plain language
  3. Ask for commented Arduino/ESP32 code
  4. Ask Claude to explain any section you don’t understand
  5. Copy the code → test in Wokwi before uploading
Screenshot
Arduino IDE — code loaded + Serial Monitor open
Arduino IDE 2
Free
Upload to board · Serial Monitor · library management
The standard environment for uploading code to Arduino and many ESP32 boards. Paste AI-generated code here, select your board and port, and upload. The Serial Monitor is your primary debugging window — treat it as essential, not optional.
How to start
  1. Download Arduino IDE 2 at arduino.cc
  2. Install board support: Tools → Board Manager
  3. Paste AI-generated code into a new sketch
  4. Select your board + port under Tools
  5. Upload → open Serial Monitor (9600 or 115200 baud)
Screenshot
Wokwi — circuit diagram + code + running simulation
Wokwi
Free
Browser simulation · test before hardware · Arduino + ESP32
Simulates Arduino, ESP32, and many common components — sensors, servos, displays, LEDs, buttons — entirely in your browser. Test firmware logic before touching a single wire. Wokwi also has an AI assistant that can help build your circuit and generate starter code.
How to start
  1. Go to wokwi.com → Start New Project
  2. Choose your board (Arduino Uno, ESP32, etc.)
  3. Add components from the “+” menu → wire them up
  4. Paste your AI-generated code into the editor
  5. Click Play → check Serial Monitor output
Screenshot
PlatformIO in VS Code — project structure + upload terminal
PlatformIO
Free
Complex projects · library management · multiple boards
A VS Code extension that replaces the Arduino IDE for more complex projects. Handles library dependencies automatically, supports hundreds of boards, and integrates with Cursor for AI-assisted editing of your firmware. Use it once your project grows beyond a single file.
How to start
  1. Install PlatformIO extension in VS Code
  2. Click PlatformIO icon → New Project
  3. Select board + framework (Arduino)
  4. Edit src/main.cpp → paste AI-generated code
  5. Click Upload (arrow icon) in the bottom toolbar
Screenshot
Tinkercad Circuits — drag-and-drop circuit + simulation
Tinkercad Circuits
Free
Beginner-friendly simulation · circuit design · wiring practice
A drag-and-drop circuit builder and simulator. More visual and forgiving than Wokwi — good for learning component connections before committing to real wire. The code editor is basic; use it for circuit design and wiring visualization, then move to Wokwi or Arduino IDE for serious firmware work.
How to start
  1. Go to tinkercad.com → sign in (free) → Circuits
  2. Drag components from the right panel onto the canvas
  3. Click component leads → drag to connect wires
  4. Click Code → paste or write Arduino code
  5. Click Start Simulation to run
Screenshot
ChatGPT — hardware prompt → annotated firmware
ChatGPT
Free + Plus
Alternative firmware generation · electronics Q&A · datasheet interpretation
A strong alternative to Claude for firmware generation, and particularly good at answering electronics questions — component datasheets, wiring conventions, communication protocols. Use it alongside Claude: generate in one, verify or cross-check in the other.
How to start
  1. Go to chatgpt.com → start a new chat
  2. Paste your hardware specification
  3. Describe the physical behavior you want
  4. Ask for Arduino or ESP32 code with comments
  5. Cross-check pin assignments against your board’s pinout diagram
The Workflow

From behavior description to working hardware.

Hardware adds a constraint vibe coding doesn't have: the physical world doesn't forgive logic errors gracefully. Simulation and serial monitoring are non-negotiable steps, not shortcuts you skip when you're in a hurry.

01
Describe the physical behavior.
Before opening any tool, write out what should happen physically: the trigger (sensor reading, button press, time elapsed), the response (motor moves, LED fades, display updates), and the feel (snappy, gradual, pulsing). One paragraph. Plain language. No code.
"When the button is held for 2 seconds, the motor ramps up slowly and holds until released" is enough. That's your brief.
02
Fill in your hardware specification.
Complete the hardware spec template: board, inputs with pin numbers, outputs with pin numbers, any libraries already installed. This takes two minutes and eliminates an entire category of AI error. Paste it at the top of every prompt in this project.
If you don't know a pin number, look it up on your board's pinout diagram before prompting — not after.
03
Generate the firmware.
Paste your hardware spec + behavior description into Claude or ChatGPT. Ask for Arduino or ESP32 code with inline comments explaining each section. Read through the output: check that pin numbers match your spec, that libraries referenced are ones you can install, and that the logic matches the behavior you described.
AI makes confident errors in pin assignments and library names. Always check these against your actual hardware before moving on.
04
Simulate it first.
Open Wokwi, build your circuit, paste the firmware, and run the simulation. Watch the Serial Monitor output. Does the behavior match what you described? If the logic is wrong here, fix it before wiring anything real. Simulation catches the 80% of errors that don't require physical hardware to surface.
Wokwi's Serial Monitor shows the same output as Arduino IDE's. If it's not printing what you expect, something is wrong — take that output to Claude for diagnosis.
05
Wire and upload to real hardware.
Once simulation passes, wire your circuit. Double-check every connection against your schematic before powering on. Upload via Arduino IDE or PlatformIO. Open Serial Monitor immediately — before you interact with the hardware — and watch for startup messages, sensor readings, and any error output.
Power the board last. Check all connections first. A reversed power connection can damage components permanently.
06
Debug with Serial Monitor + AI.
When behavior doesn't match expectations, Serial Monitor output is your evidence. Copy it exactly — every line — and paste it into Claude or ChatGPT alongside your code and hardware spec. Describe the symptom precisely: what you expected, what happened instead, and what you've already tried. Vague symptoms get generic diagnoses.
"The servo twitches instead of holding position" + serial output + code is a solvable problem. "It doesn't work" is not.
Prompt Patterns

Three prompts you’ll use constantly.

01  ·  First firmware generation Starting a new sketch
Hardware: Board: [Arduino Uno / ESP32 DevKit v1 / etc.] Inputs: [Component, model, pin, protocol] Outputs: [Component, pin, type] Libraries: [any installed, or "standard Arduino libraries only"] Behavior: [plain language description of what should happen, when, and how it should feel] Write Arduino code for this. Add a comment above every function explaining what it does. Use Serial.println() to log key events so I can monitor behavior. Keep the code readable — I’m going to be editing it.
The "keep it readable" instruction matters. AI defaults to compact code that's hard to modify. Ask explicitly for clarity.
02  ·  Debugging with Serial output When behavior doesn’t match expectation
Hardware: [paste hardware spec] Expected behavior: [what should happen] Actual behavior: [exactly what happens instead] What I’ve already tried: [any changes made] Serial Monitor output: [paste every line of output exactly as it appears] Current code: [paste full sketch] What is causing this, and how would you fix it?
Paste the Serial output verbatim — every line. This is your evidence. AI diagnosis improves dramatically with real output versus a description of output.
03  ·  Adding a behavior to existing code Iterating on a working sketch
Current working code: [paste full sketch] I want to add the following behavior: [describe the new physical event, trigger, and response] The new behavior should work alongside the existing behavior without interrupting it. Add the new code with comments. Do not change anything that is already working. After the code, tell me if the new behavior requires any wiring changes.
"Do not change anything already working" is critical. Without it, AI will often refactor your whole sketch while adding the new behavior, breaking things that were fine.
Pitfalls

Five ways this goes wrong.

01

Trusting AI-generated pin assignments.

AI assigns pins confidently and incorrectly more often than any other firmware error. It may use a pin that doesn't exist on your board, is reserved, or conflicts with a library. Always verify against your board's actual pinout diagram.

Check every pin number against the board pinout before uploading. This takes 60 seconds and prevents the most common hardware failure.
02

Not opening Serial Monitor.

Most firmware problems are invisible without Serial output. If you're debugging by observation alone — watching what the hardware does — you're missing the most important diagnostic tool you have. AI can't help you either without it.

Open Serial Monitor every single time you upload. Make it the first thing you do after code goes on the board.
03

Skipping simulation.

Uploading untested firmware directly to hardware and then debugging the result is the slowest possible workflow. Wiring, power, and hardware introduce variables. Simulation isolates the code. Find logic errors there, not on the bench.

Simulate in Wokwi before uploading. One caught error in simulation saves more time than the simulation takes.
04

Vague hardware descriptions.

"A sensor" or "an LED strip" leaves AI guessing at component models, communication protocols, and library choices. The result is code that almost works — which requires a full debugging session to fix what a precise description would have prevented.

Use the hardware spec template every time. Component name, model, pin, protocol. Four fields. Two minutes.
05

Adding multiple new behaviors at once.

Adding three sensors and two new outputs in a single code update makes it impossible to know which change caused a problem when something breaks. Hardware debugging is already hard enough without entangled variables.

Add one new behavior. Test it. Confirm it works. Then add the next. Every working state is a checkpoint you can return to.