Skip to content

About

RU Hackathon, repository.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

Auto-Architect ⚡

Smart Hardware & Firmware Auditor — Take a photo of your breadboard. Get a safety report and ready-to-flash code in under 30 seconds.

Built for Build With AI Hack Days @ RU using Google Gemini AI.


What It Does

  1. Upload a photo of a breadboard circuit or hand-drawn schematic
  2. Gemini analyzes the image through a 3-stage AI pipeline:
    • Stage 1 — Vision Extraction: Identifies every component and pin connection
    • Stage 2 — Safety Audit + Codegen: Checks wiring against electrical rules and writes driver code
    • Stage 3 — Self-Check: Verifies every pin number in the code matches the detected connections
  3. Results show:
    • 🔩 Detected components with confidence levels
    • 🛡️ Color-coded safety audit (PASS / WARNING / CRITICAL)
    • 📟 Copy/download-ready C++ (.ino) or Python (.py) firmware

Quick Start

1. Get a Gemini API Key

Go to Google AI Studio and create a free API key.

2. Set Up Environment

cd auto-architect
cp .env.example .env
# Edit .env and paste your API key:
# GEMINI_API_KEY=your_key_here

3. Install & Run

npm install
npm start

Open your browser at http://localhost:3000


Project Structure

auto-architect/
├── .env                  ← Your API key (never commit this)
├── .env.example          ← Template for others
├── .gitignore
├── package.json
├── server.js             ← Express app entry point
├── routes/
│   └── analyze.js        ← POST /api/analyze handler
├── services/
│   └── geminiService.js  ← 3-stage Gemini pipeline
├── data/
│   └── wiringRules.js    ← Hardcoded wiring knowledge base
└── public/
    ├── index.html        ← Single-page frontend
    ├── style.css         ← Dark premium UI styles
    └── app.js            ← Frontend state machine & rendering

API Reference

POST /api/analyze

Request (multipart/form-data):

Field Type Required Description
image File ✅ Circuit photo (JPG/PNG/WEBP, max 20MB)
board String No "Arduino Uno", "ESP32", "Raspberry Pi Pico", or "auto"
language String ✅ "cpp" or "python"

Response (200 OK):

{
  "board": { "type": "ESP32 DevKit", "confidence": "high" },
  "components": [{ "id": "c1", "type": "DHT11", "confidence": "high" }],
  "connections": [{ "from_pin": "GPIO4", "to_component_id": "c1", "to_component_pin": "DATA", "confidence": "high" }],
  "audit": [{ "severity": "WARNING", "issue": "No pull-up resistor on DHT11 data line", "explanation": "..." }],
  "code": "// ESP32 + DHT11 code...",
  "code_language": "cpp",
  "verified": true,
  "corrections_made": []
}

Error (502):

{ "error": "Human-readable error message" }

Tech Stack

Layer Technology
AI Google Gemini API (gemini-2.5-flash + gemini-2.5-pro fallback)
Backend Node.js + Express
File Upload multer (in-memory)
Gemini SDK @google/genai (official, latest)
Frontend Plain HTML/CSS/Vanilla JS
Syntax Highlight Prism.js
Secrets dotenv

Demo Photos to Try

Best results come from:

  • Well-lit breadboard photos with visible component labels
  • Clear hand-drawn schematics with labeled pins
  • Arduino/ESP32 development board photos with obvious silkscreen

Hackathon Judges

  • ✅ No user accounts or database — fully stateless
  • ✅ Gemini API key stays server-side only
  • ✅ Graceful error handling (bad photo, API timeout, malformed JSON)
  • ✅ Self-verifying 3-stage pipeline with structured JSON output mode

About

RU Hackathon, repository.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages