How to Generate BOM and Centroid Files from KiCad in Linux
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.
Note | 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. |
Figure 2. Plugin copied
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:
Figure 3. Generate BOM menu item
Now the Bill of Material dialog appears.
Figure 4. Generate BOM menu item
Click the "+" button, and browse to the plugin folder, select bom2jlc.py then click Open.
Figure 5. Browse and find bom2jlc.py
Leave the nickname unchanged, click OK:
Figure 6. Plugin nickname
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"
Figure 7. Plugin command line
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
- etc.
Figure 8. JLC and LCSC fields have been added for R25
Figure 9. Edit Symbols Fields menu item
Figure 10. Symbols Fields table
Export the files
Generate BOM
Open the schematic in EEschema, select Tools → Generate Bill of Materials.
Figure 11. Generate BOM menu item
Click the Generate button to produce the BOM.
Figure 12. Generate BOM
Generate CPL
Open the board in the PCB editor, select Tools → External Plugins → Generate JLCSMT Placement Files.
Figure 13. Generate CPL
Figure 14. CPL Generated
All generated files can be found in the project folder, as shown below.
Figure 15. The generated BOM and CPL files
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.
Figure 16. Preview in the ordering system
Note | 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. |
Last updated on July 25, 2023