In this tutorial, we will show you how to set up design rules in KiCad. Before starting the layout, it is very important to determine a set of rules you will follow.
For selecting saving preferences follow the procedure below:
- Go to Preferences
- Click Preferences
- Fill Autosave information – Autosave and File history size
In Hotkeys, you can choose shortcuts. This is an efficient way to do your PCB layout. You have pre-saved commands but you can also add new ones.
Feel free to browse the display options as well. You can choose among many options, such as the grid style, thickness, spacing, etc.
To modify Display Options:
- Change Grid style and Cursor Options by selecting required radio button
- Enter values for Grid thickness, Min grid spacing and Dimensions as required.
KiCad layer set up
Click Board Setup at the top. In Layers, you can custom your layer set.
By default, you will have two copper layers. You can see the top copper layer and the bottom copper layer. These are signal layers.
To set up layers in the PCB:
- Select the Board Setup button
- Click the Layers option
- Select the number of inside layers
You can change the number of layers. Let’s say you need a 4-layer PCB, you will now have two inside layers between your top and bottom layers. You can keep them as signal layers and make them power planes, as per your stack-up requirements.
At the top again, you can choose the PCB thickness, also defined by your stack-up.
Now suppose you are using a differential track on the first layer, the reference layer to Layer 1 should be a ground layer, because on the differential pair, the ground layer should always be below the differential pairs without breaks. This is to ensure the impedance matching of the differential pair is constant over the entire length.
This is your stack-up. Here, we have a 4-layer stack-up. You can now go to Text & Graphics. This is where you can edit the text that will appear on your board. Choose the height, width, line thickness, etc.
To edit the text that will appear on the board:
- Select the Text & Graphics option under Layers
- Enter thickness, height and width values
- Select Italic and Keep Upright checkboxes as required
KiCad net classes
Let’s discuss net classes. It is important to go over these design rules in KiCad.
You can see over here, there are different nets. And you can see there is a default class available. This defines a particular clearance. Clearance is the minimum distance which needs to be maintained between the two tracks. KiCad will handle that part once you define this minimum clearance.
You can also define the minimum track width for a particular net. A net class is a group of nets. So all these nets will be assigned to this net class. And this net class will follow these design rules in KiCad based on the minimum values you define for clearance, track width, via size, via drill, differential pair width, etc.
If you want to create a new net class, click the + sign. For this demo, let’s create a net class for a 90-ohm differential pair used for a USB.
We have created a new net class. The width of your differential pair will be defined in your stack-up along with the spacing. And normally, for differential pairs, the clearance is five times the track width.
These are the nets present in your circuit and this is the net class. Imagine you want to assign Net-(BT1-Pad1) and Net-(C2-Pad1) to some other class, click Default under Net Class and select the class among the ones that are available.
If you want to assign Net-(BT1-Pad1) to the 90-ohm differential pair net class, this net will now follow all the design rules in KiCad assigned for this class.
If you have multiple differential classes, each of the differential pairs should follow different track widths, or different spacing. You can create multiple classes and define the clearances for each single-ended line and each differential pair.
KiCad Track Width and Vias
Now let’s go over Tracks & Vias. In your board, there might be different current levels. If your Layer 1 thickness is one ounce copper and if you want a track to carry one-amp current, then your track width should be minimum 40 mils.
But there are also milliamp currents flowing through your circuit so you won’t use 40-mil widths for all the nets. You might require different track widths, which you can define in the Width column. Here, we’ll say 10. If you want a 40-mil track, specify 40.
The same goes for vias, which allow tracks to travel from one layer to another layer.
You can choose you via size and drill. Drill refers to the hole size of your via. Here, we will specify 10 for drill and 22 for size and another 8 for drill and 20 for size. The unit is mils.
Solder mask and clearance design rules in KiCad
Let’s move on to the Solder Mask/Paste part. You can see solder mask clearance.
The solder mask is used to cover the entire board except the pads defined in your footprint. If your pad size has a 10-mil diameter, your solder mask opening could be 14 mils to leave 2 mils on each side. Basically, the solder mask clearance is the extra space that will not be covered by the solder mask.
Before defining the clearance, remember to check your manufacturer’s capabilities.
Same goes for the solder paste, which is used to assemble components.
Now, your PCB design rules in KiCad are set. You can see them at the top of the screen. The unit is mils. If you want to shift to mms, click the mm button on the left hand side.
If you want to route tracks, click this button on the right-hand side. Here, we have selected 9 mils, but if you want another value, click this track dropdown and select the one you require. And now this track width is 10 mils.
If you want to change the size of the text, go to Edit at the top and select Edit Text & Graphic Properties.
To modify footprint references :
- Click Edit Text and Graphic Properties
- Select layer
- Enter line thickness (0.152 mm = 6mil)
- Enter text width, height and thickness at 0.75mm = 30mil
- Click OK when done
At the top, there are grid options. The grid will help you with the accuracy of your design. It is the distance between these two points. While designing, it’s a best practice to keep it at 5 mils. But if needed, you can click Edit User Grid and define your own values.
The differential pair design rules in KiCad
This circuit has a differential pair. There is a USB connector and there are two tracks running from there, D- and D+. And there is another differential pair, D1- and D1+.
If you want to define a pair as a differential pair, select Place Net Label on the right-hand side and click the screen. Whatever name you choose, it has to end with + and – or _P and _N.
This is very important for differential pairs. When you start the routing, if KiCad notices a D-, it will search for the D+ and consider these two tracks as differential pairs.
Now if you want to route two differential tracks, click Route at the top. You can see the option for single tracks, which is already available on the right-hand side, and there is the differential pair option. When we click it, a window pops up and mentions it is unable to find complementary differential pair nets. This is why you need to make sure the labels end with – and + or _N and _P.
We will show you how to route a differential net in the next KiCad tutorial. We will also show you how to do the impedance matching of your nets. There are two different differential nets, and their length should be the same.
Under Route, there is an option called Tune Differential Pair Length. We can show you right now how it works for a single track. We select Tune Track Length and then this red track. A note appears and reads ‘Too short: 37.440 mm/ 100.000 mm’, which means that we have set the target length as 100 mm, but the actual length of our track is just 37.44 mm. This is very important in DDRs, for instance, where you use address lines and data lines. There are eight different address lines and eight data and their length should be equal.
Differential pair length tuning
If you want to change your target length, right click the track and select Length Tuning Setting. As we just saw, the target length is 100 mm. We will see what happens when we write 40 mm. Meanwhile, don’t forget that all these parameters are very important in differential pairs. We will discuss this in our next KiCad tutorial when we cover how to route differential pairs. For now, we will just show you how the target length can be achieved.
So we set the target length to 40 mm. It is still indicating ‘Too short: 37.44 mm/40 mm.’ Now we want to make it 40 mm.
So place your cursor on the track and move it. You can see a small S-shaped track appearing. This is how you increase the size of your track.
And the note now reads ‘Tuned: 40 mm/40 mm’, which means the length is exactly 40 mm.
KiCad is a versatile tool for electronic circuit design and corresponding PCB design requiring familiarity and expertise. This guide on setting up KiCad for your PCB design will help you design faster and better. Good luck on designing!
DOWNLOAD OUR KICAD DESIGN GUIDE: