KiCad board merge tool (Frankenstein toolbox)

It's all about the code!
Post Reply
User avatar
AndreyB
Site Admin
Posts: 14342
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

KiCad board merge tool (Frankenstein toolbox)

Post by AndreyB »

I would like to introduce my Project Frankenstein, a set of tools to merge smaller KiCad projects into one large project. As in making the whole ECU board from smaller functional boards.

So, what is we have a number of independents KiCad projects and we want to bring them all together?
Schematic is trivial - just use 'Hierarchy sheet' and you are all set. All you need is to annotate all the modules so that you do not have a naming conflict. Easy! Zero clicks - just copy files in the proper folder and you are done.

Netlist? Actually, component list. Sure, easy. Just open both .cmp files and merge them in notepad. Pretty easy, 5 clicks. Still, I have created a tool to automate this:

Code: Select all

java -jar ../../java_tools/pcb_sync.jar cmp_merge frankenstein.cmp ../1A_injector_6-channels/inj_6ch.cmp ../adc_amp_divider/adc_amp_divider.cmp
PCB? Ops. Not so easy. One cannot just merge to PCB files into one with Notepad - for the reasons of Net naming issues.
First of all, all un-named nets would have names like "N-00000x" and you've got yourself a naming conflict. Even if you waste your time on giving all your nets unique names, you are still screwed - internally, KiCad sometimes references Nets by there ID and not by there name (For example, (via ... (net 0)))

So, PCBs can only be merged automatically, and that's exactly the kind of tool I have implemented!

So, here we have two projects:
Image
and
Image

Let's also create a simple template for the future combined board - just the common design rules and the common cuts rectangle:
Image

Now, with a simple command

Code: Select all

rem Let's merge these PCBs into the Frankenstein!
java -jar ../../java_tools/pcb_sync.jar pcb_merge frankenstein_template.kicad_pcb frankenstein.kicad_pcb ../1A_injector_6-channels/inj_6ch.kicad_pcb ../adc_amp_divider/adc_amp_divider.kicad_pcb
We combine these two PCBs into one
Image

You will now ask me - what about all that free space between the board? Right. That's true, we need a vertical revision of the analog board which would sit under the discovery - no script would be smart enough to re-arrange all these components. A human would need to do that.

My plan for this is some simple merge configuration file which would specify some simple actions while merging, for instance a list of components which should be eliminated.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 14342
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: KiCad board merge tool (Frankenstein toolbox)

Post by AndreyB »

I've decided to split the thread about the tool I use to merge the board from the actual board
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 14342
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: KiCad board merge tool (Frankenstein toolbox)

Post by AndreyB »

cilek wrote:but still I am not able to understand that how you deal with the free space between the boards?
In the merge script you can specify if you want to move one of the boards so that the gap is smaller or large. After that it's all manual - after all it's just a tiny command line tool :)
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
Post Reply