1. Blog>
  2. Layout in Pcbnew --- Part 1

Layout in Pcbnew --- Part 1

by: Sep 14,2020 7527 Views 0 Comments Posted in PCB Design & Layout

layout pcbnew pcb kicad pcb design toolbar footprint

Pcbnew is KiCad’s layout editor. Think of it as a drawing program that is specifically designed for drawing printed circuit boards. Pick up a PCB and, and try to identify and list its most important attributes.


Your list should be similar to this:

1.  Components, like resistors and integrated circuits,

2.  Wires (or traces, as we will call them), that connect the components,

3.  A board made of fibreglass or similar material, with a particular shape,

4.  Graphics, like text or drawings, printed on the board,

5.  Holes, large or small.

6.  Components, wires, and graphics may appear on one, or two sides of the board. Wires can also appear in many layers that are sandwiched between the top and bottom layer to allow for more complicated circuits.

We use the layout editor to design a PCB with all of these elements. With KiCad’s Pcbnew, you can design PCBs that are very simple, like the one we are working on in this section, and extremely complicated and dense ones, like the one in Figure 1.

Figure 1: An example of a relatively dense layout in Pcbnew. It belongs to the Crazyflie project[4].

In the next few pages, you will take a hand-on tour of Pcbnew and learn about it most important features.


The user interface

Let’s start Pcbnew. The objective is to become familiar with its user interface and the functionality that is absolutely necessary for our very simple first project. 

To start Pcbnew, go back to the KiCad main application, and click on the Pcbnew button, as in the example in Figure 2.

Figure 2: Start Pcbnew from the main KiCad application window.

You can also start Pcbnew through the menu. Click on Tools, and then 'Run Pcbnew', or through a keyboard shortcut (Ctrl-P on Windows and Linux, Cmd-P on Mac OS).

Pcbnew will start, and you will see the main window. It should look like the example in Figure 3.

Figure 3: The Pcbnew main window, with its toolbars annotated.

Compared to Eeschema, Pcbnew may seem more complex and even intimidating, but rest assured, it isn’t. In this part of the book, I will help you to learn only the most important functionalities so that you can start designing your PCB very quickly. Just like we did in the Eeschema segment, we’ll start with the basics of the layout sheet (item 1 in Figure 3), then learn about the mouse and hotkeys controls, and then the toolbars and menu bars (the rest of the items in Figure 3).

Let’s start with the layout sheet.


The layout sheet

Similarly to Eeschema, in Pcbnew you design your PCBs inside the designated sheet area. It does look very similar to the schematic sheet. You can also edit the layout template in Pcbnew in the same way you did in Eeschema. That is, by editing the page layout description file using the Pl_editor application.

You can also load an existing custom layout exactly as you did in Eeschema. In Pcbnew, click on the File menu, then click on Page Settings. At the bottom right side of the window, you will see the 'Page layout description file' text field. Use the 'Browse' button to find and select the template you created earlier in this section.

While you have the Page Settings window open, let’s fill in the form so that it looks like the example in Figure 4.

Figure 4: The Pcbnew Page Settings dialog box.

As you can see, the fields in the Pcbnew page settings window are identical to the ones in Eeschema. Click on the Ok button to commit the title block text, and confirm that your text appears in Pcbnew’s title block (as in the example in Figure 5).

Figure 5: The Pcbnew title block.

The layout sheet uses a grid to help you place components on specific, evenly spaced, locations. You can control the size of the grid from the grid drop-down widget in the top toolbar.

Figure 6: You can change the grid size from the Grid drop-down widget.

When you are working on loosely populated PCBs (like the one we are working on in this segment), you can opt for larger grids. 

Another useful feature that you will use a lot, is called 'Zoom to Fit' (Figure 7).

Figure 7: Zoom to fit changes the zoom level so that the entire PCB fits in the Pcbnew window.

When you click on the 'Zoom to fit' button, situated in the top toolbar, the zoom level of the sheet changes so that the complete PCB can fit within the Pcbnew window.


Mouse buttons and hotkeys

In Pcbnew, the mouse and hotkeys work almost exactly the same as they do in Eeschema. I use a mouse with two buttons and a scroll wheel. The scroll wheel is useful for zooming in and out of the sheet.

This table contains information about the default role of each button or button and key combinations:

Table 1: Mouse controls in Pcbnew.

When you do a single left click on a footprint, the footprint’s details are shown in the status bar, at the bottom of the Pcbnew window, like in the example in Figure 8.

Figure 8: To see a footprint’s details, click on it.

In the example of Figure 8, I have left-clicked on the footprints of a potentiometer ('RV1'). In response, Pcbnew shows me the details of this footprint in the status bar, in the area inside the red box. From this, you can see the number of pads included in this footprint (3), it’s orientation (90 degrees from its default orientation), which library it belongs to ('BC Miniproject v2:7Trimmer_Vishay'), and more.

When you double left-click on a footprint, the Footprint Properties window for this footprint will come up.

Figure 9: Double left-click on a footprint to open the footprint properties window.

In the footprint properties window, you can edit that footprint’s properties, such as its reference designation, its orientation, position, and much more. You can also change the association of the underlying component to a different footprint, or start the footprint editor so that you can edit the current footprint.

The right mouse button produces a contextual menu that depends on what you clicked on. For example, if you click on a footprint, you will get the context menu in Figure 10.

Figure 10: Clicking on a footprint produces this context menu.

Many of the functions in this menu are accessible through simple hotkeys, like 'E' for the Properties window, 'R' to Rotate, and 'M' to Move. These hotkeys should be familiar to you from Eeschema. 

If you right-click on a track, you will get the context menu in Figure 11.

Figure 11: Clicking on a track produces this context menu.

Notice the there is very little difference between the two context menus. The track contextual menu contains the 'Select' options, which the footprint contextual menu does not. The footprint contextual menu, on the other hand, contains the 'Open in Footprint Editor' option, which the track contextual menu does not. Don’t worry about what these specific functions do, for now, as we will not need them until later in this book.

Finally, if you right-click in an empty area of the sheet, you will get the context menu in Figure 12.

Figure 12: Clicking on an empty area of the sheet produces this context menu.

These are functions that allow you to reposition the sheet, zoom in and out, and change the grid size.

Hotkeys in Pcbnew are as important as they are in Eeschema. Most of the hotkeys that you are already familiar with from Eeschema will work in Pcbnew, but there are some differences, so it is worth spending a few minutes here.

With Pcbnew in focus, type '?' Or Alt-F1. You will see the Hotkeys List (Figure 13.

Figure 13: The Hotkeys List in Pcbnew.

There are a lot of hotkeys available, but for the purposes of your quick introduction to Pcbnew, only a few are necessary. To use a hotkey, simply place the pointer of your mouse over a footprint, track, text or another part of the layout sheet and type the hotkey.

Table2: A list of the most frequently used hotkeys in Pcbnew.

There are more hotkeys available in Pcbnew, but the ones listed in Table 9.1 are the most useful ones. Before long, you will commit them to memory and use them constantly.

If you wish to change some of those hotkeys, you can. The process is the same as the one you learned about in the Eeschema segment. Click on the Preferences menu item, then Hotkeys Options, and then Edit Hotkeys (Figure 14).

Figure 14: How to edit your hotkeys in Pcbnew.

This will reveal the Hotkey editor (Figure 15):

Figure 15: Select an existing Hotkey to highlight it, and then type in a new key or key combination.

To change a Hotkey, simply select it with your mouse and type in a new key or key combination.

Now that you know how to use your mouse and keyboard to control Pcbnew, let’s move on to the next topic and learn about the toolbar functions.


Pcbnew toolbars and menus

In Pcbnew, the available functions and tools are grouped in toolbars, menus, and the status bar. 

You can see the standard Pcbnew window in Figure 3. Following is a quick summary of the purpose of each bar. We’ll look at some more details at later parts of this book.

The left toolbar, marked '2' in Figure 3, contains functionality for controlling the visual representation of the various elements of the PCB, as well as of the user interface. For example, you can turn on or off the display of rats nest lines. These lines show incomplete connections between pads. You can also show or hide the part of the right toolbar that allows you to switch to particular layers. 

The right toolbar, marked '3' in Figure 3, contains the mains functions needed for editing the contents of the sheet. This is where you will find buttons for adding a new footprint, new tracks, and vias, text or graphics on your sheet. 

Next to the right toolbar is the Layers manager, marked '4' in Figure 3. You can hide it by clicking on the Layers button in the left toolbar if you are working on a small monitor and you want to maximize the available space in the sheet. The Layers manager allows you to select the board layer on which you want to work next. For example, if you want to work on the front layer, you will click on the 'F.cu' option to select it. If you want to work on the back layer, you will click on the 'B.cu' option.

At the top of the Pcbnew window are three groups of functions. Two toolbars, and the drop-down menus. Marked as '5' in Figure 3 is the Sizes toolbar. It allows you to select sizes for the tracks, vias and the sheet grid. 

On top of it is the main functions toolbar, marked as '6' in Figure 3. This is where you will find functions for saving your work to a file, printing your layout on paper, exporting it for manufacturing, performing the design rules check (an equivalent of the Electrical Rules Check in Eeschema), and importing the Neltlist file that you created in Eeschema.

Finally, at the very top of the Pcbnew user interface, we have the drop-down menus. Many of the functions that are available through the toolbar buttons are also available through the menus and, of course, through hotkeys. But there are several functions that are only available through the menus. An example is the Preferences menu, where its contents are only available through it.

Let’s have a closer look at the items that I described above, and learn the most frequently used functions by continuing the work we started in Eeschema. We’ll design a very simple PCB for our resistor and LED circuit.


Left toolbar

In the left toolbar (Figure 16) there are several functions there are familiar from Eeschema. For example, buttons labeled 2, 4, 5, and 6 have the same functionality in Pcbnew as they have in Eeschema.

Figure 16: The left toolbar.

For now, let’s not be concerned with buttons 1, and 7 to 16. These will make more sense when we are working on a more elaborate PCB so that we can make use of them.

Let’s try out the grid button (2). Click on it to enable it. You should see a thin black box around it, indicating that the grid is enabled. White horizontal and vertical lines should be visible in the sheet if the grid size is of an appropriate size. In Figure 17, I have enabled the grid and set its size to 1 mm.

Figure 17: Enable the grid and adjust the grid size.

Button 3 allows you to change the relative coordinate system from Cartesian to Polar. I am more accustomed to the Cartesian system so I stay with the default. With the relative coordinate system, you can measure the distance between two locations in the sheet. This is a very useful function in Pcbnew as we want to design very accurate boards that will match well with the components we plan to attach. In Figure 18 you can see the Cartesian and Polar coordinate values as they appear in the status bar.

Figure 18: Cartesian (right) and Polar (left) coordinates.

Buttons 4 and 5 allow you to switch the length measuring units to millimetres or inches. 

Button 6 allows you to change the shape of the cursor to be either a simple pointer or a pointer with crosshairs that reach the sides of the Pcbnew window, as you can see in Figure 19. 

Figure 19: Pointer type changed to crosshairs.

In the next segment, we’ll have a look at the top toolbar. You will learn how to use the Netlist button to import the schematic from Eeschema so that you can start working on the layout for your first PCB.


Top toolbar

The top toolbar contains several groups of buttons that include principal functions in Pcbnew. These functions allow you to save the layout to disc, print it to paper or to a format that is supported by PCB manufacturers, select a layer in which to continue work, import a netlist, and more.

In Figure 20 you can see an example of the top toolbar.

Figure 20: The top toolbar in Pcbnew.

As you can see, there is a lot going on here. Some of the buttons should be familiar to you; you saw them in Eeschema. With reference to the numbers in Figure 9.20, buttons in groups 1, 3 and 4 work the same in Pcbnew as they do in Eeschema. 

Let’s explore some of the most commonly used functions of the toolbar by continuing with the simple project we started in the Eeschema segment.


Import the Netlist

The layout work begins by importing the Netlist file. I remind you that this file contains the information that Pcbnew needs in order to import the necessary footprints and setup the ratsnests in the layout sheet. The ratsnests are thin lines that connect the footprint pins that must be electrically connected. 

Let’s do this now. Click on the Netlist button, marked '6' in Figure 20. 

Figure 21: The Netlist window.

The Netlist window will appear. There are a lot of options that allow you to fine-tune the behaviour of the Netlist import function. As we are importing a Netlist to an empty sheet, the actual setting don’t matter. However, imagine that you are importing a Netlist to a layout that already has footprints in it. Perhaps you had to go back to Eeschema to make updates and corrections, which resulted in a new Netlist file. How would you like Pcbnew to handle components that have a new footprint? Or a footprint that exists in the sheet but not in the Netlist you are about to import? These are things we can control by making appropriate choices in the Netlist window.

In this example, we will accept the default options and let the import proceed. Notice that in the 'Netlist File', the Netlist file we created in Eeschema is already listed. If it isn’t, click on the Browse button to find it and select it. 

Next, click on the 'Read Current Netlist' button. Pcbnew will read the file and show you the results in the Messages text area. The window will not disappear. Move it a little to the side, and notice that the circuit’s footprints are now in the layout sheet. 

Figure 22: Reading the Netlist file will place the footprints to the sheet.

Click on the 'Close' button to dismiss the window. Let’s concentrate on the footprints that we just added to the layout sheet.


Move footprints

The two footprints should be attached to your mouse pointer. Click anywhere inside the sheet to place them.

Place your cursor on the footprint bundle and use the scroll wheel to zoom in.

Figure 23: Zoom into the footprint bundle.

Let’s separate the footprints manually. Use the 'M' hotkey to move one of the footprints away from the other. When footprints and other items are overlapping, the exact location where you mouse course is at may be occupied by more than one of them. When that happens, Pcbnew does not know which item you want to operate on. It will produce a context menu asking you to clarify. 

It looks like in the example in Figure 24, where I placed the mouse pointer on a location where three items 'exist', a pad, and the two footprints. Then, I typed 'M', for 'Move'. I am working at zoom level 7.33 and grid size 0.25 mm.

Figure 24: A context menu asking for clarification of item selection.

You can click and select one of the footprints. This will attach the footprint to your mouse pointer. You can then move it, and do a left-click to place the footprints on its new position.

Alternatively, because the LED footprint is larger than the resistor, it is an easier target. Place your cursor on it, taking care to be clear of the resistor, and again type 'M'. In Figure 25, you can see how I moved the LED footprint to the left of the resistor.

Figure 25: The two footprints are not overlapping.

Let’s rotate the resistor by 90 degrees. Place your mouse pointer over the resistor footprint, and type 'R', for 'Rotate'. You will also need to use 'M' on the resistor to move it a bit to the right, as in the example in Figure 26.

Figure 26: Move the resistor by 90 degrees. The arrow shows the ratsnest line.

In Figure 26 you can also see the single rattiest line, which indicates that we must create a track that connects pad 2 of the LED footprint (D1) with pad 1 of the resistor footprint (R1).


Design Rules Check (DRC)

At the moment, we have the two footprints in the sheet, placed at locations where I think are appropriate for this project. We will need to use some of the tools in the right toolbar, but before we get to it, I’d like to introduce a few more of the functions from the top toolbar.

One of the most important functions is the Design Rules Check (DRC) which you can access via the button labeled '7' in Figure 20. The DRC is similar to the ERC in Eeschema. It checks your layout for errors. 

The most common errors that the DRC can find are things like:

two tracks are too close to each other

no tracks connecting pads that should be connected

a track is too close to a pad

a track is to close to the edge of the board

a track is too close to a via

a via is too close to a pad

There are more, of course. The details of things such as 'when are two tracks too close to each other' and ' when is a track too close to a pad', are all configurable by editing the Design Rules for the project. You can do that by calling the Design Rules Editor from the Pcbnew main menu item 'Setup' (item '7' in 9.3). The Design Rules Editor looks like the example in Figure 27.

Figure 27: The Design Rules Editor in Pcbnew.

In Figure 27 you can see the default design rules. All the values are in millimeters. As per these rules, tracks must be 0.2mm away from other tracks, vias, and pads, or more. The width of a track must be 0.25mm or more, and so on. You can also see the default global design rules by clicking on the 'Global Design Rules' tab. For the purposes of this simple project, we will work with these default rules. In later projects, you will learn how to make modifications to the design rules. Let’s click on the 'Cancel' button to exit this dialog box.

Next, let’s do a DRC now, even though we know that our layout is not complete. I’d like you to see what a DRC error looks like, and learn to interpret it. Click on the DRC button, and the window depicted in Figure 28 should appear.

Figure 28: The DRC Control window.

On the left side of the DRC Control window, notice that there are several options, such as 'Min track width' and 'Min via size'. These values are copied from the Global Design Rules settings. You can confirm that by clicking on the 'Global Design Rules' tab in the Design Rules Editor (Figure 27). The DRC Control window allows you to change these values to you can try the DRC with custom values. 

For example, let’s say that the default values case the DRC to report an error because a track to closer than 0.2mm to a pad. If you know that your PCB manufacturer can accommodate clearances of 0.1mm, then you can use '0.1' as a custom value in DRC Control to see if the error still comes up. If not, then you can continue with your work, knowing that your manufacturer will be able to produce the board. But if the error comes up again, you will know that you have to move the track further away from the pad.

To start the check, click on the 'Start DRC' button. The result should be what you see in Figure 29.

Figure 29: The DRC reveals that two pads are not connected.

The DRC reveals no problems in the Problems/Markers tab, but show two unconnected pads in the Unconnected tab. If you click on the error message, it will automatically zoom and pan into the location of the error. This error is easy to understand: Pad 1 of the R1 footprint on the front copper layer, which also exists in the back copper layer (since this is a through-hole component), should be connected to Pad 2 of the D1 footprint.

Let’s fix this. We will need to use the Wire tool that belongs to the right toolbar. In Figure 30, the arrow points to the Wire tool. You can also activate the Wire tool by typing the 'X' hotkey, which is how I prefer to do it.

Figure 30: The Wire tool.

Place your mouse pointer over pad 1 of the resistor, and then type 'X'. With the wire tool selected, mouse your mouse slightly to the left, and notice that a thick red line that connects pad 1 of the resistor with the mouse cursor (Figure 31). 

Figure 31: Drawing a new track.

As you are drawing the track, notice that the ratsnest line that connects pads 1 and 2 is still showing. This indicates that the electrical connection is not complete. Place your cursor in the middle of pad 2 of D1, and double click to complete the new track. 

Figure 32: Completed drawing a new track.

You now have a completed electrical connection between the two pads, and the ratsnest line has disappeared. A solid red line with two segments represents the new track. When you manufacture this board, this red line will be implemented with copper.

The line of the track is important. By default, red refers to the top copper layer, and green refers to the bottom copper layer. You can see which colours represent the various PCB layers by inspecting the 'Visibles' panel on the right side of the Pcbnew window. Figure 33 shows the first few items in the list, which includes the top and bottom copper layers.

Figure 33: Each layer has its own colour.

With the only unconnected pair of pads connected, there should be no more DRC errors. Repeat the DRC to make sure. It should come back clean, with no errors in the Problems/Markers and Unconnected tabs.

There is still more work to be done. At the very least, we must add a connector so that we can connect this simple circuit to a battery. We also need to mark the borders of the PCB so that Pcbnew, and eventually the manufacturer, know where to cut the board. But before we get to that, let’s have a look at the 3-D representation of our work so far. In the main menu, click on View, and then click on '3D Viewer' (Figure 34). 

Figure 34: a 3-D representation of our incomplete board.

In the 3D viewer, you can manipulate the model using your mouse. Zoom in and out, pan and rotate. You can get a very accurate preview of what the PCB will look like if you went ahead to manufacture it. Many footprints, like the LED and the resistor, have 3D models that are used to render this view. If a footprint does not have a 3D model, only its pads will be shown.


Plot for Gerbers

While we are still on the top toolbar, let’s have a quick look at the Gerber plotter and the layer chooser. You can access the Gerber plotter by clicking on the button with the plotter icon in the group of buttons marked '4' in Figure 9.20. In Figure 9.35 you can see the Plot window.

Figure 35: The Plot window from where you create the Gerber files.

When your layout work is complete and you are ready to send it to a manufacturer, you will need to create several files that contain the necessary board information. The Plot window is where this operation takes place. Several files are needed because a PCB is the combination of multiple layers and holes. You already know about the top and bottom copper layers, but there are more. For example, there is the layer on which the graphics are printed, both on the top (front silkscreen, or 'F.Silk') and the back (back silkscreen, or 'B.Silk'). There is also the solder mask, front, and back ('F.Mask' and 'B.Mask' respectively). The solder mask is a polymer material that is applied over the copper traces to prevent short circuits and protect against oxidisation. It also makes it easier to solder components onto the board by preventing the solder from spreading away from the pads and onto the tracks.

Each of the layers that your PCB uses is described by its own file. In the Plot window, you will select which files you’d like to create and then click on the Plot button to have them created.

Most PCBs also have holes, used to implement things like vias, pads for through-hole components, and opening for mounting screws. There is a separate file that you must create that will contains information about these holes, called the 'Drill File'. To create the Drill File, click on the 'Generate Drill File' button, which is right next to the Plot button. This will bring up the Drill Files Generation window, that you can see in Figure 36.

Figure 36: The Drill Files Generation window from where you create the Drill File.

Pcbnew can explore files in several different formats, but every manufacturer I have ever used can work with Gerber-formatted files, so we will use this type in this book. By default, Gerber is selected for the Drill Files and the Plot files. 

The exact options that you should select depend on the expectations of your PCB manufacturer. For example, OSHPark has a guide to help you with the Gerber export step. OSHPark also allows you to submit the Pcbnew file with the .KiCad_pcb extension, and avoid having to create the Gerber files altogether, which is a welcome convenience. Pcbway.com also has a guide that details the Gerber file export process from KiCad.

I will show you how to do both in the next project, in which we will design and produce a PCB.


Layer chooser

The last top-menu item that I’d like to introduce is the Layer Chooser. It is labeled '8' in 9.20. You can see it extended in Figure 37.

Figure 37: The top-menu dropdown allows you to switch between layers.

The Layer chooser in the top toolbar contains the exact same items as the Layer tab in the Visible pane next to the right toolbar. It allows you to switch between layers. 

Let’s do a quick experiment. Let’s delete the only track so far, and redraw it, but this time in the bottom layer. 

First, the delete part. Place your mouse cursor over the red track. Try to avoid any areas where the track overlaps something else, like a pad. If you do, Pcbnew will ask you to clarify your selection with the context menus you saw previously. With your mouse over the track, hit the 'delete' key on your keyboard. The track will disappear, and the ratsnest will appear in its place. 

Next, click on the Layer Chooser to open it, and click on B.Cu (Back Copper) to select it. Notice the small triangle pointing to 'B.Cu' in the Layer tab of the Visibles pane (Figure 38).

Figure 38: The back copper layer is selected.

Now, let's re-draw the track. Place your mouse over one of the pads indicated by the ratsnest, and type 'X' to start drawing. Complete the drawing by double left-clicking on the other pad. Your layout should look like the example in Figure 39. The track is now green instead of red since it is in the bottom copper layer.

Figure 39: A new track in the back copper layer.

With two-layer boards, it does not matter much whether a track is placed on the top or the bottom layers. These days, single and double layer boards bring no material differences in cost or manufacturing processes. 

We will discuss PCB design principles and considerations later, and learn good common practices for choosing positions for footprints and tracks, but for now let’s continue to focus on Pcbnew.


Right toolbar

The right toolbar is where you will find the various drawing tools. With these tools, you can add and remove footprints, graphics, text, dimensions and, of course, tracks to the layout sheet. In Figure 40 you can see the right toolbar annotated with numbers to make reference easier.

Figure 40: The right toolbar.


Standard mode

The button, marked as '1' in Figure 40, allows you to the standard drawing mode. Most likely, you will enter the standard mode by hitting the ESC key. In Standard mode, you can click and select footprints and other items, right-click to reveal the context menu and measure distances between two points in the sheet.

Try this now: Hit the ESC key to enter standard mode, and click on the LED footprint. You will see that the footprints properties appear in the status bar, at the bottom of the Pcbnew window.

Figure 41: Click on an item while in the standard mode to display the item's properties.

In Figure 41, I have clicked on the LED footprint. In the status bar, I can see that this footprint designator is 'D1', it is on the front copper layer ('F.Cu'), it has two pads, and more. 

Try clicking on the green track, that connects the LED to the resistor. The status bar will tell you that the name of the net which is implemented by the track is 'Net-(D1-Pad2)', and that it is drawn in the back copper layer ('B.Cu').


Net highlighter

The next button in the right toolbar, marked '2', is the net highlighter. While our current PCB is minimal, with a single net[5], you will quickly find yourself working on PCBs with many nets. In Figure 42 you can see an example PCB that contains several more nets than our current PCB does. 

Figure 42: A PCB with several nets.

With only a glance at this board, it is hard to determine which tracks belong to, say, the 5V track or the GND track. But with the help of the Net Highlighter tool, this task becomes much easier. Click on the Net Highlighter button.

Figure 43: The Net Highlighter makes it easy to see tracks among other tracks.

In Figure 43 you can see the highlighted green track, with the net name 'GND2’ running from the bottom left of the image to around the middle right side. Notice that the Net Highlighter tool is enabled.


Add footprint

When you imported the Netlist file into Pcbnew, Pcbnew automatically added the specified footprints into the sheet. If you want to add additional footprints, you can do so using the Add Footprint button, marked as '4' in Figure 40.

In our simple PCB, there is currently no provision for an external power source that will provide the power needed to light up the LED. It would be good to be able to add a simple connector for this purpose.

Let’s go ahead and do this now.

First, you need to decide what kind of connector to add to your board. You can choose between something very simple, like two large pads on which you can solder the power source wires. You can also choose a barrel connector plug, a header connector like the ones used on the Arduino, or a screw terminal. Of course, there are many more options. 

Let’s assume that you have chosen a screw terminal, like the one in Figure 44 for the convenience of being able to securely attach the wires that come from a small AA battery pack. 

Figure 44: We’ll add this screw terminal to our project layout.

To add a new footprint, click on the Add Footprint button, or type the 'O' hotkey. If you use the hotkey, first place your cursor on the approximate location where you would like to attach the new footprint. The Load Footprint dialog box will appear, as in Figure 45.

Figure 45: The Load Footprint dialog box.

This is not very useful. We don’t know or remember the name of the screw terminal footprint, and the history list is empty. The easiest way to find a footprint when you don’t know exactly what you are looking for is to use the footprint browser. 

Click on the button marked 'Select by Browser' to reveal the footprint browser window (Figure 46).

Figure 46: The footprint browser.

The footprint browser contains three panes. The one in the left lists the available libraries; the one in the middle lists the footprints that belong to the selected library; and the one in the right shows a visual representation of the selected footprint. Take some time to browse around the various libraries and footprints. 

The footprint browser also gives you access to the 3D viewer. The 3D viewer gives you a 3D rendering of what the selected footprint looks like on a 'virtual' PCB. To use it, click on the button with the integrated circuit icon, as in the example of Figure 47.

Figure 47: The footprint browser.

A good candidate for the 2-pole screw terminal we are looking for is inside the Terminal_Blocks library. There are several footprints in this library, and we want the one with the 2 pads, and 5.08 mm distance between the centres of the pads. The distance between the pads is conveniently provided as part of the name of the footprint, but that is not always the case. I have cultivated the habit of measuring a footprint to confirm it will match the real-world part before I drop it to the layout sheet. 

First, notice that in Figure 44, the rules against the pins of the screw terminal shows that the distance between them is a bit over 5.08 mm. If you want high accuracy, you can use a calliper to make these measurements (this is something I will show you how to do in a later project). Another thing you can do is to measure the pin distance against a length that you already know is correct. In this case, You can plug the screw terminal into a standard breadboard that we know has a socket pitch of 2.54 mm. The screw terminal pins span across three breadboard holes, so the total distance is 2.54 x 2 = 5.08 mm. 

Let’s go back in the footprint browser. Remember in Eeschema that we can use the distance counter to measure the distance between to locations of the sheet? We can use the exact same function in most apps in KiCad. Let’s use it to confirm we have the right footprint. Place your mouse cursor in the middle of pad number 1, and press the space bar to zero the dx and dy counters. Then move your cursor to the middle of pad number 2. Look at the dx reading in the status bar. It should show 5.08 mm (Figure 48).

Figure 48: The distance between the pads is 5.08 mm.

This is the confirmation we need to be sure that this is the correct footprint for the screw terminal. Double-click on the footprint name to accept it and drop it to the layout sheet (Figure 49). 

Figure 49: The screw terminal footprint is added to the layout.

Before we do the wiring, we should move it to a better position and orientation. Place your mouse cursor over the screw terminal footprint and use the 'M' and 'R' hotkeys to move and rotate the footprint. My version of the layout looks like the one in Figure 50.

Figure 50: The screw terminal footprint at its final position.

With the new footprint in the layout, the next thing to do is the wiring. Let’s do that next.


Wiring

Right below the 'Add footprint' button in the right toolbar is the 'Add tracks and vias' button. We use this button to create, you guessed it, tracks and vias. As always, there are hotkeys to quickly enable these functions: 'X' to add new track, and 'V' to add new vias.

Let’s work on adding new tracks. We need a new track that connects the cathode of the LED to one of the pads of the screw terminal, and another to connect the free pad of the resistor to the other pad of the screw terminal

First, ensure that the front copper layer is selected. We are working on this project as a single-layer project.

Next, place your mouse cursor over pad 1 of the LED, and press 'X' to get into track mode. The tool will start drawing immediate. As you move the mouse, you will see the track being laid behind it. If you make a mistake, just hit the ESC key to cancel out of the track tool, and try again (press 'X' to begin drawing again).

Try to draw the track that starts from the LED cathode pad to pad 1 of the screw terminal. Remember that to end the drawing of a track, double-click. In Figure 51, you can see the start of my attempt.

Figure 51: A question mark appear as I am trying to draw an ad-hock track.

When you try to end the track by double-clicking, you will notice that Pcbnew is not allowing you to do so. This is because as you are drawing the new track, Pcbnew is automatically checking for violations of the design rules. Because we are trying to create a track that does not exist as a ratsnest, to a footprint that is not in our Eeschema (and Netlist) sheet, Pcbnew assumes that we are doing something illegal.

It is true that a better way to add the screw terminal footprint to our PCB would be to first add it in the schematic diagram (Eeschema), and then import it into Pcbnew through the Netlist, as we did with the other two components. But while that is the orthodox way of doing things, KiCad allows us to work in a more ad-hoc day by turning off the design rules checking. I rarely work this way, but in some cases, this is necessary, as you will see in a more appropriate example later. 

To turn off the design rules checking by clicking on the top button in the left toolbar (Figure 52).

Figure 52: Turn off design rules checking.

With the rules checking off, you can draw the new track as you wish. To work with rules checking turned off under KiCad 5 and newer, you will also need to switch to the Legacy Toolset. To do that, click on Preferences and then Legacy Toolset (Figure 53).

Figure 53: To turn off rules checking you must enable the legacy tool set in KiCad 5 or newer.

Place your mouse over Pad 1 of the LED and type 'X'. Do single clicks to create segments, and double-click to finish drawing over Pad 1 of the screw terminal footprint. Notice the '?' at the end of my incomplete track in Figure 54? This is a reminder that you are working with design rules checking turned off.

Figure 54: The '?' at the end of the track reminds you that you are working with design rules checking off.

Complete the wiring for the two ad-hock tracks, so that the PCB looks like the one in Figure 55. The two new tracks complete the circuit. Remember to turn back on the design rules checking. 

Figure 55: Ad-hock tracks added.

I must repeat that adding ad-hock wires and footprints is not best practice and should only be used for a good reason. It is best to include all components and nets in the schematic diagram, and then bring this information over to Pcbnew where you can do the layout under the supervision of the design rules checker. In this example, however, I wanted to show you the flexibility of KiCad to work without any restrictions, while acknowledging that restrictions are in place for a very good reason: to avoid human errors.

We are close to finishing this first PCB. The few remaining on our to-do list are adding the board cut-out (that defines the borders of the board) and the graphics (things like lines and text). But before we do that, let’s have a quick look at fill zones and keep-out areas.


Fill zones and keepout areas

Buttons marked '6' and '7' in the right toolbar (Figure 40) allow you to create copper fill zones and keep-out areas respectively. We will not be using any of the two in this example, but will we in later projects. For now, I’d like you to be familiar with these functions at a high level.

A copper fill is an area on the PCB from where the copper has been left intact, instead of being etched out. In Figure 56 you can see an example of copper filled areas in the back of this Arduino Uno clone. 

Figure 56: The back of this Arduino Uno contains several copper filled areas.

Copper fills (also known as 'copper pours') are commonly used to create a ground plane (as well as 5 V or 3.3 V planes) as a better way to distribute the ground level around the board (as opposed to using traces). Another reason for including copper planes is to reduce the amount of etching chemical needed to remove copper from the raw board[6] and to improve the electrical and radio interference characteristics of the final PCB. 

There are different types of copper fills. Most designers tend to opt for a solid copper pour, like the one you see in Figure 56. It is also possible to create copper fills that include a pattern of a lattice, like the one in Figure 57.

Figure 57: PCB board showing copper pour with a hatch fill (Image reused under Creative Commons License, https://commons.wikimedia.org/wiki/File:PCB_copper_pour_hatch_filled.png).

A keep-out area is a part of the PCB where you wish to keep empty of tracks, vias and copper pours. When you create a keep-out area, you can specify which of the above you would like to keep out of it. Your choice becomes part of the design rules checks, and the checker prevents you from adding any of those items in the keep-out area. 

You may want to create a keep-out area for things such as having an area that provides structural support for other parts of a gadget, areas that can be snapped off to help in manufacturing, to name a few.

In our current simple design, we will not create a copper fill or keep-out areas, but we will in our later projects.


Continue reading the Part 2.


Read the original article.


Last year TechExplorations held the 1st Maker Mind Meld online conference. And PCBWay was the main sponsor. 

As the main organizer of this activity, Peter kindly offered 10 free coupons to access the conference contents for our pcbwayers. So if you are interested in it, leave your comments below, we will sent the coupon to you through email.


Note: The content and the pictures in this article are contributed by the author. The opinions expressed by contributors are their own and not those of PCBWay. If there is any infringement of content or pictures, please contact our editor (zoey@pcbway.com) for deleting.


Written by

Join us
Wanna be a dedicated PCBWay writer? We definately look forward to having you with us.
  • Comments(0)
Upload photo
You can only upload 5 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
0 / 10000
    Back to top