Skip to the content
PCBKitNew board
2 layers20 × 12 mmDifferential pair, the printed circuit board in 3D

Electromagnetic simulation for KiCad PCBs using Gmsh and Palace. Reproducible workflows for impedance, transmission lines and S-parameters. With CPU and CUDA support.

Size
20 × 12 mm
Copper layers
2
Thickness
1.03 mm
Parts
2
Nets
2
Pads
4
Tracks, vias
2, 0
Pours
1
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
29 Oct 2026
Updated
4 Nov 2026

Overview

Differential pair is an open-source printed circuit board by gerhardmalberg, from the gerhardmalberg/pcb-em-lab repository on GitHub, published under the Apache-2.0 licence. It is a 2-layer board of 20 × 12 mm with 2 parts on 2 nets, routed with 2 tracks and 0 vias.

README

examples/differential-pair/README.md

Standalone differential-pair example

This synthetic 20 × 12 mm PCB exercises KiCad → Gmsh → Palace → ParaView without another checkout, external footprints or component models. Its files are Apache-2.0. It is a teaching fixture, not a manufacturing design or an impedance qualification. The supplied saved PCB is ready to use.

Two 0.8 mm top traces have a 0.6 mm edge gap over a rectangular bottom ground plane. J1/J2 pad 1 is P, pad 2 is N. The saved stackup has 35 µm copper, a 0.93 mm core with εr = 4.2, and two 15 µm mask layers with εr = 3.3. Estimated dielectric losses are zero. The 2D cut at x = 10 mm is marked on Dwgs.User; the 3D ports are 13 mm apart, with open pad/trace stubs beyond them.

CaseCalculationOutput under results/examples/differential-pair/
case.jsonTwo cross-section modes at 100 MHz, modal impedance and per-length quantities2d/
driven.jsonTwo-port network at eight frequencies, 100–800 MHz, fields and circuit handoffs3d/

Both use PEC copper: finite thickness in 2D, sheets at layer midplanes in 3D. They omit conductor loss. Their small meshes and finite air domains have not undergone convergence studies; results demonstrate operation, not accuracy.

Run

From the lab root after installation:

bash
./pcb-em run examples/differential-pair/case.json --backend cpu
# Optional 3D extension
./pcb-em run examples/differential-pair/driven.json --backend cpu

CPU uses two MPI ranks and one thread per rank. When the CUDA image is built and verified, add --backend cuda --mpi-ranks 1 instead. Backend changes rerun the solver in the same output directory; copy results or change output in a copy of the case first if you want to keep separate comparisons.

Each stage is also independently selectable, with prerequisite resolution:

bash
./pcb-em run examples/differential-pair/case.json --backend cpu --stage extract
./pcb-em run examples/differential-pair/case.json --backend cpu --stage mesh
./pcb-em run examples/differential-pair/case.json --backend cpu --stage solve
./pcb-em run examples/differential-pair/case.json --backend cpu --stage postprocess

Extraction reads saved fills without saving/refilling the PCB. exports.step adds a KiCad board/copper preview, with component models excluded. This STEP is not the solver geometry: it uses KiCad's export axes and 0x0mm origin. Do not overlay it on the numerical geometry without checking the transform. The numerical model uses KiCad XY in mm, z = 0 at the top copper surface, and Palace Model.L0 = 0.001. In 2D, mesh X is distance along the cut and mesh Y is height.

GUI access to each step

For a menu-driven workflow in VS Code, use File → Open Workspace from File and select differential-pair.code-workspace. Then choose Terminal → Run Task: EM 2D and EM 3D tasks run each CPU stage or the complete case; Inspect tasks open KiCad, FreeCAD, Gmsh, ParaView or Qucs-S. Alternatively, press Ctrl+P and type task EM or task Inspect. Inspection tasks first run any required pipeline stages. Run one task at a time for a given case and close its external GUI before rebuilding it. See the VS Code task documentation for the task menu. No extension is required, and no task starts automatically.

The workspace's PCB task opens results/examples/differential-pair/gui-source/. Edits to this inspection copy do not change the simulation's source board. Its Qucs-S task opens gui-circuit/, preserves schematic edits and refreshes the generated Touchstone data. Edit the supplied JSON files in VS Code to change the simulated cases. The commands below provide the same inspection tools without requiring VS Code.

GUI commands use authenticated X11/XWayland and separate persistent preferences under .cache/gui/. Close an application to return to the terminal. For KiCad's first launch, accept its default settings and installed footprint-library table if prompted. The fixture does not need downloaded models or libraries.

StepGUIFile
PCB and 3D board viewKiCad PCB Editor; View → 3D Viewerboard.kicad_pcb
Board/copper STEPFreeCADextract/board.step
Constructed geometry and tagged meshGmshmesh/geometry.brep, mesh/board.msh
Case and solver settingsVS Code or another text editorJSON, mesh/case.json, solve/fields.json or solve/excitation-*.json
Fields, slices and mode/frequency selectionParaViewpostprocess/view.pvsm, native .pvd files
Results and logsText editor or spreadsheetpostprocess/README.md, report.json, native CSVs and solve/stage.log
Optional circuit reuseQucs-Ssupplied network.sch with postprocess/network.s2p from 3D

Run these from the lab root. Use a copy for KiCad, which may write preferences beside the board. The output directory is writable in the other GUI sessions:

bash
mkdir -p results/examples/differential-pair/gui-source
cp -n examples/differential-pair/board.kicad_pcb results/examples/differential-pair/gui-source/
./pcb-em gui pcbnew --workdir results/examples/differential-pair/gui-source -- /work/board.kicad_pcb
./pcb-em gui freecad --workdir results/examples/differential-pair/2d/extract -- /work/board.step
./pcb-em gui gmsh --workdir results/examples/differential-pair/2d/mesh -- /work/board.msh
./pcb-em gui gmsh --workdir results/examples/differential-pair/3d/mesh -- /work/geometry.brep
./pcb-em gui paraview --workdir results/examples/differential-pair/2d -- --state=/work/postprocess/view.pvsm
./pcb-em gui paraview --workdir results/examples/differential-pair/3d -- --state=/work/postprocess/view.pvsm

FreeCAD: 0 selects axonometric view, V, F fits. Gmsh: Tools → Visibility shows physical groups in board.msh; a BREP stores geometry, not physical names. ParaView's time selector steps through modes (2D) or frequencies (3D). Read the native CSVs for physical frequencies. Open other native PVD collections to inspect both port excitations. Field normalization appears in the image; a modal eigenfield does not represent a specified operating voltage. When using a host ParaView outside the launcher, relocate /work in the Load State dialog to the case's result directory, or open its native PVD file. For 3D Gmsh inspection, hide the surrounding air group or use a clipping plane to reveal the board inside the air domain.

Palace has a JSON/command-line workflow, not a native solver GUI. Edit the JSON in a GUI text editor and launch the Solve task from the supplied workspace, or run the stage command in its integrated terminal. For example, with VS Code installed:

bash
code examples/differential-pair/case.json results/examples/differential-pair/2d/mesh/case.json

Generated solver JSON is replaced on rerun; change the source JSON for repeatable runs. Keep manually edited solver files outside stage directories. See Running Palace.

The 3D run exports 100 Ω Touchstone data and a QucsatorRF netlist. The supplied network.sch is a native GUI schematic with the S-parameter file component, two matched 100 Ω ports and an eight-point 100–800 MHz sweep already connected. Its Cartesian plot displays S11 (reflection) and S21 (transmission) in dB. Copy it beside the generated Touchstone file, open it and press F2 to simulate, then close the simulation messages window to see the curves. A fresh lab GUI profile selects QucsatorRF automatically; if you already have a profile, select that backend in the simulator toolbar. Existing preferences are preserved. If the backend path is requested, use /opt/qucs-s/usr/bin/qucsator_rf. Its two abstract ports represent differential ports, not a four-terminal common-mode network. A SPICE model is exported only after fit/passivity checks pass; inspect report.json before using it.

bash
cp -n examples/differential-pair/network.sch results/examples/differential-pair/3d/postprocess/
./pcb-em gui qucs-s --workdir results/examples/differential-pair/3d/postprocess -- /work/network.sch

Preserved outputs

The pipeline generates postprocess/fields.png, fields-domain.png and a reopenable view.pvsm. Native Palace fields, tables, solver inputs and logs remain alongside derived reports. Stage manifests and provenance.json record hashes, tool identities, backend and completion. Generated outputs are ignored.

Optional regeneration uses KiCad's system Python: /usr/bin/python3 examples/differential-pair/generate-board.py NEW.kicad_pcb. The generator refuses to overwrite existing files; normal runs use the supplied saved board directly.

Parts

2
QtyValueFootprintReferences
2Differential portJ1, J2

Questions

How big is the Differential pair PCB?

It measures 20 × 12 mm and has 2 copper layers, 1.03 mm thick.

What parts does the Differential pair use?

2 parts. 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 Differential pair KiCad files?

From the gerhardmalberg/pcb-em-lab repository on GitHub, at the commit this page was made from: the board is examples/differential-pair/board.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the Differential pair 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).

Similar boards

  • 2 layers37 × 19 mmPassive rpi hub75-adapter, the printed circuit board in 3D

    Passive rpi hub75-adapter

    hzeller/rpi-rgb-led-matrix

    Controlling up to three chains of 64x64, 32x32, 16x32 or similar RGB LED displays using Raspberry Pi GPIO

    2 parts4.4kGPL-2.0
  • 2 layersDiode template, the printed circuit board in 3D

    Diode template

    adamws/kicad-kbplacer

    KiCad plugin for automatic keyboard's key placement and routing

    2 parts547GPL-3.0
  • 2 layers20.3 × 15.2 mmL0 button, the printed circuit board in 3D

    L0 button

    Luos-io/luos_engine

    Open-source and real-time orchestrator for cyber-physical-systems, to easily design, test and deploy embedded applications and digital twins.

    2 parts546MIT
  • 2 layers35.1 × 46.8 mmSDEX2M2 Breakout Board, the printed circuit board in 3D

    SDEX2M2 Breakout Board

    NVNTLabs/switch2-SDEX2M2

    Micro SD Express to M.2 NVME Adapter for Nintendo Switch 2

    2 parts542GPL-3.0
  • 2 layers59.3 × 36.6 mmExpansionBoardTemplate, the printed circuit board in 3D

    ExpansionBoardTemplate

    BlueSCSI/BlueSCSI-v2

    BlueSCSI v2/Ultra - an open source, open hardware, SCSI emulator using the Pi Pico PR2040 and Pico 2 RP2350

    2 parts459GPL-3.0
  • 2 layersAlpha.9mm.wire, the printed circuit board in 3D

    Alpha.9mm.wire

    ohmtech-rdi/eurorack-blocks

    Software to Hardware Prototyping for Eurorack using C++, Max/Gen~ or Faust

    2 parts410
  • 2 layers26.7 × 64 mmGpu power, the printed circuit board in 3D

    Gpu power

    dennisss/dacha

    Monorepo for awesome tools/projects/libraries

    2 parts397Apache-2.0