Automate Fabpack Generation With Kibot
The Kibot automation package is a comprehensive tool designed to streamline various aspects of the electronic design process, focusing on improving efficiency and reducing errors. Here are a few of its key functionalities:
- Bill of Materials (BOM) Generation:
- Kibot automates the creation and management of BOMs by extracting component information directly from your Kicad design. This ensures accuracy and consistency, minimizing manual data entry errors. It also integrates with supply chain and component management systems, providing real-time information on component availability and pricing.
- Fabrication Package (Fabpack) Creation:
- Kibot simplifies the generation of fabrication packages, which include all necessary files and documentation required by manufacturers to produce a printed circuit board (PCB). This automation ensures that all files are correctly formatted and consistently named, reducing the likelihood of production delays or errors.
- Documentation Generation:
- Documentation is crucial for any electronic design project, and Kibot automates the creation of comprehensive project documentation. This includes design schematics, assembly instructions, and test procedures. Automated documentation ensures that all necessary details are included and up-to-date, facilitating smoother communication between design, manufacturing, and assembly teams.
- Design Rule Checking (DRC) and Validation:
- Kibot can perform automated design rule checks and validations, ensuring that designs meet specific manufacturing requirements and industry standards. Kibot can also gate the release of fabrication documents on a passing DRC / ERC check. This helps catch potential issues early in the design phase, reducing costly revisions and rework.
Installation
Installing KiBot is a breeze on Ubuntu and Debian based systems. You can download the latest release from the official Releases page, and then run:
sudo apt install ./kibot*_all.deb
with the resulting file.
Configuration
The most powerful piece of KiBot is configuring it to produce the outputs you require. This is also, unfortunately, the trickiest piece. Since it is a conglomeration of a large number of external tools, there are a correspondingly large number of options.
However, if you want to start leveraging KiBot to automate your fabpack generation immediately, we’ve done the work of creating a ready-made YAML file to use in your own design libraries. You can find the full version of this configuration file on our GitHub page, if you’d like to use it for yourself.
Astute readers of the blog will note that this is the same folder structure we wrote about in “Organizing Your Kicad Projects”. In fact, it goes a step further by automatically generating the contents of about half of those folders. It’s a considerable time savings!
Here’s what the script does, in excruciating detail - so you know exactly what it’s doing, and can modify it to suit your needs!
Note: We developed this with Kibot v1.6.3; breaking changes to the API are anticipated in the upcoming v1.7.0 release!
Global Configurations
This section manages some versioning metadata for KiBot, as well as some configurations for how time and date stamps are formatted in output files from KiBot.
This also where preflight checks are configured. In this case, run_erc
and run_drc
are both set to false
; this means that a user must manually verify passing ERC and DRC checks. ignore_unconnected
means that KiBot will complain about a hanging net that is missing a NoConnect symbol.
kibot:
version: 1
global:
date_format: "%Y%m%d"
time_format: "%H%M"
preflight:
run_erc: false
update_xml: false
run_drc: false
check_zone_fills: true
ignore_unconnected: false
Outputs
This section defines various output files to be generated, including their type, directory, and specific options.
PDF Prints
Our KiBot configs print a few PDF files for easy design archiving and sharing. All of these end up in the pdf/
direcctory.
The first document we generate is a nice straightforward PDF print of the schematic:
- name: 'pdf_sch'
comment: 'Print schematic (PDF)'
type: 'pdf_sch_print'
dir: 'pdf/'
options:
output: '%p_schematic.pdf'
Note that %p
here is the top level name of your KiCad project. This should be the name of your project’s containing folder, and your .kicad_pro
file.
Our second set of PDFs is a front and backside print of all footprints:
- PDF PCB Prints (Front and Back): Exports PDFs of the front and back gerber layers for footprint verification.
- name: 'pdf_pcb_front'
comment: "Print frontside footprint verification"
type: pdf_pcb_print
dir: pdf/
options:
output_name: '%p_PCB_Top.pdf'
layers:
- layer: F.Cu
- layer: F.SilkS
- layer: Edge.Cuts
- name: 'pdf_pcb_back'
comment: "Print backside footprint verification"
type: pdf_pcb_print
dir: pdf/
options:
output_name: '%p_PCB_Bottom.pdf'
layers:
- layer: B.Cu
- layer: B.SilkS
- layer: Edge.Cuts
This is a trick we learned from the VoltLog YouTube channel by way of a blog post from Nash Reilly. Using KiCad’s “1:1” print setting ensures that you have a printout of everything on the PDF to match real life trace and pad scale. By doing this, you can order a set of components from Digikey or Mouser, then use this life size printout to ensure that your footprints match the components you are designing with. This is a huge risk reduction step that can save you tons of time and money when designing with brand new parts!
Fab Documentation
A folder of fab documentation makes it easy to organize all the information needed to get external partners like board houses and assembly shops to fabricate and assemble your design.
Assembly Drawings
The first command in this configuration generates an assembly drawing of your board. This helps correlate component values and positions with reference designators on the schematic. It serves as another double check to pick-and-place files and the bill of materials.
- name: 'pdf_asm_drawing_back'
comment: "Print Back Assembly Drawing"
type: pdf_pcb_print
dir: fab/draw
options:
output_name: '%p_assembly_Bottom.pdf'
layers:
- layer: B.Fab
- layer: B.CrtYd
- layer: Edge.Cuts
- layer: User.Drawings
- layer: User.Comments
- name: 'pdf_asm_drawing_front'
comment: "Print Front Assembly Drawing"
type: pdf_pcb_print
dir: fab/draw
options:
output_name: '%p_assembly_Front.pdf'
layers:
- layer: F.Fab
- layer: F.CrtYd
- layer: Edge.Cuts
- layer: User.Drawings
- layer: User.Comments
Gerbers
Gerbers are the de facto 2D format that board houses use to program board fab machines. Our configuration uses fairly standard Protel extensions with tented vias.
- Gerbers: Generates Gerber files for PCB fabrication.
- name: 'gerbers'
comment: "Generate gerbers"
type: gerber
dir: fab/pcb/gerber
options:
exclude_edge_layer: true
exclude_pads_from_silkscreen: false
use_aux_axis_as_origin: false
plot_sheet_reference: false
plot_footprint_refs: true
plot_footprint_values: true
force_plot_invisible_refs_vals: false
tent_vias: true
line_width: 0.1
subtract_mask_from_silk: false
use_protel_extensions: false
gerber_precision: 4.6
create_gerber_job_file: true
use_gerber_x2_attributes: true
use_gerber_net_attributes: true
layers:
- 'copper'
- 'technical'
- layer: Edge.Cuts
suffix: Edge_Cuts
- Drill Files: Generates drill files needed for PCB manufacturing.
- name: 'drill'
comment: "Generate drill files"
type: gerb_drill
dir: fab/pcb/gerber
- GenCAD File: Exports a GenCAD 1.4 file used by some vendors’ pick-and-place (PNP) lines.
- name: 'gencad'
comment: "Exports GenCAD 1.4 file"
type: gencad
dir: fab/asm/gencad
options:
output: '%p_gencad.%x'
- Pick-and-Place File: Generates a file with component positions for pick-and-place machines.
- name: 'pnp'
comment: "Generates pick'n'place cmpt positions"
type: position
dir: fab/asm/pnp
options:
output: '%i_%p.csv'
- Individual BOM: Exports an individual bill of materials where each component is listed on a separate line.
- name: 'bom_ind'
comment: "Generate Individual BOM (one cmpt per line)"
type: bom
dir: fab/asm/bom
options:
output: 'bom_indiv_%p.csv'
group_fields: ['Reference']
columns:
- field: 'References'
name: 'RefDes'
- field: 'Value'
name: 'Value'
- field: 'Pop'
name: 'Pop'
- field: 'Mfg'
name: 'Mfg'
- field: 'MfgPN'
name: 'MfgPN'
- field: 'Dist'
name: 'Dist'
- field: 'DistPN'
name: 'DistPN'
- field: 'Footprint'
name: 'Footprint'
csv:
hide_pcb_info: true
hide_stats_info: true
- Collated BOM: Exports a collated bill of materials where components are grouped by manufacturer part number.
- name: 'bom_col'
comment: "Generate Collated BOM (grouped by MfgPN)"
type: bom
dir: fab/asm/bom
options:
output: 'bom_collate_%p.csv'
fit_field: 'Pop'
columns: ['References', 'Quantity Per PCB', 'Value', 'Mfg', 'MfgPN', 'Dist', 'DistPN', 'Datasheet']
csv:
hide_pcb_info: true
hide_stats_info: true
- Fabpack for Turnkey PCB Assembly: Zips files needed for quoting turnkey PCB assembly.
- name: 'zip_asm'
dir: releases/staging/
comment: "Creates fab pack - turnkey PCB mfg"
type: compress
options:
output: 'fabpack_%p_turnkey_%D_%T.zip'
files:
- from_output: bom_col
- from_output: bom_ind
- from_output: pnp
- from_output: gencad
- from_output: gerbers
- from_output: drill
- from_output: pdf_asm_drawing_front
- from_output: pdf_asm_drawing_back
- Fabpack for Bare PCB Fabrication: Zips files needed for quoting bare PCB fabrication.
- name: 'zip_pcb'
dir: releases/staging/
comment: "Creates fab pack - bare board only"
type: compress
options:
output: 'fabpack_%p_bareboard_%D_%T.zip'
files:
- from_output: gerbers
- from_output: drill
More Customizations
If you’d like to go further, here are some other options for using Kibot:
- Automate this with a CI pipeline.: Kibot is very capable of running as an automated task. GitHub Actions is a popular choice for this, and is supported in the official KiBot documentation. GitLab Runners or Jenkins jobs can also support running Kibot. Stephane Schueller even went as far as automating every commit of his KiCad files using GitHub Actions. Wow!
- Add more third party tools.: Kibot has extensibility and compatibility with many, many useful third party KiCad utilities. It is possible to have KiBot generate 3D renders, create Interactive HTML BOMs, and populate BOM variants.
- Create Board Variants: With the help of the KiBOM plugin, it is possible to use KiBot to create Altium-style board variants, which allows for selective population of board components. This makes it relatively straightforward to produce multiple circuit board variants from a single set of CAD data.
Kibot provides a robust suite of automation tools that enhance the electronic design workflow, from initial design through to manufacturing and documentation. By automating these critical tasks, Kibot helps engineers and designers save time, reduce errors, and improve the overall quality and reliability of their projects.