Low Cost PCB's Low Cost Components

Author Topic: Hacking the KiCAD Libaray system to be actually useful  (Read 6083 times)

0 Members and 1 Guest are viewing this topic.

Offline janoc

  • Super Contributor
  • ***
  • Posts: 1766
  • Country: fr
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #25 on: May 18, 2017, 06:31:40 AM »
A library *is* a database and should be treated a such.    It makes non-trivial designs manageable.         

Part 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.

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.

Yes, 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.
« Last Edit: May 18, 2017, 06:44:46 AM by janoc »
 

Offline homebrew

  • Regular Contributor
  • *
  • Posts: 204
  • Country: ch
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #26 on: May 19, 2017, 04:48:26 AM »

Part 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.

The 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.


Yes, 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.

Actually 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.
« Last Edit: May 19, 2017, 04:51:00 AM by homebrew »
 

Offline Vasi

  • Contributor
  • Posts: 40
  • Country: ro
    • My photo gallery
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #27 on: May 20, 2017, 10:15:44 PM »
I think practice is the best advisor - and a ton of projects to be finished.
 
The following users thanked this post: jancumps

Offline ar__systems

  • Frequent Contributor
  • **
  • Posts: 317
  • Country: ca
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #28 on: May 25, 2017, 09:36:16 PM »
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.
Nobody 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? 
 
The following users thanked this post: splin

Offline Gibson486

  • Regular Contributor
  • *
  • Posts: 65
  • Country: us
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #29 on: May 27, 2017, 01:57:30 AM »
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?
 

Offline Kelbit

  • Contributor
  • Posts: 48
  • Country: ca
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #30 on: May 27, 2017, 06:02:51 PM »
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.
 

Offline homebrew

  • Regular Contributor
  • *
  • Posts: 204
  • Country: ch
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #31 on: May 28, 2017, 08:31:57 PM »
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.
Nobody 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?

Well 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 ...
 

Offline ar__systems

  • Frequent Contributor
  • **
  • Posts: 317
  • Country: ca
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #32 on: May 29, 2017, 12:32:39 AM »
Well 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 ...
Well 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.
 
 

Online Rerouter

  • Super Contributor
  • ***
  • Posts: 2884
  • Country: au
  • Question Everything... Except This Statement
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #33 on: May 29, 2017, 10:03:10 PM »
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?

Personally, 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 part

What 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.
« Last Edit: May 29, 2017, 10:40:32 PM by Rerouter »
 

Offline Gibson486

  • Regular Contributor
  • *
  • Posts: 65
  • Country: us
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #34 on: May 31, 2017, 02:39:09 AM »
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?

Personally, 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 part

What 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.

I used this to move library stuff around...

https://www.compuphase.com/electronics/kicadlibrarian_en.htm
 

Offline Kelbit

  • Contributor
  • Posts: 48
  • Country: ca
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #35 on: June 01, 2017, 11:03:24 AM »
Well 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 ...
Well 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.
 

I'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.
 
The following users thanked this post: voltsandjolts

Offline ar__systems

  • Frequent Contributor
  • **
  • Posts: 317
  • Country: ca
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #36 on: June 03, 2017, 12:40:15 AM »
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.
 

Offline Gibson486

  • Regular Contributor
  • *
  • Posts: 65
  • Country: us
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #37 on: June 03, 2017, 01:03:01 AM »
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.

Well, 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.
 

Offline Kelbit

  • Contributor
  • Posts: 48
  • Country: ca
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #38 on: June 06, 2017, 04:09:48 PM »
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.

Simple, 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.
 
The following users thanked this post: voltsandjolts

Offline Gibson486

  • Regular Contributor
  • *
  • Posts: 65
  • Country: us
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #39 on: June 07, 2017, 11:46:13 AM »
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.

Simple, 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.

I 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.
 

Offline Kelbit

  • Contributor
  • Posts: 48
  • Country: ca
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #40 on: June 07, 2017, 04:08:30 PM »
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.
 

Offline Gibson486

  • Regular Contributor
  • *
  • Posts: 65
  • Country: us
Re: Hacking the KiCAD Libaray system to be actually useful
« Reply #41 on: June 07, 2017, 10:15:37 PM »
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.

That 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf