Kicad library paradigms

The topic of how Kicad (and indeed, any other EDA package) libraries should be organized comes up regularly on forums such as the Kicad User forum. There are many opinions, and user preference seems to be mostly based on experience with previously-used systems. The preference also seems to be split down a “professional” versus “hobbyist” point-of-view. This post will attempt to present the two prevailing preferences for Kicad library organization. After that, I will explain the basic system I have created for my own use.

Kicad Libraries, an overview

As of the current stable version of Kicad, 4.0.6, Kicad’s libraries are divided into three separate types:

Schematic symbol libraries (which have a .sch file extension) hold all of the symbols the designer can put on a schematic using EESchema.

Footprint libraries (which have a .pretty file extension, and are actually directories which contain the footprints, which have a .kicad_mod file extension) hold the footprints which are used with pcbnew to define how a real component is attached to the board and connected to other parts.

3D model libraries aren’t really libraries, rather, they are just collections of 3D models in VRML format, and for nightly builds also STEP.

These three library types are loosely connected. Each schematic symbol has a “Footprint” field, which can be populated or not. A part might come in more than one footprint, so a user might wish to not have the library symbol include a default. As for footprints, it should be obvious that common footprints are used by thousands of devices, so having a generic SOIC-8 footprint is more useful than having a TL072-SOIC-8 footprint. Finally, all footprints have a 3D Model field, which calls out such.

Users can decide how to organize their libraries. One might reasonable decide to have exactly one schematic library and one footprint library, and those libraries include only parts that have been vetted and put onto an approved parts list. Others might prefer to have a “digital” library, an “analog” library, a “passives” library and so forth for schematic symbols, and an “IC” library, a “passives” library, a “connectors” library and so forth for PCB footprints. Kicad is flexible, indeed agnostic, in this respect.

Paradigms for Kicad libraries

Since schematic symbols in libraries are not required to have a populated footprint field, Kicad allows for essentially two separate library paradigms, which I will call the “CvPCB flow” and the “atomic library” concept.

CvPCB Flow

This is named for the Kicad tool CvPCB, which is used to map footprints to schematic symbols prior to generating a netlist for pcbnew.

Many users prefer to draw a schematic without concern for the actual components to be used on the board. For example, a user designing an op-amp circuit may wish to place a generic op-amp symbol on the sheet, and then choose generic resistor and capacitor symbols to complete the design. Before layout, obviously footprints must be chosen, so the CvPCB tool is run to do this association. The user may select DIP-8 for the op-amp and standard ¼-watt through-hole parts for the resistors and a standard through-hole ceramic part for the capacitors. (Part values are uninteresting for the layout, so it doesn’t much matter whether the op-amp is a TL072 or an NE5532.) After associating all symbols with a footprint, CvPCB back-annotates the selections to the schematic. The footprint field in each symbol is populated with what was chosen. Then a netlist is generated and pcbnew is launched. The netlist is imported, and the layout starts with all of the chosen footprints.

This flow has advantages. One is that the designer may not know exactly what op-amp is being used, or whether through-hole or surface-mount passives are going to be used. This flexibility is prized by hobbyists.

This flow has disadvantages. The main one, in my view, is that it is utterly disconnected from any reasonable way of generating a bill of materials. Matching the resistors and op-amps put on the schematic to something one can actually buy requires generating a generic BOM from Kicad and then manually editing it to match parts from various vendors. And this manual parts matching occurs for every design, every time. For the hobbyist doing one board design a year, this inefficiency is probably acceptable.

Atomic PARTS (or components) Libraries

“Atomic parts” is a term used to indicate that the symbol in the schematic library is more than just something generic without footprint or part-number information. It means that the symbol and the footprint (and the 3D model) are combined into one inseparable unit. All symbols have a footprint pre-selected. Ideally, each symbol includes a custom “Part Number” field. This part number field is critical, as it is the hook into a parts list database. This database is not part of Kicad, and can be as simple or complex as the user requires.

A generic “dual op-amp” symbol is no longer allowed. Instead, the user must create, for example, an OPA1652AID symbol with the SOIC-8 footprint set. A USB Type B jack is similar, in that it will explicitly call out the proper footprint. Rather than generic “resistor,” the library will contain RES_0805_1%, indicating that the part is the 0805 size and has a tolerance of 1%. Value of the resistor is given in the symbol’s VALUE field, as one might expect.

The disadvantage to this paradigm is that parts have to be fully defined before the design can begin. The professional user will argue, though, that this requirement is really an advantage. When an OPA1652AID is placed on the schematic, pcbnew already “knows” that it uses the SOIC-8 package. The BOM generated by EESchema also has the correct part number; there is no need to look up parts and create the BOM by hand. The hard work of that parts lookup and vetting is done once and is then used for each design. It is tedious work that is not repeated.

In a following post, I will explain the simple atomic parts library system I’ve created for my own use.

Leave a Reply

Your email address will not be published. Required fields are marked *