Every now and then a question about multiple PCB projects pop up on this forum, and usually the answer is that this is not implemented in KiCad.
So I’ve been toying with this idea in my head of making a hierarchy of projects.
The Idea is that each PCB has it’s own project, but there is also a project that binds them all.
So today I did an experiment and documented it, and it seems to work quite well.
This it not meant to be a totorial for people new to KiCad, so stuff like Footprint assignment etc, is mostly skipped.
It’s probably best to keep this tutorial clean, and therefore I’ve opened another thread to add comments or ask questions. Please post those at:
I do not yet know if this will work, but I’ll make some screenshots and document as I go. I start with making a few projects in the same directory:
“common”, “dac”, “micro”, “power”. When you make the projects, uncheck:
to put all the projects in the same directory. (Ignore the "directory is not empty warnings).
All 4 projects show up in KiCad’s project manager:
The next step is to make a common connector to connect all the PCB’s in the project.
1). Select the “common” project (Probably NOT important).
2). Start the Symbol Editor.
3). Symbol Editor / File / New / Library / Name "1234_New_Library.lib / [[Save] / [Project] (Library Table, as opposed to "global). / [OK].
Then make a new symbol in our new library:
1). Symbol Editor / File / New Symbol / 1234_New_Library / [OK].
2). I gave my connector the name “Interconnect”, and a “J” for RefDes.
Draw a pin. I’ve left the name empty, and give it pin number “1”.
Place the pin somewhere on the board, and then hit [Insert] a bunch of times, so you have enough pins. I thought 10 would be plenty for now, and then click on the “Show pin table” icon.
I’ve added the pin names of 4 pins. +5V, GND, SDA and SCL:
Then I moved the pins (by dragging as a block), added a rectangle, and filled it with background color:
- Make sure all pins are on a 100mil grid.
- When a block of pins is selected you can attachich it to your cursor with ‘m’, and then ‘r’ for rotate, or ‘x’ or ‘y’ to mirror in the X and Y axis.xxn
- For drawing the graphics I set the grid to 50mil (Note the top and bottom).
I want all my Interconnect connetors to be the same, so I’ve also added the Footrpint to the symbol:
Symbol Editor / Edit / Properties / Footprint / Connector_PinHeader_2.54mm:PinHeader_1x10_P2.54mm_Vertical
Symbol Editor / File / Save.
Symbol Editor / File / Quit. (You can probably leave it open).
Back in the project manager, make the “common” project active, and start the schematic editor.
Create 3 hierarchical sheets in the “common” schematic, and click [Yes] to link the hierarchical sheets to the already existing (empty) schematics.
Here are the 3 Hierarchical sheets:
Then I cleared and redid the Annotation. As expected it does all the sheets in the project:
Now it starts becoming interesting.
The main goal of this experiment is to make 3 separate PCB’s.
Pressing [F8] (After some footprint assignment) takes the components of all the schematics, and puts them on the PCB.
For this project this is clearly not what we want.
Therefore we close Pcbnew without saving, and we also exit Eeschama, but we leave the project manager open.
Then, in the Project manager, we select the power supply project:
… and then open it’s schematic, and press [F8].
This time, only the components of the power supply schematic are imported, which is exactly what we want.
For multi board designs, you often want to use the exact same board size, mounting holes and connector layout for all the boards, or you may want to have a template as a starting point, and edit it in the final design.
So now we make a 5th project, called “board_template”. It’s schematic is pretty simple. Just the connector and 4 mounting holes:
The “board_template” project is already active, so [F8] starts Pcbnew with only the connector and the mounting holes.
Set the grid to 5mm, and on the Edge.Cuts layer we add a graphic polyline, starting from coordinate (50 ,50) and draw a rectangle 60mm to the left, and 50mm to the south, and place the connector and the mounting holes on it.
It very likely is a good Idea to lock all the parts (& board outline?) now, but I forgot this step…
Then save and quit Pcbnew.
Next step is to import the new board template in the “power” schematic.
This is done with Pcbnew in “Stand alone mode”. Pcbnew is in "Stand Alone mode if it is opened from the command line, or directly from the start menu of your OS, and then:
Pcbnew / File / Open
… Browse to the “power” project and open it.
Set the Grid to 5mm, just to make all boards more conform.
Pcbnew / File / Append board.
Insert the template board. To keep later modifications easier, it may be a good idea to put the template on all the sub projects in the same location, and that is why we set the grid to 5mm. As insertion point I moved the mouse to ( 0, 0), which is 10mm outside the left top of the page. Coordinates and grids may get confusing when switching between imperial (for lots of 0.1" holes) and metric (Hey, I live in Europe). Another reason for logical coordinates, is as preparation for revisons. It should be able to simply delete the board outline (with holes & connectors) from the sub-projects, and re-import them from the (modified / updated) template).
Save the imported template in the power.kicad_pcb, and exit the stand alone version of Pcbnew.
In the Project Manager, double click on the “power” project to make it active and look at the results. The board outline, mounting holes and connectors are all there.
Nothing else is in the board, because I had not saved it before.
There are some differences between the schematic, and the freshly imported template PCB. The connector on the template has RefDes J1, while on the schematic it has refdes J3. (The schematic also has no mounting holes, but one step at a time).
Pcbnew, change the RefDes of the connector to J3, because that is the correct name of the connector for this board.
Open the schematic and press [F8]. By default it wants to remove the mounting holes, and the connector, and replace the connector with another one:
This is not what we want.
1). Uncheck “Delete extra footprints”.
2). Select: “Re-associate footprints by reference”
The “Update PCB from Schematic” now looks like:
Clicking “update PCB” and “Close” attaches the new components to the cursor. J3 is not part of the new import, because now the connector from the template is used. After a bit of cleanup it’s clear from the Ratsnest that the connector is accepted as part of the design, and this is a good point to save the board.
When designing a PCB, I often go through a lot of small iterations and go back and forth between schematic and PCB.
As a “revision” I add an extra 100nF capactior to the schematic, and then press [F8] again. First it doest the annotation (Oops, it’s called C1), and upon updating the PCB almost all the nets get “Reconnected”, but I pressed “OK” nonetheless, and all looks OK.
For a real project it’s easier to keep components separated by giving them RefDes numbers which are far apart. For example, everything on the “power” board starts with 100+. But those are just details.
For working on the schematic you should choose the “common” project, to make sure annotation does not use duplicate the RefDes for different sub-projects.
From within the “common” project you can work with hierarchical labels, just as with any hierarchical labels. ERC should also work normally.
When updating a PCB, you should first switch to the sub project, by selecting (double cliking) it in KiCad’s Project Manager. If you forget this step, then all components of all PCB’s will get imported in the PCB of the “common” project, which is harmless, but probably also useless.
When you forget to switch back from a “sub-project” to the “common” project, you may create duplicate symbols during ReDes assignment, but it’s easy to fix, and it’s just another good reason to keep the number 100 or so apart.
It’s also a limitation. All the RefDes must be unique across the whole project.
If you want to experement with it, here’s the zipped project:
2019-06-20-experiment_multi_pcb.zip (196.3 KB)
As said before, please post Idea’s, suggestions questions and discussions in:
That’s it for today, but this thread will probably be edited and updated later.