PCB Layout
Importing the Netlist
It’s finally time to get to work on what you’ve likely been looking forward to this entire tutorial: designing the PCB.
Importing the Netlist
To get started let’s open the PCB Editor, the next program in the KiCad suite that we will be using to build our board. If you’re still in the Schematic Editor after following the previous section, close out of it and return to the main KiCad window. Open up the PCB Editor by clicking on its button or by hitting Ctrl+P. After a moment, you should be met with an interface that looks similar to the Schematic Editor’s, except with a black background for the drawing area and and a completely different set of toolbars. To get started we will first have to import our schematic data, called a netlist. Click on the Update PCB with changes made to schematic button. This will automatically generate the latest netlist from your schematic and bring it into the PCB Editor. When the corresponding window pops up, just click on Update PCB at the bottom-right. All your components will now appear in the drawing area. To finish up, click Close. When you’re back at the main PCB Editor window, you should see that all the component footprints that you loaded are following your cursor. For now, just place the clump down somewhere in the middle of the drawing area.
...
Layer Name | Physical? | Description |
F.Cu B.Cu | Yes | Defines the copper layers where the PCB traces and copper planes will exist. Note that footprint pads are on this layer. |
F.Adhesive B.Adhesive | Yes | Defines adhesive areas. Only needed in some cases, such as when components are on the bottom side during reflow soldering. |
F.Paste B.Paste | Yes | Defines the areas to be covered with solder paste in reflow soldering. Also referred to as the stencil layer. |
F.SilkScreen B.SilkScreen | Yes | Defines labelling and artwork on the silkscreen layer. This is usually the (usually) white text and graphics that you see on a PCB. |
F.Mask B.Mask | Yes | Defines the area free of soldermask, the usually green layer of polymer that coats the board. |
User.Drawings User.Comments | No | Layers to be used for user comments and drawings. |
User.Eco1 User.Eco2 | No | Custom layers with no specific purpose – can be used for whatever you want. |
Edge.Cuts | Yes | Defines the edge of the PCB and/or internal cutouts. |
Margin | No | Defines a margin relative to the edge cut. |
F.Courtyard B.Courtyard | No | Defines each component’s “courtyard area”, the boundary that no other component should be placed in. |
F.Fab B.Fab | No | Documentation layers, mostly used for labelling important values such as dimensions, component names, and values. |
...
The ratsnest is extremely useful when doing the initial layout for your components as it shows what connections you will have to make in the trace connection routing step. With it enabled, board layout is just a fun game where you untangle the ratsnest and make the lines as short as possible. Let’s get to work on this by moving your footprints around. The hotkeys to move footprints are pretty much the same as those in the schematic editor. For instance, you can hover over a part and press M to move it around or R to rotate it. One major difference is that if you press F on a part, it will flip it onto the other side of the board. We will use this to move our battery holder to the back of the board to keep it out of view and give all the other parts a bit more space.
Additionally, you may notice that there’s a bit of snapping to the positions of footprints when you move them around. The grid that the snapping occurs on can be changed through a dropdown at the top:
...
There’s one important tool that should be mentioned before you get on your way: the 3D Viewer. This tool allows you to see a 3D preview of what your board looks like. This comes in handy quite a lot as it’s sometimes difficult to figure out what your board design is like with just a 2D view. To open the 3D Viewer, just go to View > 3D Viewer or press Alt-3. If you do this now, you will notice that all the components are laying on a very small square PCB. This is because you have not yet defined the board’s edges, but we’ll get to this later on. Also note that not all of your components have 3D models. Some, such as the PIC microcontroller, potentiometer and the programming header , and battery holder only have the pads visible. This should be fine, as all we need to know during layout is what things look like on the board itself.
...
This process is very similar to adding a symbol in the Schematic Editor. Click on the Add a footprint button on the right toolbar or hit A. Your cursor will then go into footprint placement mode. which you can exit by pressing Esc or clicking on the Select item(s) button on the right toolbar. Once you have entered footprint placement mode, the Choose Footprint window will open. Search for the MountingHole_3.2mm_M3_Pad
footprint through the filter, select it, and place it on in the drawing area. Now go ahead and get untanglingBy default this mounting hole will have a refdes, just like all the other footprints, but since this is just a hole we can get rid of that. This can be done by editing the placed down footprint and toggling the Show checkbox on the Reference designator row in the table at the top of the Footprint Properties window.
Now go ahead and get untangling! For now, you don’t need to worry about exact positions so just place them in an area such that it untangles the ratsnest as best as possible. On the next page Shown below is a view of the finished board with only the components visible. Note that I have made some layers hidden to make the footprints easier to see. You can identify the components by taking a look at its corresponding refdes on the silkscreen layer. Use this to get a bit of an idea of where you should be putting things. You don’t have to copy this board exactly though, try taking some creative liberties and perhaps learning a thing or two in the process.
...
As with any CAD program that allows you to create an arc, KiCad makes this process somewhat annoying. Start off by clicking to pick the center of the arc. Next, click to specify the radius of the arc. Now here’s the important part, move your mouse around to specify how long the arc extends clockwise.
Now that you’ve gotten your KiCad graphic design crash-course, let’s draw the outline of our board. Below is a dimensioned drawing of the outline that we used, but you are free to design it however you like. The only requirement is that the board is large enough to fit all the components and be a reasonable enough size to use as a keychain if you want to use it as such.
...
Creating a copper pour is fairly simple. Just click on the In order to ensure that we’re going to create a copper zone rather than a non-copper zone, select a copper layer (such as F.Cu
or B.Cu
from the layers panel. Next, just click on the Add a filled zone button on the right toolbar and click on a point that you want to use as one of the corners of the fill area. Anywhere outside the board edge should be fine. The Copper Zone Properties window will open. The first copper pour we want is for the 3.3V net on the top bottom layer of the board. Select FB.Cu
in the Layer panel, +3.3V
in the Net panel, and then click OK. The first vertex for your copper pour will be selected, just select the other three vertices to create a polygon that covers the entirety of the board. On the selection of the last point, double-click to complete the shape. Let’s repeat this process of for the other copper pour that we want: a ground plane on the bottom layer of the board. When creating this filled zone, select BF.Cu
in the Layer panel and GND
in the Net panel. This zone should also cover the entire board. Depending on which view mode is toggled, you should now either have no indication that a filled zone has been created except for the polygon surrounding the board, or your entire board should be filled by the copper layer. If the former is the case, you can take a look at the pours that you have created by clicking the Show filled areas of zones button on the left toolbar. Click between the F.Cu
and B.Cu
layers on the Layers Manager to see both the planes and make sure that everything looks okay. Note that the filled zones have automatically connected to any relevant component pads, so you don’t need to worry about that. Usually you don’t want to see the filled areas when you’re doing your trace routing so just turn it off for now by clicking on the Show only zone boundaries button.Before we move on, there’s a very important note that you should keep in mind while you’re routing your traces. Whenever you route traces on top of a pour you need to refill the zones afterwards to update them so they give clearance to the traces. Otherwise, your traces will be merged with the copper pours and that’s likely a bad thing. To refill all the copper pours on the board, go to Edit > Fill All Zones or simply hit B. You should do this every time you place some new traces. Hit the button as frequently as (I hope) you hit the save button, which should be quite frequently
Before we move on, there’s a very important note that you should keep in mind while you’re routing your traces. Whenever you route traces on top of a pour you need to refill the zones afterwards to update them so they give clearance to the traces. Otherwise, your traces will be merged with the copper pours and that’s likely a bad thing. To refill all the copper pours on the board (or in our case, to initially fill them), go to Edit > Fill All Zones or simply hit B. You should do this every time you place some new traces or create a new copper zone. Hit the button as frequently as (I hope) you hit the save button, which should be quite frequently.
Depending on which view mode is toggled, you should now either have no indication that a filled zone has been created except for the polygon surrounding the board, or your entire board should be filled by the copper layer. If the former is the case, you can take a look at the pours that you have created by clicking the Show filled areas of zones button on the left toolbar. Click between the F.Cu
and B.Cu
layers on the Layers Manager to see both the planes and make sure that everything looks okay. Note that the filled zones have automatically connected to any relevant component pads, so you don’t need to worry about that. Usually you don’t want to see the filled areas when you’re doing your trace routing so just turn it off for now by clicking on the Show only zone boundaries button.
Routing Best Practices
As an aside, the electrical team has compiled a PCB design best practices document, found here. This document not only goes through the dos and don’ts of PCB layouts, but also all other aspects of electrical design that the team does work in. Since that document is several pages on its own, I’ll tell you all you need to know to finish your board in the next few sections. Do take a look at that document along with the rest of the Electrical Standard sometime down the road though, as it contains a plethora of helpful information, reference material, and learning resources.
...
Have you played any of those games where you have to connect multiple pairs of nodes with “wires” without having any of the wires overlap, or maybe even tried to solve the Three Utilities Problem? Well, routing traces is pretty much just that. As you may know already, traces are just lines of copper on the PCB that conduct electricity between pads. You will use these to connect everything that you haven’t already connected using your power and ground planes.
Before we start, we’re going to want to change up a few settings so that the board is optimized for our manufacturing constraints. Since the KiCad defaults for trace width and via size are quite generous, we can definitely decrease these a bit to make our routing more compact. Start off by changing the current unit to mils by clicking on the Use mils button on the left toolbar. Next, go to File > Board Setup…. If you’re not already in the section, and click on Pre-defined Sizes under Design Rules on the left panel. Three lists of pre-defined tracks, vias, and differential pairs should pop up. Under the Tracks section, click on the Add button close to the bottom. A new entry will be added to the list above. We should be fine to make our track widths 8 mils, so set the new entry to that value. Next, click on the Add button under the Vias section. In the new entry set the Size to 30 mils and the Drill Hole to 15 mils.
Next, go to Constraints under Design Rules on the left panel. Under Copper, set the value for Minimum clearance to 8 mils, the value for Minimum track width to 8 mils, and the value for Minimum via diameter to 15 mils.
...
Routing a trace is quite similar to placing a wire in the Schematic EditorxEditor: click on one point to start the trace and then click again to finish that trace segment. If the trace doesn’t terminate at a pad, double-click to end it. One thing to be noted is that which layer you place your traces on, the front or back layer, depends on whether you have B.Cu
or F.Cu
selected in the Layers panel for the back or front of the board respectively. You can quickly switch between these layers by using the Page Up and Page Down keys. Also note that when you’re placing down traces, they angle snap at 45 degreesdegree angles. In routing it’s usually best practice to have the traces be this way.
...
Shown below is the trace layout of the finished reference board. Don’t forget to use vias, as those are what will be connecting the ground 3.3V net from the copper pour on the back to components on the front of the board. Also, don’t worry about routing traces over the silkscreen layer as in the manufacturing process the silkscreen will be applied as the top layer of the board anyway. As always, feel free to be a bit creative in the routing process if you so desire. This is definitely the stage at which you can really make things look quite pretty and unique.
...
To finish off our board and this exceedingly long tutorial, let’s pretty up the board by arranging our silkscreen labels and adding more where they are required. Let’s start off by organizing our refdes labels. If you want to follow the reference board, use the trace layout pictures from the last two pages above to get everything where they need to be. If you want to do things yourself, here are a few guidelines to make sure that everything looks as nice as possible:
...
Once you’re done, let’s add all the silk-screening that we will need to finish up our board. We’re mostly going to be using the Add a text item tool for this, which can be found on the right toolbar. This tool is very similar to the Place text tool in the Schematic Editor, so not much explanation is needed. Let’s start off by adding a label to the first pin of the programming header to indicate that it’s the MLCR (Master Clear External Reset) pin. With the tool enabled, click anywhere on the drawing area to start the label-making process. Before anything else, ensure that we’re going to be creating labels on the front of the board by choosing F.Silkscreen in the Layer drop-down. Don’t worry about label width, height, and thickness values, as we can change these up after we place it down. Specify the text that you’d like to use in the Text text-area, in our case “~MCLR~ 3.3V”. Note the tildes“3V3 ~{MCLR}”. Note the tilde and curly braces, which you can use to put a bar over “MCLR”. The first pin of the programming header will be indicated by a shaded-in box on its silkscreen. Place a label near it with the text. Just like the Schematic Editor, you can hover over a feature and press R to rotate or E to open its properties and modify its settings to make it look nicer if you’d like. Repeat this process to add the rest of the silkscreen text to the front of the board.
To finish up add some decor to the front, we can add a Waterloo Rocketry logo silkscreen. The footprint library that we downloaded from GitHub has many silkscreened logos that we can use exactly for this purpose. Click on the Add Footprints button on the right toolbar and click somewhere on the drawing area. Once the Choose Footprint window appears, find the Tutorial_Footprints
library and expand it. You should now see a few logo footprints. You can preview any one of them by clicking on one. Choose a logo to use, making sure that it is a silkscreen logo as opposed to a solder-mask logo, as indicated by the name. Logo_SilkScreen_15mm
was used on the reference board. Place the logo wherever you see fit, making sure to not have it overlap with any footprint pads and preferably any vias.
...