One common complaint we hear from most new KiCAD users relates to schematic and footprint libraries. The trick is to use just one schematic symbol and footprint library each with your project. This way any changes to the default schematic libraries will not affect your project and it will be easy to share your project with others without breaking it. I’ve spent some time refining this technique and I’ll walk you through the process in this article.

We have covered KiCAD (as well as other) Electronic Design Automation (EDA) tools several times in the past. [Brian Benchoff] did a whole series on building a project from start to finish using all the various EDA packages he could lay his hands on. No CAD or EDA software is perfect, and a user has to learn to get to grips with the idiosyncrasies of whichever program they decide to use. This usually leads to a lot of cussing and hair pulling during the initial stages when one can’t figure out “How the hell do I do that?”, especially from new converts who are used to doing things differently.

Read on to learn the best practices to use when using KiCAD and its library management.

Project Management

KiCAD keeps schematic symbols and component footprints in separate libraries and you need to link a symbol to a footprint using one of several different methods. This puts off a lot of folks, but it works quite well once you get used to it.

In the old days before computers, most designers would first quickly draw out a schematic, then create a “bill of materials” where they flesh out the specifications of the components to be used. This would then help them to choose the component footprints, leading to the board layout phase. KiCAD tries to follow this work-flow. Here’s a typical folder structure I use to organize a KiCAD project, having refined this technique over many years of working with the software.

doodad ↳3d_models // .STEP and .WRL model files for all footprints ↳datasheets // data sheets for components used ↳gerber // final production files ↳images // SVG images and 3D board renders ↳lib_sch // schematic symbols ↳lib_fp.pretty // footprints ↳pdf // schematics, board layouts, dimension drawings

Managing Schematic Libraries

When you draw a schematic using symbols from the built-in libraries bundled with KiCAD, EESCHEMA creates a local backup library — doodad-cache.lib. Once you’re done drawing your schematic, copy this file to the ↳lib_sch folder and rename it to doodad.lib.

Next, go to ↳PREFERENCES↳Component Libraries , select “CURRENT SEARCH PATH LIST” to point to your local project folder ~/doodad/, click the ADD button at the TOP of the pop up window (NOT the Add button in the middle of the pop up), and finally select doodad.lib. It gets added below the currently selected library in the list.

KiCAD reads these libraries in sequential order, so you need to select doodad.lib and bring it to the top of the list using the UP button. If there’s a symbol with the same name in different libraries, then the first instance of it gets used. At this point, you can either remove all the other listed libraries, or just ignore them as long as you ensure that every symbol you use gets added to doodad.lib and get’s called only from that file.

Your project now uses just one schematic symbol library — ~/doodad/lib_sch/doodad.lib — and any changes to the default schematic libraries will not affect your project. Moreover, using the above defined folder structure, it’s easy to share your project on GitHub. When your project gets cloned or downloaded, this ensures there are no library conflicts.

All of the above may change when KiCAD implements s-expression formats in EESCHEMA and schematic libraries (already implemented in PCBnew), so we’ll revisit this at that time.

Assigning Footprints to Symbols

There’s several ways of doing this, but essentially, you select a schematic symbol, and assign it a footprint from one of the default libraries. Ever since KiCAD moved footprint libraries to GitHub, this has been a cause of heartburn for many. For one, all libraries are hosted online, and KiCAD needs to look them up every time you fire it up. For those who don’t change this behaviour, it slows down the program during startup, if you’re not connected to the web. Online libraries are a good idea because footprints stay updated, but it is a sure fire way to break your designs should one of the footprints used in your design change. This won’t show up for you immediately, because you will have to explicitly re-read the net-list and get KiCAD to replace changed footprints. But for someone else who clones your design, and their KiCAD version loads up the updated footprint, it WILL break things.

The solution is to clone all the KiCAD libraries to a local location on your computer, and then point KiCAD to this location. But when you do this, it negates the advantage of having access to updated libraries. I don’t think there’s an ideal way to make it work, but here’s what works for me.

I clone the GitHub libraries to my local computer, and keep them updated by regular pulls. This helps me use existing footprints or modify them to suit my requirements. But my project does not use any of those cloned libraries directly. Instead, I generate a project specific footprint library that contains all of the footprints (~/doodad/lib_fp.pretty) used in the project. Once again, this ensures that when the project gets cloned, all of the right footprints are already available without depending on external source libraries.

How to Make KiCAD Footprints Local and Project-Unique

Start by cloning (from GitHub) the KiCAD footprint repository to your computer. This is best done using the ‘Footprint Libraries Wizard‘ from within PCBnew. In my case, I have cloned it to ~/kicad_sources/library-repos. In KiCAD’s PCBnew, select ↳PREFERENCES ↳CONFIGURE PATHS and edit KISYSMOD to point to the local footprint library path (~/kicad_sources/library-repos).

In some cases, additional steps may be required to make things work. Select ↳PREFERENCES ↳FOOTPRINT LIBRARIES MANAGER and determine the location of the “fp-lib-table” file used by PCBnew. This is a text file that tells PCBnew where to look for footprint libraries – on Github, local path etc. Open this file in a text editor, and check if it uses KISYSMOD as the path. If not, do a search and replace for all instances of current path and replace it with KISYSMOD.

Now, you can edit each schematic symbol, and add a footprint to it — either from within EESCHEMA, or using the stand alone Cvpcb module. Once all footprints have been assigned, make sure you re-generate the netlist before moving on to PCBnew.

You can now start PCBnew and read the netlist, which dumps all the footprints in a pile on the canvas. Select the Mode : footprint icon, then context-click on any ONE footprint, select ↳Global Spread and Place ↳Spread out all footprints.

This spreads out all the footprints making it easier to select and move them around. Once you’re done with your board layout, and all of your footprints are locked in, select FILE ↳Archive Footprints↳Create Library and Archive Footprints and provide the path/name to the .pretty folder in your project (~/doodad/lib_fp.pretty). This copies all the footprints used in your layout to the target folder.

Then, Preferences↳Footprint Libraries Wizard↳Files on my computer↳(navigate to ~/doodad/lib_fp.pretty) and make sure you select “To the Current Project Only” before hitting Finish. At this point, you have used footprints from KiCAD’s global libraries and applied them to schematic symbols, made a netlist, imported netlist in PCBnew, placed the footprints and routed the board, made an archive of all the footprints used, and configured PCBnew to use that archive library.

Next, return back to EESCHEMA, and edit the footprint association of each symbol to point to the new lib_fp.pretty folder instead of the local GitHub repository on your computer. The easiest way to do this is to open the .SCH file in a text editor and do a search/replace. In our present example, we will replace instances such as “Capacitors_ThroughHole” or “Resistors_ThroughHole” or “LEDs” with our local project library folder “lib_fp”

Open the schematic one last time, save a fresh netlist, open PCBnew, read this netlist, but this time select the CHANGE option under Exchange Footprint. Your board layout will now be using footprints saved in your lib_fp.pretty folder, and changes to the KiCAD global libraries will not affect the layout.

Wrapup

This may sound a bit convoluted in the beginning, but over time it becomes quite easy, and you can eliminate some steps as you get better. For example, I already have my own library for most of the common parts that I use, and copy these footprints before starting off on a new project. Over time, as you get better at it, you will start building your own schematic symbols and footprints from component data sheets instead of using external versions. Like I said at the beginning, it’s not perfect, and for me this process works very well. If you have comments or suggestions on making this better, chime in and let us know.