Skip to the content
2 layers45 × 35 mmTrain mcu core, the printed circuit board in 3D

creates 2d and 3d kicad PCB images for agentic review

Size
45 × 35 mm
Copper layers
2
Thickness
1.6 mm
Parts
18
Nets
15
Pads
84
Tracks, vias
0, 15
Pours
8
Routed
Not yet
KiCad
KiCad 10.0 (file 20260206)
Created
24 Mar 2026
Updated
26 Mar 2026

Overview

Train mcu core is an open-source printed circuit board by johnbetts, from the johnbetts/kicad-image-gen repository on GitHub, published under the Apache-2.0 licence. It is a 2-layer board of 45 × 35 mm with 18 parts on 15 nets.

It is built around the ESP32-S3-WROOM-1-N8. Its parts include 5 resistors, 3 capacitors, 2 connectors, 2 switches and 1 IC. It belongs with the ESP32 boards of this library.

Main components

1

README

README.md

kicad-image-gen

Generate PNG screenshots of KiCad PCBs that look like the PCB editor -- headlessly, from the command line or Python.

Why This Exists

I was designing PCBs with an AI-assisted workflow (kicad-ai-workflow) and hit a wall: every time I wanted Claude to review a board layout, I had to manually screenshot the KiCad PCB editor and paste the image into the conversation. Over and over. For every iteration.

I tried kicad-cli exports, but the raw SVG/PDF output looked nothing like the editor -- wrong colors, no ratsnest, no pad labels, missing mounting holes. The images were useless for AI-driven layout review because they didn't show the information an EE needs to evaluate placement: which pads connect where, what's routed, what isn't.

So I built this tool. It generates images that match the KiCad PCB editor appearance -- dark navy background, red pads, cyan mounting holes, visible ratsnest lines, pad numbers and net names -- using a custom color theme, SVG post-processing, and careful layer ordering.

Now my workflow is fully automated: generate a board, render images, feed them to Claude for review, apply fixes, re-render, repeat. The whole loop runs inside autoresearch iterations -- modify placement, render, score, keep or discard -- without ever opening KiCad.

Requirements

  • KiCad 10 (uses kicad-cli under the hood)
  • Python 3.10+
  • rsvg-convert (for SVG-to-PNG conversion): brew install librsvg

Install

bash
pip install -e .

# Install the custom KiCad color theme (required for editor-matching colors)
cp kicad_image_gen_theme.json ~/Library/Preferences/kicad/10.0/colors/kicad_image_gen.json

CLI Usage

bash
# 2D editor-style screenshot (with ratsnest + pad labels)
kicad-image-gen 2d board.kicad_pcb -o board_2d.png

# Composite mode (3D render base + overlay -- photorealistic)
kicad-image-gen 2d --composite board.kicad_pcb -o board_composite.png

# 3D rendered view
kicad-image-gen 3d board.kicad_pcb --view iso -q high --floor -o board_3d.png

# Full set: 2D top/bottom + 3D top/bottom/iso
kicad-image-gen both board.kicad_pcb -o output_dir/

2D Options

FlagDescription
-l, --layersLayer list or preset: all, top, bottom, copper, silkscreen, fab
-w, --widthOutput width in pixels (default: 4800)
-t, --themeKiCad color theme name (default: kicad_image_gen)
--compositeUse 3D renderer as base with PIL overlays
--no-ratsnestHide ratsnest lines
--no-pad-labelsHide pad numbers and net names
--pad-labelsShow pad numbers and net names (default)
-m, --mirrorMirror the board
--bwBlack and white

3D Options

FlagDescription
--viewPreset: top, bottom, iso, iso-back, iso-bottom, front, back, left, right
-w, --widthImage width (default: 1600)
--heightImage height (default: 900)
-q, --qualitybasic or high
--perspectivePerspective projection
--floorEnable floor, shadows, post-processing
--zoomCamera zoom level
--rotateCustom rotation as X,Y,Z degrees

Python API

python
from kicad_image_gen import render_2d, render_3d, render_2d_composite, render_all

# 2D editor view with ratsnest and pad labels
render_2d("board.kicad_pcb", "board_2d.png", width=4800)

# 2D clean (no overlays)
render_2d("board.kicad_pcb", "board_clean.png", ratsnest=False, pad_labels=False)

# 3D isometric
render_3d("board.kicad_pcb", "board_3d.png", view="iso", quality="high", floor=True)

# Composite (photorealistic base + ratsnest overlay)
render_2d_composite("board.kicad_pcb", "board_composite.png", ratsnest=True)

# Full set: 2d_top, 2d_bottom, 3d_top, 3d_bottom, 3d_iso
results = render_all("board.kicad_pcb", "output/")

What It Renders

The 2D output matches the KiCad PCB editor appearance:

  • Red pads via custom color theme with transparent soldermask
  • Cyan mounting holes injected at NPTH pad locations
  • Ratsnest lines (MST-based) showing unrouted net connectivity
  • Pad labels with pin numbers (cyan) and net names scaled to pad size
  • Dark navy background with subtle board substrate fill
  • Yellow edge cuts for board outline visibility
  • Board margin via viewBox padding

Architecture

Thin wrapper around kicad-cli (KiCad 10's official CLI). No dependency on the deprecated pcbnew Python bindings.

  • 2D pipeline: kicad-cli pcb export svg with custom theme and layer ordering -> SVG post-processing (background, mounting holes, ratsnest, pad labels) -> rsvg-convert -> PNG
  • 3D pipeline: kicad-cli pcb render -> PNG (direct output)
  • Composite pipeline: kicad-cli pcb render --side top -> Pillow overlay compositing
  • PCB parsing: Standalone .kicad_pcb S-expression regex parser for pads, nets, bounds, mounting holes

Using with AI Agents

This tool was built specifically for AI-driven PCB design loops. Other Claude Code skills can call it directly:

python
from kicad_image_gen import render_2d
render_2d(pcb_path, output_path)

Or via CLI in any agent's bash:

bash
kicad-image-gen 2d board.kicad_pcb -o placement.png

License

Apache 2.0

Parts

18
QtyValueFootprintReferences
4MountingHoleMountingHole:MountingHole_2.7mm_M2.5H1, H2, H3, H4
2100nFeasyeda2kicad:C0805C1, C5
210Keasyeda2kicad:R0805R1, R2
25.1Keasyeda2kicad:R0402R3, R4
110uFeasyeda2kicad:C0805C2
1330Reasyeda2kicad:R0603R5
1BOOTeasyeda2kicad:SW-SMD_4P-L5.1-W5.1-P3.70-LS6.5-TL_H1.5SW1
1ESP32-S3-WROOM-1easyeda2kicad:WIRELM-SMD_ESP32-S3-WROOM-1U1
1LEDeasyeda2kicad:LED0603-RDD1
1RESETeasyeda2kicad:SW-SMD_4P-L5.1-W5.1-P3.70-LS6.5-TL_H1.5SW2
1UART_HeaderPinHeader_1x04_P2.54mmJ2
1USB-CConnector_USB:USB_C_Receptacle_GCT_USB4105J1

More from johnbetts/kicad-image-gen

4
  • 2 layers90 × 55 mmTrain relay, the printed circuit board in 3D

    Train relay

    johnbetts/kicad-image-gen

    creates 2d and 3d kicad PCB images for agentic review

    36 partsApache-2.0
  • 2 layers60 × 40 mmTrain analog input, the printed circuit board in 3D

    Train analog input

    johnbetts/kicad-image-gen

    creates 2d and 3d kicad PCB images for agentic review

    29 partsApache-2.0
  • 2 layers50 × 40 mmTrain power, the printed circuit board in 3D

    Train power

    johnbetts/kicad-image-gen

    creates 2d and 3d kicad PCB images for agentic review

    19 partsApache-2.0
  • 2 layers50 × 40 mmTrain ethernet, the printed circuit board in 3D

    Train ethernet

    johnbetts/kicad-image-gen

    creates 2d and 3d kicad PCB images for agentic review

    17 partsApache-2.0

Similar boards

  • 2 layers85 × 115 mmOSO BOOK B1, the printed circuit board in 3D

    OSO BOOK B1

    joeycastillo/The-Open-Book

    For details on how to build, test and use Open Book, I've made documentation available here.

    76 parts8.1kCC-BY-SA-4.0
  • 2 layers299 × 82.5 mmPixelWave, the printed circuit board in 3D

    PixelWave

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    663 parts915
  • 4 layers56.5 × 99.8 mmBitaxeGamma, the printed circuit board in 3D

    BitaxeGamma

    bitaxeorg/bitaxeGamma

    Bitaxe based on the BM1370 from the S21 Pro

    147 parts432CERN-OHL-S-2.0
  • 2 layers129.5 × 50.8 mmLilka, the printed circuit board in 3D

    Lilka

    lilka-dev/lilka

    Схема та документація ігрової консолі Lilka

    39 parts234GPL-2.0
  • 4 layers84.5 × 129.5 mmBitaxeHex, the printed circuit board in 3D

    BitaxeHex

    bitaxeorg/ultraHex

    multi-ASIC Bitcoin miner

    369 parts190CERN-OHL-S-2.0
  • 2 layers110 × 115 mmEsp32 keyboard v0.1, the printed circuit board in 3D

    Esp32 keyboard v0.1

    hhuysqt/esp32s3-keyboard

    USB/BLE keyboard driver based on ESP32S3-WROOM-1

    230 parts168GPL-3.0
  • 2 layers35.1 × 36.6 mmBinNanoFOC, the printed circuit board in 3D

    BinNanoFOC

    katbinaris/nanofoc_devkit

    Compact All-In-One BLDC Controler featuiring ESP32-S3, TMC6300 and Magalpha sensors. Small 35x35mm footprint.

    76 parts146
  • 2 layers148 × 81 mmCommunicator pcb, the printed circuit board in 3D

    Communicator pcb

    Hack-a-Day/2025-Communicator_Badge

    The 2025 Hackaday Supercon RF Communicator Badge

    58 parts107MIT

Questions

How big is the Train mcu core PCB?

It measures 45 × 35 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Train mcu core use?

18 parts, built around the ESP32-S3-WROOM-1-N8. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Train mcu core KiCad files?

From the johnbetts/kicad-image-gen repository on GitHub, at the commit this page was made from: the board is reference/train_mcu_core.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the Train mcu core design in my own project?

Its repository publishes it under the Apache-2.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).