# AI-PCB-Generator **Repository Path**: RexHuang936/AI-PCB-Generator ## Basic Information - **Project Name**: AI-PCB-Generator - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-29 - **Last Updated**: 2026-06-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
The world's first fully AI-powered, open-source PCB design suite.
From natural language to production-ready PCBs โ in minutes, not weeks.
Describe your circuit in plain English or Turkish โ AI generates the full schematic โ auto-places components โ routes traces โ simulates the circuit โ runs DFM analysis โ exports Gerber files โ orders from JLCPCB with one click.
      [](https://buymeacoffee.com/otis21)
--- ## ๐ Why AI PCB Generator? Traditional PCB design takes **days or weeks** โ you need to learn complex EDA tools, manually draw schematics, place components, route traces, run checks, and generate manufacturing files. **AI PCB Generator does all of this in under 5 minutes.** Just describe what you want in plain text, and the AI handles everything from circuit design to production-ready output. > ๐ฌ *"Design a motor driver board with L298N, 12V input, 5V regulator, PWM headers, and flyback diodes"* > > โก **Result:** Complete schematic + PCB layout + 3D view + SPICE simulation + DFM analysis + Gerber ZIP โ ready to order. --- ## โจ Key Features ### ๐ง AI-Powered Circuit Design Type a description in **natural language** and the AI generates a complete circuit specification โ components, pin connections, net assignments, footprints, and placement. Supports **OpenAI GPT-4o**, **Google Gemini**, **Anthropic Claude**, or any OpenAI-compatible API. ### ๐ Interactive Drag & Drop Schematic Editor Full-featured schematic editor with **drag-and-drop** component placement, **real-time wire drawing**, undo/redo, and a searchable component palette with 18+ categories. Edit AI-generated designs or build from scratch. ### ๐ค AI Co-Pilot with ERC Engine Built-in **Electrical Rules Check** with 8 automated rules โ unconnected power pins, missing resistors on LEDs, no ground, multiple output conflicts, missing decoupling capacitors, and more. Smart **pin alias matching** (VINโIN, GNDโVSS) eliminates false positives. ### โก Real-Time SPICE Simulation Simulate your circuit **before manufacturing** with integrated **NgSpice 46** support: - **DC Operating Point** โ Node voltages and branch currents - **Transient Analysis** โ Time-domain waveforms - **AC Frequency Sweep** โ Bode plots and frequency response - **DC Sweep** โ Transfer characteristics Built-in **MNA (Modified Nodal Analysis) solver** works even without NgSpice installed โ no external tools required for basic simulations. ### ๐ AI Design Review & DFM Analysis **12 manufacturing-focused checks** powered by industry standards (IPC-2221): | Check | Description | |-------|-------------| | DFM-001 | Power trace current capacity validation | | DFM-002 | Annular ring verification (via & pad) | | DFM-003 | Acid trap detection (acute-angle junctions) | | DFM-004 | Thermal relief recommendations | | DFM-005 | Silkscreen over pad detection | | DFM-006 | Component spacing for pick-and-place | | DFM-007 | Board dimension validation | | DFM-008 | Via aspect ratio check | | DFM-009 | Copper balance analysis | | DFM-010 | Solder bridge risk detection | | DFM-011 | Minimum drill size verification | | DFM-012 | Differential pair length mismatch | Each issue comes with a **0-100 manufacturability score**, severity rating (Critical/Warning/Info), and actionable **fix recommendations**. ### ๐ญ One-Click PCB Manufacturing Go from design to **production order** with a single click: - **Manufacturer Profiles** โ JLCPCB, PCBWay, OSH Park with real capability limits - **Live Cost Estimation** โ PCB cost + SMT assembly breakdown, updated as you change quantity - **Production Package** โ Generates everything you need: - ๐ฆ **Gerber ZIP** โ Ready to upload to any manufacturer - ๐ **BOM CSV** โ JLCPCB-compatible Bill of Materials - ๐ **Pick & Place CPL** โ Component placement for SMT assembly - ๐ง **KiCad PCB** โ For further editing in KiCad - **Lead Time Display** โ Know exactly when your boards will arrive - **Capability Validation** โ Warns if your design exceeds manufacturer limits ### ๐ฅ๏ธ Professional 3D PCB Viewer Realistic isometric **3D visualization** with: - KiCad `.wrl` 3D model loading (VRML 2.0 parser) - 18+ built-in component models (resistors, capacitors, ICs, connectors, LEDs...) - Layer toggles (copper, silkscreen, 3D models, wires) - Smooth rotation, pan, and zoom controls ### ๐ง PCB Layout Engine - KiCad-quality **EDA-style** layout rendering - Grid-based auto-placement with intelligent grouping - **Freerouting** integration for automatic trace routing - Layer support (F.Cu, B.Cu, inner layers) - Real-time **DRC** (Design Rule Check) with pad clearance, trace width, via drill validation ### ๐ฆ Multi-Format Export - **KiCad** `.kicad_pcb` โ Open directly in KiCad 9.0 - **Gerber** RS-274X + Excellon drill โ Standard manufacturing format - **SVG** โ High-quality vector graphics - **JSON** โ Full circuit data for automation > Export fix (March 17, 2026): Gerber silkscreen export now derives component body bounds from pad geometry, resolving the `'PlacedComponent' object has no attribute 'width_mm'` crash seen during exports such as Arduino Uno Shield. ### ๐ ๏ธ Bundled Vendor Tools All critical tools come **pre-bundled** โ no separate installation needed: > Freerouting fix (March 17, 2026): Production file generation now falls back to the internal A* router when Freerouting fails or produces no SES output, instead of aborting the manufacturing/export workflow. | Tool | Version | Status | |------|---------|--------| | NgSpice | 46 | โ Bundled in `vendor/` | | Freerouting | 2.1.0 | โ Bundled in `vendor/` | | KiCad | 9.0 | ๐ Auto-detected | Run `python setup_vendor.py` to download vendor tools automatically. ### ๐ Multi-Language & Theming - Full **Turkish** and **English** UI - **Dark** and **Light** themes - Live language switching โ no restart needed --- ## ๐ Architecture ``` User Input (Natural Language) โ โผ โโโโโโโโโโโโโโโโโโโ โ AI Engine โ GPT-4o / Gemini / Claude / Any LLM โ (OpenAI API) โ โโโโโโโโโโฌโโโโโโโโโ โ CircuitSpec (Pydantic JSON) โผ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ Schematic โโโโโโถโ AI Co-Pilot โ โ Editor โ โ (8 ERC Rules) โ โโโโโโโโโโฌโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ โผ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ PCB Generator โโโโโโถโ DRC Engine โ โ + Auto-Router โ โ (6 Checks) โ โโโโโโโโโโฌโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ โผ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ SPICE Simulator โ โ DFM Analysis โ โ (NgSpice/MNA) โ โ (12 Checks) โ โโโโโโโโโโฌโโโโโโโโโ โโโโโโโโโโฌโโโโโโโโโโ โ โ โผ โผ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ Production Output โ โ Gerber ZIP โ BOM CSV โ CPL โ KiCad PCB โ โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ โ โผ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ One-Click Manufacturing โ โ JLCPCB โ PCBWay โ OSH Park โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ``` --- ## ๐ Requirements | Software | Version | Required? | Description | |----------|---------|-----------|-------------| | **Python** | 3.10+ | โ Required | Core runtime | | **AI API Key** | โ | โ Required | OpenAI, Gemini, Claude, or compatible | | **KiCad** | 9.0+ | โก Recommended | 3D models & advanced export | | **Java** | 11+ | ๐ง Optional | For Freerouting auto-routing | | **NgSpice** | 45+ | ๐ฆ Bundled | SPICE simulation (auto-downloaded) | | **Freerouting** | 2.1+ | ๐ฆ Bundled | Auto-routing (auto-downloaded) | --- ## ๐ Installation ### 1. Clone the repository ```bash git clone https://github.com/22507260/AI-PCB-Generator.git cd AI-PCB-Generator ``` ### 2. Create virtual environment & install ```bash python -m venv venv # Windows venv\Scripts\activate # macOS/Linux source venv/bin/activate pip install -r requirements.txt ``` ### 3. Download vendor tools (NgSpice + Freerouting) ```bash python setup_vendor.py ``` ### 4. Configure API Key ```bash copy .env.example .env # Windows # cp .env.example .env # macOS/Linux # Edit .env and add your AI API key: # OPENAI_API_KEY=sk-... ``` ### 5. Launch ```bash python main.py ``` --- ## ๐ Usage ### โก Quick Start (5-Step Workflow) 1. **Describe** โ Type your circuit in the left panel: ``` Design a sensor board with USB-C 5V input, 3.3V LDO regulator, 3 status LEDs and I2C header. ``` 2. **Generate** โ Click **โก Design** โ AI creates the full schematic 3. **Simulate** โ Switch to **โก Simulation** tab โ Run DC/Transient/AC analysis 4. **Review** โ Check the **๐ Design Review** tab โ Fix any DFM issues 5. **Manufacture** โ Click **๐ญ Manufacture** โ Generate Gerber ZIP + BOM + CPL โ Order ### ๐ฏ Built-in Templates | Template | Description | |----------|-------------| | ๐ก LED Circuit | Simple LED + current-limiting resistor | | ๐ Voltage Regulator | 12V โ 5V โ 3.3V with bypass capacitors | | ๐ฎ Arduino Shield | 2 buttons + 3 LEDs + I2C + potentiometer | | ๐ก๏ธ Sensor Module | I2C temperature/humidity + 3.3V regulator | | โ๏ธ Motor Driver | L298N dual H-bridge + PWM + flyback diodes | | ๐ USB-C Power | USB-C input + ESD + polarity protection | ### โจ๏ธ Keyboard Shortcuts | Shortcut | Action | |----------|--------| | `Ctrl+N` | New Project | | `Ctrl+O` | Open Project | | `Ctrl+S` | Save Project | | `Ctrl+E` | Export (KiCad/Gerber/SVG/JSON) | | `Ctrl+M` | One-Click Manufacture | | `Ctrl+Z` | Undo | | `Ctrl+Y` | Redo | | `Ctrl+,` | Settings | --- ## ๐ Project Structure ``` AI-PCB-Generator/ โโโ main.py # Application entry point โโโ setup_vendor.py # Vendor tool downloader (NgSpice, Freerouting) โโโ requirements.txt # Python dependencies โโโ src/ โ โโโ app.py # QApplication bootstrap โ โโโ config.py # Settings (pydantic-settings + .env) โ โโโ vendor.py # Vendor tool auto-discovery โ โโโ ai/ โ โ โโโ schemas.py # Pydantic data models (CircuitSpec, etc.) โ โ โโโ client.py # LLM API wrapper (OpenAI-compatible) โ โ โโโ prompts.py # System prompts + few-shot examples โ โ โโโ parser.py # AI output validation & repair โ โโโ pcb/ โ โ โโโ generator.py # Board generation + auto-placement โ โ โโโ router.py # Freerouting integration โ โ โโโ exporter.py # KiCad / Gerber / SVG / JSON export โ โ โโโ rules.py # DRC engine (6 design rule checks) โ โ โโโ dfm.py # DFM analysis engine (12 checks) โ โ โโโ manufacturing.py # One-Click manufacturing pipeline โ โ โโโ components.py # Component database โ โโโ simulation/ โ โ โโโ engine.py # NgSpice + built-in MNA solver โ โ โโโ netlist.py # SPICE netlist generator โ โโโ gui/ โ โ โโโ main_window.py # Main window (6-tab layout) โ โ โโโ input_panel.py # AI input + template selector โ โ โโโ schematic_view.py # Drag & Drop schematic editor โ โ โโโ pcb_view.py # KiCad-quality PCB layout viewer โ โ โโโ view3d.py # 3D PCB viewer (VRML/OpenGL) โ โ โโโ simulation_view.py # SPICE simulation UI + plots โ โ โโโ ai_copilot.py # AI Co-Pilot + ERC engine โ โ โโโ design_review.py # DFM analysis panel + scoring โ โ โโโ manufacturing_dialog.py # One-Click manufacturing dialog โ โ โโโ component_panel.py # BOM table โ โ โโโ component_palette.py # Drag & Drop component palette โ โ โโโ export_dialog.py # Multi-format export dialog โ โ โโโ settings_dialog.py # Settings + tool status โ โ โโโ i18n.py # Turkish/English translations โ โ โโโ theme.py # Dark/Light theme engine โ โโโ models/ โ โ โโโ model_registry.py # KiCad 3D model mapping โ โ โโโ vrml_parser.py # VRML 2.0 mesh parser โ โโโ utils/ โ โโโ logger.py # Structured logging โ โโโ file_io.py # Project save/load (.apcb) โ โโโ validators.py # Input validation โโโ vendor/ # Bundled tools (auto-downloaded) โ โโโ Spice64/ # NgSpice 46 โ โโโ freerouting-2.1.0.jar # Freerouting โโโ data/ โ โโโ templates/ # Built-in circuit templates โโโ assets/ # Icons, fonts, styles โโโ tests/ # Unit & integration tests ``` --- ## ๐งช Testing ```bash pip install -e ".[dev]" pytest ``` --- ## ๐ Feature Comparison | Feature | AI PCB Generator | KiCad | EasyEDA | Altium | |---------|:---------------:|:-----:|:-------:|:------:| | AI Natural Language Design | โ | โ | โ | โ | | Drag & Drop Schematic | โ | โ | โ | โ | | SPICE Simulation | โ | โ | โ | โ | | DFM Analysis (12 checks) | โ | โ | โ | โ | | One-Click Manufacturing | โ | โ | โ | โ | | AI Co-Pilot (ERC + fixes) | โ | โ | โ | โ | | 3D PCB Viewer | โ | โ | โ | โ | | Cost Estimation | โ | โ | โ | โ | | Open Source | โ | โ | โ | โ | | Free | โ | โ | โ ๏ธ | โ | --- ## ๐ค Contributing 1. Fork the repository 2. Create a feature branch (`git checkout -b feature/awesome-feature`) 3. Commit your changes (`git commit -m 'feat: add awesome feature'`) 4. Push the branch (`git push origin feature/awesome-feature`) 5. Open a Pull Request --- ## ๐ License MIT License โ see the [LICENSE](LICENSE) file for details. ---
Built with โค๏ธ using Python, PySide6/Qt6, and AI
Star โญ this repo if you find it useful!