PCB Layout

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.

Layers

Before we move on, we should get familiar with an important PCB Editor feature: layers. A PCB is a three-dimensional object composed of multiple layers of various materials. The PCB Editor represents this “stack” using its layers system. On the right side of the window you should see the Appearance pane open to the Layers tab. Here you will be able to toggle the visibility of the board’s layers and choose which to edit. If you read through the layer names, you will notice that a lot of them are prefixed by either F. or B.. These prefixes indicate whether the layer is on the front or back of the board, respectively. For instance, the layer F.Cu contains the copper pours and traces on the front side of the board while B.Cu contains those on the back. For this board we will be using a 2-layer PCB layout. These two layers are the front and back of the board. In more complicated PCBs it is common to see more layer sandwiched in between the two outside layers, but two layers is usually enough for most of our designs.

Zoom into the parts you placed previously and try toggling a few of the layers using the eye icon beside them to see what changes. Additionally, you can click on a layer to make it the top-most visible layer to get a better view on it. Note that the layers are color-coded for visibility, and you can even customize these colors if you so desire. Below is a table that gives a run-down of what each layer in the Layers Manager does. Whether the layer will physically exist on the finished board or only exists in the PCB Editor to provide information have also been specified. Layers relevant to us are bolded, as not all of them will be used when designing our board.

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 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.

Now that you have some understanding of what each layer does, zoom into the parts you placed previously and toggle a few layers again, taking a look at what the layers correspond to on the footprints. Perhaps take a bit of time to get familiar with all the layer colors too.

Rough Component Layout

Let’s get started on our board by first moving around our clump of footprints into something that we can work with. You’ll notice that there are white lines connecting footprints. This is called the ratsnest and it displays the electrical connections that you will need to make between pads on the board. If you cannot see the ratsnest or want to turn it off at any time, click on the Show board ratsnest button on the left toolbar.

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 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.

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:

The location of the grid snapping selection on the top toolbar

Currently, the grid snapping values might be in increments of inches or mils (1/1000 in). To switch to the vastly superior metric system, you can switch the units to mm by clicking on the Use millimeters button on the left toolbar. The button to change back to mils is right above. For your information, the reference board was designed in mils. Additionally, you can temporarily disable snapping while placing down a part by holding down the Ctrl key.

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 potentiometer and the programming header 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.

Another quick thing to note is that when you move a component to the back layer, it flips the entire footprint. Because of this, it may be tricky to work with such components as everything is backwards. Fortunately, there’s an easy solution to this. You can flip the entire board, essentially viewing its other side, by going to View > Flip Board View.

Lastly, we need one more footprint for the PCB that we will manually add from the PCB Editor, and that is the hole for the keychain. Note that if you don’t want to use your PCB as a keychain then you can skip this part.

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 in the drawing area. By 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. 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.

The top layer of the PCB. Note the rotations of the components. For more ambiguous ones, such as the resistors, rotate them such that their ratsnest is the least tangled

 

 

Creating Board Edge Cuts

Now that we have a rough idea of where our components are going to be and how much space it’s going to take up, let’s define our board’s shape. This can be done by drawing polygons on the Edge.Cuts layer. To enable drawing on a layer, click on it on the Layers panel. You should then see a small blue arrow that indicates that you are currently working on that layer. The tools you will be using to draw your board edges will be on the right toolbar:  Draw a line and  Draw an arc. If you’re well-versed in CAD then you should feel right at home with these tools. Let’s quickly go through how each one works.

Draw a line

This is the simplest of the tools to work with. Simply click on one point to start the line and click somewhere else to finish it. When you’re placing a line and your cursor is near the end of another line segment or the center of a circle/arc, a hollow circle will pop up to indicate the location where the line can be connected to. This can be used when you’re connecting up lines to create a polygon. To terminate a line without connecting it to another, just double-click. You may notice that this process is very similar to laying wires in the Schematic Editor.

Draw an arc

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.

Component Layout

Now that we’ve gotten the board shape specified, start laying out your components within its confines. Shown below are two views of the finished board with the components visible along with the board’s edge. Use this as a guideline to do your own layout or go wild and design it how you like. Just remember to keep the ratsnest untangled and components rotated to how they should be. It always helps to use the 3D Viewer occasionally to see how things look.

 

Pouring Planes

Now that we’ve finalized the layout of our components, it’s now time to electrically connect them up. On top of using the standard electrical traces to hook up our pads, we will also be using two copper pours, one on each side of the board, to make our power connections. While electrical traces are very specific in what they connect, usually being a connection between a few pads, a copper pour is more of a “to whom it may concern”. Creating a pour fills up the areas on of the PCB that don’t have any traces with a massive plane of copper. These copper planes can be used to conduct electricity and connect a large number of component pads. Pours are most commonly used to easily connect power and ground to components on the board, as almost all components require these connections. We will be using our two copper pours to connect up our ground and 3.3V source.

Creating a copper pour is fairly simple. 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 bottom layer of the board. Select B.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 F.Cu in the Layer panel and GND in the Net panel. This zone should also cover the entire board.

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.

Trace, Via, and Constraints Setup

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… 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 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.

And there we go! The values have been entered and all we need to do now is select our pre-defined sizes for use. Click OK to close out of the Board Setup window and set our traces and vias to our new pre-defined values through the first and second drop-downs at the top of the window:

Select our 8 mil trace width from the first drop-down and the 30/15 mil via size from the second.

Vias

Before we get to routing, it would be helpful to know what electrical vias are. As you know, our PCB consists of two different layers, one on the front and the other on the back of the board. You can use traces to route between two points on a single layer, but how would you make connections between the two layers? Vias are exactly what you need to do this. A via consists of two pads on different layers of a board that are connected together by an electroplated hole that tunnels through the PCB’s non-conductive middle. All you need to do to make a multi-layer connection is route traces (from the same net, of course) to a via on both sides.

Routing Traces

Now, it’s finally time to get routing! To do so, there’s only two tools that you will need: Route tracks and Add free-standing vias, both on the right toolbar. The hotkey for routing is X, and while you are routing you can press V to easily place a via.

Routing a trace is quite similar to placing a wire in the Schematic Editor: 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 snap at 45 degree angles. In routing it’s usually best practice to have the traces be this way.

All you’ll need to do for your routing is create traces between the pads that need to be connected up, indicated by the white lines in the ratsnest. When you start creating a track from an existing track or a pad, the entire drawing area will darken except for traces and pads that are on the same net as the trace and/or pad that you are working with. These are the only locations that you can connect your current trace to. This is very helpful when you have a spaghetti mess of traces going everywhere and just want to know where you can hook things up. As mentioned before, every time you’re done placing some traces remember to refill your copper pours. Doing so frequently can cause less headaches in the future, as you will immediately be able to know if one of your traces has cut off a copper pour to a pad that requires it, and will be able to fix it right away. Finally, when doing your routing there is one golden rule that you should try to follow: avoid making 90° angles. When connecting traces together or creating bends, avoid right angles and instead opt for 45-degree angles. Below are some alternatives to right-angle traces that you may see yourself needing on your board.

Placing a via is as simple as selecting the tool and clicking somewhere on the board. You can either place down a via and route your traces to it or directly click somewhere on a trace, creating a connected via at that location. Remember that vias exist on both layers of the board, so make sure that you’re not accidentally connecting together two different nets together when you place one. Another useful application of vias is to “hop” over traces. If you want to route a trace in a path that intersects with another and this blocked path will makes detours messy, you can simply place vias on both sides of the blocking trace and route your trace to one of the vias, route between the two vias on the other layer, and continue on the original layer.

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 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.

Design Rules Checker

Well, that’s the PCB routing done. I hope you had a lot of fun doing it as this is my personal favorite part of the PCB design process. Just like we did when we finished up wiring our schematic in the Schematic Editor, we’re going to use an automated rules checker to verify that everything is hooked up properly and that no clearance issues exist. Click on the  Show the design rules checker window button on the top toolbar. Click on Run DRC over on the bottom left. If the Violations and Unconnected Items tabs do not display any errors (warnings are fine), then you can close the window and continue on. If a few issues do exist, take a look at what the errors say and fix the offenders. Keep doing so until the DRC stops complaining when you run it.

Silkscreen Labels

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 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:

  • Make sure that labels are do not overlap each other or any component pads.

  • Try to avoid overlapping with vias, as soldermask will not be applied on their exposed metal. It’s not that big of as issue though so ignore this rule if you have to.

  • Make sure that all labels are rotated to face the same way.

  • Make sure that the refdes labels are close to their footprint and that it’s clear as to which component it corresponds to.

  • Change up the snapping grid size to make labels line up better. Don’t make the grid too fine though, as silk-screening can only be so accurate.

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 “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 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.

That’s all for the front silkscreens. Let’s take a look at what they look like on the reference board:

The last silkscreen labels that we will be inserting are the ones on the back layer of the board. To make it easier on ourselves, let’s first flip the board – recall that the option to do so is in View > Flip Board View. There’s not much to add except for a Waterloo Rocketry logo and some board information.

Starting with the Waterloo Rocketry logo, we can repeat the steps used previously to insert the Logo_Horizontal_Silkscreen_10mm footprint. Make sure that you’re creating this label on the B.Silkscreen layer. Once that's done, All that’s left is to add a label to provide some info about the board, such as board name (both official and nickname), creation date, and designer name. There’s not much to this, just place down a label with the board name, “2022 Electrical Tutorial”; its nickname (we named ours’ “Achievement Get!” but name it whatever you want), The designer name (first and last name, or first initial and last name), and the date of creation in YYYY-MM-DD format.

Below is what the reference board silkscreens look like on the back layer after following the above instructions:

Congra-wait, before that, save the board. Okay now, congratulations on creating your first board in KiCad, entirely from scratch! Take a bit of time to marvel at the masterpiece you have created, whether it be in 2D or through the 3D Viewer. At this point you’re pretty much done with this tutorial. If you’re eager for some extra learning or would like to know how you can turn this design into files that can be used by a manufacturer to actually create the board, the next, completely optional bonus section is just for you!