Is there a way to convert whole PCB in new footprint?

Hi everyone !
I’m wondering if there is a way (or magic tool ^^) to make a new footprint from a PCB file ?
In my case, i’m doing a small PCB which will be plug on others biggest PCB (like mother board). It’s easy to make a schematic symbol, but when I’m face to drawing the footprint… but since I designed the PCB of my small card, with all pads at right position, is there a way to transform the PCB file into a footprint ?
I think we have to use only pads and edge cut layout which will give us a new footprint, right ?
Thanks you

1 Like

If the smaller board is going to connect into a connector on the main board, can’t you use a footprint for that connector instead? Or will this be a custom connector?

If you need the daughter board in more than one project you could go the route of a template.

A quick and dirty option would be to:

  • copy the daughter board project into the template location.
    • (See the environment variable KICAD_PTEMPLATES in the “kicad main window”->preferences->“configure paths”)
  • remove everything except the required connectors. (In both the schematic and the pcb.)
    • You can use local labels to communicate what pin means what or hierarchical sheets.
    • Here i assume that the pads on the daughter board side are the same as on the mother side. (example if you use pin headers/ socket strips)
    • Otherwise it might be a lot harder. For smd connectors you need to flip them to the other side of the pcb. Depending on the footprints, this might move them.
  • If you are happy with the result, lock the footprints such that you can not move them by accident.
  • one option to check if everything worked is by using kicad stepup to create a 3d model form the daughter and mother board. After that assemble these two boards in any mcad tool and check if all connectors mate correctly.
1 Like

Yes, it could be done with a script, I’ve thought about writing it. The question is what exactly is the scope? Does the footprint need to include zones, tracks? Which pads are taken as connection points, how are they numbered, etc.

My guess is that by the time the script has been configured for a particular use, it might have been quicker to create the footprint manually. But since this requirement frequently comes up, it would be interesting to see what could be done.

The daughter boards have more than one connector (if there was only one, footprint would be mostly the connector’s footprint)
I did it manually for my first case, I place Edge.Cuts line in F.SkilS layout and put pads of connectors in footprint by converting relative XY coords in connector’s footprint by absolute XY coords in my new footprint from connector’s XY coords and orientation with text editor (notepad++).
It’s really faster than redrawing the footprint, but I think it’s simple to make it automatic with script (but not in my competence), so I wonder if someone already did it ?
I understand than some parameters are not “standards”, like which pads will be used between mother and daughter cards ? You can draw daughter PCB with components on top, but reverse the card on mother cards, so need a symetry… There will always be necessary to adjsut manually the footprint since everything can’t be guessed automaticaly, but the longer and repetitive works (placing pads with right size at right position) could be done in few ms with a script.

How does the script know which pads to use?

An example would help a lot.

In my case, I use pin header, but I know it’s a single case, and it needs to be set…
An example would be to put an arduino-like on a mother card, you have to make the footprint of your arduino-like card, and what you have is the PCB you did, so a script to make a footprint from the PCB would be great to place it on new mother boards.
In my case, I want to create many function on a 'template" cards, and plug it on my main card the version I need (it could be differents buck-boost supply, card to read contacts or a card to set contacts, differents sensors with same communication pins, but without same physical implantation of these pins…)
I don’t know if the best way is to set an array of connector’s type to keep in footprint and ignore everything else in beginning of a script, or set a propriety in eeschema on connectors you want to keep in footprint, so the script could identify in PCB with footprint to convert in new one…

Don’t you just make the daughterboard use some easy and well known connector placement? e.g. two 5x1 0.1" headers, separated by 1".

The Arduino layout is almost a simple DIP, apart from their snafu with non 0.1" spacing.

My goal is to use pin headers with 0.1" with right distance so I can plug it on prototype card, but there is no standards of dimensions, number of pins… etc
I can use 4x1, 4x2 (not compatible with pototype card), 7x1 and so on… Connectors in parallele, but not always (not compatible with pototype card)
I don’t want to be constrained in the way I route the card, so I wonder if it’s possible to automated the way to create a new footprint from any card.

I made a little progress on a script., so far I have extracted some info from the PCB:

>>>execfile ("C:\Python_progs\pcb_to_footprint\pcb_to_footprint\")
Found project c:\temp2\smart_rgb_led_at85\rgb_led
Found pcb: c:\temp2\smart_rgb_led_at85\rgb_led.kicad_pcb
edge at (91440000, 99060000) - (91440000, 99060000)
edge at (91440000, 83820000) - (91440000, 83820000)
edge at (76200000, 83820000) - (76200000, 83820000)
edge at (76200000, 99060000) - (76200000, 99060000)
origin 76200000, 83820000
bbox (76149999, 83769999) (15340002, 15340002)
pad 1 at 1270000,1270000
pad 2 at 1270000,3810000
pad 3 at 1270000,6350000
pad 4 at 1270000,8890000
pad 5 at 1270000,11430000
pad 6 at 1270000,13970000

The next step is to figure out how to create a footprint module.

maybe the footprint python library (footprint generator) by @pointhi could be of help here.

Yes, I have been looking at that. Here is a what I have now:

Original PCB

Converted to module :

The pads are numbered in the order they appear.

1 Like

A few more features and a more complicated sample:

Very nice ! it’s what I’m looking for, for personnal development or even for PCB open-source you can find on ghitub or else, it will be faster to build footprint and include them in our project !

Hi bobc !
Is it possible to have a link to your script ?

Sure, it’s only half finished. You will also need and edit the script a bit to point to the right path, and add parameters specific to your design. (13.2 KB)

1 Like

Thank you ! I will give it a try as soon as I can.

I tried it and it works well, thank you !

In the same way, is there some script to build a 3D model from the 3D view in pcbnew to apply on our new footprint ?

Kicad stepup (assuming you have step files for the parts you want to have visible.)

Simply import the whole pcb into freecad that way, remove what you don’t need, union all remaining parts. Import the footprint you created and align the unioned 3d model to it. Export the unioned 3d model to both wrl and step.

This workflow will not include silk or copper layers of the board. If you want that you will need to export the pcb to wrl directly from pcb_new and use blender or wings to edit your 3d model if necessary. (This workflow does not allow colaboration with mechanical engineering cad tools as it does not create a valid step file.)


Thank you for your fast reply ! I will try your method.