Monday, 14 August 2017

Importing 3D model for KiCAD footprints

I've been using KiCAD for a while and had created a few PCBs with it. I have to say it's very impressive and worth for every one to use, even for professional purpose. It's open source and free, good documented, and has no limitation on board size or connections etc.

One of the best things I love of KiCAD is the 3D viewer, letting you have a feel of what the PCB will look like before you send it out to the factory.
Although there are already many components have 3D models in the library, there will always the need to add you own footprints and needs to build 3D models for them. KiCAD itself has not provided the 3D model importing function yet, so you have to do it with the help of some third party software.

After some research on the internet, I have figured out how to do it and will list it step by step here, hope it will help somebody who need this.

Step 1 : You need to install a software named FreeCAD, it's an open source software too. KiCAD has support for Windows and Linux both, so does the FreeCAD, but I'm using the Ubuntu version of KiCAD, so the following work were all done in Ubuntu, should be the same in Windows. I have to admit that I had never used a modern 3D software before, the only experience I had used a CAD system was about 15 years ago using a version of AutoCAD with no 3D capability. But you don't need to know how to use the FreeCAD to export 3D models to KiCAD.

Step 2 : Install a plugin for FreeCAD named KiCAD STEPUP . You can find it on Sourceforge.

Step 3 : Find the 3D model for your component. Usually you will get it from the manufacturer's website. For example, here we'll build the 3D model for an inductor from Wurth Elektronik, order number 744787039.
Normally the 3D model will be in STEP format, a file named xxxxx.stp. To my understanding, any format that FreeCAD can accept will work.

Step 4 : Find out which footprint in the KiCAD library will suite the new component. To our example, I choose the "Inductor_Taiyo-Yuden_NR-60xx_HandSoldering"

If you use the 3D viewer to see it you can only see the pads on the PCB like above.

Step 5 : Run the KiCAD STEPUP tool. Don't open the FreeCAD directly, run the plugin and it will open the FreeCAD automatically. Switch to the directory in which KiCAD STEPUP Tool was installed and use the command :
The FreeCAD will open with a special window:

Step 6 : Use the "Load kicad footprint kicad_mod" button to load the footprint.

Step 7 : Use the "Import STEP 3D model" button to import the 3D model.
This component happens to be at the right place. Sometimes the 3D model is not aligned with the PCB pads, in this case, use these buttons above the 'load' to adjust its position.

Step 8 : "Export to kicad". Select the 3D model and click this button, it will save a .wrl file.

Step 9 : In KiCAD, open the footprint editor, in the "properties->3D settings", change the 3D shape file (.wrl) with the one we just created. Done!