Skip to content

lollokara/BugBuster

Repository files navigation

BugBuster logo

B U G B U S T E R

Give AI models physical hands to measure, control, and debug real hardware.

License Platform MCP Firmware Desktop Protocol Python


Animated BugBuster PCB 3D model


BugBuster is an open-source hardware platform that bridges the gap between AI models and the physical world. Through a Model Context Protocol (MCP) server, AI assistants like Claude can autonomously measure voltages, drive outputs, capture waveforms, analyze digital signals, and debug embedded targets — using a single USB-C connection to a purpose-built PCB.

One board. 61 AI-callable tools. A full electronics bench in your AI's hands.


Why BugBuster?

AI models are exceptionally good at reasoning about electronics — reading datasheets, interpreting schematics, diagnosing faults. What they lack is the ability to touch the real world. BugBuster closes that loop.

Without BugBuster

You:    "The output is wrong"
AI:     "Can you measure pin 3?"
You:    *probes pin 3* "It's 1.8V"
AI:     "Expected 3.3V. Check the regulator input."
You:    *probes regulator* "Input is 5V"
AI:     "Check the enable pin..."
        ...20 more round-trips...

With BugBuster

You:   "The output is wrong. Debug it."
AI:    *reads all 4 channels*
       *detects 1.8V where 3.3V expected*
       *checks supply rails — input is 5V*
       *reads enable pin — HIGH, correct*
       *captures ADC snapshot on output*
       "Found it: your 3.3V regulator
        output sags to 1.8V under load.
        Input is fine, EN is high — likely
        thermal shutdown or current-limit."

More scenarios: Docs/Scenarios.md.


Support Development

If you find BugBuster useful and would like to support its ongoing development, hardware prototyping, and maintenance, you can donate via PayPal:

Donate via PayPal


What's in the box

Capability Highlights
Measure 4-ch 24-bit ADC V (0–12 V), I (4–20 mA), R, RTD — up to 4.8 kSPS/ch
Drive 4-ch 16-bit DAC V (0–11 V / ±12 V), I (0–25 mA)
Generate Waveform engine Sine / square / triangle / sawtooth, 0.01–100 Hz
Digital I/O 12 level-shifted IOs 1.8–5 V VLOGIC, MUX-routed, debounced counters
Route 32-switch MUX 4 × ADGS2414D octal SPST, break-before-make
Power Adjustable supplies 3–15 V VADJ1/2, USB-PD 5–20 V, 4 e-fuses
Scope ADC streaming Real-time display, BBSC + CSV export
Logic Analyzer 4 ch @ up to 1 MHz (USB stream); up to 125 MHz 1-ch offline PIO capture, RLE, hardware triggers, dual route (low-speed MUX / high-speed level-shifted), dedicated RP2040 USB vendor-bulk endpoint
SWD Probe CMSIS-DAP v2 OpenOCD / pyOCD / probe-rs / VS Code — dedicated 5-pin connector (VADJ4 · SWCLK · SWDIO · TRACE · GND)
HAT Power Rails VADJ3 + VADJ4 (adjustable 0V-36V) + 3V3_ADJ DS4424-tuned LTM8083 rails, per-rail current monitoring (50 mΩ shunt), auto-calibration
HAT IO Bank 8 level-shifted IOs GPIO10–15 + GPIO20–21, direction-controlled, Conn1 + Conn2 headers
HAT Status LEDs 8× WS2812B Per-connector status indicators, boot animation
UART Bridge Transparent passthrough Configurable baud + pins
Quick-setup slots Save/restore device state 5 named snapshots (DAC, channels, routing) — BBP 0xF0–0xF4, /api/quicksetup/* HTTP routes
External I2C/SPI Bus transactions Route any IO as SDA/SCL or MOSI/MISO/SCLK/CS; Python + MCP tools included
MicroPython runtime Script engine Upload & execute on ESP32, REPL, persistent SPIFFS store, autorun on boot, full API access
CDC auto-recovery Serial fallback BBP idle for 1 min → CDC #0 returns to CLI; CLI keypress reclaims immediately
VADJ PD guard Voltage negotiation VADJ1/VADJ2 capped by USB-PD voltage; firmware + Python + MicroPython enforce safe limits

†HAT expansion board required.


System architecture

flowchart TB
  HOST["Host<br/>(Claude / Desktop / Python)"]

  subgraph BB["BugBuster main board"]
    direction TB
    ESP32["ESP32-S3<br/>(dual-core)"]
    SPI["SPI bus<br/>AD74416H · 4× ADGS2414D MUX"]
    I2C["I²C bus<br/>DS4424 · HUSB238 · PCA9535"]
    ESP32 --- SPI
    ESP32 --- I2C
  end

  subgraph HAT["RP2040 HAT (optional)"]
    direction TB
    RP["RP2040<br/>(debugprobe fork + LA)"]
    PIO0["PIO 0 — SWD"]
    PIO1["PIO 1 — LA capture (125 MHz)"]
    RP --- PIO0
    RP --- PIO1
  end

  HOST -->|"USB CDC #0 — BBP v8<br/>control plane (MCP / desktop)"| ESP32
  HOST -->|"WiFi HTTP REST<br/>(token-paired)"| ESP32
  ESP32 -->|"HAT UART 921600 8N1<br/>(HAT_Protocol.md)"| RP

  HOST -->|"USB vendor bulk<br/>EP 0x06 OUT · 0x87 IN<br/>LA data plane @ ~1 MB/s"| RP
  HOST -->|"USB CMSIS-DAP v2<br/>(direct — no proxy)"| RP
  HOST -->|"USB CDC — target UART bridge"| RP
Loading

Host stack

flowchart LR
  subgraph Host["Host machine"]
    Desktop["Desktop app\n(Tauri + Leptos)"]
    MCP["MCP server\n(bugbuster_mcp)"]
    PyLib["Python lib\n(bugbuster)"]
  end

  subgraph ESP["ESP32-S3"]
    BBP["BBP v8\nUSB CDC #0"]
    HTTP["HTTP REST\nWiFi / USB"]
  end

  subgraph HAT["RP2040 HAT"]
    UART["HAT UART\n0xAA framing"]
  end

  Desktop -->|"BBP v8 / COBS+CRC-16"| BBP
  MCP     -->|"BBP v8 / COBS+CRC-16"| BBP
  PyLib   -->|"BBP v8 / COBS+CRC-16"| BBP

  Desktop -->|"JSON REST"| HTTP
  PyLib   -->|"JSON REST"| HTTP

  BBP  --> UART
  HTTP --> UART
Loading

Two independent USB paths when the HAT is attached:

  • ESP32 USB CDC — control plane (BBP v8 binary protocol over COBS + CRC-16). MCP server, desktop app, and Python library all speak this.
  • RP2040 USB vendor bulk — Logic Analyzer data plane. The ESP32 is not in the LA data path; this decouples capture throughput from the BBP control stream and is what makes sustained 1 MHz / 4-ch streaming possible. Details: Docs/LogicAnalyzer.md.
Communication transports at a glance
Transport Protocol Latency Who talks it Best for
ESP32 USB CDC #0 BBP v8 (COBS + CRC-16) < 1 ms MCP · desktop · Python Full control + streaming control plane
ESP32 HTTP REST JSON over WiFi ~10 ms desktop · Python · browser UI Remote access, OTA
RP2040 USB vendor bulk 4-byte framed packets < 1 ms desktop · Python (libusb) LA streaming / readout, ~1 MB/s
RP2040 USB CMSIS-DAP v2 standard DAP < 1 ms OpenOCD / pyOCD / probe-rs SWD debug (zero proxy)
HAT UART 0xAA + CRC-8, 921600 1-5 ms ESP32 ↔ RP2040 only HAT config / status (see Firmware/HAT_Protocol.md)

Full wire format: Firmware/BugBusterProtocol.md.


Quick start

MCP server (USB — recommended)
cd python
pip install -e ".[mcp]"

# Find your port: ls /dev/cu.usbmodem*   (macOS) or ls /dev/ttyACM*  (Linux)
python -m bugbuster_mcp --transport usb --port /dev/cu.usbmodemXXXX

Add to ~/.claude/settings.json:

{
  "mcpServers": {
    "bugbuster": {
      "command": "/path/to/python",
      "args": ["-m", "bugbuster_mcp", "--transport", "usb",
               "--port", "/dev/cu.usbmodemXXXX"]
    }
  }
}

/mcp in Claude Code to reload. 61 tools appear.

Desktop app (build from source)
rustup target add wasm32-unknown-unknown
cargo install trunk tauri-cli

cd DesktopApp/BugBuster
cargo tauri dev       # hot-reload
cargo tauri build     # release bundle
Flash firmware (ESP32 + RP2040 HAT)
# ESP32-S3
cd Firmware/ESP32
pio run -e esp32s3 -t upload
pio run -e esp32s3 -t uploadfs   # web UI to SPIFFS

# RP2040 HAT
cd Firmware/RP2040
git submodule update --init --recursive
mkdir build && cd build
cmake -DPICO_BOARD=bugbuster_hat .. && make -j
# hold BOOTSEL, then: cp bugbuster_hat.uf2 /Volumes/RPI-RP2

Current versions: ESP 3.2.0, HAT bb-hat-3.0, Desktop 0.7.0. Release workflow + version-sync checklist: Docs/ReleaseChecklist.md.

Python library (no MCP)
import bugbuster as bb
from bugbuster import ChannelFunction

with bb.connect_usb("/dev/cu.usbmodemXXXX") as dev:
    dev.set_channel_function(0, ChannelFunction.VOUT)
    dev.set_dac_voltage(0, 5.0)
    print(dev.get_adc_value(1))

Full API + HAL examples: python/README.md.


Safety model

Giving an AI control of real hardware demands hard boundaries. BugBuster enforces them at the tool layer — the AI cannot bypass these even if instructed:

  • MUX exclusivity — each IO has exactly one active signal path.
  • E-fuse auto-arm — configuring any output arms overcurrent protection.
  • Current limit — 8 mA default; full 25 mA requires allow_full_range=True.
  • Voltage confirmation — supplies above 12 V require confirm=True.
  • Board-profile rail lock — VLOGIC / VADJ1 / VADJ2 can be locked per-board via a JSON profile; see Docs/board_profiles.md.
  • Risk gatesmux_control, register_access require i_understand_the_risk=True.
  • Post-action monitoring — every output operation triggers an automatic fault check; warnings propagate back to the AI.

Full rule-by-rule matrix: python/bugbuster_mcp/README.md.


Desktop app

Dashboard
Overview — live 4-ch readings, SPI health, temperature
Logic analyzer
Logic Analyzer — 1–4 ch @ up to 125 MHz, UART/I²C/SPI decoders

21 tabs total — full screenshot gallery and tab reference in DesktopApp/BugBuster/README.md.


Explore the docs

Topic Where to read
MCP tools & prompts (61 tools, 4 prompts, 6 resources) python/bugbuster_mcp/README.md
Python library (low-level client + HAL, transports, examples) python/README.md
Desktop app (21 tabs, screenshots, build & release) DesktopApp/BugBuster/README.md
ESP32-S3 firmware (FreeRTOS tasks, BBP, HTTP) Firmware/ESP32/README.md
RP2040 HAT firmware (debugprobe fork, LA, SWD, HVPAK) Firmware/RP2040/README.md
BBP v8 wire format (handshake, frames, opcodes, events) Firmware/BugBusterProtocol.md
HAT UART protocol (ESP32 ↔ RP2040, 921600 8N1) Firmware/HAT_Protocol.md
HAT architecture (RP2040, debugprobe, HVPAK, connectors) Firmware/HAT_Architecture.md
External I2C/SPI bus engine (routed IOs, Python/MCP usage, BBP/HTTP endpoints) Docs/ExternalBus.md
Logic Analyzer & vendor-bulk streaming Docs/LogicAnalyzer.md
Hardware (ICs, power topology, ESP32 pinout) Docs/Hardware.md
Board profiles (schema, rail lock, MCP integration) Docs/board_profiles.md
HVPAK descriptor validation Docs/hvpak-descriptor-validation.md
Real-world scenarios Docs/Scenarios.md
Test suite (unit, simulator, device) tests/README.md

Repository map

BugBuster/
├── Firmware/
│   ├── ESP32/                   ESP-IDF firmware (PlatformIO) — main controller
│   ├── RP2040/                  HAT firmware (Pico SDK + debugprobe fork)
│   ├── BugBusterProtocol.md     BBP v8 wire format (USB CDC + HTTP REST)
│   ├── HAT_Protocol.md          ESP32 ↔ RP2040 UART framing
│   ├── HAT_Architecture.md      HAT board architecture reference
│   └── FirmwareStructure.md     Cross-firmware reference
│
├── DesktopApp/BugBuster/        Tauri v2 + Leptos 0.7 (21 tabs)
│
├── python/
│   ├── bugbuster/               Control library (USB + HTTP, 170+ methods)
│   ├── bugbuster_mcp/           MCP server (61 tools, 4 prompts, 6 resources)
│   └── examples/                Annotated example scripts
│
├── tests/                       pytest — unit, simulator, hardware-in-the-loop
│
├── Docs/                        Architecture, Scenarios, Hardware, LA, board profiles
├── PCB Material/                Altium schematics + layout
└── Scripts/                     One-off test and automation scripts

Acknowledgements

The HAT PCBs were provided by JLCPCB for free to support the open-source community.


License

AGPL-3.0 — see LICENSE.

BugBuster is free to use, modify, and self-host. If you distribute a modified version, or run a modified version as a network service, you must release the corresponding source under the same license. For closed-source or commercial-OEM use, contact the maintainer for an alternative license.

About

A not so easy Universal Debugger

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors