Skip to the content
PCBKitNew board
4 layers43 × 24 mmDisco, the printed circuit board in 3D

A PegJS parser for Kicad Modules

Size
43 × 24 mm
Copper layers
4
Thickness
1.6 mm
Parts
21
Nets
67
Pads
165
Tracks, vias
189, 46
Pours
4
Routed
Yes
KiCad
KiCad 5 (file 20171130)
Created
9 Aug 2020
Updated
17 Nov 2024

Overview

Disco is an open-source printed circuit board by jdthorpe, from the jdthorpe/kicad-module-parser repository on GitHub. It is a 4-layer board of 43 × 24 mm with 21 parts on 67 nets, routed with 189 tracks and 46 vias.

It is built around the MPU-9250. Its parts include 8 capacitors, 4 connectors, 3 ICs and 2 resistors. It belongs with the STM32 boards of this library.

Main components

1

README

README.md

Convert Kicad Board and Module files to JSON

Do you love working with S-Expressions? Me either. Convert your Kicad board and module files to JSON or YAML and use your favorite tools to work with your Kicad board and module file data!

CLI Usage

When installed globally (npm i -g kicad-to-json), npm installs the k2j command line tool, which converts your kicad files to json like so:

sh
k2j ./my_module_file.kicad_mod
# creates ./my_module_file.json in compact format

k2j ./my_board_file.kicad_pcb --yaml --format long
# creates ./my_board_file.yaml in long format

Use the -h flag for the usual help:

txt
usage: index.js [-h] [-o OUTPUT] [-f {compact,long,bare}] [-v] [--yaml] file

Convert Kicad board and module files to JSON/YAML

positional arguments:
  file                  The Kicad pcb or module file to convert to json

optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        Output file (defaults to input file with '.json' or '.yaml' extension)
  -f {compact,long,bare}, --format {compact,long,bare}
                        Set the output format
  -v, --verbose         verbose output
  --yaml                set output to yaml

Javascript / Typescript Usage

User friendly data

ts
import { parse } from "kicad-module-parser"

// convert the module (string) to compact format
const my_module = parse.module(kicad_mod_contents_string)

// convert the board (string) to long format
const my_board = parse.board(kicad_pcb_contents_string,"long")

Output Formats

Background

The kicad_mod and kicad_pcb files are S-Expressions based which have the general format (name ...contents ) where the contents are either individual values or nested s-expressions (e.g. ( pts (xy 1 1) (xy 2 2))). Some s-expressions are singletons, such as the pts expression within a polygon and others can appear multiple times, such as the individual xy pairs within an array of points.

bare Notation

In the bare notation the first token in the s-expresion appears as it's type attribute, and the remaining sub-expression appear in the value attribute. This format is quite literal, but generally hard to work with. Here is a brief example (in yaml format):

yaml
type: kicad_pcb
value:
  - type: version
    value:
      type: number
      value: '20171130'
  - type: general
    value:
      - type: thickness
        value:
          type: number
          value: '1.6'
      - type: drawings
        value:
          type: number
          value: '605'
      - type: tracks
        value:
          type: number
          value: '2555'
      - type: zones
        value:
          type: number
          value: '0'

compact Notation

In the compact format, s-expression types and values from the bare format are used as key-value pairs of a JSON object This works for s-expressions that are singletons, but for expressions like (add_net GND) (add_net +3v3) which may appear multiple times within the parent s-expression, the contents of the expression are included in an array of the same name, such as :

json
{
    "add_net":[
        {"net_name": "GND"},
        {"net_name": "+3v3"}
    ]
}

Here is the same example from above in compact format:

yaml
kicad_pcb:
  version: 20171130
  general:
    thickness: 1.6
    drawings: 605
    tracks: 2555
    zones: 0
    modules: 172
    nets: 143

long Notation

The long format is a hybrid between the Compact and Bare formats, and recoginses that module and board files are special, in that nearly every file will have many repeating entities (such as gr_lines) where preserving the order of the entites may be useful. Hence, the immediate children of boards and modules (and modules nested within boards) are represent in bare format, and everything else is represented in compact format. Here is the same example from above in long format:

yaml
kicad_pcb:
  - type: version
    value: 20171130
  - type: general
    value:
      thickness: 1.6
      drawings: 605
      tracks: 2555
      zones: 0
      modules: 172
      nets: 143

bare Format Details

There are 4 primitives in the bare format which have type "string", "hex", "number" and "boolean", such as:

json
{ "type": "string", "value": "GND" }
{ "type": "hex", "value": "1234ABCD" }
{ "type": "number", "value": "3.2" } // yes, numbers are represented as strings
{ "type": "boolean", "value": true }

The array type has a type attribute of "array" and a value contianing an aray of primitives, such as:

json
{ "type": "array", "value": [ { "type": "string", "value": "GND" } ] }

The container type is like the array type but it's type attribute has a value other than "string", "hex", "number", "boolean" or "array", and the value can contain any type (including other containers), or an array containing any of the types, sucy as:

json
{
  "type": "xy",
  "value": [
    {
      "type": "x",
      "value": {
        "type": "number",
        "value": "117.4"
      }
    },
    {
      "type": "y",
      "value": {
        "type": "number",
        "value": "28"
      }
    }
  ]
}

Final notes

There are a handfule of sub-parsers and things I was not personally interested in (such as page formatting) which result in a value like "page info": "unsupported". If you despirately need page info (or any other unsupported features), I welcome your pull request!

If your board or module results in an error, please put it in a github repo (or a minimal example that raises the same error), and open an issue with a link to that github repo.

Parts

21
QtyValueFootprintReferences
60.1uF/0603Capacitor_SMD:C_0603_1608MetricC3, C4, C5, C6, C7, C8
4MountingHole_2.2mm_M2_Pad_TopBottomMountingHole:MountingHole_2.2mm_M2_Pad_TopBottomH1, H2, H3, H4
25.1k/0402Resistor_SMD:R_0402_1005MetricR1, R2
2U.FLConnector_Coaxial:U.FL_Hirose_U.FL-R-SMT-1_VerticalJ3, J4
11uF/0603Capacitor_SMD:C_0603_1608MetricC2
11uF/0805Capacitor_SMD:C_0805_2012MetricC1
1Conn_01x04Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ2
1MCP1804T-1802I/OTPackage_TO_SOT_SMD:SOT-23-5U2
1MPU-9250Sensor_Motion:InvenSense_QFN-24_3x3mm_P0.4mmU3
1STM32F103R8TxPackage_QFP:LQFP-64_10x10mm_P0.5mmU1
1USB_C_Receptacle_USB2.0Connector_USB:USB_C_Receptacle_Amphenol_12401548E4-2AJ1

Questions

How big is the Disco PCB?

It measures 43 × 24 mm and has 4 copper layers, 1.6 mm thick.

What parts does the Disco use?

21 parts, built around the MPU-9250. 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 Disco KiCad files?

From the jdthorpe/kicad-module-parser repository on GitHub, at the commit this page was made from: the board is data/pcb/custom/Disco.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the Disco design in my own project?

Its repository states no licence, so its author keeps all rights: ask jdthorpe before reusing the design.

More from jdthorpe/kicad-module-parser

4
  • 4 layers85 × 57.5 mmFirefly, the printed circuit board in 3D

    Firefly

    jdthorpe/kicad-module-parser

    A PegJS parser for Kicad Modules

    104 parts12
  • 2 layers18 × 20 mmUsbPower, the printed circuit board in 3D

    UsbPower

    jdthorpe/kicad-module-parser

    A PegJS parser for Kicad Modules

    6 parts12
  • 4 layers16 × 13 mmBoard simple, the printed circuit board in 3D

    Board simple

    jdthorpe/kicad-module-parser

    A PegJS parser for Kicad Modules

    2 parts12
  • 4 layers16 × 13 mmBoard2, the printed circuit board in 3D

    Board2

    jdthorpe/kicad-module-parser

    A PegJS parser for Kicad Modules

    2 parts12

Similar boards

  • 2 layers35 × 38.4 mmHandgelenk, the printed circuit board in 3D

    Handgelenk

    Jeija/esp8266-smartwatch

    ESP8266 DIY WiFi Smartwatch with MPU-9250, RTC, OLED, FT232, ...

    61 parts233
  • 2 layers100 × 74 mmMicromouse, the printed circuit board in 3D

    Micromouse

    kbumsik/WolfieMouse

    IEEE Reion 1 Micromouse competition.

    214 parts79
  • 4 layers70 × 80 mmPower Board, the printed circuit board in 3D

    Power Board

    kbob/LED-Cube

    Blinky in 3D!

    91 parts51
  • 4 layers42 × 83.9 mmStratoSoar MK2.2, the printed circuit board in 3D

    StratoSoar MK2.2

    crnicholson/StratoSoar-MK2

    StratoSoar is an engineering project that aims to be able to fly a glider (dropped from a high-altitude balloon), down to any selected coordinates.

    116 parts24
  • 2 layers187 × 152 mmKiss masterboard, the printed circuit board in 3D

    Kiss masterboard

    squarewavedot/ledcubeelectronics

    LEDCube battery and masterboard electronics

    163 parts22
  • 2 layers49.3 × 19.7 mmFineMotion-5, the printed circuit board in 3D

    FineMotion-5

    Kamilake/FineMotion-Tracker

    ESP8266 Motion Capture Full-Body Tracker for SlimeVR

    43 parts16CERN-OHL-P-2.0
  • 2 layers146 × 100 mmLoliBot, the printed circuit board in 3D

    LoliBot

    CCHS-Melbourne/LoliBot

    Welcome to the 2018 linux.conf.au Open Hardware Project. You can see information about this and other MiniConfs at .

    42 parts13
  • 4 layers46 × 45.9 mmESP32-S3-MINI, the printed circuit board in 3D

    ESP32-S3-MINI

    vandychuob/ESP32-S3-Project

    65 parts12MIT