DEV Community

Umesh Adabala
Umesh Adabala

Posted on Fully Autonomous

CircuitMind: An AI-Native Engineering IDE for Physical Systems and Embedded Electronics

CircuitMind: An AI-Native Engineering IDE for Physical Systems and Embedded Electronics

Tagline: Think it. Build it. Prove it.

Source Repository: https://github.com/umeshadabala/CircuitMind

Video Demonstration: https://www.youtube.com/watch?v=0OOJEV3uivg

Architecture: React 18 / TypeScript / FastAPI / Pydantic v2 / SQLite / Wokwi


Video Demonstration

A complete walk-through of CircuitMind's closed engineering loop is available here:

(Direct Link: Watch on YouTube)


The Gap Between Software Toolchains and Hardware Engineering

Modern software engineering benefits from robust feedback loops:

  • IDEs provide contextual symbol navigation and real-time type checking.
  • Compilers and linters halt execution on semantic discrepancies.
  • Automated testing frameworks enforce invariant behavior before deployment.
  • AI code assistants leverage project-wide ASTs to inform generation.

In contrast, embedded electronics and physical computing remain fragmented:

  1. Requirements Translation: Mapping high-level functional specifications to microcontrollers, sensors, and passive components requires manual datasheet reconciliation.
  2. Electrical Integrity: Wiring errors—such as feeding a 5V sensor logic level directly into a 3.3V ESP32 GPIO—frequently result in hardware damage.
  3. Firmware Consistency: Developers manually write boilerplate Arduino C++ with hardcoded pin assignments, often triggering internal timer, interrupt, or ADC channel collisions.
  4. Lack of Automated Testing: Physical validation is predominantly manual, relying on uncalibrated test inputs and unstructured serial terminal inspection.
  5. Architectural Drift: Design rationale (such as specific pin routing, pull-up resistor selections, or threshold constants) is rarely preserved across project revisions.

Standard large language models fail in this domain because they lack physical grounding. Without deterministic hardware verification, generic models regularly invent non-existent pins, map multiple conflicting peripherals to identical GPIOs, or produce syntactically valid code that cannot function on real silicon.

CircuitMind addresses these deficiencies by enforcing a structured, deterministic engineering pipeline around physical systems.


Architectural Overview

CircuitMind provides a closed-loop engineering lifecycle:

$$\text{Describe} \longrightarrow \text{Design} \longrightarrow \text{Generate} \longrightarrow \text{Simulate} \longrightarrow \text{Test} \longrightarrow \text{Diagnose} \longrightarrow \text{Repair} \longrightarrow \text{Verify} \longrightarrow \text{Remember}$$

+-------------------------------------------------------------------------+
|                               CIRCUITMIND                               |
+-------------------+--------------------+--------------------------------+
| Stage             | Mechanism          | Output Artifacts               |
+-------------------+--------------------+--------------------------------+
| 1. Specification  | Natural Language   | Parsed functional constraints, |
|                   | Intent Parser      | operating parameters           |
+-------------------+--------------------+--------------------------------+
| 2. Synthesis      | Hardware Graph     | Resolved component instances,  |
|                   | Engine             | validated pin netlists         |
+-------------------+--------------------+--------------------------------+
| 3. Code & Diagram | Multi-Artifact     | * Arduino C++ (sketch.ino)     |
|    Generation     | Emitter            | * Wokwi diagram (diagram.json) |
|                   |                    | * Step-by-step wiring tables   |
+-------------------+--------------------+--------------------------------+
| 4. Simulation     | Behavioral Runner  | Real-time UART serial stream,  |
|                   | & Wokwi CLI        | virtual sensor stimuli         |
+-------------------+--------------------+--------------------------------+
| 5. Verification   | Behavioral Test    | Assertion results with         |
|                   | Engine             | telemetry evidence             |
+-------------------+--------------------+--------------------------------+
| 6. Diagnosis &    | Defect Analyzer    | Root-cause analysis, unified   |
|    Repair         | & Patch Generator  | diffs, automated re-test       |
+-------------------+--------------------+--------------------------------+
| 7. Memory         | DevMemoryAI (DMAI) | Persistent SQLite audit log of |
|                   | Engine             | all design decisions           |
+-------------------+--------------------+--------------------------------+
Enter fullscreen mode Exit fullscreen mode

Core System Subsystems

1. Deterministic Project Graph and Catalog Validation

CircuitMind treats all LLM responses as untrusted input. Model outputs are strictly parsed and validated against a centralized schema using Pydantic v2.

  • Component Catalog: A curated specification database containing verified hardware metadata for microcontrollers (ESP32 DevKit V1, Arduino Uno) and peripherals (HC-SR04 ultrasonic sensors, DHT22 temperature/humidity sensors, SSD1306 OLED displays, servomotors, piezo buzzers, LEDs, potentiometers, and resistors).
  • Constraint Solver: Before any firmware or diagram is emitted, the validator verifies electrical compatibility (logic levels, supply rails), pin capabilities (PWM, ADC, I2C, SPI), and net collision constraints.

2. Multi-Artifact Generation

Once the hardware graph passes validation, CircuitMind emits synchronized, production-grade artifacts derived directly from the project state:

  • Arduino C++ (sketch.ino): Non-blocking, structured firmware containing typed pin constants, macro definitions, setup initialization, and polling/interrupt logic.
  • Wokwi Simulator Format (diagram.json): Standardized part definitions, pixel coordinates, orientations, and netlist wire mappings color-coded by electrical purpose (red for VCC, black for GND, blue for SDA, orange for SCL/PWM/digital).
  • Human-Readable Assembly Instructions: An ordered connection table detailing terminal-to-terminal mappings for physical breadboarding.

3. Behavioral and Headless Simulation

CircuitMind combines real-time browser interaction with headless CI testing capabilities:

  • Interactive Behavioral Simulation: Users manipulate virtual environment parameters (e.g., sliding target distances for ultrasonic sensors) while monitoring streaming UART telemetry.
  • Wokwi CLI Pipeline: When running in verification mode, the backend can invoke headless runs via wokwi-cli with serial assertion checks (--expect-text, --timeout), enabling automated regression testing.

4. Automated Defect Diagnosis and Patching

When a hardware connection or software definition is misconfigured, CircuitMind provides a deterministic repair workflow:

  1. Defect Identification: Verification tests fail when observed telemetry diverges from requirement assertions.
  2. Root-Cause Analysis: The debugger evaluates the delta between the project graph, pin constraints, and firmware definitions.
  3. Diff Generation: The system constructs a structured unified diff addressing both netlist connections and firmware source lines.
  4. Automated Re-Verification: Applying the patch updates the project version, invalidates stale artifacts, and re-executes tests to prove correctness.

5. Persistent Engineering Memory (DMAI)

Hardware design decisions require traceability. CircuitMind records every specification change, version bump, test execution, and repair patch into a local SQLite repository (data/circuitmind.db):

  • Immutable audit records capture why specific pins or threshold constants were assigned.
  • Natural-language queries allow engineers to retrieve historical context (e.g., "Why was the piezo buzzer routed to GPIO19 instead of GPIO4?").

User Interface Implementation

CircuitMind's frontend is constructed with React 18, TypeScript, and Vite. Designed as a dark-mode engineering IDE, it incorporates:

  • Project Overview: High-level system requirements, bill of materials, and operational parameters.
  • Wiring and Schematic View: Interactive SVG circuit schematics and sorted connection tables.
  • Firmware Editor: Syntax-highlighted C++ viewer with clipboard utilities.
  • Simulation Console: Virtual stimulus controls paired with an active UART terminal log.
  • Verification Matrix: Automated test result cards showing assertions, execution evidence, and status indicators.
  • Engineering Memory Log: Searchable timeline of historical project revisions and rationale.
  • AI Copilot Drawer: Versioned natural language modifications to requirements and hardware specs.

Implementation Walkthrough: Smart Parking Sensor

To illustrate the pipeline in practice:

1. Specification Input

Build a smart parking sensor using an ESP32. When an object is closer than 20 cm, 
activate a warning LED and buzzer. Explain the wiring and show me how to test it.
Enter fullscreen mode Exit fullscreen mode

2. Hardware Graph Synthesis

The catalog engine selects:

  • Microcontroller: ESP32 DevKit V1
  • Sensor: HC-SR04 Ultrasonic Sensor (Trigger: GPIO5, Echo: GPIO18)
  • Visual Indicator: Red 5mm LED with a 220 Ohm current-limiting resistor (GPIO21)
  • Acoustic Indicator: Piezo Buzzer (GPIO19)

3. Generated Firmware (sketch.ino)

// Generated by CircuitMind
#define PIN_TRIG 5
#define PIN_ECHO 18
#define PIN_LED 21
#define PIN_BUZZER 19
#define THRESHOLD_CM 20

void setup() {
  Serial.begin(115200);
  pinMode(PIN_TRIG, OUTPUT);
  pinMode(PIN_ECHO, INPUT);
  pinMode(PIN_LED, OUTPUT);
  pinMode(PIN_BUZZER, OUTPUT);
}

void loop() {
  digitalWrite(PIN_TRIG, LOW);
  delayMicroseconds(2);
  digitalWrite(PIN_TRIG, HIGH);
  delayMicroseconds(10);
  digitalWrite(PIN_TRIG, LOW);

  long duration = pulseIn(PIN_ECHO, HIGH, 30000);
  float distance = (duration * 0.0343) / 2;

  Serial.print("DISTANCE_CM:");
  Serial.println(distance);

  if (distance > 0 && distance < THRESHOLD_CM) {
    digitalWrite(PIN_LED, HIGH);
    tone(PIN_BUZZER, 1000);
  } else {
    digitalWrite(PIN_LED, LOW);
    noTone(PIN_BUZZER);
  }
  delay(100);
}
Enter fullscreen mode Exit fullscreen mode

4. Verification Execution

  • Test Case A (Obstacle at 12 cm): The simulation feeds 12 cm into the sensor model. Observed telemetry confirms DISTANCE_CM: 12.00, with LED and buzzer asserted high. Status: PASS.
  • Test Case B (Obstacle at 45 cm): The simulation feeds 45 cm. Observed telemetry confirms DISTANCE_CM: 45.00, with LED and buzzer de-asserted. Status: PASS.

Local Installation and Execution

System Requirements

  • Python 3.10 or higher
  • Node.js 18 or higher with npm

1. Clone the Repository

git clone https://github.com/umeshadabala/CircuitMind.git
cd CircuitMind
Enter fullscreen mode Exit fullscreen mode

2. Configure the Backend Service

# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install required packages
pip install fastapi uvicorn pydantic pytest httpx python-dotenv

# Run the FastAPI server
PYTHONPATH=. uvicorn backend.app.main:app --host 127.0.0.1 --port 8000 --reload
Enter fullscreen mode Exit fullscreen mode

3. Configure the Frontend Client

In a separate terminal window:

cd frontend
npm install
npm run dev
Enter fullscreen mode Exit fullscreen mode

Navigate to http://localhost:5173 in your web browser.


Automated Verification and Test Suite

Backend unit testing:

PYTHONPATH=. ./venv/bin/pytest backend/tests/test_backend.py -v
Enter fullscreen mode Exit fullscreen mode

Full eight-stage end-to-end integration pipeline:

./venv/bin/python3 backend/tests/integration_demo.py
Enter fullscreen mode Exit fullscreen mode

Project Roadmap

  • CAD/EDA Export: Direct netlist conversion to KiCad schematics and PCB layout formats.
  • Expanded Microcontroller Support: Addition of STM32, Raspberry Pi Pico (RP2040), and Nordic nRF52 series parts to the component catalog.
  • Direct Flashing via WebSerial: Browser-based flashing of compiled binaries directly to connected development boards using the Web Serial API.

Summary and Repository Links

CircuitMind is an open-source initiative designed to bring formal verification, deterministic schemas, and structured debugging workflows to physical computing.

Contributions, issue reports, and architectural feedback are welcomed via the GitHub repository.

Top comments (0)