sk1libman- Library Management

Stop press: Color me confused.

This page was created years before January 2017. But revised in January 2017. Since the introduction of the .pretty folders (for schematic symbols and pcb footprints) I have been struggling. What follows may or may not help you get to a good understanding! Though the page started long ago, I have updated it, to try to deal with the things that are confusing me. (If you are "an expert" and see serious flaws, and would be willing to help, maybe we could talk a bit, first by email, then, if easier and you are feeling very kind, Skype?)

But I DO still like using KiCad….

The "problems" are in my understanding of how to operate it, not in the underlying product, I am sure.

(There is overlap between this page and my page about where to put things. But, the issues are so important that it might pay you to read both… and make sure that…

*your understanding
*what that page says
*what this page says

… are all in sync!)

One of my few criticisms of KiCad… and it may just reveal a lack of understanding on my part, as opposed to a flaw in the product, is the fact that "library" can mean one of two things…

*A collection of schematic symbol definitions, held in a .lib file
*A collection of footprint (or "module") definitions, once held in .mod files, now held in .kicad_mod files.

(In the case of the latter, there is more to the change than the name! Covered elsewhere.)

If that ambiguity is KiCad's "great flaw", I think it is pretty good software! (I am even coming around to the view that the "inclusive" term may be a good idea… but maybe calling the schematic symbol library something other than ".lib" (".cpt"?) would have precluded the newbie trap that I fell into: Thinking that "libraries" and "the .lib files" were the same thing. ("Libraries" are the .lib files plus the .kicad_mod files in XX.pretty folders] (previously simply in .mod files.))

By the way: The old ".cmp" files are no longer part of the system.

Be careful over the word "library", and all will be well.

KiCad offers the user great power to fine tune, on a project- by- project level, which is excellent… but you do have to work a bit to master "the system". Well, I had to, anyway.

Here's the thing….

You can have multiple .lib and XX.pretty files/ folders on your computer. Each can have multiple schematic symbols and footprints in them, respectively. (Although not every .lib file or XX.pretty folder will necessarily have more than one schematic symbol or footprint in it. (Footprints are held, one to a file, in .kicad_mod files.)

By the way: What if you are using, say, libraries "MyLib1.lib" and "MyLib2.lib", and there is a "MyResistor" in each of them, and they aren't the same? (The system CAN cope… i'm just fuzzy on what it does about the situation, which "MyResistor" will be used.)

Hold on to your hat… This is both a little arcane and a lot cool…

I think that if you try to place a MyResistor on your schematic, you will get the MyResistor which "comes first" in that project's list of "libraries I am using in this project". (We'll see how to build those lists elsewhere. For now, just try to take on board the consequences… and power!… of that mechanism.)

Note this: Not every project will "know" about every library!

A number of libraries come with KiCad. I would advise you to leave these in the state they came in. It is not impossible to set up your own .lib files and XX.pretty folders. You should master the art of doing that, anyway. It is easy to "clone" schematic symbols and footprints. Again, you probably should master that art. Clone and then tweak. With this approach, if you mess up, you still have the original, still as it was when "your elders and betters" gave it to you.

Things to get on top of….

The differences between, meaning of "schematic symbol" and "footprint". (I believe "module" is just another way of saying "footprint", by the way. A deprecated way.)

How KiCad "knows" which .lib and which .mod files are to be "seen" by a given project.

How to create a new .lib or .mod file, the two sorts of library.

Where to keep your libraries… I've done a separate note on that, by the way.

Good news/ bad news….

Not coincidentally, there is an overlap between why it is hard to [ get started with databases] and why it is hard to get started with using your own schematic symbol and footprints in KiCad.

There are "database-like" elements "under the hood" in the workings of KiCad.

In databases and KiCad, there are things to "set up". And you have to accomplish that before you really know what it is you are trying to set up! You have to service your car before you've even learnt to drive it! The good news is that once you have it set up, just using it is relatively straightforward! PCB CAD (and databases) aren't like wordprocessors and spreadsheets, where you can "crawl", first, before you start to "walk" and "run"…. but that makes them more "fun"! (?)

Be of stout heart! It is worth the struggle.

I have written about certain folders I think you should set up in a page I've made other links to above, my "sk1fileswhere" page.

With those folders in place, you've made a great start. Creating them is a "do once" chore.

To start a new project, you only have to open the Kicad central project manager, and click (on the menu) "File | New", drill into Prjts, set up a new folder (with the tools built into the "SaveAs" you are using) and finish the save, preferably with the same name as you used for the project's folder, or that name with something like "v0-0" added on, to indicate the current version.

Starting a new .lib file is a little more tedious, but it isn't something you have to do often. For this task, I do have a "modern" (2/17, KiCad 4-0-4) explanation of how to set up a new schematic symbols (component) library. And I've been "chopping out" the "deadwood" of the old explanation.

There is no absolute 1:1 connection between creating schematic symbols and footprints. You may want to do one. Or the other. Or both. Any of those are valid. But, while there's no 1:1 connection, the two topics do have certain similarites, of course.

We've just dealt with staring new schematic symbol libraries.

Starting a new footprint library is also slightly tedious, but, like setting up schematic symbol libraries, it isn't something you have to do often. I have explained how to start a .kicad_mod file in my "making footprints" guide.

I do have a "modern" (2/17, KiCad 4-0-4) explanation of how to set up a new footprints (modules) library. And I've been "chopping out" the "deadwood" of the old explanation.

STILL TRUE, 2/17: In the case of both .lib and .kicad_mod libraries, it is easy to clone things out, so don't be shy. Give yourself a "jumbled", "experimental" Tmp.lib file and a Tmp.pretty folder for .kicad_mod files, and use them while you gain some experience. ("Wisdom comes with experience… and experience is what you get when you lack wisdom.") Just be careful about using things from those libraries in "finished" or "important" work… who knows what will be in a "Tmp" ("temporary") file six months from now? (Although no software I am aware of enforces the "rule", it is my working practice never to use "Tmp" as the start of a file (or folder) name if I am going to put anything "important" in it. Thus, if I ever see something called "Tmp…", and can't (now) recall what it is, I know I can just delete it, without having to look inside it.)

Going back to "Don't use schematic symbol from tmp.lib…" If you've done something you may want to revisit later, it shouldn't depend on a definition that is inside a tmp.lib schematic symbol collection, should it?

If you realize "too late"…

Make a copy of the schematic symbol in a non "tmp" .lib file. Revise the schematic, replacing the schematic symbol with the "new" schematic symbol. This will be a little fiddly, as you will have to re-run CvPcb, too… but it is worth the hassle.

STILL TRUE, 2/17: Be careful about names you establish for individual schematic symbols and footprints. I believe KiCad has a clever "overlay" mechanism in place… if there are two schematic symbols called "SPST" in your .lib files, for instance, it uses the first one it "sees"… and the order it uses when "looking" for things is, I determined within the project's .lib usage settings. (A similar situation pertains to footprints and .mod files.) (This feature of KiCad is powerful… and thus needs to be used with care and attention… but again: The "hassle" (minimal in this case) is well worth it.) (Or I may have mis-understood the system, at least in respect of footprints. It may be that when you use CvPcb to map footprints to schematic symbols, you will know which "SPST" footprint definition you are chosing. You will be in clear command of where things are drawn from.)

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License