Help with library organization

Capacitors have different values, different footprints, part numbers, polarization, etc.

What I’m struggling with is I would like to associate some of these for specific parts. For example, there is a Panasonic cap: 12TPG33M which has a specific footprint, symbol, etc.

If I just use a generic polarized cap symbol and then for every instance fill out the footprint, part number, etc. it will become tedious.

So, should I create one symbol for each value I use so that this is all together? Or?

There are many ways I can go and would like to hear different ways people have done it so I can learn from that.


What do you think you can gain with such an approach?

If you just take a 100uF electrolytic, then you can buy them from different brands, different Max. temperature, voltage, low ESR, high reliability types etc. In stead of trying to approximate the nearly infinite variation of such components, KiCad uses a flexible approach to assemble these from different parts (Schematic symbol, Footprint, Value text, etc).

But KiCad’s libraries are text based and also very simple.
Generating a library of pre-defined capacitors could be done very simple by:

  1. Create a fully specified capacitor in KiCad.
  2. Put that in a project specific library.
  3. Open that library in a text editor.
  4. Copy most of it as blocks of text into a python script.
  5. Iterate though your variables and make the Python script create a library for all variations and combinations you would like.

Also: How many different capacitors do you expect to use in any project of yours? Probably not more then a handful. Instead of bothering with scripts to generate big libraries with capacitors you would probably never use (and have to browse through to get to the few you want) It is probably simpler to just fully define the capacitors you need, and then export them into a personal library and collect them there.

Such a personal library is also a source for “preferred” and verified parts, you can also add ordering info for your favorite store.

A simple trick I use for resistors and capacitors is to first place one of them on the schematic, then assign a footprint to it, and then for the rest of the schematic make copies of that. Just hovering over an already existing resistor and pressing c for copy is quicker then getting a generic resistor symbol from a library.

If you “forgot” to add the footprint to the first component, then you can also use: Eeschema / Tools / Edit Symbol Fields and the “grouping” function there to copy for example a Footprint Field to multiple other schematic symbols.

Same for Power symbols such as GND and Vcc and labels. Copying is quicker then placing new ones, and with labels it also avoids typing errors.

This is a personal choice.
For my own projects I work with a generic polarized cap symbol and I add the footprint mostly with cvpcb.

I had a client that made his own symbols and each cap and resistor had its own symbol with value, footprint, tolerance and manufacturer part number fields. So for ten different caps he has ten different symbols.

Another choice is a table in the format of an .equ file ‘components value’ ‘footprint name’.

KiCad is flexible and allows different approaches for assigning footprints.

Thank you for the info. I’m running into a challenge I haven’t worked out a good solution for.

I would like to have a capacitor symbol called “CAP”. And since my library is going to be less then 10 different caps., I was thinking I could create aliases which were CAP_PART_NUMBER and then for each of them, assign the footprint i.e. 0402, 0603, 0805, 1206, etc. I would create a Manufacturer and Part number field. for each one.

Then, when I generate a BOM, I would have everything there.

But it seems when one creates an alias, you can override the name, description and keywords but not the other fields.

Does this mean that I need to create a symbol for each part number? How else can I enter the manufacturer, part number and symbol?

Yes. …

I generally go a slightly different route. I define a house part number that contains the capacitor value, tolerance, voltage rating and other electrical parameters as “cleartext”.

Then i have capacitor symbols for lets say a 0603 cap, 100V, 5% already connected to the correct footprint and with the house part number partially filled out. I could then write a BOM script that takes the value field and places it into the partial house part number but to be honest i simply did this by hand as i never got around to writing that script (short term solutions sometimes stay permanent)

The order information is handled in an external database (ok a simple spreadsheet) where i link the house part number to a real component i can order.

This got the number of symbols i need to maintain down and had the additional flexibility of not needing to change the schematic if i want to select a different (but electrically equivalent) cap. Was especially usefull during the MLCC crisis.

I can however see a use for having some special caps as their full order number in the lib. An example would be special caps for high frequency applications that have parameters not of interest to your normal caps (could of course still be handled by the house part number system but if the number of parameters get too high then it might get quite hard to manage)

I have one symbol for all 0603 capacitors with aliases for each value I wont to use.
In past (old Protel) the name containing only value (for example 1n) I used for ‘default’ footprint (0603). To specify 0402 capacitor I used another name (1n_4). Moving to KiCad I found that I can’t use Univers Condensed font at schematic so I decided that (to have names shorter) I want to have the same name for 1n 0603 and 1n 0402. As the same name can’t be used in the same library I have several libraries for capacitors. You can assume that my ‘C’ library contains my default 0603 capacitors (one symbol with many aliases) and my ‘C1’ library contains 1mm (0402) capacitors (also one symbol with many aliases) and my ‘C2’ library contains 2mm (0805) capacitors. So at schematic I lose the size information - I can have some 1n capacitors and they can be different sizes.

The method I proceeded with this is to create a library for a manufacturer.

Take SM resistors. I typically default to Vishay CRCW and I have a that I used to generate 0402,0603,0805,1206

Below is a snippit of the format string

ENTRY_LIB = f'''#
# {R}
DEF {R} R 0 0 N Y 1 F N
F0 "R" 100 100 50 H V C CNN
F1 "{R}" 100 -100 50 H V C CNN
F2 "{kicad_footprint}" -500 0 50 V I C CNN
F3 "" 0 0 50 H I C CNN
F4 "{MFG}" -400 0 50 V I C CNN "manf_num"
F5 "{tol}" -300 0 50 V I C CNN "Tol"
F6 "{v}" -200 0 50 V I C CNN "V"
F7 "{pwr}" -100 0 50 V I C CNN "W"
F8 "{mass}" -100 0 50 H V C CNN "mass (g)"
S -40 -100 40 100 0 1 10 N
X ~ 1 0 150 50 D 50 50 1 1 P
X ~ 2 0 -150 50 U 50 50 1 1 P

this way I can just search “0402 10k” and it would return the exact part in the browser.

Now caps :frowning: value, footprint, VOLTAGE,dielectric … I keep meaning todo the same thing but I have not settled on whether to use KEMET or AVK and typically I use both since some voltage and capacitance are only available in flexi-term from either or :frowning:
When I have a moment I would probably do a similar thing and write a help-script to auto-generate 0603, 50V, X7R Kemet and 0603, 25V C0G etc…

@Naib , I’m not following everything you are saying. So, some questions:

  1. I assume this is a code snippet. If so, any chance you can post the entire source? I’m not familiar with Python at all. If you can’t, I understand.
  2. Do you run this outside or within Kicad as a plugin? I’m missing the linkage between this code and the result being found in the symbol browser.
  3. If this is generating a library (run outside KiCad) can you post an example .lib and .dcm?

I went spellunking into the library format but I’m missing some concepts.


This is a good and common question.
I have made a few custom symbols for things like 0.01 bypass caps, 2N7002, generic diode…

I standardized on 0805 and Sot23, Sod123. When I insert a 0.01 then I know it is already 0805 handsolder footprint.

For everything else I use Cvpcb to assign footprint.

ahh sorry, I never replied to this…
This is a code snippit, I can provide the code, I just need to make a project on gitlab.

its run outside kicad to create the lib and dcm.

It might be worth having a look at Qeda which I think might achieve much of what you are after.

@Naib - it is fine. I decided to create individual parts for different capacitance, voltage, and size.

Sadly, the problem I’m running into is that when you bias a ceramic capacitor, the capacitance drops and so, depending on the bias voltage, the expected capacitance is lower. So, the capacitance shown is not what occurs. As I type this, I’m thinking I should add a visible field that is value @ bias voltage so that I don’t have to keep looking them up.

Do you also consider to show next to diode its VF as a function of IF and next to transistor its hFE as a function of collector current?

age old problem :slight_smile:

are you sure you want that in the component and not a schematic note since that cap might be used on other ccts with a different bias voltage

Good points.

@Piotr - for circuit calculations, I will make notes to capture non-obvious things.
@Naib - a schematic note is a good idea.

Explain in more detail what your problem actually is.
I see no reason to use at schematic other value than nominal value used to order capacitor.
It is the designer’s task to know the parameters of elements he selected. At typical schematic there is no place to add all important parameters of elements used (imagine such information for microcontroller).
If reduction of capacitance as a function of voltage (typical for example for Y5V capacitors) is a problem than probably their initial (not low) tolerances and temperature influence on their capacitance are also a problems needing the same kind of notes at schematic.
You just should not use such capacitors in places where exact capacitor value is important.

No, it’s not.
If this can be a problem, then simply use better quality capacitors.

That would be a horrible thing to do.
You can specify a 220nF Y5V if you want a 100nF decoupling cap, but calling a “220nF Y5V” a “100nF @5V” would just be confusing, and there probably is no shop in the world where you can buy it.

Don’t start calling components something else then what they are, and they are what the manufacturer puts on the label.

Any engineer should be aware of these properties of Y5V. At most put a single text note on the schematic that you’ve scaled your capacitor values because of biasing issues.

My sentence was true because of ‘If’ at the beginning.

Thank you for helping me figure out how to organize my library. I think I’m good for the time being. I’ll circle back if I run into anything else.

I agree that a part should have what the manufacturer calls out and that is what I do. I then, add a text annotation which has the capacitance at the bias voltage. This is just helps me.

Since there was a question about bias voltage - here is a picture of what I’m talking about for an example muRata ceramic capacitor - 2.2uF, 16V, X5R, part #: GRM155R61C225KE11 that shows how the capacitance drops with with bias voltage.


All the best.