Hacking the KiCAD Libaray system to be actually useful - Page 1
Forum section: electronics / general

author: homebrew
author_rank: Frequent Contributor
timestamp: April 23, 2017, 09:24:52 am
content: So KiCads Library management system ist not free of controversy and has been criticized A LOT. Thus let’s see if we can do anything about that …Let’s for example take a capacitor. The symbol in the shipped library offers you to set its value after it has been placed in the schematic and in the later process steps add a footprint to your taste. But that has a serious drawback: You practically need to design your stuff with the ordering system of your supplier at hand – use their parametric search to see if the desired properties are actually available in the package. BOM-creation becomes a pain in the ass and so on ...Hence let’s do something different. Using the library editor, let’s load the “C” symbol and add some fields to it. I simply ‘abused’ the value field for the part-name. Yes – there is a designated footprint field – so let’s use that. And create additional fields for tolerance, ratings and dielectric material. However instead of typing in values directly I used placeholders instead. Here is what the result looks like:I can export the single component and name the file ‘C_template.lib’. It now has the following content:#encoding utf-8## ###PARTNAME####DEF ~###PARTNAME### C 0 10 N Y 1 F NF0 "C" 25 100 50 H V L CNNF1 "###PARTNAME###" -150 0 39 V I C CNNF2 "###FOOTPRINT###" 50 -200 39 H I L CNNF3 "###DATASHEET###" 50 -400 39 H I L CNNF4 "###VALUE###" 50 -100 60 H V L CNN "P_Value"F5 "###RATING###" 50 -250 39 H I L CNN "P_Rating_U"F6 "###TOLERANCE###" 50 -300 39 H I L CNN "P_Tolerance"F7 "###MATERIAL###" 50 -350 39 H I L CNN "P_Material"DRAWP 2 0 1 20 -80 -30 80 -30 NP 2 0 1 20 -80 30 80 30 NX ~ 1 0 150 110 D 50 50 1 1 PX ~ 2 0 -150 110 U 50 50 1 1 PENDDRAWENDDEF##End LibraryOk, now let’s get to the real deal. Let’s create the library. Of course, as a good engineer, we start with Excel :-) Or rather with OOCalc, if you prefer. And now I cant put all the parameters in it, like so:… and save it as plain csv.Convenient Bash-skills are convenient …Code:echo "EESchema-LIBRARY Version 2.3" > Capacitors_SMD.lib; echo "EESchema-DOCLIB Version 2.0" > Capacitors_SMD.dcm; for i in $(cat Capacitors_SMD.csv); do IFS='; ' read -r -a array <<< "$i"; cat ${array}_template.lib | tail -n +3 | head -n -2 | sed -e "s/###PARTNAME###/${array}/g" -e "s/###FOOTPRINT###/${array}/g" -e "s/###VALUE###/${array}/g" -e "s/###RATING###/${array}/g" -e "s/###TOLERANCE###/${array}/g" -e "s/###MATERIAL###/${array}/g" -e "s,###DATASHEET###,${array},g" >> Capacitors_SMD.lib; echo "\$CMP ${array}" >> Capacitors_SMD.dcm; echo "K ${array} ${array} ${array} ${array}" >> Capacitors_SMD.dcm; echo "\$ENDCMP" >> Capacitors_SMD.dcm; doneThis transforms the csv into KiCad library format using the template. The result looks like this:~/kicad_partlib$ head Capacitors_SMD.dcmEESchema-DOCLIB Version 2.0$CMP 0603N1R0C500CTK SMD0603 1p0 50V NP0$ENDCMP$CMP 0603N1R5C500CTK SMD0603 1p5 50V NP0$ENDCMP$CMP 0603N1R8C500CTK SMD0603 1p8 50V NP0$ENDCMP~/kicad_partlib$ head -n 24 Capacitors_SMD.libEESchema-LIBRARY Version 2.3## 0603N1R0C500CT#DEF ~0603N1R0C500CT C 0 10 N Y 1 F NF0 "C" 25 100 50 H V L CNNF1 "0603N1R0C500CT" -150 0 39 V I C CNNF2 "SMD0603" 50 -200 39 H I L CNNF3 "http://www.passivecomponent.com/document/MLCC/MLCC_catalog_200503.pdf" 50 -400 39 H I L CNNF4 "1p0" 50 -100 60 H V L CNN "P_Value"F5 "50V" 50 -250 39 H I L CNN "P_Rating_U"F6 "0.25p" 50 -300 39 H I L CNN "P_Tolerance"F7 "NP0" 50 -350 39 H I L CNN "P_Material"DRAWP 2 0 1 20 -80 -30 80 -30 NP 2 0 1 20 -80 30 80 30 NX ~ 1 0 150 110 D 50 50 1 1 PX ~ 2 0 -150 110 U 50 50 1 1 PENDDRAWENDDEF## 0603N1R5C500CT#DEF ~0603N1R5C500CT C 0 10 N Y 1 F NLoading this library and you get a nice search frontend in eeschema:Or you can search by other parameters.Placing the component and you have an innocent looking capacitor…Or you can go full tilt and set everything to visible …So what do you think? Could that be a viable way to work with components in KiCAD? Suggestions?

author: rs20
author_rank: Super Contributor
timestamp: April 23, 2017, 11:53:50 am
content: OK, I was ready to dismiss this post based on the title; but I stand corrected -- I really rather like this idea. Not sure if I'll actually do it, but kudos for the inspirational effort at theveryleast!

author: janoc
author_rank: Super Contributor
timestamp: April 23, 2017, 12:33:25 pm
content: Well, so basically you have turned the Kicad library system into a copy of Eagle's, where every value/footprint variant/voltage rating has its own symbol/footprint in the library, duplicating the stuff all over the place.Now imagine that there is a mistake in that symbol or footprint. With the original Kicad way of doing things you fix a single symbol/footprint and all parts using it will be correct. With yours? Good luck fixing few thousands parts each time - even if you automate the job.The entire point of the Kicad's design is that you are not supposed to do this. Add the fields to the components, but do that per project, as you need them, not creating entire libraries of 0603 and 0805 capacitors that differ only in a value of a field or two.

author: julian1
author_rank: Frequent Contributor
timestamp: April 23, 2017, 01:04:00 pm
content: I have always tried to keep part information out of the schematic symbols - so I can use them generically and freely. I even go so far as to avoid creating new symbols for common parts - for example variations on different op-amps - if they follow known pin-outs such as 741. Ideally I can then simply associate a TH or SOIC footprint for PCB layout, and the schematic and footprint are kept loosely coupled. The end goal is a PCB and I only do enough work for that - rather than try to capture all the detail of a circuit and component values. I find the Kicad library model works well using this approach.

author: homebrew
author_rank: Frequent Contributor
timestamp: April 23, 2017, 01:23:49 pm
content: Quote from: janoc on April 23, 2017, 12:33:25 pmThat is interesting to hear from a super contributor. When I started using CAD-Systems, I probably had the same mindset but people from here and some professionals I know have changed my point of view over the time: The schematic is the place (and the only one) where everything is specified - except layout of course. Till now, the only consistent way of doing that I know is to have a separate symbol for every part ("part" == orderable, specific component). For some designs the parameters of a component are important. Even with simple DC/DC converters it can matter if it is a low ESR type of capacitor or not. Where would you specify that?For other components special symbols are required as the pinout changes with the packages (i.e. BGA != SOIC etc ...). Then also I can auto-generate the BOM directly from the schematic without further effort ...What I did was not to copy the eagle system ... Eagle really has separate footprints for every component. I'm not doing that. Deliberately! For the capacitor example I just specify that is is an 0603 footprint. I still have them in a single place. That footprint can be altered according to the particular needs of the project (i.e. hand-soldering vs, reflow ...)And come on ... a general and severe mistake in a capacitor component?

author: oldnewb
author_rank: Contributor
timestamp: April 23, 2017, 07:31:39 pm
content: Keeping every last design detail in the schematic is a nice idea, but in practice you can easily end up with an enormous and/or unreadable schematic if each symbol includes a list of specifications next to it. Furthermore, there are too many components and too many manufacturers and too many part numbers (all subject to change) to make the job of compiling a comprehense library worth the hassle.Eeschema allows you to set additional symbol fields (via Preferences->Schematic Editor Options->Template Field Names in v4.0). These fields are always present in the component properties dialog; they only get saved to the schematic's file if their value is changed from your specified default. For example, I have eeschema configured to add "SPEC" and "NOTE" fields.My current preferred workflow is to create a schematic with text notes in the corner regarding default component assumptions (e.g., "All caps are 20% X7R MLCC unless otherwise specified."). Components with special needs have their "SPEC" and "NOTE" fields defined accordingly. I create a separate BOM spreadsheet for all of the manufacturer- and vendor-specific details, which I fill out as I shop for parts online. KiField (https://github.com/xesscorp/KiField), a third-party Python script, transfers component data between eeschema files and an Excel spreadsheet file (in both directions), which makes the job much simpler.

author: miceuz
author_rank: Frequent Contributor
timestamp: April 24, 2017, 05:48:35 am
content: Thanks for sharing @homebrew. It's inspirational, but also not compatible with my work flow.If I need a special tolerance for a component, I will add it in the value field. Like "10k 0.1%". I also have fields for manufacturer part number, manufacturer name and distributor id. Usually I source components as I am drawing the schematics, so I fill those fields as a part of schematic capture and I can generate a BOM that is compatible with elecrow, seeed and the like. I keep all the project documentation in the schematic.KiCad has a patch proposed where it adds a dialog that allows to do a bulk edit all the fields - this would be a huge improvement for me. It's not in the nightly yet though. KiField looks like a very useful script for now, thanks!

author: janoc
author_rank: Super Contributor
timestamp: April 24, 2017, 08:05:00 am
content: Quote from: homebrew on April 23, 2017, 01:23:49 pmIn the schematics, of course.However, that doesn't mean I would generate/maintain huge libraries containing every possible part variation. I don't know how people do with more advanced tools like Altium, perhaps there is a more efficient way there but with Kicad I do prefer the approach with the separate tool to maintain that info en masse - it ismuchfaster to assign the information there than to click on every single component in the schematic to set it (or to be sure that the correct one was picked from a library) and none has been forgotten. Right now CvPCB handles only footprints but I can imagine a similar table-based approach for other fields too. By default the footprint info is stored in a separate file but recent versions of Kicad import it back into the fields in the schematics.In the absence of field support in CvPcb a bit of scripting to modify the values in the schematics would do the job. That has also the advantage that if I need to change the values (e.g. to change from 0805 parts to 0603 ones), I can quickly rerun the script and don't need to replace the components (which could leave them disconnected if the symbol is not exactly the same size, etc.).Quote from: homebrew on April 23, 2017, 01:23:49 pmFor ICs that's a bit different, there I tend to create a separate symbol for each package variant too because the support for alternative packages in Kicad is rather limited, indeed. So there is not really a choice there.Quote from: homebrew on April 23, 2017, 01:23:49 pmYes, that has been a little exaggeration on my part. I was more referring to the fact that every possible part variant is a separate part in the symbol libraries, because Eagle (and other PCB packages) does that too if I remember correctly (haven't used Eagle in a while).Quote from: homebrew on April 23, 2017, 01:23:49 pmYou mean like symbols changing between different releases of Kicad? Have you never had the messages about parts being replaced or "rescued" when loading an old project because the parts have been replaced in the libraries in the meantime? Sometimes only the shape of the parts changes slightly, sometimes there is a larger change that could break your diagram. Of course, if you generate all your libraries yourself, you may not care, on the other hand you are missing out on any improvements in the stock library files as well (which may not be always visible outright - like the footprint fields that were added relatively recently).

author: ar__systems
author_rank: Frequent Contributor
timestamp: April 24, 2017, 12:36:00 pm
content: Quote from: janoc on April 23, 2017, 12:33:25 pmThis is actually not correct. Eagle libraries for RCL do not have values and are not linked to manufacturers. They are very generic, only symbol and footprint.

author: ar__systems
author_rank: Frequent Contributor
timestamp: April 24, 2017, 12:45:27 pm
content: Quote from: homebrew on April 23, 2017, 01:23:49 pmYou are right, for some. It depends on what you do. Maybe if you are doing high speed analog designs inductance of resistors will matter, and you will have to specify mfg part number for it, and ESR of a cap might matter for voltage regulator. But for the most part RC parts are very generic. I think there was only one time I had to specify high voltage/pulse withstanding resistors, and another time I needed 0.1% resistors. Otherwise as far as I'm concerned resistor is fully specified by the value, package and tolerance and I don't provide part numbers for them. So those 1% of cases I will find the suitable component at circuit design time and include its p/n in schematics.I work on Eagle btw.

author: voltsandjolts
author_rank: Unknown
timestamp: April 24, 2017, 02:34:20 pm
content: Quote from: ar__systems on April 24, 2017, 12:45:27 pmThe trouble is there is often someone else who is concerned, such as the assembly sub-contractor who like to have components fully specified with manufacturer and their PN.IMHO every part should be specified by its manufacturer and PN in the libraries, which then makes automatic BOM generation much easier.If you have to make a BOM you need to do that work anyway, so it may as well be in the libraries for easy reuse.But each to their own I guess.

author: ar__systems
author_rank: Frequent Contributor
timestamp: April 24, 2017, 02:44:36 pm
content: It does make BOM generation easier, but it makes everything else worse. Many contract assemblers stock certain common components and you can have them for cheap. If you specify some other components instead of the ones they could use, your assembly cost goes up.

author: voltsandjolts
author_rank: Unknown
timestamp: April 24, 2017, 03:03:58 pm
content: OK, so specify those parts in your library and BOM.If you leave it up to your assembly house to substitue whatever they think is a good match for your spec you could be in for trouble.When you start having batch problems due to components they fitted you are in a world of hurt. You may not even know how many boards were produced with a particular substituted part.

author: homebrew
author_rank: Frequent Contributor
timestamp: April 24, 2017, 03:41:50 pm
content: Quote from: janoc on April 24, 2017, 08:05:00 amYes, that would be BAD! But I really strive to generate / create everything on my own. Because I want to make all the decisions. Maybe I want elongated pads to ease hand assembling ... or small ones for high density stuff. And I don't like the default silk-screens anyway :-)And think of the symbols for ICs provided. LOTS of problems like invisible power pins, power pins of zero length, duplicated power pins (i.e. on every opamp in a package) and whatnot... Using such symbols, at least for me doesn't cut it ...And apart from that, I'll only create a symbol once. The rest will be done by scripts and OOCalc ...Quote from: oldnewb on April 23, 2017, 07:31:39 pmExactly - That's why I've set them to invisible by default. The information is there but not visible / printed. As for the second remark - that is the very purpose of scripting it...Quote from: ar__systems on April 24, 2017, 02:44:36 pmThen I would STRONGLY recommend to also document this in the schematics. And yes - you are all correct - changing parts on a global scale would be a PITA with the method I proposed. However as the components only vary in their field values, the problem could probably be solved with a script. I'll look into this ...I think in the end everybody has to pay a price. Either one goes fast and ugly with the default symbols and modules (which I couldn't because I would make too much errors for sure!) or pays the price in terms of hours spent ... I'll go for the latter as do electronics mainly in my spare time for fun and pleasure. Hence I can do everything to the level of precision that I like and enjoy ...

author: ar__systems
author_rank: Frequent Contributor
timestamp: April 24, 2017, 04:24:44 pm
content: Quote from: voltsandjolts on April 24, 2017, 03:03:58 pmAt the design stage, when you are doing design for someone else, you don't even know which assembly place the customer is going to use. And then they can switch it as well. Yes it is theoretically possible that replacing part can create a problem, but in reality it does not happen very often. Did not happen to me even once on about 20+ projects currently in mass production that I designed.Another side of the problem is that if you over-specify generic parts, you will be constantly bugged by the customer ("this resistor is out of stock! what else can we use?").

author: voltsandjolts
author_rank: Unknown
timestamp: April 24, 2017, 04:35:55 pm
content: So it looks like you are in a market where you are happy not knowing exactly what you have produced. Lucky you.I'm not, we need documentation for every board produced along with test certs.But we are going off topic now, these are manufacturing issues.

author: ar__systems
author_rank: Frequent Contributor
timestamp: April 24, 2017, 06:55:39 pm
content: Quote from: voltsandjolts on April 24, 2017, 04:35:55 pmLol, I do know, various hospital equipment. Let's just say I don't care about what brand 100K pull up resistor they use, it will still work whether it is 10K or 200KOf course you can specify the most expensive ones.

author: homebrew
author_rank: Frequent Contributor
timestamp: April 24, 2017, 07:03:27 pm
content: Just to show a real screw-up I managed to do as a result of lazily mapping footprints to symbols. I had two of these regulators in my design:Component 1: TPS63001 (VSON-10)http://www.ti.com/lit/ds/symlink/tps63001.pdfComponent 2: TPS63031 (VSON-10)http://www.ti.com/lit/ds/symlink/tps63031.pdfAlthough the same manufacturer, the same schematic representation in the datasheet, apparently the same series (well not really) and actually THE SAME name of the package in the overview "VSON (10)" these chips do NOT share the same footprint. Of course I wacked in the same footprintIt was just a prototype and the component could still be mounted somehow creatively it was not a nice experience ...Clearly my fault - no one else to blame! But nevertheless this got me into rethinking my workflow ...

author: voltsandjolts
author_rank: Unknown
timestamp: April 24, 2017, 07:50:40 pm
content: Quote from: ar__systems on April 24, 2017, 06:55:39 pmYour answer is nonsensical.You cannot know exactly what you have built when you don't care whether you have fitted 50V One-Hung-Low resistors with poor quality terminations and big TC...or name brand items, IMHO.

author: nctnico
author_rank: Super Contributor
timestamp: April 24, 2017, 08:44:10 pm
content: There is only one way which works: a component should be split into a symbol, part information and a footprint. This is best brought together through a database. I like the initiative but please look at how Orcad Capture CIS works. Creating a correct BOM is a matter of one click with the mouse button.

author: julian1
author_rank: Frequent Contributor
timestamp: April 25, 2017, 01:51:47 am
content: Some other sources of component variation - that don't require schematic or pcb revision might be,- If you discover a de-rated or competitor op-amp or comparator works just as well, and decide to switch- corresponding changes to RC op-amp compensation component values with changes to op-amps/GBW.- different pcb fabricators with different layer thickness, means different decoupling cap choices are necessary- different customers that have different 0R jumper configurations- modules that are entirely populated/de-populated based on product version/need- upgrading to better components with standard pinouts - eg. power Mosfets to take advantage of lower RDS(on)/ and heat generation - as they become available to the market and at lower pricesThat's a lot of part specification to try to bake in at the schematic level or PCB level.I have only ever used Kicad. But I think it makes sense to track the bom independently of the cad package - perhaps with date,revision,customer, board fabricator details included. That is - assuming there is enough product volume/complexity to justify the bother of tacking it in the first place.

author: Paul Bryson
author_rank: Contributor
timestamp: May 16, 2017, 06:41:28 pm
content: Thanks, Homebrew. I had rejected Kicad because I thought it could not do this - i.e. tie the footprint and the manufacturer's part number to the schematic library symbol. The typical workflow (as I understand it) used for Kicad seems so error prone - personally I find it unacceptable. I will now reconsider using Kicad.Specifying the footprint and part number later seems to make sense because it is modular. But every time you use that symbol you have to risk making a mistake in choosing the wrong part number or footprint. That is just asking for errors. I prefer to create a schematic symbol once and never have to worry about it again. All of the arguments against this approach seem to focus on making it easier for the designer - instead of minimizing errors.One of the primary goals of engineering documentation is to minimize errors. Anything unspecified can be a source of error. I always specify specific part numbers and I do not allow contract manufacturers to make any part substitutions without written permission - even resistors. This usually involves a single communication where the CM suggests a list a substitutes which I either allow or disallow. A small price to pay for knowing exactly how your product is built.

author: janoc
author_rank: Super Contributor
timestamp: May 16, 2017, 07:07:54 pm
content: Quote from: Paul Bryson on May 16, 2017, 06:41:28 pmThat is why you have footprint filters in the schematic symbol. When you are creating the part, you can specify which footprints you want to permit and only those will show when selecting the footprints in CvPCB. The UI could use a bit of work, but it works. CvPCB will use that info and automatically associate the part with the footprint if there is a unique match for you. Of course, you can override it and associate any footprint, but the system isn't designed to handle users trying to break it.

author: ehughes
author_rank: Frequent Contributor
timestamp: May 16, 2017, 11:53:07 pm
content: The library system is what drives me crazy about Kicad. The developers ignore industry best practices and it will be a toy until they get out of the NIH mindset. This idea of associating a footprint after the schematic is complete is ridiculous.A library *is* a database and should be treated a such. It makes non-trivial designs manageable.Industry has solved this problem by using a complete manufacturer part number as a root key for a part. This ensures a 1:1 relationship between the part and footprint. Cases where you can substitute multiple manufacturers is handled by abstracting the part with an internal part number. In this case you become the manufacturer as there has been a value added step inserted into the supply chain. This approach is the only way that has been proven to solve long term PLM/PDM issues.This approach of course requires some engineering discipline.

author: Bassman59
author_rank: Super Contributor
timestamp: May 17, 2017, 12:50:45 am
content: Quote from: Paul Bryson on May 16, 2017, 06:41:28 pmIt is again worth noting that you can use Kicad without using CvPCB's symbol/footprint matching. It does require that you create and maintain your own libraries, but that's standard for professional use anyway.When you create symbols for your schematic libraries, populate the footprint field. Also create a custom "part number" field which you should populate with manufacturer part number, or perhaps house part number which would be a key into an external database.Once you do this, you're on your way. You vet your parts as you create the symbols (and possibly footprints, if they don't already exist), so you know that when you place a part on a schematic, you know it has the correct footprint, a correct part number for your BOM, and there is no need to re-do that every single time you do a design.I agree with ehughes below -- a proper database-driven library system would be a boon to professional users who find such a thing necessary. The question is, who will architect it and implement it?QuoteI think that the arguments against this approach seem to focus on making it easier for the hobbyist who doesn't care about maintaining a rational parts inventory system. The voices of support for CvPCB seem to be very loud, though.

author: janoc
author_rank: Super Contributor
timestamp: May 17, 2017, 08:31:40 pm
content: Quote from: ehughes on May 16, 2017, 11:53:07 pmPart library certainly isn't a database, especially not in Kicad. It is just that - library of symbols and library of footprints. The database part that permits you to join and store information about part numbers, datasheets, substitutes and similar is completely absent from Kicad so far. Trying to repurpose the existing library system for this is an attempt to drive a square peg into a round hole, I am afraid. It isn't designed for this and will be very fragile.Quote from: ehughes on May 16, 2017, 11:53:07 pmYes, but that also assumes that you have a proper database-backed inventory system, where each entry has also associated part symbol, footprint, datasheets and what not. This doesn't exist in Kicad so far. I am not really aware of any low-end PCB tool that actually has something like that.OTOH, it shouldn't be too difficult to build something similar, for example by tying Kicad with something like PartKeepr (https://partkeepr.org/). It would certainly beat having to maintain crazy amounts of duplicated data in the libraries or trying to stuff the extra information into schematic symbol fields.

author: homebrew
author_rank: Frequent Contributor
timestamp: May 18, 2017, 06:48:26 pm
content: Quote from: janoc on May 17, 2017, 08:31:40 pmThe KiCad library system is not a database? Sure it is! It's a file based one. Of course not a relational DB (hence the need for redundancy) but for no reason I would see the fragility of neither the DB system, nor the approach.Quote from: janoc on May 17, 2017, 08:31:40 pmActually I don't see the "crazy amount" of duplication. Typically just the passives and simple semiconductors (e.g. diodes) are the ones where there is a massive choice of parts with the exact same symbol. However, these symbols also have just a trivial graphic representation, containing of only a view primitives. But yes, such information would be redundantly stored over and over again. Looking at my example from the beginning, the redundant part of the symbol is far less than the actual information provided...Instead, the REAL argument against my proposal that came out of the discussion would be the very very inconvenient process of changing parts during the design. Changing the value of a capacitor would require the discipline to delete the part from the schematic and add a completely new one. If not done very carefully, this could easily have implications on the netlist and thus corrupt the layout (if this has been created already). The only way around that would be to address the changes by altering the schematic directly using a script. Again - potentially an error prone process.

author: Vasi
author_rank: Regular Contributor
timestamp: May 20, 2017, 12:15:44 pm
content: I think practice is the best advisor - and a ton of projects to be finished.

author: ar__systems
author_rank: Frequent Contributor
timestamp: May 25, 2017, 11:36:16 am
content: Quote from: homebrew on May 18, 2017, 06:48:26 pmNobody will want that. And I'm sure no one will want a database of passives in their CAD. There are 100s of manufacturers and millions of parts. Who would want to maintain that, and why?

author: Gibson486
author_rank: Frequent Contributor
timestamp: May 26, 2017, 03:57:30 pm
content: Jst curious...What system do people use to make their libraries? If you do not make something based on the the part number, how do you differentiate?

author: Kelbit
author_rank: Regular Contributor
timestamp: May 27, 2017, 08:02:51 am
content: This thread is pretty timely. I'm predominantly an Altium user (originally learned it in university & now use it daily at work), but I've been forcing myself to learn KiCad for a side project.I agree the KiCad library system is pretty bush league - I've ended up junking all the default KiCad libraries and rolling my own. I assign custom fields to each part for manufacturer, manufacturer part number, preferred distributor, and distributor part number. This way I can closely mirror the way I do it at work with Altium: each schematic symbol is associated with a physical part that can be purchased, and I can automatically generate a BOM from the schematic.For passives, I have template components for the schematic symbol that I can duplicate and modify if I need to add parts to the library. I also hacked together a python script which can take in a CSV file from DigiKey and automatically fill a library with passives. For example, I pulled a list of all the 1% ERJ series 0603 resistors from Panasonic from DigiKey and then had the script automatically fill the library with the parts complete with description, manufacturer & P/N information, and DigiKey P/N info. It works well - I have all the standard values in my library now, and I know that if I put a part from my libraries on the schematic that I can buy it from DigiKey.

author: homebrew
author_rank: Frequent Contributor
timestamp: May 28, 2017, 10:31:57 am
content: Quote from: ar__systems on May 25, 2017, 11:36:16 amWell than, what do you want? A PCB full of errors?What is the pin-spacing on your 100uF jelly bean capacitor? 2.5mm? 3.5mm? Is the 22uF capacitor really available in 0603 package? And so on and so on ...Yes sure, the best option would be if CvPcb would provide a database with orderable components. So instead matching designators to footprints one would match designators to orderable components. Each component would then have A SINGLE footprint associated. Problem solved ...However, we don't have that ...

author: ar__systems
author_rank: Frequent Contributor
timestamp: May 28, 2017, 02:32:39 pm
content: Quote from: homebrew on May 28, 2017, 10:31:57 amWell you need some common sense when designing the circuit board, CAD is not a substitution for it. Personally I don't want to assign mfg part numbers to common (0603 0805 etc) passives ever. Not even when I provide BOM to my client. Unless I need something special in a particular place. I don't want to restrict purchasing more than absolutely necessary.

author: Rerouter
author_rank: Super Contributor
timestamp: May 29, 2017, 12:03:10 pm
content: Quote from: Gibson486 on May 26, 2017, 03:57:30 pmPersonally, I begin with the schematic symbol, generally i am forced to create this for each IC i use short of the generic pinout ones like op amps,Next up i pull up my footprints and see if i have a good match, if not i create that footprint following kicads smd footprint naming convention (style, e.g. qfn, number of pins, size key value, e.g. width, pitch, and thermal pad or not), this way unless something is weird, there is nothing about the footprint that has to be unique. i can look at the name and tell what it is, and if it matches up.add that to the footprint feild in the schematic symbol and be done with it,For multiple footprint options i use alias's, but rarely do i forsee using multiple footprints in 1 go so i just add them as i use them, e.g. one project i may use a soic, then later a tssop, same pinout, just different footprint. so open the old symbol and add in a new alias for an already created partWhat would make kicads libraries 80x better in my book would be a duplicate scanner and a drag drop interface to move stuff between library files and delete / rename them.

author: Gibson486
author_rank: Frequent Contributor
timestamp: May 30, 2017, 04:39:09 pm
content: Quote from: Rerouter on May 29, 2017, 12:03:10 pmI used this to move library stuff around...https://www.compuphase.com/electronics/kicadlibrarian_en.htm

author: Kelbit
author_rank: Regular Contributor
timestamp: June 01, 2017, 01:03:24 am
content: Quote from: ar__systems on May 28, 2017, 02:32:39 pmI'm of the opposite view... I prefer that I get as much control over what parts go on the board as possible. A 100nF 35V 0603 ceramic cap from two different manufacturers may have radically different DC bias characteristics, for example. Or maybe the ESR is different, and that affects the ability of a cap to act as an EMC filter which means the device isn't performing the same way it did in the EMC lab. Or maybe the temperature coefficient of a replacement resistor in an analog circuit is radically different than what I tested on which affects high-temperature performance. I would prefer to keep everything as similar as possible to what I did verification & IEC testing on.If the contract manufacturer can't find a part because it's out of stock, fine - but they should contact me first before slapping in a generic replacement they found on the third floor of the Shenzhen market. That way I can check that the part they want to substitute as actually equivalent for intended use. In the case where a part is extremely jellybean (like a pullup resistor) where a bit of carbon-soaked string might do the job, then fine, I can insert a field in my BOM called "equivalent substitutions permitted" and the CM can go to town. But most of the time, I want to sign off & document any substitutions.

author: ar__systems
author_rank: Frequent Contributor
timestamp: June 02, 2017, 02:40:15 pm
content: In my experience only two times I had to spec specific passives. One time product was failing due to caps cracking because of the board was deformed due to over tighten screws (I spec'd some flex-termination caps) and second time I had to spec pulse-withstanding resistors in some AC circuit. All other times 1% spec for resistors is sufficient. My customers are only buying good parts from digikey or mouser anyway.How do you do it? Say you attach an mfg p/n to your component in CAD. What happens next time you want to change the value of that component? I had problems with this scenario in the past, where pieces of sch was copied to another board, values of components changed but attached p/n were not updated. Now I have discrepancy between my board and BOM. That was kind of embarrassing. This whole approach just creates way more opportunities for errors.

author: Gibson486
author_rank: Frequent Contributor
timestamp: June 02, 2017, 03:03:01 pm
content: Quote from: ar__systems on June 02, 2017, 02:40:15 pmWell, if you change the value, you need to change the part number. At least with KiCad, some make it so you cannot just change the resistor value in the field alone. I can understand why people put that field in there, but instances where you are worried about what you are saying, people just make the value part of the symbol itself. At the end of the day, no matter what you do, it requires you to be very careful.

author: Kelbit
author_rank: Regular Contributor
timestamp: June 06, 2017, 06:09:48 am
content: Quote from: ar__systems on June 02, 2017, 02:40:15 pmSimple, I never change values on the schematic, only in the library. If I need to change the value of the part, I'll just delete the part from the schematic and add the replace part with the same reference designator set. My philosophy is that if it's on the schematic, it's got a manufacturer's part number attached. I don't edit parameters on the schematic - only in the library. That way, at the end, I have a BoM as an output with exact, orderable part numbers.

author: Gibson486
author_rank: Frequent Contributor
timestamp: June 07, 2017, 01:46:13 am
content: Quote from: Kelbit on June 06, 2017, 06:09:48 amI have done it both ways. There are pros and cons to both. The nice thing about changing it in the library is that everything is already filled out ahead of time (your description, you values, etc). It, however, becomes a huge burden to have the library full of different resistors. Every time you get a new value, you have to search to see if you have that value already.

author: Kelbit
author_rank: Regular Contributor
timestamp: June 07, 2017, 06:08:30 am
content: I actually automated that process in the current set of KiCad libraries I'm building up - I dumped all the 1% 0603 Panasonic ERJ series resistors from DigiKey to a CSV file, then wrote a python script to populate my library with them:This way I already have all the standard 1% series values ready to go, complete with supplier links.

author: Gibson486
author_rank: Frequent Contributor
timestamp: June 07, 2017, 12:15:37 pm
content: Quote from: Kelbit on June 07, 2017, 06:08:30 amThat is awesome. Unluckily for me, we just used the part number as the name. It was a bad idea in retrospect. We are using Altium now. I am trying out both ways to see which way is better for our needs.

author: Pr0toc01
author_rank: Newbie
timestamp: March 10, 2019, 10:46:50 am
content: Hi Im new here and off to a REALY bad start by raising a dead thread. (Pr0toc01 plays his Thread Necromancer card, everyone sighs and shakes their head in disgust)Im of two minds on this.I like the fact that I can just drop a capacitor on a schematic and enter the value for it without having to go looking through the library for the one with exactly the specs I need.On the other hand there have been times where i have ended up using values for components that just dont exist / nobody makes (hey im self taught, leave me alone)I like flexibility, but I also like knowing im not going to design something that cant actually be made unless I rework everything due to bad part values.Would it be possible for someone far mopr familiar with KiCad then myself to basically add a "KNOWN VALUES" option.So you have your schematic symbol, you have your foot print, you have your model, you have your Documentation file and then you have a file containing information about known manufactured components.Lets take resistors.So you have your --|/\/\/\|-- symbol that you put downyou hit V click it and in the EDIT VALUE window you get a list (like in the add part window) with known REAL WORLD value combinations for that resistor (10k 1% 1/4w) that also contains manufacturer name, part number etc?OR just manually enter the information (and have it ask if you want to save it to the list)This would give you the flexibility to use known real world values, or type them in on the fly as you go without the need for creating a new part in the library for every value combination...Its just a thought, and im not familiar enough with the code of KiCAD to try to make this work myself.Again, sorry about raising a dead thread

author: janoc
author_rank: Super Contributor
timestamp: March 10, 2019, 11:01:10 am
content: Quote from: Pr0toc01 on March 10, 2019, 10:46:50 ama) It is better to start a fresh thread than to hijack a random old one.b) What you want would require ENORMOUS amount of work from "someone" - you do realize that KiCAD devs are all unpaid volunteers, right?There are tons of possible "real world" combinations, literally tens of thousand when speaking about passives, from many manufacturers. Think not only values and tolerances but also temperature coefficients, materials, dimensions, max. voltage, etc.Some manufacturers provide their own libraries you can load and use but most don't. It is a pretty unworkable idea, IMO. When you are designing something, you calculate the values you need and then look up online what you can get (and how much it will cost - one can get even oddball values easily but they may be expensive specialty items!) and then adapt your design. Onlythenyou put it into a PCB CAD program.

author: rs20
author_rank: Super Contributor
timestamp: March 10, 2019, 10:53:37 pm
content: Pr0toc01, go tohttp://www.logwell.com/tech/components/resistor_values.html, print it out, and stick it to the wall next to your computer screen. Job done.

author: bson
author_rank: Unknown
timestamp: March 11, 2019, 12:47:07 am
content: Quote from: miceuz on April 24, 2017, 05:48:35 amThis is exactly what I do, too. I wish KiCad would standardize these fields so BOM tools would know what to look for.I may have a dozen 0.1µF caps, all 0402, but the one in the buck converter is different from all the others and needs to be a specific part. So I make those custom values visible on the schematic and the PCB fab layer, but many BOM tools can't be configured to look for them.I also wish it could use a simple REST API to do part lookups; then I could implement a simple server in golang that fronts a part inventory database and bridges queries to those distributors who will let me do API based parts lookups.

author: HendriXML
author_rank: Super Contributor
timestamp: March 13, 2019, 11:07:28 pm
content: Quote from: bson on March 11, 2019, 12:47:07 amThis repohttps://github.com/HendriXML/KiCad-BOM-reporteris about precise matching on different criteria. It’s work in progress, but it has a lot of potential.

author: mkschreder
author_rank: Contributor
timestamp: March 31, 2019, 08:15:57 pm
content: I constantly abuse the value field for part id. This is just the only way to make it work for larger projects.Sent from my SM-G960F using Tapatalk

author: mkschreder
author_rank: Contributor
timestamp: March 31, 2019, 08:18:17 pm
content: Quote from: janoc on April 23, 2017, 12:33:25 pmI disagree. It is extremely clean approach to create a bunch of 402 capacitors of different values. I even go as far as adding static text to them specifying value, voltage etc. Then I can just place these parts on the schematic and no more hassle. Great approach.Sent from my SM-G960F using Tapatalk

author: Bassman59
author_rank: Super Contributor
timestamp: April 01, 2019, 02:17:16 am
content: Quote from: mkschreder on March 31, 2019, 08:18:17 pmI split the difference by using a custom field for a house/company part number. That part number is for a "family" of parts, which is to say, parts that vary in only one parameter. So I have a family for 0805 1% resistors, and another family for 0805 0.1% resistors, and a third family for 0603 1% resistors. Therefore there are just three resistors in my passives schematic library. When I start to need 0402 1% resistors I'll make another resistor symbol for my library.A Python script takes the BOM generated by Kicad and uses the Part Number field and the standard Value field to key into a database that spits out a full vendor part number.There are many many ways to do this. At two previous jobs, the resistors library contained one entry for every part value/tolerance/package we'd want to use. At first glance that might seem unwieldy ("there are SO MANY resistor values!") but in reality, even for a company that did a lot of analog, the number of resistors we actually used was maybe 200, and the naming scheme was obvious so finding the part in the library and placing it on the schematic wasn't difficult."But what if you have to change the part value?" Well, that was easy, you just delete the old part in the schematic and replace it with one with the new value and same reference designator. The PCB layout didn't care. The schematics and BOMs were tracked as separate entities in the system anyway, and the system was set up for the convenience of the purchasing department. It ensured that parts put on the schematic got ordered and that they'd fit the footprint on the board, always.Also many people have suggested (and some have even demanded!) that Kicad implement a database for its parts library. Most people will agree that it's a good idea, but zero people have stepped up to propose a library database scheme, much less even implement one as a proof of concept.

author: Simon
author_rank: Unknown
timestamp: April 26, 2019, 10:04:59 am
content: I'm confused. I thought you could now specify a footprint in a symbol? Yes footprints and specific part numbers all need to go in on the schematic so that a BOM can be easily produced and ordered. An yes when it gets to things like elecy capacitors you have to have a symbol per port number as it becomes important as to what part you have chosen.

author: mkschreder
author_rank: Contributor
timestamp: April 26, 2019, 10:15:58 am
content: KiCads library system makes very little sense unless you hack it Simon and do what I do in this video:https://youtu.be/5-GwQi7LG-AI modified how kicad updates fields to make my life easier. Basicaly the rule is: never modify the part on the schematic - not even the value - do everything in the library and then update ALL fields besides the designator.Sent from my SM-G960F using Tapatalk