# KiCAD - Getting Started
https://docs.kicad.org/8.0/en/getting_started_in_kicad/getting_started_in_kicad.html
**Started:** 2024-12-04 - 15:54
**Finished:** 2024-12-07 - 08:09
# Summary
[[KiCAD - Overview]]
# Contents
[[#Basic Concepts and Workflow]]
[[#Tutorial Part 1 - Project]]
[[#Tutorial Part 2 - Schematic]]
[[#Tutorial Part 3 - Circuit Board]]
[[#Tutorial Part 4 - Custom Symbols and Footprints]]
## Basic Concepts and Workflow
KiCAD mainly consists of two things
- Drawing a symbolic schematic (A Schematic)
- Laying out a physical circuit board (A Layout)
Schematics contain **Symbols**.
PCBs contain **Footprints**.
### Project-based Workflow
A KiCAD Project is a Folder.
That folder will contain:
- Project File
- Schematic
- Board Layout
- Other
- Symbol Libraries
- Footprint Libraries
- Simulation Data
- Purchasing Information
Project-related settings are primarily stored at the Project Level. Opening a board file outside of it's project files/context/folder will likely result in missing design information.
### Schematic Capture
Schematics are drawn first. PCBs are laid out second.
Custom symbols may need to be created for the Schematic.
It is during Schematic capture that footprints need to be assigned to the components.
Custom footprints may need to be created for the Board Layout as well.
When the schematic is complete, it must pass an ERC - Electrical Rules Check.
After that, the schematic information is transferred to the board editor and layout begins.
### Board Layout
The layout process requires each footprint to be placed precisely and carefully.
After component placement, copper traces are drawn to fulfill the connections detailed in the schematic.
Other electrical considerations come into play at this point such as:
- Trace Resistance
- Controlled Impedance Requirements
- Crosstalk
- EMI
- etc.
Schematics can be updated after layout has begun. Changes to the schematic are easily pushed into the board design.
The reverse is true as well: changes in the board layout can rewrite the schematic.
Once the board layout is complete, it must pass a DRC - Design Rules Check.
After that, fabrication files are generated so the board can be manufactured by a PCB fabricator.
## Tutorial Part 1 - Project
When you make a new project. There's an option for it to automatically create a folder for it.
### Main Menu
The main menu of KiCAD shows all the editors and viewers alongside a project files pane.
Clicking any of the editors will automatically open the project's file associated with that editor.
![[Pasted image 20241204162952.png]]
The Main Project File - `.kicad_pro`
The Schematic File - `.kicad_sch`
The Board File - `.kicad_pcb`
>.pro as in Project.
#protip/kicad Open the KiCAD Settings with `CTRL+,`
### Backups
You can configure the backup settings under Preferences > Common
![[project-backup-settings.png]]
## Tutorial Part 2 - Schematic
### Symbol Library Table Setup
The location of the default library table files depends on operating system and may vary based on installation location. Below are the defaults for each operating system:
- Windows: `C:\Program Files\KiCad\8.0\share\kicad\template\`
- Linux: `/usr/share/kicad/template/`
- macOS: `/Applications/KiCad/KiCad.app/Contents/SharedSupport/template/`
Most of the stuff is right here:
![[Pasted image 20241204164145.png]]
*Not sure how to extend the libraries. Do we just copypaste?*
### Schematic Editor Basics
- Pan/Drag - M2 or M3
- Zoom In/Out - Scroll or F2/F1
- Pan Up/Down - SHIFT+SCROLL
- Pan Left/Right - CTRL+SCROLL
There's a "Center and warp cursor on zoom" - moves mouse to center whenever you zoom in/out. I don't like it.
**Left Toolbar - Display Settings**
**Right Toolboard - Schematic Editor**
![[Pasted image 20241204164721.png]]
### Schematic Sheet Setup
It's important to set up the schematic sheet itself before actually laying anything out.
Start by going to File > Page Settings and giving the Schematic a Paper Size, Title, and Date.
*Set mine up as Tabloid/A3 - Suneater Labs*
NOTE: Most schematic edit tools remain active after you've used them and closed their popup window.
e.g. once you've placed a component, the next click is ready to open the component selection window again.
#### Adding Symbols
Add Symbol - A
![[Pasted image 20241204165803.png]]
Symbol sounds cosmetic, but it really means component.
You'll have to search for the component you want and pick the best match.
Notice on the right it shows both the Symbol and the Footprint.
In this case we have no default footprint selected, but there is a dropdown where you have options.
These are live viewers. You can pan/zoom in both.
#### Selecting and Moving
- M1 Drag, or select and press `M`.
- SHIFT+M1 to add to selection
- CTRL+M1 to add/toggle selection. The usual stuff
- G for Drag, similar to move
- R to rotate
- DEL - Delete
Text labels can be moved independently of the component, relative to the component.
G and M behave identically for unconnected symbols.
For connected symbols, M will release the connection, G will maintain it.
Mouse Drag performs G - Drag by default, enabled in settings.
#### Wiring the Schematic
Wire button is just a line. Or press `W`.
All pins have thinline circles on them indicating they're a connection point.
You can just hover over the circle and click it to wire things up as well.
You CAN pass wires through multiple components in series and link them all at once, just as in LTSpice.
##### Power Symbols
Power symbols are important for clarity and there are many available in the library.
Click the Ground icon or press P for Power Symbols.
This opens a symbol library that only displays power symbols.
Note that labels and power symbols with the same name are connected together. Another GND symbol or wire labeled `led` on this schematic page would be shorted to the existing one, even without wires visually connecting them.
##### Net Labels
Draw Net Labels is the underlined A on the right bar. Or Press `L`.
*Rotate being R and not CTRL+R is kind of messing me up*
#### Annotation, Symbol Properties, and Footprints
##### Annotation
**Annotation** - assigning a unique reference designator to each symbol
e.g. R1, D34, B5, etc.
![[Pasted image 20241204172200.png]]
The top-bar symbol for schematic annotation allows you to reset and algorithmically assign unique reference designators to every component according to whatever criteria you define.
This saves some time, and you can choose to just `Clear Annotation` and wipe the board clean if you want to do it yourself, partially or completely.
##### Symbol Properties
Open Properties - E or Double Click
Next is filling in each symbol's values (e.g. 3V, red, `part numbers`, 2.2kΩ, etc.)
You can also change reference designators in the same screen.
There doesn't seem to be a symbol in the toolbars you can click to open Symbol Properties
Some symbol properties will show automatically in the bottom-left pane.
You cannot select multiple symbols and bulk-edit their properties.
BUT there is a Symbol Fields Table for a global edit table on the top toolbar
![[Pasted image 20241204172859.png]]
##### Footprint Assignment
Finally, after Annotation and Values/Properties are entered, it's time to assign a footprint to each component.
Some symbols come with pre-assigned footprints, but for most components, there are many possible footprints and form factors, so it's necessary for us to select each one.
![[Pasted image 20241204173215.png]]
There are several ways to assign footprints. The top bar has a tool that lists all the symbols and their values in the center, and then allows you to flip through various footprint libraries to select the appropriate one for each symbol.
**Every symbol needs to have an assigned footprint. How else would you layout the PCB?**
You can right-click any of the individual footprints and select `View selected footprint` to open a popup viewer.
There are several ways to filter the *gazillion* footprints:
- Filter by footprint types specified in the selected Symbol
- The symbol itself can contain data that constrains what footprints should be associated with it
- Filter by pin count
- The symbol has a number of pins, the footprints also have some number of pins
- Filter by library (toggle)
- When you click a Footprint Library on the left side, it activates this filter.
- To deactivate it and see all libraries, just click it again to disable
- Search
**It's usually best to use the Symbol Filter OR the Library Filter but not both**
Helpful Notes:
- The arrow buttons for jumping to the next unassigned symbol - useful.
- Keep the viewer open, as it will update when you select a different footprint.
- Be mindful of your filters.
- Prepare to spend a lot of time sifting through footprints.
- Prepare to spend time building out many of your own custom footprints.
- Use the keyboard as much as you can during this process.
- Save to schematic often. It's easy to forget.
- This is the same thing as "Apply, Save to Schematic, & Continue" ... I think.
[Additional Tips on Assigning Footprints](https://docs.kicad.org/8.0/en/eeschema/eeschema.html#assigning-footprints)
#### Electrical Rules Check
It is a good idea to run ERC before starting layout.
KiCAD's Electrical Rules Checker cannot make sure that the design in the schematic will work.
It can check for common connection issues such as
- Unconnected pins
- Two power outputs shorted together
- Power inputs that aren't powered by anything
- etc.
It also checks for unannotated symbols and typos in net labels.
`File -> Schematic Setup -> Electrical Rules -> Violation Severity`
You can modify the electrical rules and adjust their severity there.
Run ERC by clicking the button for it in the top toolbar.
![[Pasted image 20241204175545.png]]
It will find many potential errors.
If you click the symbol it's referencing, it will place a red arrow and move your camera to the component.
You can exclude violations by right-clicking each error message.
It's worth addressing all violations even if they aren't design errors, if only to get a clean ERC report.
It's good practice to avoid missing the real problems.
In this case `Input Power pin not driven by any Output Power pins` is a common ERC error.
Power symbols like `VCC` and `GND` expect to be driven by some other power output pin, like a Voltage Regulator.
It's obvious to a human that these pins are driven by the battery, but not to KiCAD.
We can either:
- Dismiss the warnings
- Add `PWR_FLAG` symbols from the Power symbol library. This tells KiCAD these nodes actually are driven.
- `PWR_FLAG` is a "Special symbol for telling ERC where power comes from"
![[Pasted image 20241204180050.png]]
At this point, the ERC passes without any violations and the schematic can be considered complete.
#### Bill of Materials
Tools -> Generate Bill of Materials
This is optional - it will produce a .csv for you.
You can configure which symbol metadata gets included, filename, location, formatting, etc.
![[Pasted image 20241204180701.png]]
*Angel's problem :^)*
## Tutorial Part 3 - Circuit Board
You can go back to the main menu, or click the PCB editor button from the Schematic Editor's top bar.
#### PCB Editor Basics
Same general layout:
- Left bar - display options
- Right Bar - edit tools
Some buttons have a triangle in the bottom right, indicating there's a expanding tool palette inside.
Click and hold to open the menu, then click the tool you want. Or hold click, drag, release on selected tool.
Right side has an Appearance Panel where you can adjust visibility, opacity, and colors of PCB layers, objects, and nets.
This is also where you can click and select the Active Layer.
Under the Appearance Panel in the bottom right is the Selection Filter, which enables and disables various object types. Useful for picking out specific stuff in a crowded layout.
#### Board Setup and Stackup
Like the Schematic Editor, it's important to configure the board's settings before proceeding.
`File -> Page Settings`
`File -> Board Setup -> Board Stackup -> Physical Stackup`
Board Setup is also the second button in the top bar.
**There are a ton of settings here with a lot of nuance, but you have to take the time to define them properly.**
The most important settings are the stackup & design rules:
##### Physical Stackup
`Board Setup -> Board Stackup -> Physical Stackup`
This is where we select what copper and dielectric layers the PCB will have, and their thicknesses.
![[Pasted image 20241204192949.png]]
##### Design Rules - Constraints
`Board Setup -> Design Rules`
This is where we set sizes and spacing for tracks and vias.
**For real projects the Design Rules/Constraints should always be set according to the listed capabilities of the PCB Fab House so that the PCB design is actually manufacturable.**
![[Pasted image 20241204193257.png]]
It's easy to find the manufacturing capabilities on JLCPCB's website:
https://jlcpcb.com/capabilities/pcb-capabilities
![[Pasted image 20241204193355.png]]
For this tutorial project, we will use the default Design Rules, and the default Physical Stackup with 2 Copper Layers.
##### Design Rules - Net Classes
You can create Net Classes, and define a set of custom design rules associated with a specific group of nets.
This menu is both where you design the rules & assign the nets.
Of course, track width and spacing can be managed manually during layout in the editor.
Net Classes are best practice because they provide an automatic way to manage and check design rules.
Custom Net Classes might include `High Current` with wide traces or `50 ohm` with specific width and clearance.
#### Importing Changes from Schematic
When you first switch to the Layout, the components from the Schematic won't be there.
To import data from the Schematic into the Layout, click the button on the top bar, or press `F8`.
Since this has the potential to cause major changes to the Layout, a warning window will pop up to give you a summary of the changes to review.
![[Pasted image 20241204194213.png]]
Once you click `Update PCB` the window will close and all the footprints will appear in a cluster for you to place with your mouse.
**Updating Schematic -> PCB is a manual process and the designer needs to decide when it is appropriate to update the PCB with modifications from the schematic.**
**Each time the schematic is edited, the designer must use the `Update PCB from Schematic` tool to keep the Schematic and Layout in sync.**
#### Drawing a Board Outline
The board's outline and dimensions need to be defined by drawing a single closed shape on the `Edge.Cuts` layer.
Select the `Edge.Cuts` layer by left-clicking it under the Appearance Panel.
The size of the grid can be changed via the dropdown along the top bar.
Switch to a coarse grid to get nice round numbers for the board's outline - 1mm Grid.
Then simply take the rectangle tool (or line, circle, etc.) and define the single shape.
#### Placing Footprints
Ratsnest - the thin lines indicating unresolves connections between pads
The ratsnest is useful for determining what the best relative positioning is for each component.
**Controls:**
`M` - Move
`F` - Flip
`R` - Rotate
**Some considerations for arranging the footprints:**
- Some footprints have exact requirements for their locations.
- e.g. connectors, indicators, buttons, switches.
- Some components have electrical considerations.
- Bypass capacitors should be close to power pins for their IC.
- Sensitive analog components should be far away from digital interference.
- Almost all components have a "Courtyard".
- Generally speaking, courtyards should not intersect.
- Generally, seek to minimize routing length and complexity
All PCB Layers are viewed from the front side of the board.
Footprints on the bottom of the board are therefore upside down and appear mirrored.
You can press `F` to flip a footprint onto the backside of the board. The pads will change color in addition to the mirroring since they're on a different copper layer.
Each PCB layer has a unique color.
#### Routing Tracks
There's a button on the right bar for `Route Tracks`, or you can press `X`.
The thin ratsnest lines will disappear once the connection has been made in copper.
Beginning a trace on a component attached to the back layer will automatically switch your active layer.
Through-hole pads are one way to connect between the two copper layers.
Vias are another way.
Press `V` to place a Via while routing a trace.
The Via is a hole that drops you through to the other copper layer.
If you can't place the components exactly where you want them, simply refine the grid spacing.
**After routing tracks, if you need to move a component, use `D` to Drag while extending the trace dynamically.**
*I took the time to pick a decent color theme, and then manually changed the courtyard colors so it was very clear whether a component was on the top or bottom side*
#### Placing Copper Zones
Copper Zones fill an enclosed shape with copper.
You have to specify a copper layer for it to exist on, and you have to associate it with a particular node/net within the layout.
It will automatically connect to other copper objects associated with the same node/net, and will automatically avoid objects belonging to other nets.
Copper Zones are mainly used for managing power connections since they can provide lower impedance connections than the typical thin traces.
The shape of the copper fill can be arbitrary.
![[Pasted image 20241206073116.png]]
The shortcut for a Copper Zone is `CTRL+SHIFT+Z`.
There is an associated dialog window.
When outlining the Copper Zone's perimeter, left click to add points, and double click to end the polygon.
**These outlines are incomplete and still need to be filled with copper.**
Fill the zones with `Edit -> Fill All Zones` or `B` and `CTRL+B` to fill and unfill respectively.
![[Pasted image 20241206073524.png]]
The connections between the filled Copper Zone and the other Copper Objects associated with the same node are mediated by thin traces like this:
![[Pasted image 20241206073615.png]]
These are thermal reliefs - they make the pads easier to solder.
The zone properties is where all the zone settings & thermal reliefs are defined.
![[Pasted image 20241206073736.png]]
##### Warning
Zones are not filled automatically when first drawn nor when modified nor when footprints are moved.
Zones are refilled manually both when you fill them, and when you run the DRC.
**Make sure zone fills are up-to-date before generating fabrication outputs**
Example: Moving a resistor after filling zones leaves behind holes, broken connections, etc.
To fix this, it's necessary to both re-complete the traces as well as to refill the copper zones.
![[Pasted image 20241206074612.png]]
There is a show only zone boundaries button on the left bar.
They're still filled, just hidden for visual clarity.
![[Pasted image 20241206074048.png]]
#protip/kicad You can flip the board view to the backside under the `Layer Display Options` under the Appearance Panel:
![[Pasted image 20241206074147.png]]
#### Design Rule Checking
Layout Editor -> Design Rule Check (DRC)
Schematic Editor -> Electrical Rule Check (ERC)
DRC checks for common design mistakes like
- Mismatches between schematic and layout
- Copper regions that have insufficient clearance
- Copper regions that are shorted together
- Unconnected Traces
- etc.
Custom Rules can be written as of KiCAD 8.0.
The full list of design rules and their severity level is under
`File -> Board Setup -> Design Rules -> Violation Severity`
Like with the ERC, running DRC and fixing all errors is strongly advised before generating Fabrication Outputs.
Run a DRC with `Inspect -> Design Rules Checker` or click the button in the top bar.
![[Pasted image 20241206075159.png]]
There is a button to Refill all Zones before performing DRC, which is convenient. On by default.
If there are any errors, they will be enumerated and create the little arrows for each.
In this case, I dragged a resistor and didn't refill the zones. Now there are three clearances errors each for both terminals of the resistor:
- Pad Clearance Violation
- Through Hole Clearance Violation
- Rear solder mask aperture bridging together two nets
All that's really necessary in this case is to recheck Refill all Zones before performing DRC, and rerun.
#### 3D Viewer
There's a 3D Render tool for the PCB under `View -> 3D Viewer` or by pressing `ALT+3`
Raytracing is available as well.
The 3D Models for each component are associated with the footprints, in the footprint library.
Since not all footprints come with 3D models, users can add their own if they wish.
#### Fabrication Outputs
The board layout is finished, so the final step is generating fabrication outputs to send to a manufacturer.
From the Layout Editor, go to `File -> Plot`.
![[Pasted image 20241206084141.png]]
There's a lot going on in the Plot Options.
**Plot Format:** It's almost always going to be Gerber.
**Include Layers:** Ensure all the necessary layers are checked, such as coppers, edge.cuts, mask, silkscreen, paste, etc.
- mask - soldermask
- paste - useful for manufacturing solder paste stencils for surface mount boards
**Plot on All Layers:** Self-explanatory, not very necessary in most cases.
**Output Directory:** Relative to the project folder (e.g. `fab/`)
**General Options:** Default settings are fine
**Gerber Options:** Default settings are fine
Save will export a .txt of the Output Message log.
You can also run the DRC from this window.
To produce the actual fabrication outputs, there's another dialog to handle under `Generate Drill Files`
**Plot** - Generates the Gerber Files
**Generate Drill Files** - Generates the files that specify the location of all the holes in the board.
**Both are necessary to fabricate the board**.
##### Final Output
Check the output folder and review the gerber and drill files produced.
- There should be a Gerber file for each layer included.
- There should be a Gerber Job File.
- There should be a few Drill Files.
![[Pasted image 20241206085436.png]]
#protip/kicad
**PTH** - Plated Through Holes (for electrical connectivity)
**NPTH** - Non-Plated Through Holes (for mounting, or other mechanical)
KiCAD has a Gerber Viewer that allows you to review these files.
Opening all of the Gerber Files in the viewer will produce a new layer stackup where you can toggle visibility for each layer and verify things look correct.
![[Pasted image 20241206090143.png]]
You cannot open a Gerber Job File in the viewer. It contains the metadata for the PCB project and provides additional information to the fabricators. It is not considered essential to the manufacturing process.
If you can't open a drill file, it may because it's empty. In this case there are no NPTH - Nonplated Through Holes.
## Tutorial Part 4 - Custom Symbols and Footprints
This example follows modeling a `NKK M2011S3A1W03` which is a SPST toggle switch.
### Library and Library Table Basics
Symbols and Footprints are both organized into Libraries.
**A Library can hold Symbols or Footprints, but not both.**
Alongside the Global Libraries, there are also Project-Specific Libraries.
From the Schematic Editor: `Preferences -> Manage Symbol Libraries`
From the Layout Editor: `Preferences -> Manage Footprint Libraries`
Both Libraries can be accessed from `Preferences` from the Main Menu/Project Manager.
#### Path Substitutions
Library filepaths are usually defined with substitution variables to make it easier to move libraries around without modifying the library's filepaths.
There are a few main path substitutions:
**Symbol Library:**
- `${KICAD8_SYMBOL_DIR}` - Standard symbol library directory
- `${KIPRJMOD}` - Current project directory
**Footprint Library:**
- `${KICAD8_3DMODEL_DIR}` - Standard 3D model library directory
- `${KICAD8_FOOTPRINT_DIR}` - Standard footprint library directory
- `${KIPRJMOD}` - Current project directory
![[Pasted image 20241206112920.png]]
*My KiCAD 8.0 installed to Program Files, but some examples show it under %APPDATA%*
### Creating New Global or Project Libraries
The first step in creating a new symbol or footprint is choosing a library in which to store it.
It makes more sense to create your own custom libraries to contain your custom components.
Creating custom entries inside the global/standard library is a good way to lose your work down the line.
**Symbol Editor** is another tool in the Main Menu. Creating a new symbol and creating a new symbol library to contain it both occur here.
`File -> New Library` inside the Symbol Editor to create a new Symbol Library.
The New Library can either be Project-Specific, or an additional Global Library.
The file extension for a symbol library is `*.kicad_sym`
It is specified in the filetype which type of library it is.
#protip/kicad You can pin a custom library so it shows at the top of the list.
Otherwise, you'll have to find it alphabetically.
![[Pasted image 20241206142603.png]]
After creating this new Project-Specific Library, you can go to `Preferences -> Manage Symbol Libraries`, switch to the tab `Project Specific Libraries` and it will appear there.
### Creating New Symbols
Select the Library you want to add a symbol to.
Hit `CTRL+N`, right click the library, or hit the new symbol button on top bar.
You'll have to specify the Name of the symbol, and it is wise to set the Default Reference Designator.
In this case we're doing a `SW` with part number/name `M2011S3A1W03`.
Every other field left at default.
![[Pasted image 20241206143050.png]]
Now the reference designator will appear in the editor, and the new symbol will appear as an entry under the selected library.
#### Symbol Pins
Start drawing the symbol by adding a pin.
Add Pin - `P`
Pins require a few properties:
- Pin Name - `A`
- Pin Number - `2`
- Electrical Type - `Passive`
- Orientation - `Right`
- X Position - `-200 mills`
- Y Position - `0`
#protip/kicad You can select a symbol fragment, hit `M` for Move, and then use the arrow keys to carefully position.
Keep in mind each individual Pin has its own properties,
and then the Symbol overall has its own properties.
You can access properties in general with `E`.
For simpler symbols, it may be convenient to turn off Pin Names in the Symbol's Properties.
Remember to fill out the Keywords section for the Symbol, so that it's easier to find via search later on. In this case, `spst switch toggle`.
Note for later, the `Define as power symbol` option.
![[Pasted image 20241206194454.png]]
#### Symbol Editor - Critical Information
![[Pasted image 20241206193955.png]]
![[Pasted image 20241206194003.png]]
Small grids are useful for graphical features, but symbol pins must always be placed on a 50 mil (1.27 mm) grid. Pins which are not aligned to a 50 mil grid will not be able to connect to wires in the schematic.
It is strongly recommended to always use mils (or inches) in the Schematic Editor and Symbol Editor, particularly for symbol pins. Mixing imperial and metric units will result in symbol pins that cannot be properly connected because they do not align with wires or other pins. The KiCad libraries use a 50 mil grid for their pins; using a different unit system will prevent your symbols and schematics from connecting with KiCad’s builtin symbols. Note that unlike in the PCB editor, units in the schematic have no physical meaning.
#protip/kicad If you reduce the grid size for construction of non-pin cosmetic features of a symbol, be sure to set the grid back to 50 mil when you are done. It does not reset by default.
### Creating New Footprints
To create a custom footprint we have to dimension several tedious things:
- Create a footprint library for the project
- Determine physical pin size
- Determine hole size (some margin larger than pin)
- Determine annular ring size for solder pads
- Determine placement geometry for each unique pin
- Design Cosmetic Footprint Graphics
Open the Footprint Editor from the Main Menu.
`File -> New Library` to create a new Footprint Library.
Define it as a Project-Specific Library and save it to the project folder.
Once the Library is created, `File -> New Footprint`
For this one:
- Name - `Switch_Toggle_SPST_NKK_M2011S3A1x03`
- Type - `Through Hole`
##### Custom Grids to simplify Pad Placement
For ease of placement, adjust the grid to match the desired pad spacing.
Open the grid settings by right clicking the grid button in the left toolbar and select `Edit Grids`.
You can add a new grid with the + button, and set its size to the dimension between the pins, in this case `4.7mm`
#protip/kicad
By convention, pin 1 is located at (0,0), then pin 2 at (0, y1) and pin 3 at (0, y2).
So with our 4.7mm grid (0, 4.7mm) and (0, 9.4mm).
##### Footprint Generators
Instead of clicking `New Footprint` you can select `Create Footprint` and a Footprint Generator/Wizard will open
#### Footprint Pads
The switch we are modeling has two pins numbered 2 and 3. We're skipping Pin #1.
The two pins are spaced 4.7mm apart.
##### Pin Hole Placement and Enumeration
After setting up the 4.7mm grid, we can `Add Pin` and place the first pin at (0,y1).
Obviously, this will be Pin 1. Go into the properties and set it to #2.
##### Pin Hole Diameter:
The switch has small rectangular metal pins of dimension `1.17 x 0.8 mm`, which results in a diagonal of `1.42mm`.
We will design the hole diameter to have a margin of `0.2mm`, so:
`1.42mm + 0.2mm = 1.62mm`
**Hole Diameter:** 1.62mm
##### Annular Ring
Then, we need to select the copper annular ring's diameter. In this case, 0.15mm of copper, so:
`1.62mm + 2x0.15mm = 1.92mm`
**Annular Ring Diameter:** 1.92mm
*The tutorial is cheeky, and immediately increases the rings to 2.22mm*
**Annular Ring Diameter:** 2.22mm
**Note:** the properties assigned to the previous pad and hole size will be considered as default for the Footprint and will be copied from the previous pad.
**Note:** You can right click on a pad after making an adjustment and then click `Push Properties to Other Pads`
**Note:** The pad size fields accept mathematical expressions, such as `1.62+2x0.3`, etc.
These mathematical expressions can include unit conversions as well.
#### Footprint Graphics
A good footprint will have three graphics:
- The exact part outline on the fabrication layer - `F.Fab`
- A slightly larger outline on the silkscreen layer - `F.Silkscreen`
- An even larger boundary on the courtyard - `F.Courtyard`
#### Specific Dimensions
##### Fabrication Outline
- 7.9mm wide
- 13mm tall
- 0.10mm line thickness
Create a custom grid with:
- X-Spacing: `7.9mm`
- Y-Spacing: `13mm`
- X-Grid Origin: `3.95mm`
- Y-Grid Origin: `-1.8mm`
*This process is super annoying wow*
###### Fabrication Outline Reference
![[fab-outline.png]]
*Note the origin crossed-circle on the top right of the rectangle, at the custom origin point of (3.95, -1.8)*
Notes:
- You have to select the `F.Fab` layer before drawing the rectangle.
- When you do this, you can go into the rectangle properties and see that the line thickness is `0.10mm`
##### Silkscreen Outline
- Silkscreen Line Width: 0.12mm
- Fab Line Width: 0.10mm
Another custom grid spec for the silkscreen:
- X grid: 7.9 mm + 2 * 0.11 mm = `8.12 mm`
- Y grid: 13 mm + 2 * 0.11 mm = `13.22 mm`
- X origin: 8.12 mm / 2 = `4.06 mm`
- Y origin: -1.8 mm - 0.11 mm = `-1.91 mm`
###### Silkscreen Outline
![[silk-outline.png]]
Note:
- In this case, the default silkscreen width was set to `0.10mm` so I manually set it to `0.12mm`
##### Courtyard Outline
The courtyard outline should surround the part with a 0.25mm clearance.
**Another Method:** Switch to a 1mm grid, draw an approximate rectangle, and then manually edit the properties to input these corner dimensions.
![[courtyard-outline.png]]
Silkscreen lines moved outward by 0.11mm, half of the thickness of both the fab line and the silkscreen. That is: `0.5 x (0.10 + 0.12) = 0.11mm`.
*This footprint process is super particular and tedious. It requires careful measurements and precise alignment on several distinct grids in order to create an accurate and usable model.*
Final step is to rearrange the text and the Footprint is complete.
![[Pasted image 20241206204956.png]]
#### KiCAD Library Conventions
There is a **KiCAD Library Conventions** document which provides a set of guidelines for symbols and footprints. They are a good starting point.
Symbols in the official library are requires to follow the **KLC**.
[KiCAD Library Convention (KLC)](https://klc.kicad.org/)
The [KLC requirements for footprint filters](https://klc.kicad.org/symbol/s5/s5.2/) contain some useful tips for effective footprint filters.
#### Add Footprint to Symbol
The next step is to link the Footprint to the Symbol.
KiCAD will know to set the Footprint as the default option when that Symbol is used moving forward.
**Process:**
- Open the Symbol Editor
- Open the switch symbol
- Edit the Symbol's properties
- Go into the `Footprint` field:
- Click the library book
- Find the Project-Specific Footprint Library
- Select the Switch Footprint
- Save the Symbol
The symbol editor preview will now show that there is a Footprint associated with the symbol: `getting_started:Switch_Toggle_SPST_NKK_M2011S3A1x03`
![[Pasted image 20241206205614.png]]
#### Add Symbol to Schematic
- Open the Schematic Editor
- Open the Project-Specific Library created for this design
- Select and add the custom component in
- Wire the component into the schematic
- Re-run ERC
**Always Re-run ERC when you are done making changes to the Schematic Editor**.
The default footprint for this custom symbol should already be assigned.
![[Pasted image 20241207074000.png]]
#### Add Switch to Layout
Next, switch to PCB view, and run `Tools -> Update PCB from Schematic` or `F8` or the top bar button.
Since the PCB Layout needs to be revised and several components need to be repositioned, remember to press `B` to recalculate the fill zones. Otherwise the board will be useless.
![[Pasted image 20241207074350.png]]
Be sure to re-run DRC after making adjustments to the Layout.
#protip/kicad Select a trace segment and press `U` several times to expand the selection to all the connected trace segments, until the entire trace is selected. This allows you to quickly delete and clean up outdated traces.
Double check and ensure the switch has the footprint listed under it's `Footprint` Property.
*At this point, we would also re-export the gerber/fabrication files, but the tutorial is now complete.*
#### Footprints and 3D Models
3D models for components are stored in separate files from the Footprints themselves.
The filenames for the 3D models are saved in the Footprint.
Any number of 3D models can be added to each Footprint.
There is a `3D Models` tab under `Footprint Properties`.
3D models can be either `.step` or `.wrl`.
STEP is better for dimensional accuracy.
VRML is better for aesthetics.
KiCAD can automatically select the STEP version and export a 3D model of the board for MCAD integration.
**Not all footprints in KiCad’s library are provided with 3D models, but all footprints list a 3D model filename even if the 3D model does not exist. This is so 3D models can be added at a later date without needing to edit the footprint.**
### KiCAD - More Learning Resources
https://www.kicad.org/help/learning-resources/
https://docs.kicad.org/
Phil's Lab