165 lines
5.2 KiB
Markdown
165 lines
5.2 KiB
Markdown
TODO: Add table of content
|
||
# KiKit Processor
|
||
Processing script for KiKit panelizes PCBs and draws a fixture sketch and positions the whole panel for easy CNC and MSLA processing.
|
||
|
||
The script:
|
||
|
||
- Panelizes the board
|
||
- Moves the finished panel to the origin `(0, 0)`
|
||
- Adds alignment holes
|
||
- Adds silskcreen text
|
||
- Extends the copper layers
|
||
|
||
The resulting output is intended for repeatable CNC/MSLA processing.
|
||
|
||

|
||
|
||
## Install kikit
|
||
Install `kikit`:
|
||
```bash
|
||
pipx install --system-site-packages kikit
|
||
```
|
||
|
||
## Usage
|
||
|
||
```bash
|
||
# Panelize the PCB using the preset defined in `myPreset.json`.
|
||
kikit panelize \
|
||
-p myPreset.json \
|
||
../Flow_Controller.kicad_pcb \
|
||
panel/Flow_Controller_Panel.kicad_pcb
|
||
```
|
||
|
||
The new `panel/Flow_Controller_Panel.kicad_pcb` file will contain the panelized PCB with the following feature specified in `myPreset.json`. E.g.: Grid of 1 x 2 with space 2.1 mm, new mounting holes and fiducials.
|
||
|
||
```json
|
||
"layout": {
|
||
"type": "grid",
|
||
"rows": 1,
|
||
"cols": 2,
|
||
"hspace": "2.1mm",
|
||
"vspace": "2.1mm"
|
||
}
|
||
```
|
||
See all values in [default.json](https://raw.githubusercontent.com/yaqwsx/KiKit/refs/heads/master/kikit/resources/panelizePresets/default.json)
|
||
|
||
Check the kikit panelization [examples](https://yaqwsx.github.io/KiKit/latest/panelization/examples/).
|
||
|
||
# Exporting gcode for CNC
|
||
|
||
## pcb2gcode
|
||
Use CNC for drilling holes and milling board outlines. You can also use CNC for isolation traces milling. However, the best result will give you MSLA PCB exposure. TODO: Add link to the section
|
||
|
||
Adapt milling and drilling parameters in `millproject`. Look up [pcb2gcode/wiki](https://github.com/pcb2gcode/pcb2gcode/wiki) for help.
|
||
```bash
|
||
nano millproject
|
||
```
|
||
*Make sure to set `mirror-axis` in the `millproject` to half of your board width!!!*
|
||
|
||
```bash
|
||
./export_for_cnc.sh panel/Flow_Controller_Panel.kicad_pcb
|
||
```
|
||
|
||
Launch the `gSender` program.
|
||
* Load the `output/gcode/drill.ngc` file for drilling holes.
|
||
* Load the `output/gcode/outline.ngc` file for milling the board outlines.
|
||
* Load the `output/gcode/back.ngc` file if you want to mill the isolation traces.
|
||
* Load the `output/gcode/front.ngc` file if you want to mill the isolation traces.
|
||
|
||
## Milling tip: Increase the thermal spoke and trace width
|
||
When routing for milling, use the widest traces possible. 1mm, 2mm and wider, the machine doesn't care, but later you won't be soldering leads to small fragile strips of copper. You can use copper pours for routing too.
|
||
|
||
Set up the entire back side as one big GND pour. Then, increase the thermal spoke width to be larger than 1mm. This avoids small features and gives more room for error if a larger drill is used for the holes.
|
||
|
||

|
||
|
||
|
||
# MSLA PCB Exposure: KiCad → Photon Mono 4
|
||
|
||
Convert KiCad PCB layers to `.pm4n` files for direct UV exposure on an **Anycubic Photon Mono 4** (9024×5120 px, 17 µm/px).
|
||
|
||
---
|
||
|
||
## Setup
|
||
|
||
### 1. Create the Dummy.pm4n
|
||
|
||
Open **CHITUBOX Basic** slicer, select printer **Anycubic Photon Mono 4**, slice any tiny STL (a 1×1×0.05 mm box), and save as `Dummy.pm4n` in the same directory as `export_for_msla.sh`.
|
||
|
||
This file is reused for every job — it carries the correct LCD resolution metadata.
|
||
|
||
### 2. Install dependencies
|
||
|
||
```bash
|
||
python3 -m venv .venv
|
||
source .venv/bin/activate
|
||
pip install pygerber Pillow numpy
|
||
```
|
||
|
||
Or activate the venv once and put `source .venv/bin/activate` in your shell profile.
|
||
|
||
### 3. Export multiple layers (e.g. copper + soldermask)
|
||
|
||
```bash
|
||
./export_for_msla.sh \
|
||
--layers Front,Back,F.Mask,B.Mask,F.SilkS,B.SilkS \
|
||
--invert Front,Back,F.Mask,B.Mask,F.SilkS,B.SilkS \
|
||
--mirror Front,F.Mask,F.SilkS \
|
||
--exposure 60 \
|
||
panel/Flow_Controller_Panel.kicad_pcb
|
||
```
|
||
|
||
#### Using gerber_to_pm4n.py directly
|
||
|
||
```bash
|
||
python3 gerber_to_pm4n.py Dummy.pm4n output/gerbers/Flow_Controller_Panel-Front.gbr \
|
||
--invert --mirror --exposure 60
|
||
```
|
||
|
||
---
|
||
|
||
## Output structure
|
||
|
||
```
|
||
output/
|
||
├── gerbers/
|
||
│ ├── Flow_Controller_Panel-Front.gbr
|
||
│ └── Flow_Controller_Panel-F_Mask.gbr
|
||
└── pm4n/
|
||
├── Flow_Controller_Panel-Front.pm4n ← copy to USB, print on Mono 4
|
||
├── Flow_Controller_Panel-Front.preview.png ← visual check before printing
|
||
├── Flow_Controller_Panel-F_Mask.pm4n
|
||
└── Flow_Controller_Panel-F_Mask.preview.png
|
||
```
|
||
|
||
---
|
||
|
||
## Troubleshooting
|
||
|
||
**`kicad-cli: command not found`** — add KiCad to PATH:
|
||
```bash
|
||
export PATH="/usr/lib/kicad/bin:$PATH"
|
||
```
|
||
Or on Flatpak:
|
||
```bash
|
||
alias kicad-cli='flatpak run --command=kicad-cli org.kicad.KiCad'
|
||
```
|
||
|
||
**Expected Gerber not found** — KiCad's layer→filename mapping:
|
||
|
||
| Layer | Filename stem |
|
||
|---|---|
|
||
| `F.Cu` | `Front` |
|
||
| `B.Cu` | `Back` |
|
||
| `F.Mask` | `F_Mask` |
|
||
| `B.Mask` | `B_Mask` |
|
||
| `F.SilkS` | `F_Silkscreen` |
|
||
|
||
---
|
||
First print checklist
|
||
|
||
Open the `.pm4n` in `Chitubox Basic` slicer to visually verify before printing.
|
||
Check the `.preview.png` — traces should appear black on white background (background = UV exposed = resist removed = etched away; traces = dark = resist kept = copper stays)
|
||
Start with `--exposure 60` and bracket from there — Bungard presensitized at 405nm typically lands between 30–120s depending on board vintage and storage.
|
||
|