AutoPCB is an AI chatbot that converts KiCad schematic files (.kicad_sch or .net) into optimized PCB layouts (.kicad_pcb) using Google's Gemini AI for intelligent footprint suggestions.
- Schematic Parsing: Supports both KiCad schematic (.kicad_sch) and netlist (.net) files
- AI-Powered Footprint Suggestions: Uses Google Gemini AI to suggest appropriate footprints
- Automated PCB Generation: Creates PCB layouts with components placed in optimized positions
- RESTful API: Clean FastAPI backend with modular architecture
- File Management: Upload schematics and download generated PCB files
AutoPCB/
├── main.py # FastAPI application entry point
├── requirements.txt # Python dependencies
├── env.example # Environment configuration template
├── parsers/ # Schematic parsing modules
│ ├── __init__.py
│ └── schematic_parser.py
├── ai/ # AI integration modules
│ ├── __init__.py
│ └── gemini_client.py
├── eda/ # EDA tools integration
│ ├── __init__.py
│ └── pcb_generator.py
├── routes/ # API route handlers
│ └── __init__.py
├── uploads/ # Uploaded schematic files
└── outputs/ # Generated PCB files
- KiCad Installation: Install KiCad (version 6.0+) with Python API support
- Python 3.8+: Ensure Python 3.8 or higher is installed
- Gemini API Key: Get an API key from Google AI Studio
-
Clone the repository:
git clone <repository-url> cd AutoPCB
-
Install Python dependencies:
pip install -r requirements.txt
-
Configure environment:
cp env.example .env # Edit .env and add your Gemini API key -
Verify KiCad installation:
python -c "import pcbnew; print('KiCad Python API is available')"
python main.pyThe API will be available at http://localhost:8000
POST /upload
Content-Type: multipart/form-data
# Upload a .kicad_sch or .net filePOST /analyze
Content-Type: application/json
{
"file_path": "uploads/schematic.sch"
}POST /suggest_footprints
Content-Type: application/json
{
"components": [
{
"ref": "R1",
"value": "10k",
"description": "Resistor"
}
]
}POST /generate_pcb
Content-Type: application/json
{
"components": [...],
"nets": [...],
"footprint_suggestions": {
"R1": "Resistor_SMD:R_0603"
},
"board_name": "my_board"
}GET /download/{filename}- Upload a KiCad schematic file
- Analyze the schematic to extract components and nets
- Get AI suggestions for appropriate footprints
- Generate the PCB layout
- Download the resulting .kicad_pcb file
GEMINI_API_KEY: Your Google Gemini API key (required)HOST: Server host (default: 0.0.0.0)PORT: Server port (default: 8000)UPLOAD_DIR: Directory for uploaded files (default: uploads)OUTPUT_DIR: Directory for generated files (default: outputs)
Ensure KiCad is properly installed with Python API support. The system will automatically detect and use the installed KiCad libraries.
Run the test suite:
pytestOnce the server is running, visit:
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
- Advanced Placement Optimization: Implement sophisticated component placement algorithms
- Interactive Chat Interface: Allow users to refine layouts through natural language
- Multi-layer Support: Generate complex multi-layer PCB designs
- Design Rule Checking: Integrate DRC validation
- 3D Visualization: Add 3D board preview capabilities
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- KiCad Import Error: Ensure KiCad is installed and Python API is enabled
- Gemini API Error: Verify your API key is correct and has sufficient quota
- File Upload Issues: Check file permissions and disk space
- PCB Generation Fails: Verify component footprints are valid KiCad footprints
- Check the API documentation at
/docs - Review the logs for detailed error messages
- Ensure all dependencies are properly installed
This project was developed for HackTX 2025 with the following objectives:
- ✅ Working prototype with core functionality
- ✅ AI integration for intelligent footprint suggestions
- ✅ Modular, maintainable codebase
- ✅ RESTful API design
- 🔄 Simple web UI (stretch goal)
- 🔄 Advanced placement optimization (stretch goal)