Checking a Footprint Against a Suggested Footprint in the Datasheet
Sadly KiCad version 5 and earlier are rather limited in inspection options. While v5 added the measurement tool it did not have the option to snap to for example pad corners (one can only snap to pad centers). For this reason it is sadly easier to export the footprint to other tools and dimension it there than to try and use KiCad for this task.
This will be fixed in version 6 of kicad as it brings more powerful snapping for the inspect mode and rather good dimensioning tools in pcbnew A updated tutorial for nightly builds close to version 6 can be found under Tutorial: How to check footprint correctness? (Pre Version 6 nightlies)
Requirements for Following this Tutorial
- Freecad preferably version 0.17 or newer
- KiCad Stepup workbench (Can also be installed directly via the addon manager found under Tools->Addon manager)
- Some way to make a dimensioned drawing
- Some pdf reader
Reading the Datasheets Suggested Footprint
To check a footprint you will need to use the dimensions given in the datasheet. Sometimes these dimensions are in a separate document.
Some datasheets define dimensions for a full series of components. A typical example is the datasheet for connectors available for many pin counts. In such documents dimensions that differ between the described parts are typically marked with a letter in the drawing and specified in a table. An alternative is that a specific dimension is given as an equation (example
(pincount - 1) * pin pitch to describe the distance between the outermost pins)
In this tutorial we will be checking the following footprint from the official library of version 5.
Molex_Micro-Fit_3.0_43045-1215_2x06_P3.00mm_Vertical.kicad_mod (5.2 KB)
For convenience here a simplified drawing from the datasheet (removed unnecessary stuff to reduce clutter for this tutorial) with highlighted dimensions.
Importing the footprint into freecad
KiCad internal measurement tools are quite poor. Luckily stepup exists to get the footprint into the powerful CAD program FreeCAD.
Open freecad and create a new file (must be done before importing the footprint as it will crash otherwise).
Switch to the stepup workbench using the workbench selection drop down menu or
Use the import footprint button. This will start a file browser dialog. Navigate to your footprint and click open.
After clicking ok you should see the footprint within freecad. You will see the different layers as a body in the combo viewer.
Create dimensioned drawing to compare against datasheet
Using the Tech Draw workbench
The tech draw workbench is the main workbench for creating dimensioned drawings in freecad. It is in fast development at the time of writing which is why no detailed tutorial is provided how to use it.
Getting the footprint into tech draw
- ensure the 3d view is set to “top” (view -> standard views -> top, hotkey “2” or click on the top face of the view cube)
- Switch to the tech draw workbench
- Create a new page (Insert new default page)
- Select the footprint layers you want to check by
crtl+left clickingin the combo view. (select all layers at the same time to ensure the view is combined)
- Insert the selected parts as a new view
Scaling the drawing
You might want to change the scaling of the drawing. For that select the page object in the page object in the combo view and switch to the data section. Enter the desired scaling value into the scale section.
Some versions of FreeCAD/TechDraw have a bug where this does not update. If that happens select the object of the view object and switch the scale type then click into the draw area
The addition of dimensions is a bit strange in this workbench (at least in freecad 0.18) You need to first select the points between which you want to add the dimension and only then can you click the dimension button. This makes it quite slow to make a drawing.
The good thing is that once added the dimensions can be dragged around which is a very nice feature indeed. Adding colour is not possible from within the workbench. Adding center lines is only possible in the workbench of FreeCAD 0.19 or newer.
LibreCAD is a powerful 2D CAD program that is especially useful because of its powerful hotkey system that allows creating nice drawings very fast once one has learned how to use it.
Getting the footprint into LibreCAD
A problem is that KiCad can not directly export a dxf file for use with LibreCAD. Which means we need to go via FreeCAD. A reliable way to export a dxf of a footprint imported via stepup is by using the drawing dimensions workbench. Which means follow the steps of the previous tutorial.
Importantly do not change the scale if you want to use this workflow. Even if the view object in the TechDraw workbench looks awful it will look good in LibreCAD.
You might want to activate showing of hidden lines especially if pads are overlapped by for example the body outline. Select the view object in the combo view and switch to data. For the Hard invisible option select true.
From the toolbar of the TechDraw workbench click the export dxf button and store the file somewhere sensible.
Then open the file with librecad. It is likely that you will not see anything after opening the file. Use the zoom auto command “za” (or view->auto zoom) to see your drawing. (more about the use of commands later)
The command (hotkey) system of LibreCAD
LibreCAD can be used only with the mouse. All tools are reachable via toolbars and also via the top menu bar. However, this is quite slow. A better option is to learn the few commands you will need to use for this task.
In the right sidebar there is a command line. Every command is entered into it. A command is always started with ENTER.
The command line is nearly always active even if you clicked somewhere. You can even chain different commands (example change the snap options while you have a drawing tool active) If the command line ever comes deactivated simply click into the command entry line.
Official docu https://librecad.readthedocs.io/en/latest/guides/cmdline.html
Good list of commands https://shortcutworld.com/LibreCAD/win/LibreCAD_Shortcuts
- zoom auto “za”
- add dimension “dh” (horizontal) “dv” (vertical) “da” (aligned) “dd” (diameter)
- toggle snapping “sg” (grid) “sc” (center) “sm” (midpoint) “se” (endpoint)
I suggest you turn on grid visibility from the view menu or via the shortcut ctrl+g (not a command but really a shortcut)
Further, deactivate all snapping options in the top toolbar (by clicking on the buttons or by using the commands) such that we have a common starting point.
The default dimension sizes will be way too large as the default is meant for part sizes normally encountered in mechanical engineering. Luckily this can be changed, sadly I am not aware to change it as the default. Go to
options -> change document properties. In that dialog select the dimension tab and set general scale to 0.1.
Dimensioning the part
In this section i will give a short introduction to adding dimensions as the way we get the drawing from stepup is not ideal. Every graphical line drawn in KiCad (for example the body outline) is exported as an outline of the thick line which means that it consists of two half circles plus two lines.
This means we will need to play with the snap options a bit to get the correct points for our dimensions. If you want to select an endpoint of a KiCad line only activate the centre snapping (as we want the centre of the half circle at the end)
If you want to get the corner of a pad only activate the end point snapping.
If you want to get the centre of a pad or a KiCad line then use snapping to midpoints.
The centre of holes is of course available by use of centre snapping.
While positioning the dimension itself I suggest activating grid snapping.
The screencast below shows how a few dimensions are added. In the bottom right corner of the video is the indicator of which buttons i press, this is not part of LibreCAD.
I do the following during the video:
- The preparation (auto zoom, turn on grid, select dimension size, turn off all snapping options)
- add horizontal body size dimension (“sc”, “dh”, click on left end, click on right end, “sg” place dimension, “sg”)
- add horizontal body size dimension (“dv” click on bottom end, click on top end, “sg”, place dimension, “sg”)
- add dimension for horizontal pin pitch (“sc”, “sm”, click on botrom line middle of first pad, click on bottom line middle of second pad, “sg”, place dimension, “sg”)
- add dimension for horizontal pad size (“sm”, “se”, click on top left corner, click on top right corner, “sg”, place dimension, “sg”)
- add diameter dimension of non plated pad (“dd” click on circle outline, move mouse around and click again to place dimension)
Example drawings made with this method
This method was used extensibly during reviews of footprint contributions to the official library. Below a few examples of that.
The drawing made while reviewing the footprint for Lightpipe_Mentor_1275 as found in the official library of version 5.
Similar drawing for ST_VL53L1x.
An example to showcase how mistakes can be documented by using a second layer with a different colour and how a third layer can be used for adding reference drawings. In this case this was a rejected contribution for the bluetooth module MDBT42Q.
Using the drawing dimension workbench
One option is to use the drawing dimensions workbench. As already mentioned in the introduction this workbench is not really maintained so it does break strangely in modern FreeCAD. However this workbench is still nicer to use (in my opinion) than the techdraw workbench so this is left here should you be able to use it.
Get the footprint into the drawing workbench
- Switch to the drawing dimensioning workbench
- Create a new page (Insert new drawing)
- Select the footprint layers you want to check by
crtl+left clickingin the combo view.
- Insert the selected parts as a new view.
- Move all views somewhere within the page and maybe also scale them. (Make sure you place all views at the same place and scale them the same value.)
Dimension the drawing
The dimensioning tools will take a bit of getting used to. (There are other workbenches that have a better user interface but they do not really allow dimensioning between different “layers”)
Dimensioned drawing in freecad. (Highlighted the dimensions in the same colors i used in the datasheet.)