Design printed circuit boards with KiCad

Boardwalk

© Lead Image © Shamain, 123RF.com

© Lead Image © Shamain, 123RF.com

Article from Issue 208/2018
Author(s):

KiCad helps you design printed circuit boards with up to 32 layers, checks for optimal placement, and supplies schematics and assembly diagrams in the popular Gerber format for submission to PCB manufacturers.

KiCad was originally launched as simple schematics software; today, it supplies blueprints for components used at the CERN nuclear research center in Geneva, Switzerland. Accordingly, CERN's scientists are actively involved in the development of KiCad, which is available for Linux, FreeBSD, Mac OS, and Windows [1].

Schematics created with this program are suitable for importing into other programs, depending on the format. KiCad comes with numerous features and, unlike the free versions of commercial counterparts such as Eagle Light Edition or Target 3001!, there are no restrictions on its use and scope. See the "Basics" boxout if you are a newcomer to the field.

Basics

In KiCad, you create the schematic first. After checking it carefully, you then design the printed circuit board (PCB), which brings the components and their "footprints" together – footprints being the connection geometries of the various components. Components can be wired (conventional, through-hole devices) or surface-mount devices (SMDs): Wired components are located on the upper side of the printed circuit board, with the soldered side and the conducting paths mirrored on the underside. SMD components are soldered directly on the PCB surface, revealing the circuit diagram in the printed conductors. Information about components can be found in libraries [2] maintained by volunteers [3].

The program is available for many distributions. You can download the latest version from the project page, where you also will find the source code if you want to compile the software yourself.

Users of Debian-based systems who use an older version of the distribution can access backports (see the "Backport" box). The Unstable and Testing branches already contain the latest version of the software.

Backport

As root, add the package source for KiCad to the /etc/apt/sources.list file; then, update the package data and install the software and the associated help files:

# echo "deb http://httpredir.debian.org/debian jessie-backports main contrib non-free" >> /etc/apt/sources.list
# apt-get update
# apt-get -t jessie-backports install kicad

Creating a Project

When you run the program (Figure 1), you are prompted to create a PCB design project. To do this, either click on the spiral notepad icon in the toolbar on the left or take the classic File | New Project route.

Figure 1: After the first call, the KiCad program window looks quite empty.

For the sake of clarity, create a new folder (in Figure 2, this is first), assign a name to the project (e.g., first here), and press Save. The left column of the program window contains a tree view of the project and its components with the first set of files (see Table 1), and the individual components are no longer grayed out.

Figure 2: After creating a project, a multitude of functions become available in the main window.

Table 1

Project Files

Extension

Content

.pro

Entries for project management

Shared

.kicad_wks

Adjustments to the worksheet

.net

Netlist

.cmp

Component assignments in the footprint schematic (create with the Pcbnew board layout editor; import into Eeschema)

Eeschema (Schematic Editor)

*_cache.lib

Copies of the parts used in the schematic

.dcm

Documentation of the component library (information about components)

.lib

Component library with information on design and connections

.sch

Schematic file without components

Pcbnew (Printed Circuit Board Editor)

fp-lib-table

List of footprint libraries

.kicad_mod

Footprint file with description

.kicad_pcb

Printed circuit board with board layout

.pretty

Directory of the footprint library folder

Output Files for Printed Circuit Board Production

.drl

Drilling data in Excellon format

.gbr

Gerber file for producing the printed circuit board

.pos

Positioning instructions for insertion machines

Output Files for Documentation

.dxf

Plot in DXF format

.pdf

Plot in PDF format

.plt

Plot in HPGL format

.ps

Plot in PostScript format

.rpt

Report file (text)

.svg

Plot in SVG format

In the File menu, you can open existing projects or create new ones. You can also create or read archives. Under Browse, you have the option of editing files with a text editor of your choice, which is determined under Preferences, where you can also configure the language for the user interface and the PDF viewer. Additionally, you can define paths and set up keyboard shortcuts (called hotkeys). Table 2 shows the shortcuts for the main window. Each tool also has its set of hotkeys.

Table 2

Hotkeys

Shortcut

Function

Ctrl+O

Load project

Ctrl+S

Save project

Ctrl+N

New project

Ctrl+T

New project from a template

Ctrl+E

Eeschema – schematic editor

Ctrl+L

Schematic library editor

Ctrl+P

Pcbnew – printed circuit board editor

Ctrl+F

PCB footprint editor

Ctrl+G

GerbView utility

Ctrl+B

Bitmap2Component utility

Ctrl+C

PCB calculator

Ctrl+Y

Pl editor

KiCad manages projects and calls up a number of tools, which you can access either from the Tools menu or directly in the toolbar (Table 3). The Help menu offers a manual and a tutorial for beginners.

Table 3

Components

Symbol

Task

Eeschema schematic editor

Schematic library editor

Pcbnew printed circuit board editor

PCB footprint editor

GerbView

Bitmap2Component utility

PCB calculator

Pl editor

Small Circuit

A design for a small 5V power supply is a good example of how to trace all the important work steps. Click on the new project you just created and start Eeschema. If you see any error messages, they only appear on the first call, so you can simply ignore them.

Click on the first icon, Page settings, and set up your project (Figure 3). To fill the desktop with components, you can either click Place | Component or choose the third symbol from the top in the right vertical toolbar.

Figure 3: You will thank yourself later if you document your work well in the beginning.

Click in the schematic sheet to position the component. You will now see the Choose Component selection dialog (Figure 4). Click OK to position the component. Each component used appears in the History of the Choose Component window, making it easy to reuse components. To find a component, enter a search term in the Filter field.

Figure 4: Each project starts by selecting the required components.

As long as you hold the component with the mouse cursor while placing, you can rotate it through 90 degrees by pressing R. If you insert an incorrect component, you can remove it by pressing Ctrl+Z or right-click and choose Delete Component.

You can edit components you have already positioned by selecting the element with the left mouse button and then right-clicking to open a context menu (Figure 5). A prompt often appears (Clarify Selection) asking what exactly you want to edit. In this dialog, select the component.

Figure 5: You can edit a component retroactively after placing it.

Adding the required data for the components you place uses the context menu, as well. Select Edit Component, and enter the reference and the value (Figure 6). For example, for a resistor, you might choose Resistor: R1, 100 Ohm. These entries appear later in various lists and in the layout for assembly.

Figure 6: Gradually add suitable references and values to the individual components.

Once all the components are on the desktop, connect them either by selecting Place | Wire or by clicking the fifth icon from the top in the right-hand toolbar. KiCad shows some weaknesses here: You always need to drag from an unconnected pin on one component to an already otherwise connected component.

Where three lines meet, the program creates a node. If two connections cross and you want to connect them, you click Place | Junction. If the component labeling is not to your liking, you can right-click, select Move Value, and place the text in a better place.

Make sure all components in the schematic are completely referenced and provided with values before using Tools | Annotate Schematic and Tools | Generate Netlist File to generate the result. If necessary, print or plot the schematic from the File menu.

In the next step, use Tools | Assign Component Footprint to merge the components with their footprints. These geometric properties include the assignment of the connections and housing dimensions. The program returns error messages the first time it is called, but you can continue working after restarting this step.

On the left-hand side of the window are the component classes and in the middle are the components from the schematic; on the right-hand side you can select the matching footprint element (Figure 7). If you want to view the dimensions and contacts of a component when selected, click on the third symbol from the left side of the window (View selected footprint). Figure 8 shows a diode used in the example.

Figure 7: Once you have designed the entire circuit, connect the circuit symbols to the matching footprints.
Figure 8: Upon request, KiCad can display the footprint data in detail.

Make sure you process all components before saving your work and closing the assignment window. To be on the safe side, click on Tools | Generate Netlist File again and then click on Tools | Layout Printed Circuit Board.

Now set the grid, the units of measurement, and the grid width. To do this, use the Show grid/Hide grid icon (second down on the left) and the Units in millimeters icon for metric dimensioning (fifth from the top). The grid width can be changed under Dimensions | Grid or with the Grid drop-down along the top of the schematic window.

The next step is to determine the size of the board. To do this, start the layer manager (left toolbar, second icon from bottom). Set Edge.Cuts as the current layer by positioning the arrow to the left of the entry; the corresponding checkbox must be filled (Figure 9).

Figure 9: Use the layer manager to define the final size of the planned board.

Now draw the outline of the board. You can find this function under Place | Line or Polygon or by clicking on the eighth symbol from the top right of the layer manager.

To read the schematics data, use the Tools | Netlist | Read Current Netlist or the Net symbol at top. The components can be found as a bundle on the desktop. Now switch to Footprint mode (top toolbar, fourth button from the right).

Right-click in the free workspace to open the context menu and select Global Spread and Place | Automatically Place All Footprints. The program now arranges the components more or less sensibly within the frame. To make your corrections, you might need space for heat sinks or wires.

To move a component, again choose Footprint mode (Figure 10) and right-click the component in question. A menu opens in which the top entry always starts with Footprint. Expand this menu item to move the component or drag, rotate, flip, and so on.

Figure 10: Automatic arrangement of the components does not always give you optimal results. If necessary, you can correct them manually.

Always be sure to use the correct layer when using wired devices – use the bottom layer (B.Cu) when dragging the conducting paths. You can change the thickness of the conducting paths or insert ground areas later (Figure 11).

Figure 11: Once you have put all the elements in place, connect them using conducting paths whose properties you can edit later, if necessary.

Results

To print or plot the results, use the File menu. With the GerbView tool, you can create a true-to-scale proof (Figure 12). Place the components on top of it and check that they match the conducting paths, drill marks, and other elements. After this quality control, send the Gerber files to a PCB service provider. To check the correct position of critical parts in advance, create a Gerber plot (File | Plot) in Pcbnew.

Figure 12: In GerbView, you can see whether all elements of the end product are in the right place on the PCB.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • FOSSPicks

    Graham has finally taken delivery of a couple of RISC-V development boards for Linux experimentation. Expect plenty of cross-build tools in future issues!

  • FOSSPicks

    Graham had an interesting moral dilemma this month: whether to include an open source Wordle clone or not. Read on to see his decision.

  • Function Generator HAT

    A touch display, a case, and a custom add-on board transform the humble Rasp Pi into a high-performance function generator that rivals expensive commercial offerings.

  • Electronic Weighing

    Create your own weighing device with easily available components and open source software.

  • FOSSPicks

    The promised profusion of extra time has failed to materialize for Graham this month, leaving him with too many synth kits to build, a table littered with components, and a leaking toilet.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News