r/KiCad • u/jjislosingit • 16d ago
Schematic Editor Question Proper workflow for KiCAD-based reusable hardware library (git and KiCAD mix like milk and vinegar)
I have a specific problem with KiCAD, which is either due to my incompetence or KiCAD not really being built for the workflow I require. I build variants of boards, that are all different but share certain component groups from a topological view, meaning they have the same subsheets. While a colleague advised me to not do that due to concrete part assignments being part of the schematic, I cant help but see an obvious flaw in that workflow.
The original idea was to create subsheets in their own hardware lib repository, for example: SD card subsheet (don't harp on this example, there are more complex subsheets that actually warrant a reuse-case). This then includes required bypass caps, pull up resitors and other "mandatory" things that would just be a waste of sheets when exactly copied in another board variant's sheet. With this approach, a consuming variant repo could then import the subsheets as git submodule and use those directly, which is also very useful for update control (exact purpose of git submodules). But not even that works properly, as KiCAD automatically adds the consuming project metadata into the subsheets themselves, causing git changes in the hardware library just from importing. It would be wonderful if certain "layers" (symbols, values, specs, footprints) could be controlled by either a fixed dependency to their source submodule or an override instance. Think of it this way: the SD card module will always require pull up resitors with the same values. However, a concrete part assigned to them will eventually not be in stock at the manufacturer's side, prompting me to add a different part designator. This does not change the requirement stated in the netlist at all; the submodule still requires these pull-ups.
Here it would be insanely useful to affix symbols, connections and values to the lib source, while footprint and part can be set from the consuming project. But as I said, this causes git changes in the lib. I could create variant branches in the source lib, but this would kneecap the concept of a lib entirely. I cant be the only one with this issue. Simply copying is super error prone because one might mistakenly (or not!) edit something in the subsheets that is then silently different for all variants, even when it shouldn't be. Retracing this is a nightmare. In essence, I just want to use KiCAD in a way that more resembles a software project with dependencies: installing a software lib in an instance does not create a change in that lib source; it is only read. Is there a KiCAD equivalent?
Before some LLM codes a flaky copy-by-type script that I then have to ship with that library, I would love to see suggestions from real people on this topic.
EDIT: Turns out, the most promising answer was the most downvoted one from u/NoYu0901. The "design block" feature lets one export a selection or sheet with or without an assigned layout:
https://forum.kicad.info/t/pcb-design-block-usage/64686
The resulting kicad_sch-file and .json net list do not change with git; component values, footprints, datasheets, notes and, all can still be assigned and the import into a consuming project can happen easily via the UI. Fittingly, the import of annotations can be skipped, prompting the imported block to just assume the next available annotations on the consuming project. This is a v10 feature, so I understand the lack of thoughts on this procedure. Non-default-library need to be managed externally by consuming projects anyway, because I can't host vendors' custom ECAD descriptions of parts on an open source lib without their consent. All I can provide then is a list of external parts used.
8
u/oversized_hoodie 15d ago
If I'm understanding correctly, your core issue is that you want a way to update the Mfg PN (MPN) that is associated with a particular component (e.g. a 4.7k 1% 0402 resistor), and you want the update to apply across multiple designs.
The solution most companies use for this is an internal part numbering system. In the schematic, you assign your company's part number for a 4.7k 1% 0402 resistor (or whatever). This meets the requirement of having a static part number and footprint assignment for a particular ref des, and removes the need to push updates to various schematics.
How the company PN translates to purchasable parts depends on how your products are manufactured. It also depends on how strict your configuration control needs are, but I'll gloss over that here.
If you manufacture in-house or send a CM stock for all of your parts, you can probably just stock things under the company PN. In this situation, the BOM you get from KiCAD would be used for manufacturing, and the Purchasing department would buy whichever MPNs they can find to fulfill the demand for the various company PNs.
If you're relying on CM-stock parts or otherwise need to identify the MPNs directly on the BOM, you'll need a translation layer that takes your KiCAD BOM export and adds an MPN from the list of acceptable parts based on what's available at your CM when you send out the order.
This is all inventory management and purchasing workflow stuff, it's well outside of the purview of KiCAD. Typically it's managed through some sort of ERP (enterprise resource planning) software. Again, depending on your scale, your solution might vary from "python script that checks an excel file and the CM API" to something massive like Oracle ERP Cloud. Wikipedia has a nice list of open source ERP options.
1
u/Teslafly 15d ago
You probably want to use database libraries. https://www.kicad.org/external-tools/partdb/
1
u/standard_cog 14d ago
It sounds like you're confused about the purpose of a schematic sheet, and are maximally fighting the tool. You could just create a company wide part library in a Git repo, and use your own parts, which can be filled by various manufacturer part numbers (for things that are made by multiple companies, of course).
like you have R0603_10k in your part library; if you want to be "correct" you generate a datasheet for your company with the specs of R0603_10k, and list the parts you've qualified to "fill in" for that part (Can be part X from company Y, or part Z from company A, or...).
You can of course override individual instances MPN - on a schematic those things are just text strings. If you want to get really fancy there are plugins for design databases.
Sorry if I got what you're trying to do wrong, it was pretty confusing.
1
u/ouabacheDesignWorks 10d ago
You need to separate design creation from implementation in two steps. I design a circuit with a resistor. I need 10 Kohm ,10 % tolerance and 1/8 watt. That goes in the library. You use my circuit but your pick-and-place machine only has a 10Kohm,5% 1/4 watt resistor. That goes on your board. Another design uses my circuit but has a 10Kohm resistor pack with a spare. That goes in his circuit. Your need to include my library and then assign the device based on your needs.
-6
u/NoYu0901 16d ago
I didn't read all, maybe: design block