Kicad Templates

From media_wiki
Jump to: navigation, search

(Updated 1/22/2022) This wiki document is an example of how to create Kicad Templates.

The steps are the same for Kicad Versions 5 and 6. 
Any template created in Kicad 5 will not work in Kicad 6 without converting the files.
You don’t need to follow the files system structure I used in this this example.
I have selected this file system method for personal ease of use on my Raspberry Pi 4
This document was written to support Kicad 5.X but can be used with Kicad 6.X
The same process works for other Linux and Windows versions.
As of the time of writing this document (January 2022) there was not a Kicad Version 6 for the Raspberry Pi. 

Set or Change the Path for User Templates in Kicad Example 1: Using the defaults.

 Open Kicad
 Select: Preferences Tab 
 Select Configure Paths
       : |       Name                 |	             Path       |
 Select: | KICAD_USER_TEMPLATE_DIR    |	/home/pi/kicad/template |
 Create the needed folders for Version 5:
 mkdir /home/pi/kicad/template.

Windows Note: Kicad 6.0 has already created the folders needed for templates  
 C:\Users\username\Documents\KiCad\6.0\template\ 
 No need to change the path for Windows Versions.

Set or Change the Path for User Templates in Kicad Example 2: Creating your own user path.

In your home directory create a directory named Kicad-projects.
mkdir /home/pi/Kicad-projects
Then CD to your new directory.
cd Kicad-projects
In the Kicad-projects directory make another directory named kicad-templates.
mkdir kicad-templates 
 or
mkdir /home/pi/Kicad-projects/kicad-templates
Open Kicad
 Select: Preferences Tab 
 Select Configure Paths
       : |       Name                 |	             Path       |
 Select: | KICAD_USER_TEMPLATE_DIR    |	/home/pi/kicad/template |
 Under Path column change to: /home/pi/Kicad-projects/Kicad-templates

Start the Project and Create the user Template.

 The template name is the directory name where the template files are stored. 
 Open: KiCad
 Select: File,  Click on: New, Click on: Project
 Select: Kicad-Projects folder
 Select: Kicad-templates folder
 Enter project name: 50mmX50mm-Template
 Click on: Save
 Select: Schematic Layout Editor
 New users note
 Configure Global Symbol Library Table will appear.
 Select: Copy default global symbol library table (recommended) Click: OK 

Setup the Schematic Page layout

 Select: File tab: Page Setting or Click on Edit Page settings Icon.
 Change Paper size to A 8.5 X 11
 Update Title Block fields

Configure the Schematic Grid size

 Select: View: Grid Settings
 Note: Kicad Version 6 has changed this to Grid Properties.   
 Set to appropriate size

Start editing in the schematic

Schematic-template.png
 Select : Place Symbol Icon on right side tool bar. 
 Click in schematic work sheet area.
 A window called Choose Symbol will open.
 In search filter enter mount.
 Select: MountingHole_Pad  Mounting Hole with connection.
 Place Mounting Hole on schematic work sheet area.
 Click on Select item icon on right side tool bar. (Looks like mouse cursor)
 Hover over mounting hole pad and hit the “C” to Copy. Note: ver6.0 use: “Control C”
 Repeat two more times. You should now have 4 Mounting Holes.
 Select: Place graphic lines or polygons icon on right side tool bar.
 Draw square around the 4 mounting holes.
 Select: Annotate schematic symbol Icon on top tool bar.
 Click: on Annotate tab then close
 Click: Save Icon on top tool bar to save drawing.

Assign footprint to schematic symbols

MountingHole.PNG
 Select: Assign footprint to schematic symbols icon on top tool bar.
 New users note:
 Configure Global Footprint Library Table
 Select: Copy default global footprint library table (recommended)
 Select:  MountingHole
 From drop down menu Select: MountingHole_3.2mm_M3_Pad_Via
 Click:  Apply, Save Schematic & Continue. Click: OK
 Select: Generate netlist icon on top tool bar.
 Select: Generate netlist in Netlist window.
 Note for Kicad Version 6: The Netlist is created automatically so this part can be skipped. 
 Click Save in file window.

Creating the PCB

 Select: Run Pcbnew to layout printed circuit board icon on top tool bar
 New users note:
 Enable Graphics Acceleration window popup.
 Select: Enable Acceleration

Setup the PCB Page layout

 Select: File tab: Page Setting or Click on Edit Page settings Icon.
 Change Paper size to A 8.5 X 11
 Update Title Block fields

Configure the PCB Grid size

Grid-select.png
 Select: View: Grid Settings
 Note: Kicad Version 6 has changed this to Grid Properties.   
 Select under Fast Switching: Grid 1  
 In the drop down menu Select:  Grid: 2.5400 mm (100.00 mils)
 Select under Fast Switching: Grid 2
 In the drop down menu Select:  Grid: 1.0000 mm (39.37 mils) 
 Click OK
 Hold down the alt key and hit the 1 key to change to Grid 2 Grid: 1.0000 mm (39.37 mils) 

Start editing the PCB Layout

Brd50X50.PNG
 Select: Load Netlist icon on top tool bar.
 Click on: Browse icon and select: 50mmX50mm-Template.net. Click: Open
 Select: Update PCB in Netlist window.
 Click Save in file window if you want the report file otherwise select Close.
 Place Mounting Holes in the middle of the worksheet.
 Select:  Grid 1.0000mm 3937(mils) drop down menu on top tools bar
 Select:  Edge.Cuts in the Layers Menu right side.
 Select: Add Graphics Lines right side tool bar.
 Click in top left corner of a 10mm square and draw a 50mm  X 50mm square.
 Select: F-Silks in the layer menu right side tool bar.
 Select: Add Graphics Lines right side tool bar.
 Draw the 4 Cross-hairs. One in each corner.
 Select:  Edge.Cuts in the Layers Menu right side.
 Select: Add Graphics arc right side tool bar.
 Add the Arc to each corner of the board.
 Move the corner edges back to Arc.
 Test Board edge cut with ALT 3 3D View.
 Move Mounting Holes to each corner and align with cross hairs.
 Add Silk layer graphics to board by selecting:
 Add text on copper layer or graphics text icon on right side tool bar.
 Save file

Creating the metadata folder.

The metadata directory is a subdirectory named meta containing files describing the template.
The metadata consists of two required files and may contain optional files. 
meta/info.html  HTML-formatted information describing the template. 
Only basic HTML tags can be used in this document. 
meta/icon.png  A 64 x 64 pixel PNG icon file which is used as a clickable icon in the template dialog.
meta/brd.png  A board outline png file. (Optional)
meta/3D.png  A snapshot png file from the 3D viewer. (Optional)

Create the meta folder:

All files must be created by the user using a text editor or previous KiCad project files.
The files must be placed into the required directory structure.
There needs to be a folder inside your project folder named meta
mkdir /home/pi/kicad/template/50mmX50mm-Template/meta (default method)
or
mkdir /home/pi/Kicad-projects/kicad-templates/50mmX50mm-Template/meta (Your own method)
Example for Windows: 
C:\Users\username\Kicad_Projects\KiCad-Templates\50X50_Template\meta

Download the example info.html and icon.png files: https://microrusty.com/Code-download-page/download.html  
Remember after downloading save the files inside the meta folder.

Set Up Procedures KiCad 5.0

KiCad 5.0