# KiCad Donut Pad Designer

Generate annular-ring (donut) copper pads for KiCad footprints. These appear on components like MEMS microphones where a GND pad surrounds a central acoustic port hole (NPTH).

## What it does

- Interactive Hydrogen webview app with live SVG preview
- Adjustable parameters: outer/inner radius, drill diameter, segments, paste aperture config, mask margin
- Presets for common MEMS microphones: IM72D128, IM69D130, SPH0645
- Exports valid `.kicad_mod` files directly to your project directory
- Python CLI generator (`donut_pad.py`) for scripted/batch use

## How the donut pad works

KiCad has no native ring pad shape. The workaround uses a **custom SMD pad** with a `gr_poly` primitive whose outline traces the outer circle CCW, then bridges to the inner circle and traces it CW. This creates a filled polygon with a hole.

```
Outer copper (R_outer) ──┐
                         │  copper annulus
Inner clearance (R_inner)┘
         NPTH drill ─── acoustic port / vent hole
```

The generator also produces:
- **NPTH hole** at the center
- **Segmented paste apertures** (quarter-arc stencil openings with gaps)
- **Solder mask opening** circle
- **Courtyard** rectangle

## Installation

The skill is installed via gallia. It lives at `~/.claude/skills/kicad-donut-pad/`.

To launch the interactive designer:

```bash
# Start the server (if not already running)
cd ~/.claude/skills/kicad-donut-pad && python3 server.py &

# Open in Hydrogen webview
adom-cli hydrogen webview open-or-refresh --name "Donut Pad Designer" \
  --url "$(echo $VSCODE_PROXY_URI | sed 's/{{port}}/8847/')"
```

Or use the Python CLI directly:

```bash
python3 ~/.claude/skills/kicad-donut-pad/donut_pad.py \
  --outer 1.04 --inner 0.58 --drill 0.8 \
  --center-x 0 --center-y 0.68 \
  --pad-number 5 --segments 36
```

## Common use cases

| Component type | Typical R_outer | R_inner | NPTH | Notes |
|---|---|---|---|---|
| MEMS microphone (3x4mm) | 0.9-1.1 mm | 0.5-0.6 mm | 0.8 mm | Acoustic port |
| MEMS microphone (2.5x3.5mm) | 0.7-0.9 mm | 0.4-0.5 mm | 0.6 mm | Smaller package |
| Pressure sensor | 0.8-1.2 mm | 0.4-0.6 mm | 0.5-0.8 mm | Vent hole |

## Source

- **Gallia repo:** `skills/kicad-donut-pad/` in [adom-inc/gallia](https://github.com/adom-inc/gallia)
- **Files:** `SKILL.md`, `index.html` (webview app), `server.py` (HTTP + save API), `donut_pad.py` (CLI generator)
