Skip to the content
PCBKitNew board
4 layers85 × 57.5 mmFirefly, the printed circuit board in 3D

A PegJS parser for Kicad Modules

Size
85 × 57.5 mm
Copper layers
4
Thickness
1.6 mm
Parts
104
Nets
58
Pads
323
Tracks, vias
842, 396
Pours
15
Routed
Yes
KiCad
KiCad 5 (file 20171130)
Created
9 Aug 2020
Updated
17 Nov 2024

Overview

Firefly 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 85 × 57.5 mm with 104 parts on 58 nets, routed with 842 tracks and 396 vias.

It is built around the ATMEGA328PB-AU, FT231XS-R and AMS1117, with the PESD5V0X1UAB and 100UF/16V among its other parts. Its parts include 30 capacitors, 12 resistors, 9 diodes, 6 connectors and 4 ICs. It belongs with the AVR (ATmega, ATtiny) boards of this library.

Main components

5

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

104
QtyValueFootprintReferences
14100nCapacitor_SMD:C_0603_1608MetricC102, C103, C108, C113, C114, C117, C118, C119, C120, C121, C122, C123, C124, C206
610nCapacitor_SMD:C_0603_1608MetricC104, C105, C111, C112, C115, C116
4300Resistor_SMD:R_0603_1608MetricR1, R2, R104, R106
382306120029Diode_SMD:D_0603_1608MetricD101, D106, D107
3MountingHoleMountingHole:MountingHole_3.2mm_M3_Pad_ViaH1, H2, H4
2100nFCapacitor_SMD:C_0603_1608MetricC201, C205
21uFCapacitor_SMD:C_0603_1608MetricC109, C110
222pFCapacitor_SMD:C_0603_1608MetricC106, C107
2270RResistor_SMD:R_0603_1608MetricR204, R205
227RResistor_SMD:R_0603_1608MetricR202, R203
247pFCapacitor_SMD:C_0603_1608MetricC203, C204
2LED_5VLED_SMD:LED_0603_1608MetricD104, D105
2PESD5V0X1UABDiode_SMD:D_SOD-523ESD1, ESD2
2RJ45_ShieldedConnector_RJ:RJ45_Amphenol_RJHSE5380J1, J2
2SolderJumper_2_OpenJumper:SolderJumper-2_P1.3mm_Bridged_RoundedPad1.0x1.5mmJP105, JP106
2SolderJumper_2_OpenJumper:SolderJumper-2_P1.3mm_Open_RoundedPad1.0x1.5mmJP107, JP108
1100KResistor_SMD:R_0603_1608MetricR201
1100uF/16VCapacitor_SMD:CP_Elec_6.3x5.3C101
1100µF 50V 27mΩCapacitor_SMD:CP_Elec_10x10Cvin1
1120RResistor_SMD:R_0603_1608MetricR105
116MHzCrystal:Crystal_SMD_0603-2Pin_6.0x3.5mmY101
11KResistor_SMD:R_0603_1608MetricR102
11kResistor_SMD:R_0603_1608MetricRadd1
14.7µFCapacitor_SMD:C_1210_3225MetricC202
14K7Resistor_SMD:R_0603_1608MetricR101
1ADM2687EPackage_SO:SOIC-16W_7.5x12.8mm_P1.27mmU103
1AMS1117Package_TO_SOT_SMD:SOT-223-3_TabPin2U104
1ATmega328PB-AUPackage_QFP:TQFP-32_7x7mm_P0.8mmU101
1Analog_1_2Connector_PinHeader_1.00mm:PinHeader_2x03_P1.00mm_VerticalJ102
1Analog_3_4Connector_PinHeader_1.00mm:PinHeader_2x03_P1.00mm_VerticalJ103
1Conn_02x03_Counter_ClockwiseConnector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_VerticalJ101
1DMX_3V3TestPoint:TestPoint_Pad_D1.0mmTP13
1DMX_DETestPoint:TestPoint_Pad_D1.0mmTP8
1DMX_RETestPoint:TestPoint_Pad_D1.0mmTP7
1DMX_RXTestPoint:TestPoint_Pad_D1.0mmTP6
1DMX_TXTestPoint:TestPoint_Pad_D1.0mmTP9
1D_Schottky_SmallDiode_SMD:D_SOD-123D102
1Driver_Disable1Jumper:SolderJumper-2_P1.3mm_Open_RoundedPad1.0x1.5mmJP104
1Driver_Enable1Jumper:SolderJumper-2_P1.3mm_Open_RoundedPad1.0x1.5mmJP103
1ET1Jumper:SolderJumper-2_P1.3mm_Open_RoundedPad1.0x1.5mmJP1
1ET2Jumper:SolderJumper-2_P1.3mm_Open_RoundedPad1.0x1.5mmJP2
1FID_ATMFiducial:Fiducial_0.5mm_Mask1mmFID1
1FID_GULFiducial:Fiducial_0.5mm_Mask1mmFID2
1FID_TLVFiducial:Fiducial_0.5mm_Mask1mmFID3
1FT231XSPackage_SO:SSOP-20_3.9x8.7mm_P0.635mmU201
1Fuse DNPFuse:Fuse_1206_3216Metric_Pad1.42x1.75mm_HandSolderF1
1JP_FTDI_RXJumper:SolderJumper-2_P1.3mm_Bridged_RoundedPad1.0x1.5mmJP4
1JP_FTDI_TXJumper:SolderJumper-2_P1.3mm_Bridged_RoundedPad1.0x1.5mmJP3
1LED_3VLED_SMD:LED_0603_1608MetricD103
1LOGOlogo:FireFly_bigG***
1LOGOlogo:radiona-16mmG***
1LOGOlogo:novenaG***
1MSTBA2Connector_Phoenix_MSTB:PhoenixContact_MSTBA_2,5_2-G-5,08_1x02_P5.08mm_HorizontalJc1
1MSTBA3Connector_Phoenix_MSTB:PhoenixContact_MSTBA_2,5_3-G-5,08_1x03_P5.08mm_HorizontalJadd1
1MountingHoleMountingHole:MountingHole_3.2mm_M3H3
1RESETButton_Switch_SMD:SW_SPST_PTS645SW102
1RXLED_SMD:LED_0603_1608MetricD201
1Receiver_Disable1Jumper:SolderJumper-2_P1.3mm_Open_RoundedPad1.0x1.5mmJP101
1Receiver_Enable1Jumper:SolderJumper-2_P1.3mm_Open_RoundedPad1.0x1.5mmJP102
1SW_DIP_x08Package_DIP:DIP-16_W8.89mm_SMDSocket_LongPadsSW101
1TP_3V3TestPoint:TestPoint_Pad_D1.0mmTP5
1TP_ATestPoint:TestPoint_Pad_D1.0mmTP104
1TP_GND1TestPoint:TestPoint_Pad_D1.0mmTP105
1TP_VinTestPoint:TestPoint_Pad_D1.0mmTP4
1TXLED_SMD:LED_0603_1608MetricD202
1USB_BConnector_USB:USB_B_OST_USB-B1HSxx_HorizontalJ3

The 102 most common of 104 parts.

Questions

How big is the Firefly PCB?

It measures 85 × 57.5 mm and has 4 copper layers, 1.6 mm thick.

What parts does the Firefly use?

104 parts, built around the ATMEGA328PB-AU, FT231XS-R, AMS1117 and PESD5V0X1UAB. 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 Firefly 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/Firefly.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the Firefly 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 layers43 × 24 mmDisco, the printed circuit board in 3D

    Disco

    jdthorpe/kicad-module-parser

    A PegJS parser for Kicad Modules

    21 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 layers109.8 × 109.9 mmLightBoxNano, the printed circuit board in 3D

    LightBoxNano

    TimGremalm/LightBoxNano

    a generic PCB for controlling LED's both LED strip and WS2812

    76 parts6GPL-3.0
  • 2 layers153 × 95.8 mmSpekky Matrix, the printed circuit board in 3D

    Spekky Matrix

    jc-SpaceXp/Spekky-Matrix

    Spectrum analyser displayed on a LED matrix board connected to a STM32 device

    390 parts1MIT
  • 2 layers88.9 × 106.7 mmDataLogger, the printed circuit board in 3D

    DataLogger

    ataweg/DataLogger

    DataLogger using "Arduino UNO" board and Greiman SdFat library

    62 partsMIT
  • 4 layers50.5 × 66 mmArduino++, the printed circuit board in 3D

    Arduino++

    Aghosh993/EE_HWDEV_KiCAD

    Repository containing all KiCAD schematic, layout and project files for PCB schematic capture and layout projects

    83 parts1GPL-3.0
  • 2 layers100 × 88 mmArduinoDCC++, the printed circuit board in 3D

    ArduinoDCC++

    danielvilas/DigitalTrains

    Digital Trains

    94 partsMIT
  • 2 layers110 × 121 mmPanel, the printed circuit board in 3D

    Panel

    Telekomak/FiresportTimer

    An open source firesport timer designed for "fire attack" discipline

    116 parts
  • 2 layers70 × 79 mmIntegrated circuits, the printed circuit board in 3D

    Integrated circuits

    LilyTronics/lily_kicad_lib

    KiCad library by LilyTronics

    37 parts2MIT
  • 2 layers68 × 55 mmAurdino oled. sd card, the printed circuit board in 3D

    Aurdino oled. sd card

    ayodhyaphanidurgaprasad-source/PCB-Projects

    Designed a 2-layer PCB that converts USB to EtherCAT for industrial network communication. Worked on the complete design flow — schematic design, component selection, PCB layout, and routing in KiCad.

    66 parts