Skip to main content

How to Set Up Design Rules in KiCad

Author Profile img: Lucy Iantosca

By Lucy Iantosca

August 1, 2024 | 0 Comments

Reviewer Thumbnail

Reviewed for technical accuracy by Dilip Kumar E

Senior Design Manager

how-to-set-design-rules-in-kicad.jpg

Contents

webinar image
On-demand webinar

How Good is My Shield? An Introduction to Transfer Impedance and Shielding Effectiveness

by Karen Burnham

KiCad is one of the best open-source EDA tools empowering PCB designers with a robust platform for circuit board development.

To get the best out of it, you need to understand how design rules are set in KiCad. These rules include several PCB design elements, such as trace width, clearance, via size, and net classes.

In this tutorial, you’ll learn the step-by-step procedure for setting up PCB design rules in KiCad version 8.

Watch the full video.

 

Steps to set design rules in KiCad

To access the design rules option in KiCad, navigate to the file menu and then board setup, or use the shortcut on the toolbar. In the board setup window, select design rules.

steps-to-access-design-rules-in-kicad.jpg
Steps to access design rules in KiCad.

Step 1: Set the constraints

Constraints allow you to establish clearance rules such as minimum clearance, track width, and annular width. To access the constraints section, click on Constraints under Design Rules. 

constraint-settings-in-kicad.jpg
Constraint settings in KiCad.

The constraints section is divided into 7 segments, each allowing you to set various parameters. Below are the segments and their corresponding parameters:

  1. Copper: Minimum clearance, track width, connection width, annular width, via diameter, copper-to-hole clearance, and copper-to-edge clearance
  2. Holes: Minimum through-hole diameter and hole-to-hole clearance
  3. Microvias: Minimum microvia diameter (finished) and minimum microvia hole
  4. Silkscreen: Minimum item clearance, text height, and text thickness
  5. Arc circle approximated by segments: Maximum allowed error in line segments
  6. Zone fill strategy: Minimum acceptable number of thermal relief spokes connecting a pad to a zone
  7. Length tuning: Stack-up height in track length calculations. When utilizing a via during length matching, select this option to automatically consider the via height.

To import settings from an existing board design, click on Import Settings from Another Board and select the design file. Next, choose the settings you want to import and click on Import Settings.

importing-settings-from-an-existing-design.jpg
Importing settings from an existing design.

To learn how to create component libraries and high-speed schematics in KiCad, download our e-book.

KiCad Design Guide - Cover Image

KiCad Design Guide

10 Chapters - 161 Pages - 180 Minute Read
What's Inside:
  • Creating a component symbol library
  • Setting up board parameters and rules
  • How to route differential pairs
  • How to place of components

 

Step 2: Specify the custom dimensions for traces and vias

In the Pre-defined Sizes section, you can establish a library of pre-defined tracks and vias. This feature is essential for maintaining consistency and ensuring that frequently used sizes are readily available. This reduces the manual input each time you create a new track or via.

setting-pre-defined-sizes-design-rules-for-tracks-vias-and-diff-pairs-in-kicad.jpg
Pre-defined sizes for tracks, vias, and diff pairs in KiCad.

To add a new track, via, or a differential pair, click on the + button.

 

tool-image

PCB DESIGN TOOL

Trace Width, Current Capacity and Temperature Rise Calculator

Calc TRY TOOL

 

Step 3: Add teardrops for tracks and pads

Teardrops significantly enhance PCBs’ reliability by reinforcing the connection between pads, traces, and vias. They act as stress relievers, reducing the risk of cracking and trace detachment due to mechanical stress or thermal expansion.

KiCad version 8 allows for custom teardrop design for circular and rectangular pads, as well as between tracks themselves, providing flexibility in PCB design.

teardrops-for-round-rectangular-and-track-to-track-teardrops-in-KiCad.jpg
Adding teardrops for round, rectangular, and track-to-track teardrops in KiCad.

In this section, you can set the following characteristics of teardrops:

  1. Best length (L): The ideal teardrop length. It’s based on the width of the connected pad or trace.
  2. Maximum length: Maximum allowed teardrop length.
  3. Best width (W): The ideal teardrop width based on the size of the connected component or trace.
  4. Maximum width: Maximum allowed teardrop width.
  5. Maximum track width: The teardrops are only generated when the connected track is narrower than a specified percentage of the pad width.
  6. Prefer zone connection: If enabled, a teardrop won’t be created if both the pad and the track are already connected to a zone (like a ground or power plane)
  7. Edges: These radio buttons specify whether the teardrop edges need to be straight line or curved.
  8. Curve points: Number of points in a curve; more points make the curve smoother.
  9. Allow teardrops to span 2 track segments: If selected, the teardrop extends into a second track segment if the first segment is too short for a full teardrop.

You can also add teardrops to existing connections quickly. To do this, go to Edit and click on Edit teardrops.

applying-teardrops-to-existing-traces-or-pads.jpg
Applying teardrops to existing traces or pads.

A dialog box appears with the following sections:

Scope: Here, you can define the types of objects affected, such as PTH pads, SMD pads, vias, or track-to-track connections.

Filter items: This allows filtering by criteria like net, net class, and layer. You can also apply filters based on round pads, pre-existing teardrops, or selected objects.

Action: You can remove or add teardrops based on your size and shape requirements. If a teardrop already exists, it will update with the new settings.

To add teardrops for individual vias and pads, double-click the pad or right-click on the pad and select Pad Properties.

A dialog appears as shown below.

adding-teardrops-on-pad-in-kicad.jpg
Adding teardrops on individual pads in KiCad.

Now, go to Connections and enter the dimensions as per your requirements.

Step 4: Perform length tuning for traces

In the Length-tuning Patterns section, you can tune the length of single tracks and differential pairs by adding serpentines to your traces. This is one of the new updates in KiCad version 8. 

length-tuning-patterns-for-single-tracks-differential-pairs.jpg
Length tuning single tracks, differential pairs in KiCad.

This section 3 segments:

  1. Single-track length tuning: Adds serpentine shapes to increase the length of a single track to the target value.
  2. Differential pair length tuning: Similar to single-track tuning, it adds serpentine shapes to a differential pair to adjust the length of both tracks in a differential pair to meet the target value.
  3. Differential pair skew tuning: Adds length to the shorter track in a differential pair to eliminate skew (phase difference) between the positive and negative sides.

When setting up tuning patterns, you need to adjust the following parameters:

  1. Maximum/minimum amplitude (A): Set the maximum and minimum amplitude for the tuning pattern.
  2. Spacing(s): Specify the spacing between meanders.
  3. Corner style: Choose between filleted (rounded) or chamfered corners.
  4. Radius(r): Enter the serpentine’s radius as a percentage of the spacing and amplitude.
  5. Single-sided pattern: Configure the tuning pattern to be single-sided, restricting it to one side of the baseline instead of the default style that positions meanders on both sides.

Also, read how to autoroute a PCB layout in KiCad using the FreeRouting plugin.

Step 5: Group the nets using net classes

In the net classes section, you can create a hierarchical structure library for organizing multiple nets. Grouping the nets within a net class ensures uniform application of design rules to the entire group.

Every net in KiCad is assigned to a specific net class. If a net is not added to a specific class, it will automatically be included in the default class. To add a new net class, you click on the + button and enter the following details:

  1. Name of the net class
  2. Clearance
  3. Track width
  4. Via size
  5. Via hole
  6. Microvia size
  7. Microvia hole
  8. Differential pair width
  9. Differential gap
creating-net-classes-kicad.jpg
Creating net classes in KiCad.

Here, we have created net classes with the names Group1, Group2, and POWER.

We have a plugin that enables you to get a PCB quote directly from the KiCad design tool. Download the KiCad plugin now to get an instant price estimation. 

Step 6: Define the custom rules

This segment allows you to set custom design rules for your design.

custom-rules-in-board-setup-dialog-box.jpg
Creating custom design rules in KiCad.

Here’s a template to define a custom rule:

(version <number>)

(rule rule_name> <rule_cause>…)

(constraint <constraint_type>…)

(condition “<expression>”

(layer “<layer name>”)

(severity <severity_name>)

Version: Here, you just have to enter a number. The rules will be assessed based on the version. The latest version number will be considered for DRC.

Rule name: Choose a descriptive name for your rule that accurately reflects its purpose. Enclose this name within quotation marks. (rule <rule_name> <rule_clause>…)

Constraint: This clause defines the actions to be taken when the rule is triggered. You can include multiple constraint clauses to impose various constraints, such as clearance and track width, on objects that meet the same conditions.

Condition: It specifies which objects the rule applies to. It uses expressions to detail the conditions.

Layer: This defines the board layers to which the rule applies. You can use specific layer names or shortcuts like outer (for front and back copper layers) and inner (for internal copper layers). If no layer is specified, the rule applies to all layers.

Severity: Define the severity level for a rule violation. This defines how violations should be handled—whether as errors, warnings, exclusions, or ignored

Let’s look at an example from the syntax help dialog in KiCad. This rule sets a minimum clearance between vias of different nets.

(

rule “Distance between Vias of different Nets”

(constraint hole_to_hole (min 0.254 mm))

(condition “A.Type == ‘Via’ && B.Type == ‘Via’ && A.Net != B.Net”)

)

In this example,

  1. Rule name: “Distance between Vias of different Nets”
  2. Constraint: Minimum hole-to-hole clearance of 0.254 mm (10 mils)
  3. Condition: Applies to vias (A and B) that belong to different nets

By following this structure, you can create and customize rules to ensure your PCB design meets all necessary requirements. Be sure to consult the syntax help dialog for precise instructions and thoroughly test your custom rules to ensure they function as intended

Step 7: Assign violation severity

The Violation Severity segment lets you assign the level of DRC violation when the rule is not followed.

assigning-violation-severity-for-design-rules-in-kicad.jpg
Assigning violation severity for design rules in KiCad

You can set the severity for electrical, design for manufacturing, and schematic parity segments using the radio buttons. After providing your input, click OK.

KiCad is a versatile tool for electronic circuit design and corresponding PCB design, which requires familiarity and expertise. This guide on setting up KiCad for your PCB design will help you design faster and better.

Are you having trouble with your KiCad PCB design? Our design experts can answer your questions on our PCB forum, SierraConnect.

sierra-connect-banner.jpg

post a question
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Talk to a Sierra Circuits PCB Expert today

24 hours a day, 7 days a week.

Call us: +1 (800) 763-7503
Book a Meeting with a Sales Rep
Email us: through our Customer Care form