Skip to the content
2 layers70.1 × 30 mmUsb shield, the printed circuit board in 3D

Generate Openscad boxes from KiCad PCB files.

Size
70.1 × 30 mm
Copper layers
2
Thickness
1.6 mm
Parts
201
Nets
6
Pads
245
Tracks, vias
39, 4
Pours
4
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
25 Dec 2025
Updated
28 Jan 2026

Overview

Usb shield is an open-source printed circuit board by gnilsson2, from the gnilsson2/YAPP_Box_KiCad_Generator repository on GitHub, published under the MIT licence. It is a 2-layer board of 70.1 × 30 mm with 201 parts on 6 nets, routed with 39 tracks and 4 vias.

Its parts include 4 capacitors, 2 connectors and 1 IC.

README

README.md

generateBox

Generate YAPP_Box OpenSCAD enclosures directly from KiCad PCB files

generateBox is a command-line utility that parses KiCad .kicad_pcb files and automatically generates OpenSCAD enclosure code.
It removes the manual work of measuring connectors, switches, and LEDs by extracting metadata directly from your PCB design.

The result is a printable project box that accurately fits your board and its components.


🚀 Features

  • Automatic Cutouts
    Generates enclosure openings for connectors and cables based on footprint properties.

  • Lid Mounting Support
    Adds mounting holes in the lid for designated components.

  • Interactive Components
    Built-in support for pushbuttons and LEDs.

  • LED Light Guides
    Automatically generates light tubes for LEDs, or simple holes if preferred.

  • 3D Model Integration
    Optionally imports your PCB’s exported 3D model for accurate fit verification in OpenSCAD.


🛠 Prerequisites

The following versions were used during development. Later versions may also work.


📋 KiCad Footprint Preparation

To allow the generator to identify components correctly, specific custom properties must be added to the relevant footprints in the KiCad PCB Editor.

Required Footprint Properties

Component TypeProperty NameDescription
ConnectorsHeightTotal height of the connector for enclosure cutouts
Connectors (Optional)ConnectorOverride to force detection (Height is still needed)
Lid ComponentsMountDiameterDiameter of the mounting hole in the lid
SwitchesHeight or MountDiameterHeight over PCB for PushButton, or diameter of lid hole
LEDsHeightHeight used to generate the light guide
LEDs (Optional)MountDiameterOverride for default LED diameter detection
Cables-(Detected by reference prefix X only)

Component roles are identified using a combination of footprint reference prefixes (e.g. J, D, SW, X) and the presence of these properties.


Example: USB Micro-B Connector

Show example

USB Micro-B connector properties


Example: LED

Show example

LED properties


📸 Optional: Export the PCB 3D Model

For best results, export your PCB as an STL file so it can be displayed inside the generated enclosure in OpenSCAD.

Steps

  1. In KiCad, go to
    File → Export → STEP / GLB / BREP / XAO / PLY / STL...
  2. Select STL as the format
  3. Set Coordinate Origin to Board center origin
  4. Rename the file extension to .pcb.stl
    (This prevents OpenSCAD’s STL export from overwriting the PCB model.)

Example

PCB 3D model inside enclosure


💻 Usage

After adding the required footprint properties and optionally exporting the PCB 3D model, open a terminal in the directory containing your .kicad_pcb file and run:

cmd
path_to_generateBox inputfile.kicad_pcb [outputfile.scad] [--lightholes]

Example

cmd
generateBox my_project.kicad_pcb my_project_box.scad

⚙ Command-Line Options

OptionDescription
--lightholesGenerate simple LED holes instead of light tubes
--noopenDisable auto open OpenSCAD program
--helpDisplay usage information
--versionDisplay version information

🔄 Typical Workflow

  1. Add the required custom properties to your KiCad footprints.

  2. (Optional) Export the PCB as an STL file.

  3. Run the generator on your .kicad_pcb file.

  4. The tool generates:

    • An OpenSCAD enclosure file (.scad)
    • A filtered PCB STL (if a .pcb.stl was found)
  5. If OpenSCAD is installed in the default location, it will be launched automatically:
    C:\Program Files\OpenSCAD\openscad.exe

  6. Render and export the enclosure in OpenSCAD.

🛠 Some maybe counter intuitive facts

  • Back wall is at x = 0, Front at positive x (inherited from YAPP_BOX).
  • KiCad y cordinate points down

🌟 Credits

This project builds upon the work of the following open-source tools and libraries:

📄 License

This project is licensed under the MIT License.

Parts

201
QtyValueFootprintReferences
189AUTO_VIAVIA_MATRIXV10_9, V10_10, V10_11, V10_13, V11_4, V11_5, V11_6, V11_7, V11_9, V11_10, V11_11, V11_13, V12_4, V12_10, V12_11, V12_13 +173
2100nCapacitors_SMD:C_0805_HandSolderingC1, C2
210uCapacitors_Tantalum_SMD:CP_Tantalum_Case-B_EIA-3528-21_HandC3, C4
2USB_Amyfootprints:USB_A_topJ1, J2
1NanoPi Duomyfootprints:nano_pi_duo_usb_shieldU1

The 196 most common of 201 parts.

More from gnilsson2/YAPP_Box_KiCad_Generator

5
  • 2 layers39.7 × 50 mmSd wav pcm5100, the printed circuit board in 3D

    Sd wav pcm5100

    gnilsson2/YAPP_Box_KiCad_Generator

    Generate Openscad boxes from KiCad PCB files.

    329 partsMIT
  • 2 layers69.1 × 65.5 mmHeater actuator node, the printed circuit board in 3D

    Heater actuator node

    gnilsson2/YAPP_Box_KiCad_Generator

    Generate Openscad boxes from KiCad PCB files.

    263 partsMIT
  • 2 layers85 × 35 mmSuper reg-5v, the printed circuit board in 3D

    Super reg-5v

    gnilsson2/YAPP_Box_KiCad_Generator

    Generate Openscad boxes from KiCad PCB files.

    49 partsMIT
  • 2 layers35.6 × 18.8 mmSamd51 micropython 9, the printed circuit board in 3D

    Samd51 micropython 9

    gnilsson2/YAPP_Box_KiCad_Generator

    Generate Openscad boxes from KiCad PCB files.

    22 partsMIT
  • 2 layers70 × 30 mmUsb on off, the printed circuit board in 3D

    Usb on off

    gnilsson2/YAPP_Box_KiCad_Generator

    Generate Openscad boxes from KiCad PCB files.

    8 partsMIT

Similar boards

  • 2 layers97.4 × 96.5 mmESP32-adapter pan, the printed circuit board in 3D

    ESP32-adapter pan

    pcbreflux/espressif

    all espressif stuff will committed here

    201 parts608GPL-3.0
  • 2 layers116.1 × 98 mmDropBear, the printed circuit board in 3D

    DropBear

    speeduino/Hardware

    Official Speeduino hardware designs

    201 parts283
  • 2 layers177.8 × 127 mmScopetrex, the printed circuit board in 3D

    Scopetrex

    schlae/scopetrex

    SCOPETREX vector gaming on your oscilloscope!

    201 parts248
  • 2 layers251.3 × 108.7 mmBarghoot, the printed circuit board in 3D

    Barghoot

    AlaaSaadAbdo/battoota

    Keyboards

    201 parts188
  • 2 layers223.5 × 160 mmBase, the printed circuit board in 3D

    Base

    bread-modular/bread-modular

    Modular Synths for Everyone

    201 parts67MIT
  • 2 layers101.6 × 147.3 mmKarabas pro revD, the printed circuit board in 3D

    Karabas pro revD

    andykarpov/karabas-pro

    FPGA based retrocomputer with FDD and HDD controllers

    201 parts37MIT
  • 2 layers140.7 × 47.4 mmEG8010 A1, the printed circuit board in 3D

    EG8010 A1

    Millisman/EG8010

    Collection of designs for the EG8010 (ASIC for single-phase SPWM control H-bridge)

    201 parts17MIT
  • 2 layers228.6 × 114.3 mmKrteq, the printed circuit board in 3D

    Krteq

    swift502/Krteq

    Low profile ortholinear keyboard

    201 parts15CC0-1.0

Questions

How big is the Usb shield PCB?

It measures 70.1 × 30 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Usb shield use?

201 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 Usb shield KiCad files?

From the gnilsson2/YAPP_Box_KiCad_Generator repository on GitHub, at the commit this page was made from: the board is TestProject/TestPcbs/usb_shield/usb_shield.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the Usb shield design in my own project?

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