🔧 KiCad PCB Automation
Design → Prototype → Manufacture
Automate PCB design workflows using KiCad. From natural language circuit descriptions to manufacturing-ready Gerber files.
What This Skill Does
- 1. Design — Create schematics from circuit descriptions
- Layout — Design PCB layouts with component placement
- Verify — Run DRC checks, generate previews for review
- Export — Generate manufacturing files (Gerbers, drill files, BOM)
- Order — Prepare and place orders on PCBWay
Requirements
KiCad Installation
CODEBLOCK0
Python Dependencies
CODEBLOCK1
Quick Start
CODEBLOCK2
Commands
Project Management
| Command | Description |
|---|
| INLINECODE0 | Create new KiCad project |
| INLINECODE1 |
Open existing project |
|
info | Show current project info |
|
list-projects | List recent projects |
Schematic Design
| Command | Description |
|---|
| INLINECODE4 | Add component to schematic |
| INLINECODE5 |
Wire components together |
|
add-net <name> <refs...> | Create named net |
|
preview-schematic | Generate schematic image |
|
erc | Run electrical rules check |
PCB Layout
| Command | Description |
|---|
| INLINECODE9 | Import schematic to PCB |
| INLINECODE10 |
Auto-place components |
|
auto-route | Auto-route traces |
|
set-board-size <W>x<H> | Set board dimensions (mm) |
|
preview-pcb | Generate PCB preview images |
|
drc | Run design rules check |
Manufacturing Export
| Command | Description |
|---|
| INLINECODE15 | Export Gerber files |
| INLINECODE16 |
Export drill files |
|
export-bom | Export bill of materials |
|
export-pos | Export pick-and-place file |
|
export-3d | Export 3D model (STEP/GLB) |
|
package-for-fab | Create ZIP with all files |
PCBWay Integration
| Command | Description |
|---|
| INLINECODE21 | Get instant quote |
| INLINECODE22 |
Upload Gerbers to PCBWay |
|
pcbway-cart | Add to cart (requires auth) |
Workflow: Natural Language to PCB
Step 1: Describe Your Circuit
Tell me what you want to build:
"I need a simple 555 timer circuit that blinks an LED at about 1Hz.
Should run on 9V battery, through-hole components for easy soldering."
Step 2: I'll Generate the Design
CODEBLOCK3
Step 3: Review & Confirm
I'll show you:
- - Schematic preview image
- Component list (BOM)
- Calculated values (resistors for timing, etc.)
You confirm or request changes.
Step 4: PCB Layout
CODEBLOCK4
Step 5: Manufacturing
CODEBLOCK5
Common Circuit Templates
templates/555astable.kicadsch
Classic 555 timer in astable mode. Parameters:
- - R1, R2: Timing resistors
- C1: Timing capacitor
- Freq ≈ 1.44 / ((R1 + 2R2) C1)
templates/arduinoshield.kicadpcb
Arduino Uno shield template with:
- - Header footprints
- Mounting holes
- Power rails
templates/usbcpower.kicad_sch
USB-C power delivery (5V):
- - USB-C connector
- CC resistors
- ESD protection
Configuration
Create ~/.kicad-pcb/config.json:
CODEBLOCK6
Design Review Protocol
Before ordering, I'll always:
- 1. Show schematic — Visual confirmation of circuit
- Show PCB renders — Top, bottom, 3D view
- List BOM — All components with values
- Report DRC — Any warnings or errors
- Show quote — Cost breakdown before ordering
I will NOT auto-order without explicit confirmation.
PCBWay Order Flow (Current)
- 1. Export Gerbers + drill files
- Create ZIP package
- Manual step: You upload to pcbway.com
- Future: Automated upload + cart placement
Cost Reference
PCBWay typical pricing (2-layer, 100x100mm, qty 5):
- - Standard (5-7 days): ~$5
- Express (3-4 days): ~$15
- Shipping: ~$15-30 DHL
Safety Notes
⚠️ High Voltage Warning: This skill does not validate electrical safety. For mains-connected circuits, consult a qualified engineer.
⚠️ No Auto-Order (Yet): Cart placement requires your explicit confirmation.
Changelog
v1.0.0
- - Initial release
- KiCad CLI integration
- Schematic/PCB preview generation
- Gerber export
- PCBWay quote integration
- Template system
Built by PaxSwarm
🔧 KiCad PCB 自动化
设计 → 原型 → 制造
使用 KiCad 自动化 PCB 设计工作流程。从自然语言电路描述到可制造的 Gerber 文件。
该技能的功能
- 1. 设计 — 根据电路描述创建原理图
- 布局 — 设计包含元件放置的 PCB 布局
- 验证 — 运行 DRC 检查,生成预览以供审核
- 导出 — 生成制造文件(Gerber 文件、钻孔文件、BOM)
- 下单 — 在 PCBWay 上准备并下单
要求
KiCad 安装
bash
Ubuntu/Debian
sudo add-apt-repository ppa:kicad/kicad-8.0-releases
sudo apt update
sudo apt install kicad
验证 CLI
kicad-cli --version
Python 依赖
bash
pip install pillow cairosvg
快速开始
bash
1. 创建新项目
python3 scripts/kicad_pcb.py new LED 闪烁器 --description 555 定时器 LED 闪烁电路
2. 向原理图添加元件
python3 scripts/kicad_pcb.py add-component NE555 U1
python3 scripts/kicad_pcb.py add-component LED D1
python3 scripts/kicad_pcb.py add-component R 1K R1 R2
3. 生成原理图预览(供审核)
python3 scripts/kicad_pcb.py preview-schematic
4. 运行设计规则检查
python3 scripts/kicad_pcb.py drc
5. 导出制造文件
python3 scripts/kicad_pcb.py export-gerbers
6. 准备 PCBWay 订单
python3 scripts/kicad_pcb.py pcbway-quote --quantity 5
命令
项目管理
| 命令 | 描述 |
|---|
| new <名称> | 创建新的 KiCad 项目 |
| open <路径> |
打开现有项目 |
| info | 显示当前项目信息 |
| list-projects | 列出最近的项目 |
原理图设计
| 命令 | 描述 |
|---|
| add-component <类型> <参考> | 向原理图添加元件 |
| connect <参考1.引脚> <参考2.引脚> |
连接元件之间的导线 |
| add-net <名称> <参考...> | 创建命名网络 |
| preview-schematic | 生成原理图图像 |
| erc | 运行电气规则检查 |
PCB 布局
| 命令 | 描述 |
|---|
| import-netlist | 将原理图导入 PCB |
| auto-place |
自动放置元件 |
| auto-route | 自动布线 |
| set-board-size <宽>x<高> | 设置板尺寸(毫米) |
| preview-pcb | 生成 PCB 预览图像 |
| drc | 运行设计规则检查 |
制造导出
| 命令 | 描述 |
|---|
| export-gerbers | 导出 Gerber 文件 |
| export-drill |
导出钻孔文件 |
| export-bom | 导出物料清单 |
| export-pos | 导出贴片文件 |
| export-3d | 导出 3D 模型(STEP/GLB) |
| package-for-fab | 创建包含所有文件的 ZIP 包 |
PCBWay 集成
| 命令 | 描述 |
|---|
| pcbway-quote | 获取即时报价 |
| pcbway-upload |
将 Gerber 文件上传至 PCBWay |
| pcbway-cart | 添加到购物车(需要认证) |
工作流程:自然语言到 PCB
步骤 1:描述您的电路
告诉我您想构建什么:
我需要一个简单的 555 定时器电路,以约 1Hz 的频率闪烁 LED。
应使用 9V 电池供电,采用直插元件以便于焊接。
步骤 2:我将生成设计
bash
创建项目
kicad
pcb.py new LEDBlinker_555
根据描述添加元件
kicad_pcb.py from-description 555 定时器 LED 闪烁器,1Hz,9V 电池
步骤 3:审核与确认
我将向您展示:
- - 原理图预览图像
- 元件清单(BOM)
- 计算值(定时电阻等)
您确认或请求更改。
步骤 4:PCB 布局
bash
导入到 PCB
kicad_pcb.py import-netlist
自动布局(或手动引导)
kicad_pcb.py auto-place --strategy compact
kicad_pcb.py set-board-size 50x30
预览
kicad_pcb.py preview-pcb --layers F.Cu,B.Cu,F.Silkscreen
步骤 5:制造
bash
运行最终检查
kicad_pcb.py drc --strict
导出所有文件
kicad
pcb.py package-for-fab --output LEDBlinker_fab.zip
获取报价
kicad_pcb.py pcbway-quote --quantity 10 --layers 2 --thickness 1.6
常用电路模板
templates/555astable.kicadsch
经典 555 定时器非稳态模式。参数:
- - R1, R2:定时电阻
- C1:定时电容
- 频率 ≈ 1.44 / ((R1 + 2R2) C1)
templates/arduinoshield.kicadpcb
Arduino Uno 扩展板模板,包含:
templates/usbcpower.kicad_sch
USB-C 供电(5V):
配置
创建 ~/.kicad-pcb/config.json:
json
{
default_fab: pcbway,
pcbway: {
email: your@email.com,
default_options: {
layers: 2,
thickness: 1.6,
color: green,
surface_finish: hasl
}
},
kicad_path: /usr/bin/kicad-cli,
projects_dir: ~/kicad-projects,
auto_backup: true
}
设计审核协议
在下单前,我将始终:
- 1. 显示原理图 — 电路的视觉确认
- 显示 PCB 渲染图 — 顶面、底面、3D 视图
- 列出 BOM — 所有元件及其数值
- 报告 DRC — 任何警告或错误
- 显示报价 — 下单前的成本明细
未经明确确认,我不会自动下单。
PCBWay 下单流程(当前)
- 1. 导出 Gerber 文件 + 钻孔文件
- 创建 ZIP 包
- 手动步骤:您上传至 pcbway.com
- 未来:自动上传 + 添加到购物车
成本参考
PCBWay 典型定价(2 层,100x100mm,数量 5):
- - 标准(5-7 天):约 $5
- 加急(3-4 天):约 $15
- 运费:约 $15-30 DHL
安全注意事项
⚠️ 高压警告:此技能不验证电气安全。对于市电连接电路,请咨询合格工程师。
⚠️ 无自动下单(尚):添加到购物车需要您的明确确认。
更新日志
v1.0.0
- - 初始版本
- KiCad CLI 集成
- 原理图/PCB 预览生成
- Gerber 导出
- PCBWay 报价集成
- 模板系统
由 PaxSwarm 构建