Tutorial: How to make a footprint in KiCad 5.1.x?

Disclaimer: Screenshots taken in a nightly from after the 5.0.0-rc2 tag. (KiCad 5 will look very similar but there will be slight differences in KiCad 4)

The official docu gives a few hints about how kicads footprint editor works.

Other FAQ articles worth reading:

Other interesting resources:

Content of this Tutorial

The first part of this tutorial gives a short introduction to footprint design. It is followed by two example footprints. Direct links to these tutorials for your convenience.

What is a footprint anyway?

A footprint describes the interface between the circuit board and the component it self. This is often called the land-pattern. At the least it needs to contain so called pads. It is also suggested to at least include the part outline and part identifiers (reference and value) on the silk and fab layers. Defining a courtyard area is also part of a good footprint.

The footprint name

Be careful when naming your footprint. Make sure you include enough information to clearly communicate what the footprint represents.

If a footprint is specialized for a single component then include the part number and the manufacturer name. For generic footprints include all identifying parameters. As a first step have a look at the footprint naming guide of the official library

Pads (The interface for soldering)

Pads are the representation of exposed copper features to which the leads of the component will be soldered.
Exposed copper means that in addition to defining the copper area the pad also needs to define a hole in the so called solder mask. Typically this cut-out is larger than the copper feature. This is achieved using the clearance settings. (In a typical footprint one sets it to 0 as this is normally handled in the pcb_new project settings.)
For through hole components there is also the drill defined.
In addition the pad number must also be set to allow the connection between footprint and symbol (between schematic and layout)

An exception are non plated through holes. These define only a drill size. (No pad number, no copper)

The silkscreen (Documentation printed onto the board)

The silkscreen is what will be printed onto the board. The colour of it will most likely be white. One can put anything onto it. It is however typical to include the outline of the component, the reference and a polarity marker. This highly depends on your preferences, the space available and on your manufacturers restrictions.
The outline is normally drawn outside the nominal dimensions of the part. It should also not overlap any exposed copper features (Keep it away from pads)

For small smd parts one needs to take care not to include silkscreen below the part itself, as it can increase the probability of soldering problems. (Example tombstoning)
If this is not a concern in your particular application then you can also include silk under the part to aid manual assembly. (Especially useful for through hole connectors. Can make it easier to know the insertion direction.)

The fab (fabrication) layer (Technical documentation for manufacturing and maintenance)

The fabrication documentation layer does not directly interact with the pcb. It will most likely only be used as documentation for assembly or for maintenance. It can also be very helpful during the pcb design process. Typically it contains the outline of the part. (Exact dimensions are preferable.)

Including the reference and value field plus a polarity marker makes this layer a lot more useful. (Text sizes can be decreased compared to the silk layer as we do not need to take care of manufacturing constrains. This allows putting the reference inside the part outlines -> less clutter while layouting the board.)

The courtyard (keepout area for other parts to allow for assembly)

The courtyard area defines a keepout for other parts. This is used to communicate the space needed for assembly and soldering. How much space is required depends on which assembly process is used. The space required for hand soldering is much larger than for reflow soldering. Manual placement also has different requirements when compared to automatic placement using a pick and place machine.

Since version 5 courtyard overlap is checked by DRC. For this to work the drawing must be a closed polygon. (Endpoints of neighbouring features must be within 0.01mm)

Creating a footprint using the footprint editor

Introduction

All elements of a footprint are specified relative to the footprint origin. This means pads are defined via their center point relative to that origin plus size specifiers.
To create a footprint the first step is to translate dimensions given in the datasheet into a form that gives the center position and size of pads. (Relative to the chosen center)

What center should be chosen for the footprint?

If your footprint is intended only to be used by yourself and you hand populate the pcb, then you can put the center anywhere you want. (Make it easy for your self. We will get back to that later on.)

Center point for automatic assembly

If the pick and place center position is given in the datasheet then use that.
For surface mounted components (SMD) the center of the part body will be a good choice for the footprint center.
For through hole parts (THT) typically pin 1 is chosen as the center position.

Something important to keep in mind: If you plan on having your board assembled by a machine, talk to the guys programming it. They can give you guidance.

Getting dimensions for the footprint

Disclaimer: This section might go into too much depths for a novice. Especially the later subsections. In practice eyeballing the dimensions should be ok for a lot of use-cases. Especially true if the part is hand-soldered. It might still be a good idea to read this as it might give you inspiration for how to improve your skills.

What can be expected inside a datasheet

Every good datasheet at least contains a detailed dimensioned drawing of the component. Some even contain a suggested footprint layout to give the user a starting point.
Such a suggested footprint should not be taken at face value. Especially older datasheets might be out of date with current manufacturing methods and industry standards. (Meaning if you have access to some reliable piece of information that contradicts the suggested footprint, it might just be that the datasheet is wrong.)

The dimensioned drawings are most likely found somewhere near the end of the datasheet. (Not all datasheets follow that rule. I have encountered datasheets where the packaging information is somewhere in the middle.)
Some manufacturers do not include the dimensioned drawings in the datasheet but have them in a separate document.

What to do if datasheet does not give a suggested footprint?

If a datasheet does not contain a suggested footprint, it is possible that the manufacturer supplies an application note that aids the user in creating a valid footprint. Dimensioned drawings of footprints in such application notes do not necessarily apply to the component in question. (Application notes might be written with many different components in mind. Drawings might just be examples for some of them.)
Some conclusions can still be drawn from the application note even if it is not for the exact part you are using.

Another source for information are similar footprints from a trusted source. In most cases it is easier to modify such a footprint than to create one from scratch.

Datasheets of similar parts by other manufacturers can also supply some useful information. Especially if they contain both a dimensioned drawing of a footprint and the package. If the dimensioned drawing of the package is the same as your component then you can use the footprint as is. Otherwise you can use it to get information about fillet sizes. (More details in the example about the qfn footprint below.)

Some manufacturers also have a specialized tool with its own specialized file format to share footprints with their users. (Analog devices is an example for that. Sadly their tool only runs under windows. It also requires you to register with them. At least at the time of writing this.)

Using industry standards

Industry standards can be of great help when designing a footprint. Sadly such standards are most likely closed. (They are quite expensive.) One well known standard for smd parts is the IPC-7351 series. (IPC-7351B is the most recent standard at the time of writing. IPC-7315C is expected to be released soon.)

There exist tools that generate footprints in accordance to IPC standards. All of them however are closed and cost quite a bit. (If you really worry about being complaint this will be the price to pay.)
There are some open tools out there (Example: The python footprint generator for kicad has some ipc generators The QEDA project also has some IPC footprint generators.). Such tools are not able to give you a certificate for your parts.

We will discuss the terminology used in this standards later on. We will also design a footprint using some of the more easily to find recommendations. (With some patience a surprising amount of information about this standard can be found.) Older IPC standards can even be found complete on some file sharing sites. Be aware that sharing them would be a violation of copyright. (This is why we will not link to any such documents here.)

Talk to your manufacturer

If you know which manufacturers will be used to produce your PCB and also who will be used to solder it, you might want to ask them for their “Design for Manufacturing” (DFM) guidelines. These guidelines might contradict other industry standards. (Like with every other competing set of standards.) Use your own judgment what guideline to trust. (If it is critical it might pay to produce some sample pcbs and analyze the result.)

18 Likes

Example footprint Molex Picoblade (From suggested footprint in the datasheet)

To illustrate the points above lets look at an example. We will be making a footprint for the molex picoblade connector 53398-0671. Molex supplies dimensioned drawings with a suggested land pattern.

Getting the necessary dimensions from the datasheet (dimensioned drawing)

picoblade_easy_center
The black dimensions are the ones already present in the original drawing. The blue ones are also from the same document but they come from a different drawing.

In red are the things we need to calculate in order to make the footprint. (As we can only enter the center position and sizes of pads.)

To make it easy for us we placed the center such that it aligns in the y direction with the center of the mounting pads.

However this part defines a center for the pick and place machine. (For our part the drawing is on page 4)
This of course makes it a lot more complicated as we then need to do more calculations. (In fact even the calculation of the center position relative to the body outline is quite involved and not shown here.)
For the remaining tutorial we will use the easier drawing as our reference. (Just be aware that this would make live harder if you want to use this footprint for programming a pick and place machine.)
picoblade

Preparing the footprint editor for creating the footprint

For following this tutorial create a new empty project. Open the footprint editor and create a new footprint library (file->new library) and add it to the project library table. (I suggest to call it tutorial and save it inside the project directory.) More details about how to make a footprint library

You should now be able to find your library in the treeview (scroll down till you find it. You can also use the search field to filter for its name.) Right click on it and select “new footprint” in the context menu. As name for that footprint i would suggest something like “Molex_PicoBlade_53398-0671 ”.

The result should look like this.

Adding the mounting pads using the user grid.

To showcase how the user grid can be used for creating footprints we will use that to add the mounting pads.

First we setup the user grid such that grid points are where our two mounting pads should later be. Open the user grid definition from the view menu (In kicad 4 it is found in the Dimensions menu)
Set the x spacing to 5.675mm. (We calculated 5.675mm for xm.)
The y spacing is not critical right now but to reduce the possibility of an error we set it to some large value. (5mm should do the trick.)

Now place the first pad for the mounting pins. Open the pad properties dialog (Press e while hovering above the pad. Also reachable via the right click menu -> preferences)
Set the pad to SMD, rectangular, x size = 2.1mm and y size = 3mm
We give the mounting pads the pin number “MP”. We do that such that it is compatible with the symbols of the official library. (There are symbols that allow connecting the mounting pad from the schematic.) Alternatively you can leave the pin number for the mounting pins empty. That will mean you can not connect them from the schematic. (Depends on your needs.)
The pad settings should look like this:

Now we duplicate the mounting pin. Start the operation with [crtl+d or right click -> duplicate] move the mouse to the right and left-click to place the second mounting pad.
The resulting footprint should now look like this. (I set the grid to be viewed as lines to make it easier to see in the screenshot.)

Adding the “normal” connection pads

We now add the remaining pads to the footprint. To showcase the grid workflow a bit more we will use it again. In a second footprint we will show how the same can be done using the array function of the modern (open gl) canvas.

Now we setup the grid center to be at y=-2.75mm (the y axis increases towards the bottom of the screen. We want to place the pads 2.75mm above the mounting pads so we need to enter a negative value.)

To reduce the possibility for errors we also set the x grid origin to -3.75mm (The origin is then at the position of pad 1)

The grid spacing in x direction is now set to the pin pitch (1.25mm)

Now place the leftmost pad. (At the grid origin = White circled cross mark.) Again edit the pad properties and set the size for the pad as shown in the dimensioned drawing. (Reminder: 0.8x1.3mm) The pin number should already be equal to 1.

Now reactivate the pad placement tool and place 5 more pads using the grid points. Notice that kicad automatically increases the pad number.
The footprint should now look like this:

The most important parts of the footprint are now done. Everything else is mainly for documentation, quality control, …

Adding the part outline on the fab layer, silk layer and courtyard layer

Read this FAQ article to learn what layer is used for what purpose

What should be on these layers can be taken from the kicad library convention. At least a part outline on the fab and silk layer plus pin 1 markers and a simple rectangle defining the courtyard area should be present for a well defined footprint.

Silk and Fab outlines

We will keep using the user grid. The outlines on silk and fab are not critical to the function of the part. It still makes sense to create them as exact as possible. (Some datasheets are missing critical information to define the details of the part outline. In such cases either a physical part can be measured, maybe a 3d model exists that can be used as a reference or one needs to approximate the outline.)

As the molex drawing includes all necessary measurements we can make an exact outline. (Deriving the measurements will be left to the reader as we already detailed that for the pads.)
Lets draw the main body outline together. Try to calculate the grid settings your self and compare them to my results: origin=(x=-4,625mm, y=-2.6mm), size=(x=9.25mm, y=3.7mm)

Set the fabrication layer as the active drawing layer. (Left-click on the F.Fab layer name in the right toolbar. The blue triangle should now point to the F.Fab layer.)
Select the line tool (right toolbar) and left-click on the grid origin. Move the mouse to the next grid point (example to the right) and click again. Repeat this for the remaining 3 lines to get a closed rectangle. Use the ESC key or double-click to end the tool.

The line thickness can be changed using the properties menu of said line. (shortcut e) Sadly there is no way to change multiple lines at once. Setting the default thickness is done in the properties dialog of any line. (The fastest workflow i know of is creating the first line, setting the default thickness and then draw the rest.)

After the main rectangle is drawn the body should look like this.

We can now repeat this process to draw small rectangles around the parts holding the mounting pins. and the body outline is done.


For the silk outline it is enough to set the grid to some small value (example 0.05mm) and just draw it such that it is fully outside the F.Fab outline.
To get it symmetric we first reset the grid origin back to 0,0.
If this is too imprecise for your liking you can continue walking around using the grid and grid origin.

One important thing to note is that it makes sense to avoid putting silk over the area that will be free of mask. So keep a small clearance to pads. (The clearance depends on the manufacturer used. For committing to the official library look at the KLC.)

After adding the silk outline plus a pin 1 marker on both the silk and fab layer the footprint could look something like this. (Note that you can also use other types of pin 1 markers. There are industry standards that give suggestions.)

Courtyard outline

The courtyard outline defines the area where no other part should be placed. It is principally up to the designer to decide how large this area should be. Again the KLC can give beginners some guidance. Another point of reference are industry standards.

KiCad 5 is now able to check for courtyard violations. For this to work the courtyard outline must be a closed polygon (Each segment end point must be with 0.01mm of the next segments start point.)

As this is a footprint for a connector and i use the KLC as my guide, i create the courtyard with 0.5mm clearance all around. (In this case relative to the pads as they protrude the body in all directions.)

In the end the resulting footprint could look like this:

Improving the resulting footprint

If you compare the footprint we created with the one found in the official library you will notice that the one in the library is a lot more complex. The fab outline is a lot more detailed and the silk outline follows it much closer. It should be noted that the footprint found in the official lib is script generated.

Another improvement would be to use the pick and place center point as the footprints origin. And the courtyard outline could follow the outline more closely.

7 Likes

Example footprint QFN-64 with exposed pad (Calculate land pattern from part dimensions)

As a second tutorial we make the footprint for ATmega165A-MU. A dimensioned drawing of the package is found in the datasheet on page 827.
You will notice that this datasheet does not include a suggested footprint layout. Now we are forced to develop one from the dimensions of the package alone.

Definition of terms

We will borrow a few terms from industry standards to discuss how to derive a footprint.
The first terms you will come across reading such a document are heel, toe and side solder fillets. These define the size increase of the pad compared to the lead contact area in their respective direction.
The lead contact area is calculated to fit most parts. (The contact area after production should agree with the calculated area with high statistical certainty.)
ipc_terms

Calculating the lead contact area

The first step for determining the pad sizes and position is to find the lead contact area. Here it is helpful to use a cad program. Pencil and paper should also be enough.
From the datasheet drawings we get the following result. (Green are maximum values. Blue are minimum values. Note that we put the maximum lead size together with the minimum body size.)

However this picture is a bit overly cautious. It is very unlikely that the pads are at their maximum tolerance at the same time as the body is on its minimum. A more realistic calculation is shown below.
A rigorous calculation must consider manufacturing tolerances as well. (Placement tolerance and tolerances from PCB production.)

For the purpose of tutorial we ignore both shortcomings. (We use the above result as is. It is in this case remarkable close compared to a more detailed calculation.)

Improved calculation of Smin

For anybody interested i give an example of how Smin could be calculated more accurately. Lets start with how we have it now:

  • Smax = Dmax - Lmin
  • Smin = Smax - Sum(tolerances)

Where D is the body size and L the contact (lead) length.

As mentioned above simply summing up all tolerances is overly cautions. A better way is to sum up the squares of all tolerance. The error term is the square root of that sum.

  • Smin(RMS) = Smax - √(Sum(tolerances²))

Calculation of the pad sizes

We use the following fillet sizes to calculate the needed pad sizes:

  • heel = 0mm
  • side = -0.04mm
  • toe = 0.3mm

The source for these is this blog post. (They are from IPC-7351)

The two pads on top are shown to check if we have a problem using these measurements. Everything looks ok so we can go into kicad and start making our footprint.

Placing the pads in kicad

Create a new footprint as shown in the Connector Molex footprint tutorial above. (As a name something like QFN-64-1EP_9x9mm should do for now. A better name would include more information. The footprint naming convention of the KLC could be used as a guide.)

This time we will use the array function of the modern (opengl) canvas. Place the first pad at x=-4.425mm and y=-3.75mm; size x=0.85mm, y=0.22mm.
Right click on the pad and select create array [or shortcut ctrl+T].
In the array dialog set the vertical count to 16 and horizontal count to 1. Vertical spacing is set to 0.5.
For correct pad numbering set the initial number selection to “start number” and enter 1 as the start number.

We do the same with the bottom row. Place the leftmost pad and give it pad number 17. (coordinates are now y=4.425mm and x=-3.75mm)
Again start the array dialog. It should still have the same values as before. So we change the vertical count to 1 and the horizontal count to 16. Make sure horizontal spacing is 0.5 and that the start number is 17.

For the remaining two side repeat the same. Place the bottom left pin and start the array function from there. We use negative spacing to get the pads to increase their pin numbers in the right direction. (remember to update the start number)
Here shown the array setup for the top row starting from the top right pad:

In the end the footprint should look like this

The exposed pad

Footprints with a large exposed pad pose a number of interesting problems. They are nearly impossible to hand solder. To make live easy one could add a large through hole (large drill) to be able to solder it from below. In this tutorial we will however make a footprint such that it can be reflow soldered.

For reflow soldering of such parts we need to reduce the paste coverage of the exposed pad to somewhere between 50 to 80% by area. (Different sources give different ranges.) We will aim for 65% as this is in the middle of this range and should be a good compromise.

In addition to reducing the paste area it is suggested to split it into multiple small areas. This allows for better out-gassing. Another benefit is that squeegee deformation is limited as the openings in the stencil are smaller that way.

The pad size is not that critical. Most manufacturer datasheets seem to suggest the nominal lead size in their datasheets. In our footprint there is enough space between the exposed pad and the normal pads. I personally would therefore increase its size a bit. (I would use the IPC calculations with 0 or a small negative fillet.)
For this tutorial we simply use the maximum pad size (5.5x5.5mm)

Add a rectangular SMD pad with size 5.5x5.5mm at x=0 and y=0. Set the pad number to 65 (one higher than the maximum normal pad number). Deselect the paste layer as we want to have it controlled by separate pads.

Now we still need to add the paste layer. A good rule of thumb is that each paste pad should be around 1x1mm. In our case we would have the choice between an array of 4x4 or 5x5 paste pads. (As we make it by hand i chose to go with 4x4)

The side length for the paste pads is calculated as 5.5*√(0.65)/4 ≈ 1.1
Using that we can sketch the layout in a cad program (or do the math by hand) such that the paste pads are equally spaced. (I aim for the inner paste clearances to be double the outer ring.)


Using the array function is not really possible in this case as it does not allow us to assign no pad number to the resulting pads. So we fall back to using the grid and the duplication of an initial pad.

For the first paste pad the pad properties dialog should be:

After placing all paste pads it should look like this. (Note that you will need to set the F.Paste Layer as active to see the paste layout.)

Bonus: Adding thermal vias

Some footprints with exposed pads need vias to connect the pad to the bottom layer (Or an internal large copper zone). This allows for better thermal management. One can of course leave this for the board design but there it gets tedious. A lot easier is placing them while creating the footprint.

Introducing vias into the pad has some drawbacks. The most noticeable is that it will result in solder loss. There are multiple ways to combat that. The cheapest being to accept some loss and increase the amount of paste. Another option is bottom tenting. If you follow the tutorial exactly you will end up with bottom tented vias. (Talk to your manufacturing guys if this is a good idea for the process used in your project.)


The first step is to decide how many vias should be placed and where. I decided to go with a 5x5 array with the outermost ring touching the outer edge of the pad. As via size i chose 0.2mm drill with 0.15mm annular ring. (Resulting in 0.5mm pad size)
Using a CAD program i get the following layout:

We setup the grid again

  • origin at any via. In this case a via is at the origin. (Meaning 0,0 is a good choice for our grid origin)
  • Spacing is the via pitch we determined in the sketch.

Place a pad and change it to be a circular through hole pad. Pad number 65, size 0.5mm and drill 0.2mm. Remove the ticks for F.Mask and B.Mask. (F.Mask is removed because we want to control where mask is placed with other pads. Removing the tick for B.Mask results in bottom tented vias.)

Duplicate that pad again for every grid point. (As soon as you have created one row or column you can select all these vias and duplicate a full column at once.)

For even better thermal results you can add a large pad on the bottom side. If you plan on adding a heat sink activate B.Mask for it. If not then you can disable it (The thin solder-mask film has very little influence in the ability to transfer heat to the air.)

Improvements for the thermal via footprint

In the screenshot you can see that the paste pads do not really align with the same grid as the vias. (Some vias are covered more then others. This can create problems in manufacturing as this way the process is hard to control.)

In the screenshot i show a few options of how to improve that. The green option shows the result of moving around the current paste pads such that each of them is in the center of 4 vias.

The magenta options are designed such that they avoid the vias with 0.1mm clearance. The leftmost magenta option trades paste coverage for clearance.
A better result is using camfered pads (The next two magenta outlines.). Chamfered pads need to be created from custom (polygon) pads. An alternative would be using rounded rectangle pads.
The script used for creating such footprints for the official library does that automatically.

If you choose the first solution (same sized pads but arranged differently) the resulting footprint will look similar to this:

Finishing the footprint and possible improvements

Add an outline on the fab layer (including a chamfer on the top left corner to mark pin 1.)
Add lines on the silk screen around the corners. (Leave out the line nearest to pin 1 as the pin 1 mark)
And add a courtyard outline. (0.25mm clearance to the pads is suggested by IPC for nominal density.)
For details how this can be done look at the connector molex tutorial above.

As inspiration the script generated footprint for the same part:

It might also be a good idea to use rounded rectangle pads with 0.25% round radius ratio (maximum 0.25mm radius).

As a bonus exercise you can try to follow the Tutorial: How to check footprint correctness? tutorial to check if you made your footprint correctly.

11 Likes

Through hole parts

Hole sizes and tolerances

For THT parts we need to find the correct hole size addition to everything we did in our other tutorials.
If the datasheet of your part contains a suggested footprint (or at least a suggested hole pattern) then you can use that.

Most modern fabricators assume any hole size given in the design documents to mean the finalized hole size. They will increase the drill diameter to account for the plating thickness. Their given diameter tolerance includes both the tolerance of the drill and plating process. (Unless they give this information separately.)

If there is no suggestion in the datasheet then we need to calculate it from the part dimensions. The hole size is influenced by all size and spacing tolerances of the part leads as well as hole size and drill placement tolerances. In addition one would also need to leave some space for solder.

tolerances

Positional tolerances can be converted into size tolerances. Sometimes this is already done for the manufacturer tolerances. (Lead pitch is often given without tolerances. In such cases the pitch tolerance is typically included in the lead size tolerances.)

positional_tolerances

Hole size from industry standard suggestions

Working with tolerances is kind of complicated and also error prone. Luckily there is a good rule of thumb for determining the hole size given in IPC standards.
They suggest to add 0.2mm to the maximum lead size. Meaning if you have a cylindrical lead with a diameter of 0.65 +/-0.05mm then you would use 0.65+0.05+0.2 = 0.9mm as the final hole (=drill) diameter.

drill_diameter

Hole size Calculation for “rectangular” leads

For leads with rectangular cross-section one would need to calculate the equivalent circular lead. (= enclosing circle that just touches the 4 corners of the rectangle)
This means calculating the diagonal (using Pythagoras theorem or a CAD program).

rectangle_lead

Lets assume our lead has dimensions a=0.35 +/-0.05 and b=0.25 +/-0.05 then the equivalent circular lead diameter would be √(0.4²+0.3²)=0.5

Oval hole (milled slot) dimensions for “rectangular” leads

It makes sense to use an oval hole (=milled slot) for leads that have a cross-section of a very long and skinny rectangle. Plating milled slots is not supported by every manufacturer. In addition there are also some manufacturers who do not support the way KiCad defines such slots. (Ask them first before you design your footprint this way.)

The easiest way to arrive at the dimensions of such a slot is by increasing the lead width (shorter side of the rectangle) by 0.2mm and the length by the hole width.

oval_drill

4 Likes

3D-Model handling

Disclaimer: Screenshots from current nightly (will become version 5.1). Version 5.0.x looks slightly different.

Preparing the 3D Model for KiCad

Molex offers 3d models for their connectors on their website, so we will continue with our picoblade connector. Go to the product site and navigate to the engineering documents section where you will find 3d model files. Download the step file (some subpages later).

Selecting the file format

KiCad supports both wrl (tessellated surface model) and step (CAD exchange format). More details see: What is the difference between step and wrl 3d models? All official footprints are setup for wrl but KiCad will replace the file ending with step if it needs it (on step export)

Aligning the model to the footprint

Most models you download will not be aligned in the way kicad expects it to be aligned.
You can of course use the settings of the footprint to align it but this is quite fiddly so the suggestion is to already align the model in your 3d CAD program. In this tutorial we will use freecad 0.18 with the extension kicad-stepup

Import elements

With stepup we can import both the footprint and the downloaded step model into freecad. First we load the footprint as shown in the screenshot.

The step file is imported via the normal freecad import tools found in the file menu or shortcut crtl+i. The result of importing both will look like the following screenshot.

Aligning the model to the footprint

As you notice the model is not aligned to the footprint right now. Many tools can be used to achieve this but this tutorial will only use the stepup internal tools. First we use the rotation options to get the model rotated correctly.


Next we can put the model onto the board. For SMD models we can use the put on z tool to easily achieve this.

Now only alignment in y direction is necessary. We will use the measure tool of the part workbench to find the distance required, enter it into stepup for the y direction movement and then move the model in place.

The final result will look like this

Export to KiCad

We now need to export the aligned model to step and (or) wrl. Stepup offers a one click tool that generates both a coloured step file and a correctly scaled wrl model. These can then be both used by kicad with scaling set to 1 (and if you aligned it correctly then offset and rotation set to 0)

3D-Model assignment (adding a model to the footprint)

3D-models unlike footprints and symbols are not really managed by KiCad. A footprint points directly to a file via a 3d path field. It is suggested to use path variables within the 3d path to increase portability.

Path variables for the 3d model path

Much more detailed description found in: Library management in KiCad version 5

Managing path variables is done via the path configuration tool found in the kicad main window -> preferences -> configure paths.

Using path variables means adding them with the syntayx ${path variable} (replace “path variable” with the name of your path variable)

Kicad will do this automatically for you if you have a fitting variable for your file path and use the browse button. (see below)

Adding the 3d model to the footprint

To assign a model open the footprints properties dialog and switch to the 3D-model dialog. (This dialog is found via edit-> footprint properties or as a button in the top toolbar)

Use the browse button (looks like the typical open button) or the add button (a plus symbol) to add 3d models.

The browse button is useful if you already have a 3d model for this path. Simply navigate to this button with the file browser opened by this dialog and select it. KiCad will take care of adding a fitting 3d path (Including the addition of path variables if there is one pointing to parts of the required path.)

The add button for manual entry is useful if you do not have a 3d model at the time of making the footprint. It allows for fully manual path entry.

The browse dialog even has a nice file preview that works for both wrl and step 3d files.

When the file is added you will be able to see it in the preview window. You can even change the scaling, position offset and rotation of the model to align it correctly with the footprint. (I would however suggest to align the 3d model to the footprint within a proper 3d modeling software and export already correctly aligned files. One way to do this is by using freecad plus the kicad stepup extension.)

8 Likes

Modify an existing footprint

Copy an existing footprint to any library (save as)

Lets say we want to make a footprint for a triple row pin header (03x10) from the existing double row connector (02x10).

So first open the footprint PinHeader_2x10_P2.54mm_Vertical from the official library. To easily find a specific footprint in the treeview enter its name in the filter field (at the top of the treeview).

Now from the file menu choose “save as” (shift+ctrl+s). A window will open that allows you to select the library you want to save the footprint to as well as the footprint name you want to use for your new footprint.
You can use the filter field at the bottom of this window to make finding the target library easier.
Be aware that one can not make a new library via save as so this must be done before trying to save the footprint. You can follow Creating a new footprint library to learn how to do it.
TlDr: file -> new footprint library → select the location where to save the library and a name → finally decide if the library should be added to the global or project (local) footprint library table.

The new footprint will be opened in the edit window ready to be modified. You should also be able to find the footprint in the treeview under its new name (you can again use the filter field to make this easier).

An alternative to the listed process is to right click on the source footprint name in the tree view and select save as directly there instead of going through the file menu.

The right click menu of the tree view also has a copy/paste functionality to copy footprints between libs (without being asked about the target library or a new name so this is the fastest option if you just want to copy a footprint without changes)

Adding a new row of pads and updating the pad numbers efficiently

As a first step lets focus on only the pads. We will copy one row of pads and then use the pad renumber feature to get the correct numbers.

To make this process easier we can hide everything except copper features. The fastest option for that is to right click in the layer view and select “Hide all non copper layers”.

Switch the grid to 2.54mm (right click → grid) and select one row of pads by using box selection (hold down the left mouse button and drag). Use ctrl+d to duplicate the selected pads. The new pads are now attached to your mouse and can be placed one grid point to the right with left click.
The result will look like the following screenshot.

Now we have all even pad numbers duplicated which will not be of much use. We therefore need to renumber the pads. We will need to ensure the pad numbering scheme we select fits the pin numbering of the symbol we want to use. For details about that see How does KiCad know which symbol pin represents which pad of the footprint?

The official library does not have a symbol for a 3 row connector so for the purpose of this tutorial i decided to just go with the numbering scheme where row one has the pad numbers 1 to 10, row two the numbers 11 to 20 and row three 21 to 30.

Doing this manually would be quite a lot of work (potentially more work than using the array tool to create the pads from scratch). Luckily KiCad has a pad renumbering tool that can be reached via the right click context menu → pads → renumber pads.

A menu will open that allows setting the first number as well as a common prefix. After setting this up a tooltip will be next to your cursor telling you to click on the pad you want to assign the given number to. This tool luckily also allows to just hold down the left mouse button and drag to easily number consecutive pads.

Edit graphical elements

Before we can edit the graphical elements we will need to make them visible again. Right click into the layer manager again and select “show all layers”.

All graphical elements (lines, arcs or circles) can be edited by selecting a single element. This brings the selected element into its edit mode which is signified by a filled square at the endpoints of every element. Sadly lines that touch (like for example two lines at the corner of a rectangle) can not be edited at the same time (meaning increasing the width of a rectangle is at least a three-step operation).

What makes it easier is setting up the grid as described in the previous sections of this tutorial (set the grid origin up to point to one target corner - set the grid x and y size to the requested size of the new rectangle - edit all elements of that form this rectangle one by one)

This will not be shown in more detail in this tutorial as it is a repeat of what is already above.

2 Likes