How to Generate BOM and Centroid Files from KiCad in Linux
This article will show how to generate BOM (Bill of Materials) and CPL (Component Placement List) files for JLCPCB SMT and hand soldering service in KiCad in Linux.
The method converted in this article utilizes a plugin called KiJLC made by Fully Automated.
The demo project kit-dev-coldfire-xilinx_5213 is used in this tutorial, the whole modified project can be found in this github repository.
This tutorial has been tested in KiCad 5.1.10 in Ubuntu 18.04.
Install the plugin
First, you need to download and install the plugin in your system. The plugin will load the next time KiCad is opened.
Install it manually
1. Download KiJLC from github.
Figure 1. Download KiJLC
2. Unzip and rename the folder
Find the downloaded file and unzip it, change the folder name from KiJLC-main to KiJLC.
3. Copy to the right place
Now copy KiJLC to the folder as shown in the following screenshot. If the target folder/path does not exist, you can just create it manually.
| Files and folders starting with a dot (.) are hidden from normal view. In file manager of Gnome, you can just press CTRL+H to show/hide them. If CTRL+H doesn’t work, just google or read the file manager’s manual.
Install by git cloning
If path ~/.kicad/scripting/plugins does not exist, in the terminal, execute the following command to create it:
mkdir -p ~/.kicad/scripting/plugins
Then cd into the folder and clone the plugin:
cd ~/.kicad/scripting/plugins git clone https://github.com/JLCPCB/KiJLC
Add a BOM plugin for the Schematic Editor
This is the last step of the installation.
First, open the Schematic Layout Editor. From the menu bar, click Tool → Generate Bill of Materials:
Now the Bill of Material dialog appears.
Click the "+" button, and browse to the plugin folder, select bom2jlc.py then click Open.
Leave the nickname unchanged, click OK:
Change command line to:
python3 "/home/atommann/.kicad/scripting/plugins/KiJLC/bom2jlc.py" "%I" "%O"
Or the full path (you can know the full path by executing command which python3 in the terminal):
/usr/bin/python3 "/home/atommann/.kicad/scripting/plugins/KiJLC/bom2jlc.py" "%I" "%O"
Add JLC and LCSC BOM fields
The KiJLC plugin expects two fields to be present: "JLC" which should contain the JLCSMT footprint specifier and "LCSC" which should contain the part number from JLCPCB SMT Parts Library.
"LCSC" part number is used for precise matching in the ordering system, it’s optional but it’s best to have it in the BOM.
Right now KiCad footprint specifiers are not being converted to JLC ones, but this could be implemented in the future.
You can add new fields for a component in different ways:
Double click on a component or just hover the cursor on a component then press E key to invoke the Symbol Properties dialog and add the fields, see Figure 8.
On the menu bar, click Tool → Edit Symbol Fields, in this way you can edit fields in bulk mode, see Figure 9 and 10.
With the help of other KiCad plugins, like KiField
Figure 9. Edit Symbols Fields menu item
Export the files
Open the schematic in EEschema, select Tools → Generate Bill of Materials.
Click the Generate button to produce the BOM.
Open the board in the PCB editor, select Tools → External Plugins → Generate JLCSMT Placement Files.
All generated files can be found in the project folder, as shown below.
Now these files can be uploaded to JLCPCB.com for manufacturing. Below is the preview of a corner of the board in the ordering system.
|To place the SMT/hand soldering orders, you also need to produce Gerber files, for how to do it, please refer to How to generate Gerber and Drill files in KiCad 5.|