KiCad...How to create reusable schematic sections?


#1

Hey All;

I’m a software developer by trade, so I’m inherently lazy :wink: In software my goal is if I have a piece of code that I know accomplishes a goal and has been tested, I prefer to re-use code rather than rewrite it and possibly introduce bugs in the re-write.

Now that my KiCad diagrams are getting more complex, I’d like to do the same thing. If I have for schematic for a circuit and footprints I’d possibly use in other designs, (eg. Voltage regulators), is there a way in KiCad to re-use it or reference it across multiple projects?

As a secondary bonus, I’d like to be able to create a PCB of a piece of a larger schematic. I have a cnc mill, where I could mill simple pcbs before building the larger overall board.

Example, being able to pull out or just use the 3v3 regulator of this eschema:

I’ve just finished GTB4, so if this is covered in later courses, or you know of a tutorial, I’d appreciate any information or suggestions.

Thanks
Robert


#2

In KiCAD 4, I have done this using techniques like copying the schematic into the project where I want to use it and use the block-save function. Quite tedious and it took a few tries if I remember rightly. There is now a copy paste option to the KiCAD 5 menu options. Imhave not tried tham out, but perhaps that might help.

Check out the KiCAD Info site. They will surely have other ideas.


#3

Thanks @Steve_Mayze, I’ll take a look at the KiCad site. I think I’m just suffering from that feeling of ‘it aught to work this way…’


#4

Use hierarchical sheets with the same file name.

Any change in one of them is mirrored in the others.


#5

Worth noting is that you should not use any global labels for such cases. (Global labels are, well global. So instantiating a file multiple times with global labels in them might create shorts.)

Remember: Power ports are nothing else than fancy global labels.


#6

I’d like to hear more about this, because I’m running into some funny business when it comes to reusing hierarchical sheets.

Here’s what I mean by funny business:
When reusing sheets within a single design, KiCAD keeps the sub-sheet as one file, and makes the uniqueness of each instantiation of the sheet within that single file. (As in, it defines a resistor, then defines the RefDes unique to each instance.) Unfortunately, when I try to reuse that sheet in a new project, it keeps the original references to the original sheets. This would lead to the sheet getting bloated over time with old references. Is there a way to clean this up or to prevent this?

Here’s an example of the bloat I was talking about. https://github.com/sethkaz/Hierarchical_Sheets_Demo

I created a Project, made a subsheet that contained a single resistor, and instantiated the subsheet a second time. I reused this subsheet twice in each of two more projects. If you open up the subsheet.sch file, you see:
AR Path="/5BDFCE97/5BDFCEB4" Ref=“R?” Part=“1”
AR Path="/5BDFCFB5/5BDFCEB4" Ref=“R?” Part=“1”
AR Path="/5BDFCFD0/5BDFCEB4" Ref=“R?” Part=“1”
AR Path="/5BDFCFEB/5BDFCEB4" Ref=“R?” Part=“1”
AR Path="/5BDFCFFE/5BDFCEB4" Ref=“R1” Part=“1”
AR Path="/5BDFD027/5BDFCEB4" Ref=“R2” Part=“1”

It keeps appending a usage instead of removing the ones that it doesn’t need.