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

Layout In Pcbnew --- Part 2

by: Sep 21,2020 5482 Views 0 Comments Posted in PCB Design & Layout

footprint toolbar menus Pcbnew layout PCB Kicad pcb design

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.

Review the First Part.


Edge cut

At the very least, the manufacturer needs to know the shape and dimensions of the PCB, as well as the tracks, holes, and vias on it. So far in this part of the book, we have been working on the tracks and holes for the pads, but not on the PCB’s shape and dimensions. We also haven’t added any graphical design elements, like text descriptions, to be printed on the PCB. Graphics are useful because they both make our PCB more aesthetically pleasing, and because they make the PCB easier to use.

Let’s start with defining the shape and dimensions of our PCB first. This is something that many designers do at the start of the layout process in Pcbnew, instead of the end as we are doing here. The advantage of doing it at the start is that we can set the physical constraints of our PCB early on. Imagine that you want to design a PCB that fits nicely inside a project box. This is a major constraint, so you should set it in your design before you start placing footprints and tracks on it. If you leave it for the end of the process, you may find that the footprints and tracks are placed in a way that makes the PCB bigger than the box. This will require a lot of rework so that everything fits. 

To draw the border of the PCB, first, select the Edge.Cuts layer from the layers manager toolbar or drop-down (Figure 58). The Edge.Cuts layer is a special layer that contains information that the manufacturer needs in order to know where to cut the board. When you export the Gerber files, the Edge.Cuts layer information is exported into its own file.

Figure 58: To create the PCB perimeter, select the Edge.Cuts layer first.

With the Edge.Cuts layer selected, you can use one of the graphics tools marked as '8' in Figure 40 to draw it. Using the line, arc, and circle tools you can create elaborate shapes for your PCB. Let’s start with something simple: a rectangular PCB. Once we have this simple design ready, we can retrofit it easily by adding space for two mounting holes along the two ends of the rectangle.

Click on the line tool and start drawing the perimeter. As you are drawing the perimeter, keep in mind that the polygon you produce must be contiguous. That is, there must be no breaks anywhere along the polygon that makes up the perimeter. A common problem here is that the start of the line with the end does not meet precisely. Close the polygon so that your PCB now looks like the example in Figure 59.

Figure 59: The perimeter of the PCB is a simple polygon.

Look at the 3D representation of your board by clicking on View and 3D Viewer. It should look like the example in Figure 60. 

Figure 60: The 3D representation of the rectangular PCB.

Let’s add another feature to this board, a mounting hole. With a mounting hole, you can secure your PCB to an enclosure with a screw. The easiest way to add mounting holes to your PCB is to add a single pad and modify it’s drill size to accommodate the size of the screw.

First, think about the screw you’d like to use. In my case, I’d like to use a nylon screw, with a width of 2.97 mm, as measured with my calliper (Figure 61).

Figure 61: Measuring sizes with a calliper is easy and accurate.

We will need an opening slightly larger than 2.97 mm on the board. When you consider adding mounting provisions to your PCB, you should think about where the PCB will be eventually installed. It could be placed inside a project box, or stacked onto another PCB, or perhaps used on a breadboard. In the case of our example, let’s plan to have it mounted on a plastic surface, using two screws. We can place the screws along the X or Y axis of the board. I’ll go for the X-axis. I’ll place one screw hole on the left of the LED, and another on the right of the screw terminal.

Let’s add the first opening. Place your cursor on the right side of the LED, as I show in Figure 62, and type 'O' to add a new footprint. Do a right click to bring up the Load Footprint dialog box, and then click on 'Select by Browser'.

Figure 62: We’ll place the new screw opening at the approximate location of the cursor.

In the Library Browser windows, look for the 'MountingHole' library in the left pane, and select the 2.7mm hole footprint (Figure 63). 

Figure 63: 1 pin footprints make good screw holes.

Double-click on the 2.7mm item to select it and drop it to the layout sheet. Position it close to the LED, as in the example of Figure 64.

Figure 64: The first screw hole is placed.

We’ll add a second screw hole next to the screw terminal, but first, we have to confirm that the one we just added has the correct drill size. Place your mouse pointer over the 1pin footprint, and type 'E' (for 'Edit'). Be careful where you place your mouse pointer because its position dictates the properties window that will appear. For example, if you place your mouse over the blue circle in the outer region of the footprint, you will get a properties window that belongs to the back or front paste layer. We want the properties of the hole, so make sure to place your mouse pointer right in the middle of the footprint, as I show in Figure 64.

You can see the screw hole properties window in Figure 65. 

Figure 65: properties for the screw hole.

The arrows in Figure 65 show the properties that are most relevant to what we are trying to do here: the shape and size of the drill. We want a circular hole (not oval), so the default shape is good. We want a drill size that is slightly larger than the diameter of the nylon screw I am planning to use (which I measured at 2.97 mm). At 3.048 mm, the drill size is also good. With this information, we know that the screw opening is appropriate. Click Ok to close the properties window. 

Let’s duplicate this hole so that we can add an identical one next to the screw terminal. Place your mouse pointer over the yellow circle at the perimeter of the hole, and type Ctrl-D to duplicate the footprint (Figure 66). 

Figure 66: When duplicating a footprint using Ctrl-D, take care to place the mouse pointer on the yellow line.

Using Ctrl-D can be tedious because the correct target is a very thin line. You can zoom in to increase the size of the target, or you can use the context menu. To use the context menu, place your mouse point right in the middle of the footprint and left-click. You can then follow the context menu by selecting the footprint name and then 'Duplicate Footprint'.

Figure 67: You can duplicate a footprint via its context menu.

This process will produce a copy of the original pad. Use the 'M' hotkey to move the new pad on the right side of the screw terminal, like in the example of Figure.68.

Figure 68: The second screw hole is on the right side of the PCB.

The two new footprints are outside the edge cut. View the 3D rendering of the PCB (View, 3D Viewer), and you will see that the new footprints 'exist' outside the PCB.

Figure 69: The new footprints are outside the PCB; we must redefine the edge cuts.

To fix this, you must redefine the edge cuts drawing. You can do this without deleting the existing edge cut. Let’s work on the left side first. Select the Edge.Cuts layer, and the click on the line graphic button. Zoom in to a comfortable level so that you can make the yellow edge line thick enough. In my example, I work at a zoom level of 13.75. Start drawing a new line from the bottom left corner of the existing edge polygon, as in Figure 70.

Figure 70: Extend the edge cut polygon from a sensible place, like the bottom left corner of the existing edge cut.

Continue the drawing of the new segment of the edge cut until it meets the top left corner of the existing polygon. In the example of Figure 71, I have also deleted the vertical segment of the original edge cut polygon. It is good practice to do so in order to reduce the risk of a manufacturer becoming confused. An edge cut polygon should enclose a single area within its sides.

Figure 71: The left side of the PCB, redrawn with a new edge cut.

Repeat the same process on the right side of the PCB. Always take care to create polygon line without interrupts, as the polygon must be contiguous. Zoom in and pan as you do the drawing in order to work with larger 'click targets'. Figure 72 shows the PCB with the completed edge cut polygon.

Figure 9.72: The project PCB with its new edge cut polygon.

Use the 3D viewer to see a rendered version of the PCB. In Figure 73 you can my PCB, complete with its screw mounting holes and the edge cut extension.

Figure 73: The project PCB with its new edge cut polygon, in 3D.


Graphics

With the edge cuts drawing complete, let’s use the same graphics tools to add some cosmetic graphics to the board. Many footprints carry their own graphics in the silkscreen layer. In our PCB, you can see that the LED, resistor and screw terminal already have graphics. You can see them depicted in white, in Figure 73.

Let’s add some custom graphical elements. 

First, change the layer setting to front silk screen ('F.SilkS'). Then try adding some graphics using the line, circle, and arc tools.

You already know how to use the line tool. I’ve used it to create a box around the LED and the resistor.

To use the circle tool, select it, then click somewhere on the PCB where you would like the centre of the circle to be, and move your mouse to draw it. The further the mouse is from the centre, the larger the circle will be. I have added two circles around the screw holes.

The arc tool is good for drawing parts of a circle. In later projects, we will also use it to create round corners for our PCB, which look better to the eye and are not as sharp. You can use the arc tool similarly to the circle tool, but instead of drawing a full circle it will draw a partial circle. I have added a few decorative arcs on the inner sides of the two screw holes. In Figure 74 you can see my PCB art, and in Figure 75 its 3D rendering.

Figure 74: An example of simple graphics created using the line, circle, and arc tools.

Figure 75: A 3D rendering of simple graphics created using the line, circle, and arc tools.

You can also add graphics to the bottom of the PCB. At the moment, there are no graphical elements there. Let’s add a couple of boxes and a circle. 

First, select the bottom silkscreen layer ('B.SilkS'). All elements on the PCB will overlap unless you un-select a layer. I find it easier to work with silkscreens when I only have the one I am working on enabled and the other disabled. You can do that from the layers manager toolbar. In Figure 76 I have disabled the front silkscreen layer by clicking on its checkbox (in the red box). This hides the silkscreen drawings in the front silkscreen so I can work on the bottom silkscreen layer. 

Figure 76: When you work in the bottom silk layer you may disable the front silk layer in order to reduce clutter.

In Figure 77 you can see my PCB’s silkscreen drawings in purple. I have unchecked the top silkscreen layer to make it easier to see the bottom silk screen elements. 

Figure 77: The purple line belong to the bottom silkscreen, with top silkscreen disabled.

In Figure 78 you can see the 3D rendering of the bottom of the PCB, which shows the bottom silkscreen.

Figure 78: 3D rendering of the PCB showing the bottom silkscreen.

In Figure 79 you can see the current state of the PCB with all layers visible.

Figure 79: The PCB showing top and bottom silkscreen contents.

It is also to add actual graphics to the silkscreen layer of the PCB, not just simple lines and circles. You can have logos, for example, or elaborate artwork. To do so you need to follow a process that involves converting a bitmap graphics file into a footprint, before inserting it into the PCB. You will learn how to do this in the breadboard power supply project.

This PCB is almost complete. There is only one more thing we need to do, and that is to add text to the front and bottom silkscreen.


Text

To add text to the PCB, we can use the Text tool, which is one of the graphics tools marked as '8' in Figure 40 . Let’s go right ahead and use it to add your name to the board. Select the front silkscreen layer, and then click on the 'T' button. Click on the location on the PCB where you would like the text to appear. The Text Properties window will appear. Type your name in the Text field, and double check that:

  • 'F.SilkS' appears in the Layer drop-down menu, 
  • 'Normal' appears in the Display drop-down menu.

Figure 80: The Text Properties window.

You can control the size of the text and its style, but other than that, the text controls are limited. You have the option of placing the text in other layers, including in the top or bottom copper layer. Copper layers are meant to be used for pads and tracks, so unless you have a good reason for this, use the silk layers for text. 

If you choose to add text to the bottom layer, take care to set the Display drop-down menu to 'Mirrored'. This will inverse the text so that when it is printed by the manufacturer it is readable.

I will also add text that provides information about the size of the resistor, and also the polarity of the screw terminal pads. This information is very used for the end user of the board. In Figure 81 you can see the final top layer silk screen, and in Figure 82 is its 3D rendering.

Figure 81: Top silk screen with additional text.

Figure 82: Top silk screen with additional text.

The text '330' has a character width of 1 mm. The rest of the characters are 1.5 mm wide each. I placed the '+' and '-' symbols outside the perimeter of the screw terminal so that they remain visible after the screw terminal is soldered on. For the LED, the only use of these symbols is during the assembly, to help me place the LED in the correct orientation. Once the LED is on, the two symbols will be hidden, but that is not a problem since I will not need them anymore.

I will add some text to the bottom of the board, where there is much more space than the front. I typically include a board name, a version number, a date, and my name. Go ahead to add your text, but remember to choose 'Mirrored' in the Display drop-down menu.

Figure 83: The Text Properties, set to print in the bottom silkscreen layer.

I have changed the character width to 1 mm to allow the full text to fit in the available space. I also changed the Layer to B.Silk, the Display to Mirrored, and the Justification to Right. You can use the 'M' hotkey to precisely place the block of text on the PCB, just like you do with any footprint.

Figures 84 and 85 show the final result.

Figure 84: The PCB, with all layers showing enabled.

Figure 85: 3D rendering of the back of the PCB, with the text clearly visible.

There’s one thing you will need to attend to before we can declare this project complete. With reference to Figure 84, notice the text 'REF**' appearing over the screw hole footprints? This isn't text that we would like to include in our manufactured PCBs. Text or other graphical elements that you do not want appearing in the final PCB can be made invisible by editing the item’s properties. 

Let’s make the three instances of 'REF**' invisible. Place your mouse cursor exactly over the 'REF**' text of the right screw hole. Then, use the 'E' hotkey to show the text item’s properties window.

Figure 86: To make a text item invisible, edit it’s Display property.

The Display property of the item is right above the OK button. Click on the 'Invisible' radio button, and the 'Ok'. 

In Figure 88 and Figure 87 you can confirm that the 'REF**' instances are now invisible.

Figure 87: The invisible 'REF**' instances are not showing in the 3D rendering.

Figure 88: The 'REF**' instances are now invisible.

Well done! At this point, your PCB is complete. Make sure you save your work (KiCad does not do this automatically). 

 You might be wondering, why not go ahead to manufacture this board? While the board you just created is an excellent first project, I’d like you to extend your skills by designing a more challenging board. That board, a simple breadboard power supply, will also be very useful for many of your future projects, so it is an excellent candidate for sending to manufacture. 

Let’s complete this section by taking a closer look at the Layer Manager, Status bar and the menus, and then we’ll continue with another project.


Layers manager

You are already familiar with the Layers manager from your work on the simple LED and resistor PCB. The layer manager, apart from allowing you to select the layer on which you would like to work next, also allows you to select which aspects of the layout are rendered. 

The Layer manager appears in two different forms. It’s available as a simple drop-down as part of the top toolbar, and in its full-featured variation on the right side of the right toolbar. Because the full layer manager takes up a substantial real estate in Pcbnew, which you may need to use in the layout sheet, Pcbnew provides a button in the right toolbar that allows you to show or hide the layers manager toolbar. 

You can see all this in the example of Figure 89.

Figure 89: The two variation of the layer manager, and the show/hide button.

The drop-down version of the layout manager and the Layer tab of the toolbar version are almost identical. They both allow you to select the current layer. But the toolbar version also allows you to hide or show the items that belong to a layer. For example, to make the tracks drawn in the front copper layer, just un-check the F.Cu option. The red track in our small PCB will disappear.

Try hiding the items in the front and back silkscreen layers as another example.

Hiding and showing layer items is not possible through the drop-down version. 

The toolbar version also has a second tab, titled Items (Figure 90). 

Figure 90: The Layer (left) and Items (right) layers of the Layers Manager toolbar.

In the Items tab, you can control the visibility of additional items of your PCB. For example, try un-checking the 'Text Front' item. This will make text to disappear, even if it belongs to multiple layers. Experiment with some of the other options in the Items tab, including the Grid option. When you check and uncheck the Grid option, notice how the Grid button (at the top of the right toolbar) updates its state.


Status bar

The status bar appears in the bottom of the Pcbnew window. It contains two segments. The top one displays the properties of the currently selected item, which the second one shows coordinates, distance, and zoom information.

Let’s have a look at an example. In your simple LED and resistor PCB, click on the LED footprint. The properties of the LED footprint will appear in the status bar (see Figure 91).

Figure 91: The selected LED footprint with its properties displayed in the status bar; the coordinates of the mouse pointer are also displayed in the status bar.

This way, you can quickly get information about footprints, tracks, text and graphical items. 

A very useful feature of the status bar is distance counter. You have seen this feature before, in Eeschema. It works in the exact same way in Pcbnew. Let’s look at an example. 

What is the width and height of the PCB you have just designed, in millimeters? We can measure it. Please your mouse pointer on the left extreme of the PCB, press the spacebar to reset the counters, and move it to the right extreme. The dx counter will show a value of 44.50 mm. The dy shows a value of -0.25 mm because I move my pointer down during the measurement (Figure 92).

Figure 92: The width of this PCB is 44.50 mm.

Do the same on the Y axis to find out the height of your PCB. The height of my PCB is 12.75 mm (Figure 93).

Figure 93: The width of this PCB is 44.50 mm.

Just like the status bar in Eeschema, the status bar in Pcbnew also provides information about absolute cursor coordinates, the zoom level, and the distance unit selected.


Menus

To complete our tour of Pcbnew, let’s have a quick look at the menus. 

The first thing to notice is that many of the functions that are available through the toolbars are also available through the menu system. For example, in the File menu, you will find options for printing, editing the page settings, plotting and saving the layout, and in the View menu, you will find options to zoom in/out, redraw and fit the layout to screen.

All of the menus except for Place, contain unique functionality. In this segment, we’ll review the most commonly used of those functions.

File

In Figure 94 you can see the contents of the File menu.

Figure 94: The Pcbnew Edit menu.

You should be able to recognise many of the items in it:

1.Page Settings, allows you to edit the contents of the title block and the page layout, as you have already learned.

2.Print, allows you to print the layout on paper.

3.Export, allows you to export the layout in various formats. For example, you can use the SVG files (one per layer) in third-party drawing applications, and Specctra DSN for using external autoroutes that support this format (such as FreeRouting, which you can learn about in a relevant recipe).

4.Plot, allows you to export the layout to a format appropriate for sending to a manufacturer, like Gerber. Interestingly, you can also use Plot to export to SVG, PDF and other formats. All of those can be used to manufacture the final PCB.

5.Close, to close Pcbnew.


Apart from the above, several functions available through the File menu are new:

1.Save a Copy As…, allows you to save the layout under a new file name. This is useful when you want to branch out your layout. For example, you can have one layout designed to use surface mounted components with the file name 'LED_resistor_smd.KiCad_pcb', and another with the file name 'LED_resistor_th.KiCad_pcb'.

2.Revert to Last Backup, allows you to load the layout recovery file. Pcbnew automatically saves your work every 10 minutes. This value is configurable via the Preferences, General window. The backup file has the '.KiCad_pcb-bak' extension. When you click on Revert to Last, Pcbnew will ask you to confirm that you want to revert to the content of the backup file and replace your current work.

3.Rescue, allows you to load an automatically created backup. By default, Pcbnew will back up your work every 10 minutes. You can control the interval through the General Settings window, from the Preferences menu item. I personally save my work manually every couple of minutes, and commit to the project Git repository and prefer not to rely on KiCad’s autosave function.

4.Fabrication Outputs, give you access to several types of file formats that can be used in a PCB fabrication process. In this book, you will learn how to export for manufacturing using the industry-standard Gerber files.

5.Import, allows you to import Specctra auto routing and DXF (Drawing Exchange Format) files that contain CAD models. DXF is a format developed by Autodesk. With it, for example, you can create a layout of a PCB placement in a program like Fusion 360 and import it into KiCad. 

6.Export, allows you to export layout data to Specctra, GenCAD (a file format used in PCB manufacturing and testing), IDFv3 (a PCB file format) and others. These file formats make it possible to use KiCad PCB projects with other CAD software. Unless you have a need to inter-operate with third-party CAD software, you are unlikely to need to venture into this menu.

7.Archive Footprints gives the ability to package the footprints found in a layout in a directory within your project so that you can share the project with your collaborators. Your collaborators will be able to work with your project even if they don’t happen to have the needed footprint libraries installed. 

Let’s have a look at the functionality found in the Edit menu next.


Edit

In Figure 95 you can see the contents of the Edit menu.

Figure 95: The Pcbnew Edit menu.

In the Edit menu you can see the standard Undo, Redo, Delete and Find buttons, but in addition, there are several more buttons that are worth a closer look.

In summary:

  • Global Deletions, which allows you to delete all items of a specific kind.
  • Cleanup Tracks and Vias, which allows you to clean up stray items, like unconnected tracks and redundant vias.
  • Move and Swap Layers, which allows you to swap a layer with any other layer.
  • Set Footprint Field Sizes, which allow you to set default properties for footprint text values.

The Global Deletions window provides a quick and efficient way to remove all items of a specific kind of items from the layout. This is one of those features that you will use rarely, but that will save you a lot of time when you need them. While it is a blanket approach to removing items, remember that you still have access to the Undo function, so if you make a mistake you can restore your work.

Try to be selective, when you use Global Deletions. Selecting the 'Clear board' radio button will delete everything in the layout. Selecting 'Text' will only delete the text items. You can also apply your choice to a specific layer or to all layers.

Figure 96: The Global Deletions window.

The Cleanup Tracks and Vias windows help us tidy up leftover tracks and vias, quickly. Try this experiment. In your LED and resistor layout, add a few stray tracks. As you are laying a track, type 'V' to add a via, and continue drawing. Double-click to end drawing. Don’t connect the stray track to any pads. That is what makes it 'stray'. Now, bring up the Cleaning Options window by clicking on Edit and Cleanup Tracks and Vias. Leave the current default selections as they are, and click OK.

The stray track and vias that you just added should disappear. 

Figure 97: The Cleaning Options window.

The Swap Layers function (Figure 98) is very useful when you want to transfer all tracks from one layer to another. For example, say that you want to move all track from the front copper layer ('F.Cu') to the bottom copper layer ('B.Cu'). 

To do that, first bring up the Swap Layers window by clicking Edit and the Swap Layers. Then, click on the button marked '…', right next to the 'F.Cu' label, and from the small window that appears, select 'B.Cu', then dismiss the small window by clicking on the 'x' button, and click OK. Try that now in your LED and resistor layout. See how the (originally' red tracks are now green? That happened because the tracks were transferred from the front copper layer to the back copper layer. 

To restore the tracks to the front copper layer, do the opposite. Back in the Swap Layers window, click on the '…' button that is next to the 'B.Cu' label, and select 'F.Cu' from the small window that appears. Then, dismiss the small window and click OK.

Figure 98: The Swap Layers window.

In Figure 99 you can see the Set Text Fields window. The width, height and thickness properties control how the footprint text values are rendered in the editor. Do a small experiment to see how this works: With the simple LED and resistor layout loaded in Pcbnew, bring up the Set Text Size window. Change Width and Height to 2, and Thickness to 0.35. Click OK. You should see that all text items that belong to properties will be re-drawn with the new properties, and look around twice as large. To make them go back to their original sizes, restore Width and Height to 1, and Thickness to 0.15.

Figure 99: The Set Text Size window.

View

In Figure 100 you can see the contents of the View menu.

Figure 100: The Pcbnew View menu.

In the View menu you can see the familiar Zoom, Fit and Redraw buttons, but in addition, there are several more buttons that I’d like you to look at.

1.3D Viewer, which renders a 3D view of the PCB

2.Show Ratsnest, which shows you a list of all unconnected nets in the PCB

3.Drawing Mode, which allows you to choose from a variety of graphics options that help when you work on busy boards

You have already used the 3D viewer in several occasions (Figure 101). Apart from the default settings of the viewer, there are several more features you should be aware of. First, experiment with the top menu bar, which allows you to zoom in/out, pan and rotate the model. 

Figure 101: The 3D Viewer.

You can control much of the rendering behavior of the viewer through its display options window, which you can access by clicking on the cog-wheel button in the top toolbar (Figure 102). Try out the various options to see the effect they have on the rendering of the model. There are more rendering controls through the Preferences menu.

Another useful function is available in the File menu. There, you can export the rendered view to PNG or JPEG image files. This is a good way to capture a high-quality render of your board that you can insert in a blog post or documentation. 

Figure 102: The 3D Viewer’s display options window.

Setup

The Setup menu contains just two items, Design Rules and Layers Setup. You can see the Setup menu in Figure 103.

Figure 103: The Setup menu

The two most important items in this menu are the top two: Layers Setup and Design Rules. You will use them in all projects of this book. You can read a summary of what these items do in the next few pages.

The bottom four items allow you to configure secondary aspects of how the layout, such as how text should look like by default, and what should be the default configuration of a pad. 

Let’s take a closer look at those.


Design Rules Editor

In the Breadboard Power Supply and later projects, you will be spending a lot of time learnings on how to use the Design Rules Editor. Briefly, this Editor allows you to create classes of nets that have specific design attributes. Tracks that belong to those nets are then drawn with adherence to this attributes.

For example, you can create a net class called 'PWR' that dictate the track width, via diameters and other attributes that should apply specifically to a track that belongs to this class. You could create another class called 'SGN' that dictate these attributes for tracks that convey signals, instead of power. This makes sense because a typical signal track will only need to convey a few milliamps of current, while a track that feeds power to the circuit components will be required to convey much more than that. 

Figure 104:The Net Classes Editor.

In Figure 104, you can see Net Classes Editor with its default values. In our simple PCB, there’s only one net, and it is assigned to the Default class. In later projects, you will learn how to create classes and assign nets to one of them.

In the same figure, there is also the Global Design Rules tab (Figure 105) .

Figure 105: The Global Design Rules.

There, you can create custom track and via sizes, and have them available in the top toolbar drop-down. This way you can create tracks and vias using ad-hock sizes that can override their assigned class.


Layers Setup

In Layers Setup (Figure 106), you can control the number of layers you would like your board to have, and, to some extent, the type of these layers.

Figure 106:The Layers Setup.

Pcbnew can produce PCBs with up to 32 copper layers, and this is configurable in the Layers Setup window. 

There are presets of up to four layer-PCBs with parts on the front, back, or both. As you experiment with selecting one of them, notice the effect on the enabled or disabled status of each layer. For example, if you choose the 'Two layers, parts on Front only' preset, you will notice that many of the copper layers are disabled. If you click on 'OK' to commit the change, these layers will disappear from the Layers Manager, leaving only the enabled ones showing. 

You can change the layer configuration as you are working on your PCB. For example, you may start with a 2-layer PCB and then realise that you need additional layers to complete the routing. That is not a problem. Just go into the Layer Setup window and add a couple of layers.


Other setup options

The bottom four options of the Setup menu contain:

1.Text and Drawings

2.Default Pad Properties

3.Pads to Mask Clearance

4.Differential Pairs

The Text and Drawings settings allow you to configure defaults for things like the text character width, height and thickness, and the thickness of a graphic segment (such as a line or an arc).

Figure 107: Default text and graphics settings.

I find the defaults in Figure 107 appropriate for most boards.

The Default Pad Properties is fairly involved, but you only need a few options tweaked in relation to setting defaults (Figure 108). 

Figure 108: Default pad properties.

In the General tab, the pad type offers four choices:

1.Through-hole, best for using with through-hole components. This option creates a hole that is internally plated, with pads on either side so that components can be soldered.

2.SMD, suitable for SMD components. An SMD pad does not contain a hole.

3.Connector, which is similar to the SMD type, but is round and typically used as a contact for probes

4.NPTH, Mechanical, which is a non-plated through hole pad, suitable for creating mounting holes.

If you choose 'Through-hole' as your default, you will also be able to specify the hole shape, as either oval or circular, and for each type, the exact dimensions.

In the Local Clearance and Settings tab you can specify minimum clearances (Figure 9.109). I prefer to keep the values there at 0 so that the footprints in my projects inherit these values from their parent footprints.

Figure 109: The Local Clearance and Settings pad

The Pads Mask Clearance window (Figure 110) allows you to control the pad mask clearance. The mask is the thin layer of non-conductive materials that covers the front and back of the board and also prevents solder from creating bridges between pads. The values you use here control how much of the pad will be covered with the masking material. If you cover too much, you will decrease the risk of solder bridges, but you will make soldering harder since there will be less of the pad exposed.

Figure 110: The Pads Mask Clearance window.

Finally, the Differential Pair Dimensions allow you to control how close together will be drawn traces that belong to the same pair, and how wide each trace should be.

Figure 111:Differential pair settings.

Place

In Figure 112 you can see the contents of the Place menu.

Figure 112: The Pcbnew Place menu.

In the Place menu, you will find the same tools as in the right toolbar. Let’s not spend any more time here and move straight to the Route menu.


Route

In Figure 113 you can see the contents of the Route menu.

Figure 113: The Pcbnew Place menu.

With the Single Track option, you can create regular tracks and vias. It is the option you will use most often. The rest of the tools in the Route menu are useful in advanced layouts that involve things such as high-frequency digital busses or analog circuits where the radio properties of the tracks must be taken into account.

Let’s have a quick look at each one:

1.Single Track, allows you to create single tracks and vias. You have already used this tool in our simple LED and resistor project.

2.Differential Pair, allows you to route two tracks at the same time. KiCad identifies tracks that should be routed together based on the ending of their net names. In the current version 5, two tracks can be identified as a pair if their net names end with '+' and '-' respectively, and their start pads are adjacent to each other. While you are drawing the paired tracks, you can also create vias, for both at the same time. 

3.Tune Track Length, allows you to adjust the exact length of a single track. This is useful if you want to control precisely the signal propagation time.

4.Tune Differential Pair Length, which is a function similar to Tune Track Length, but for a pair of tracks ('differential pair') at the same time. 

5.Tune Differential Pair Skew/Phase, allows you to precisely control the clock skew of differential pairs, another consideration in high-frequency digital electronics design. Clock skew is a phenomenon in which the same clock signal arrives at slightly different times to its destination. The effect of this is that different parts of the circuit can end up operating at a slight clock offset, which is not desirable. Learn more about clock skew on Wikipedia.

For example, we can use Differential Pairing for tracks that involve serial communications, such as the TX and RX tracks in a UART circuit, or the MISO and MOSI tracks in an SPI circuit. You can learn more about differential pairs in the recipe titled 'How to use differential pairs'.


Interactive Routing

Interactive routing is one of the most important features of Pcbnew. It makes drawing tracks quick and efficient. 

It helps you create tracks while avoiding items in the layout that can’t be moved, or moving them (the term is 'shove') if they are movable.

Let’s do an experiment with Interactive routing. Open the simple LED and resistor layout, and delete the track that connects pad 2 of the LED and pad 1 of the resistor. In Figure 114, I have deleted the track. To make the layout easier to read, I have disabled the front and back silkscreen layers by unchecking F.SilkS and B.SilkS in the Layer Manager.

Figure 114: The resistor and LED are not connected.

The ratsnest line between the LED and resistor is telling us that this track must be implemented. Type the 'X' hotkey to enter the track drawing mode. Place your mouse cursor in the middle of pad 2 of the LED. Move your mouse towards the screw terminal footprint, and notice how the track that the router leaves behind does not intersect any other tracks and goes around pads. Try to finish the drawing by double-clicking on pad 1 of the resistor. You can see my, admittedly terrible, design in Figure 115.

Figure 115: A new route using the Interactive Router, avoiding other tracks and pads.

In Figure 115, I have highlighted the new net using the 'Highlight Net' button in the right toolbar. Of course, this new net is a very poor design since it is much longer than necessary, with a lot of corners. In PCB design, we aim to create tracks that are as short as possible, with as few corners as possible. More about PCB design principles later. 

The point of this example is that as I was moving my mouse pointer through a particular path, the Interactive Router was able to find a way to place the track without violating any of the design rules.

You have fine control over the designer through the context menu Figure 116.

Figure 116: The Interactive Router Settings.

You can change these setting at any time, even during the drawing of a track. I usually set the Mode to 'Walk around', which produces a result similar to the one you see in Figure 115. As long as you choose a sensible path with your mouse, the interactive router will produce a sensible track. You can also try out the Shove mode. With Shove mode on, the interactive router will push over any items that are not explicitly fixed on the layout. You can have footprints on a fixed position by locking them through their properties and then allow for existing tracks and vias to be moved by the router as needed for laying new tracks. It is work spending some time to get used to this feature, as it is powerful and it will make your work with KiCad much more efficient in comparison to drawing in Default mode without Interactive Routing.

In Figure 116 I have selected the option 'interactive drag' for the mouse drag behaviour. This allows me to use the 'G' hotkey to drag a track to a new position without breaking it (which is the 'move' operation). Beware that you can drag a track by clicking on it to select it and then dragging to move it. The ‘G’ hotkey is a shortcut meant to save you one click. This way I can re-arrange a track that I or the Interactive Router created, without having to repair broken connections. When using the 'Move' method, the typical result is that a single segment of a track is moved, and its connection to the rest of the net is broken, which needs to be repaired.

Another powerful feature of the Interactive Router is the ability to redefine a segment of the track or the full track without having to manually delete the original. You simply type 'X' to start the track drawing process, and you draw the start and end of the new track or track segment. When you double-click to finish the drawing process, the Interactive Router will automatically remove the old track or track segment, as it is now redundant. 

Let’s use this feature to repair my awful track from Figure 115. Type 'X' and click on pad 2 of the LED to start a new track. You can also start the drawing at another position of the existing track is you want to redefine a segment of the track instead of the complete track (Figure 117).

Figure 117: Starting a new track to replace the old one.

Then, move your mouse on pad 1 of the resistor and double-click to complete the drawing. The new track is created, and the old track is automatically deleted (Figure 118).

Figure 118: The newly created track replaces the original.

It is worth spending some time here to get used to these capabilities of the Interactive Router. We will be using it extensively in the projects that will follow.


Inspect

The Inspect menu (Figure 119) includes functions for looking into nets, measuring distances on the sheet, and launching the design rules checker. You can do the latter two by using buttons in the top and right toolbars.

Figure 119: The Inspect menu.

The List Nets options give you a list of the nets that are present in the PCB. In Figure 120, you can see the Nets window. You can type in the name of the net you want to inspect in the filter box or click on the net row. In Pcbnew, whichever net you select will be highlighted.

Figure 120: The Net Filter window.

In Figure 121 you can see the GND net that I selected in Figure 120, highlighted with a high-contrast colour. This makes it easy to see how the selected net is routed.

Figure 121: A list of nets present in this simple PCB.

With the Measure tool, you can measure distances on your board (Figure 122). Notice that there is a keyboard shortcut for this tool. Just click to start measuring distance and angle, and click again to end. You can use this tool by clicking on the Measure tool button from the right toolbar.

Figure 122: The Measure tool.

Finally, you can start the design rules check by clicking on the Design Rules Checker option in the Inspect menu, or by clicking on the bug button from the top toolbar. Either way, the DRC window will come up (Figure 123).

Figure 123: The DRC tool.

The DRC tool will check for problems in your PCB, such as unconnected nets, or traces that are too close to other traces. You will become very familiar with this essential tool as you practice working on the projects in this book.


Tools

All but one of the items in the Tools menu are available in the top toolbar. You can see the Tools menu in Figure 124.

Figure 124: The Tools menu.

Here is a summary of the items in the Tools menu.

1.Load Netlist, allows you to import the Netlist file from Eeschema.

2.Update PCB from Schematic is an alternative to the Netlist. If you make changes to the schematic after you begin work in Pcbnew (perhaps you have added a new symbol, or fixed the wiring), you can choose the Update function to automatically annotate the symbols, create the new netlist, and import it into Pcbnew. I am very used to working with the Netlist directly, so I don’t use the Update function, however, I suggest you give it a go as it can speed up your work.

3.Set Layer Pair, is useful in boards with 4 or more lairs. It allows you to choose which layer should be connected when you create a via.

4.Update Footprints from Library, will check for updated versions of the footprints that exist in your layout, and apply them. This saves you doing this work manually, as was the case with older versions of KiCad.

5.External Plugins allows you to extend the capabilities of KiCad through Python scripts.

I’d like to take a closer look at the Set Layer Pair option.


Let’s start with the Layer Pairs option. When you work with PCBs that contain more than 2 layers, say 4, or more, you can configure which of these layers should be considered pairs when you create vias. You can configure the Layer Pairs using the Select Copper Layer Pair window. When you are working on a 2-layer board, the Select Copper Layer Pair window looks like the example in Figure 125. There’s not much to do here, and the only option is to pair the top and bottom layers. Now, when you create a via, a track from the top layer will continue to the bottom layer, and vice versa. The 'x' marks the selected layer.

Figure 125: The Select Copper Layer Pair window in a two-layer board.

Change your board configuration so that it is a four-layer board. You can do that through the Design Rules menu (we will look at this in more detail in the next segment). Bring up the Layers Setup window, and change the number of layers to 4 (Figure 126).

Figure 126: To change your board to a four-layer board, open the Layer Setup window from the Design Rules menu.

Now open the Select Copper Layer Pair window again. It will look like the example in Figure 127.

Figure 127: The Select Copper Layer Pair window in a four-layer board.

In this example, I have set the pairs to be the front copper and the first inner copper layers. With this configuration, when I create a via, a track that starts in the top copper layer will continue in the first inner copper layer, and vice-versa.

Please switch your board back to a two-layer configuration now before continuing.


Preferences

Through the Preferences menu, you can control various aspect of the operation of Pcbnew (Figure 128).

Figure 128: The Preferences menu.

You will be using most of the items in the Preferences menu as you work through the projects in this book, but following is a summary:

1.Manage Footprint Libraries Wizard, allows you to import footprint libraries. Once a new library is imported, you can use its footprints in your layout. You will learn how to use this tool in a later project in this book. There is also a recipe that explains how to do this; look for the one titled 'Adding a footprint library in Pcbnew'.

2.Configure Paths, allows you to configure the locations of symbol, footprint, and 3D shape libraries. You can also access the path configuration window from the main KiCad window. Look at the Kicad documentation for details on the roles of the environment variables and the paths that they point to.[7]

3.Add 3D Shapes Libraries Wizard, allows you to download 3D shapes from KiCad’s own repository and 3rd party repositories that are used in Pcbnew’s 3D Preview. You can learn how to do this by reading the recipe titled 'How to install 3D shapes'.

4.General settings, allow you to control a variety of aspect of Pcbnew’s operation, such as the frequency of the autosave function, the measurement units and type of coordinate system used.

5.Display options, allow you to control Pcbnew operations details such as the use of accelerated graphics, the grid style and how net names are displayed.

6.Set Language, allows you to change the language used in the Pcbnew user interface.

7.Hotkeys Options, allows you to customise the various hotkeys, as you learned earlier.

8.Save and Load project File allows you to save the .pro file that contains information about the project (but not the layout and schematic files, since that information is stored as individual files).

9.There are recipes that cover the usage of the libraries wizard and the 3D shapes wizard. In the next few pages, you'll take a closer look at some of the other options in the Preferences menu.


General

Through the General Setting window (Figure 129), you can configure much of the behaviour of Pcbnew.

Figure 129: The General Setting window

Here, you can control the drawing behavior of Pcbnew. For example, you can make tracks and pads 'magnetic' so that as you draw a new track, it will 'stick' to a pad when you mouse your mouse close enough, ensuring an electrical connection. 

You can control autosave, select your preferred coordinate system and unit of measurement, the shape of the course, and much more. 

I find that the default settings work well and rarely make any customisations here.


Display

Similarly to the General Settings window, the Display Options window (Figure 130) allows you to control the graphical attributes of Pcbnew.

Figure 130: The Display Options window.

For example, you can choose if you would like to show pad numbers and footprint outlines, net names, and track clearances.

Again, the default settings are reasonable and I prefer not to make any modification to the Display options.


Language

The Language option allows you to choose one of 19 languages available for KiCad’s user interface. Whichever language you choose, must also be supported by the locale of your operating system (Figure 131).

Figure 131: The Pcbnew language settings have to match the locale of your operating system.


Hotkeys

You can show the current hotkeys by selecting Preferences, Hotkeys, and List Current Keys and that you can set up your own hotkeys through Preferences, Hotkeys and Edit Hotkeys. 

You can also import and export hotkeys from the same menu item, which is a good way to ensure that you have the same settings across the computers where you use KiCad.


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)
You can only upload 1 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
0 / 10000
    Back to top