EEVblog Electronics Community Forum

Electronics => PCB/EDA/CAD => KiCad => Topic started by: ilium007 on July 17, 2021, 12:41:33 pm

Title: Help sorting out libries, symbols and footprints
Post by: ilium007 on July 17, 2021, 12:41:33 pm
I've been playing around with KiCAD for a few years now and mainly using the standard libraries along with some symbols and footprints I have had to make myself. I saw a YouTube video a while back where the person used a different approach... he copied each symbol to his own symbol library and then duplicated for each value of that component used ie. every resistor value had its own symbol. I can see this being useful in that I buy SMD parts by the 100, its a good chance that I will always use the same 10k resistor with the same datasheet, footprint, manufacturer part number, source link etc etc. It seems that it would be useful to have all this info entered once into the symbol fields instead of having to enter it for each project if I were to use the default library symbol. Each symbol then had some smaller text that contained relevant data for the circuit.


Not sure if this makes sense. I can't find that YouTube video that got me thinking about using this process. How do others make use of the default library symbols? I am about to get serious in my use of KiCAD and want to make the right decisions up front so I don't to go and rework schematics if I change my mind later.
Title: Re: Help sorting out libries, symbols and footprints
Post by: dunkemhigh on July 17, 2021, 04:27:45 pm
Let's say you have a separate symbol for every E24 resistor value, perhaps also a set to cover 1/8W and 1/4W. Does the footprint count in this? OK, so you have another lot of symbols for 0603, 0402, PTH. That's a lot of symbols, but you only have to do it once.

Now, some time later you figure your zig-zag line resistor symbols should actually be of the box sort. That's a lot of symbols to go in and change! Or, you could use a common symbol, change it once and every resistor magically matches.

IMO, using a common symbol where possible makes a lot of sense. Over in Other Products the trend is to have specific parts in the parts library (as opposed to generic parts that you sort of the detail when placing), but they still use common symbols.
Title: Re: Help sorting out libries, symbols and footprints
Post by: ilium007 on July 18, 2021, 12:14:02 pm
I was thinking that individual symbols linked to a specific component value, part# would make the BOM easier to manage. I buy 10K SMD resistors by the 100's so I will be using that exact part# for some time.
Title: Re: Help sorting out libries, symbols and footprints
Post by: dunkemhigh on July 18, 2021, 03:57:43 pm
It might. If you were talking, say, micros or something reasonably functionally unique then there are positives for doing that. But for jellybean parts such as resistors... selecting the actual manufacturer and supplier is best left to point to buying, probably. You don't really care where they come from so long as they match the headline value and tolerance specs, and if you specify, say, Vishay via RS, are you really going to create a new component to replace that when you come to order and find RS don't have any and anyway Yageo via LCSC is far cheaper?

IMO, it would be better to have the part detail relevant specs (value, tolerance, size, etc) and include a unique part reference of your own devising. It's that part reference that makes it to the BOM, and your parts database manager then generates the appropriate purchase request. It will know what to buy from where depending on MOQ, other parts (better to get them all from one place if you can to reduce shipping costs), availability and spot price. Of course, you might not have that bit of your system yet so it will be manual work, but you'd have to do that at the start using the scheme you suggest, and then again at the end when you find the part you specified isn't available from the disty now you're three weeks down the line.

If you're buying jellybeans by the 100's, that doesn't change much. In fact, it can make it worse - I do the same and some of the rarely-used parts last forever. Almost. When they do run out, often I find the supplier part number is no longer recognised, so all the buying info is obsolete and I need to resource them. Not a problem for me because the BOM gives my part reference and I just fix what that resolves to, but if I had to go back to the schematic to replace those symbols, then check the layout isn't affected (it shouldn't be, but you never know and it's better safe than sorry), then regen the BOM... no, don't want to go there ;)

Title: Re: Help sorting out libries, symbols and footprints
Post by: phil from seattle on July 19, 2021, 01:00:13 am
I dunno, that seems like a lot of work. To change a resistor or cap value, you have to change actual symbol?

I use a disti field in my symbols.  You can just plug the disti part number in via the Edit Symbol field tool in Eschema. I use LCSC so have that set up.  Then when I have, for example, 20 10K  603 resistors in a design, I just plug in the LCSC number once where they show up on the same line. I usually pull up previous BoM and crib the part numbers from that. Then when I build the BoM, it has the disti number right there.  If you use JLCPCB there is a custom BoM script that produces the BoM in their format.  No Muss/Fuss. I think there are scripts for other assembly houses as well. Totally beats having to massage a BoM by hand for part number or format.

Title: Re: Help sorting out libries, symbols and footprints
Post by: Bassman59 on July 19, 2021, 07:05:49 am
All symbols in my libraries have a "PN" field. That field is populated with a "house" part number, which is a key in a database. (I do not use the Kicad standard libraries for production. When I create new parts, I do check those libraries to see if someone else already created them, and if so, I copy the symbols to my library and add the PN field.)

The part number is of a format:



"A" is a letter indicating a broad category type. In my database, all 'A' parts are integrated circuits, so micros, op-amps, regulators, whatever. 'R' are resistors, 'C' are capacitors, 'D' are diodes, 'Q' are transistors, and so forth. (This prefix is NOT the reference designator prefix.)

"1000" is a "family" part number. For example, A-1091 is an OPA551 op-amp. C-1001 is an 0805 10% X7R 50V ceramic cap. D-1020 is an LED shaped for bar-graph meter displays.

The rule for a "family" is that the members of the family vary in only one parameter. For capacitors and resistors, the variant is obvious: the value. For that LED, it is the color. For that op-amp, it is the package (it's available in DIP and SOIC).

So the "-0" indicates the variant. This indicator could be just a different number to show the differences, so A-1091-0 is OPA551UA in SO-8 and A-1091-1 is OPA551PA in DIP-8. D-1020-0 is a green LED of that shape, D-1020-1 is red, D-1020-2 is yellow. (This suffix could have been -RED, -GREEN, -YELLOW but I didn't bother.)

And for things like resistors and capacitors, the suffix is simply the value. C-1001-10nF is a 10nF cap with all of the above specs. C-1001-470nF is a 470nF cap with those specs. C-1000-100pF is a 100 pF 5% 0805 C0G 50V cap. R-1000-10k0 is a 10.0k 0805 1% resistor. R-1000-29k4 is a 29.4k 0805 1% resistor. X-1009-24.576M is a 24.576 MHz 5x7mm 3.3V oscillator.

0.1% 0805 resistors are a separate family. 1% 0603 resistors are again a separate family. Remember again all members of a family vary in exactly one parameter, in this instance case size.

Many parts have only one family member so their suffix is simply -0.

So the answer to the OP's question: Resistors, capacitors, inductors and oscillators are the categories of parts where there are so many possible values of otherwise similar parts that you really want to have just one symbol for your "family" so you don't have say 500 0805 1% resistor symbols in the library. So the PN field for these parts has just the type and the family number, say C-1001. The value field must be populated with the part value, in a standard format.

All other part types need the full part number, so a Neutrik NC3FAH1 XLR connector's PN field is F-1000-0. I honestly don't have a problem with an op-amp library that contains two dozen different parts, each of which have the same symbol.

SO: Kicad exports a BOM in CSV. The BOM has all of the fields in each symbol, so my PN field along with the value field (and reference designators and footprint and everything else) is in it.

I maintain a master parts list, which is a simple spreadsheet. (One day I'll make it a true database.)  This parts list is keyed by the part number. This means all 0805 1% resistors have an entry. Each entry has a symbol name, a manufacturer name, a complete manufacturer part number, the footprint, a description, a count of how many pieces I have in stock, and a rough price. (It also has the library in which the symbol lives, the library in which the footprint lives, and alternate vendor names and part numbers.) One good obvious rule is that part numbers once assigned are never re-used if the original part goes obsolete or whatever.

When I go to generate an order list I export this parts list as CSV. I wrote a python script that takes the Kicad CSV BOM and the parts list CSV and looks up each part in the former in the latter, and it generates a CSV parts list with manufacturer names, part numbers, quantity of each part, a list of reference designators for each part, and a rough price.

It's simple enough and meets my needs.

Obviously it can be improved in many ways. The master parts list could include a distributor's part number -- but why? They all let you enter manufacturer part number. It could use a real database instead of a spreadsheet. Some assembly places like Seeed have a spreadsheet format they prefer for assembly orders and an addition to the python script could generate that.  The parts list could have a field indicating that the part is in an assembly house's preferred parts list and the script could flag parts not on that list.

But for now it suffices.

One important feature is that I shouldn't have to manually edit the BOM this system creates!