25
English KiCad homepage About KiCad News Docs Mini_tutorial FAQ Download Mailing lists Yahoo users group (http://groups.yahoo.com/group/kicad-users/) Yahoo developers group (http://groups.yahoo.com/group/kicad-devel/) Launchpad Developers Group (https://launchpad.net/~kicad-developers) KiCad SVN notification list (http://sourceforge.net/mail/?group_id=145591) Resources Bug tracker (https://bugs.launchpad.net/kicad) Wish list Building KiCad Developers Links Russian WikiPedia about KiCad (http://ru.wikipedia.org/wiki/KiCad) Russian KiCad docs at WikiBooks (http://ru.wikibooks.org/wiki/KiCad) KiCad libraries (http://kicadlib.org) Forum (Russian) (http://www.kicad-eda.org/phpBB2/) Site of KiCad author (http://iut-tice.ujf-grenoble.fr/kicad/) From KiCad Česky Deutsch English Español Français Polski Português Русский 中文 This mini-tutorial introduces the use of the KiCad system. It walks you through the steps of creating a simple circuit design, from schematic entry through printed circuit artwork. Along the way it introduces you to various KiCad features, and suggests efficient ways to accomplish various tasks. The KiCad manuals contain much information beyond what is presented in this tutorial. Consult them to learn more about using KiCad. The example circuit is a simple RS232 interface. Tutorial has images from a Fedora Core 3 (Linux) version. I updated this tutorial using Maxim Max232A 16 pin DIP (http://pdfserv.maxim-ic.com/en/ds/MAX220- MAX249.pdf) . 1 KiCad Mini-Tutorial Scope 2 Creating the KiCad project. 3 Drawing the Schematic with EeSchema 3.1 The Add Components Tool 3.2 Panning and Zooming 3.3 The Add Powers tool 3.4 The "Selection" tool 3.5 The "Add Wires" tool 3.6 Net/Bus Names 3.7 The "Electrical Rule Check" feature 3.7.1 The "Add noconnect flag" tool 3.7.2 Errors on power nets - PWR_FLAG 3.8 Editing component values 3.9 The Netlist Generator 4 Assigning package types with Cvpcb. Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial 1 di 25 18.09.2010 01:35

Mini Tutorial - KiCad

Embed Size (px)

Citation preview

Page 1: Mini Tutorial - KiCad

English KiCad homepage

About KiCadNewsDocs

Mini_tutorialFAQ

Download

Mailing lists

Yahoo users group (http://groups.yahoo.com/group/kicad-users/)Yahoo developers group (http://groups.yahoo.com/group/kicad-devel/)Launchpad Developers Group (https://launchpad.net/~kicad-developers)KiCad SVN notification list (http://sourceforge.net/mail/?group_id=145591)

Resources

Bug tracker (https://bugs.launchpad.net/kicad)Wish listBuilding KiCadDevelopers

Links

Russian WikiPedia about KiCad (http://ru.wikipedia.org/wiki/KiCad)Russian KiCad docs at WikiBooks (http://ru.wikibooks.org/wiki/KiCad)KiCad libraries (http://kicadlib.org)Forum (Russian) (http://www.kicad-eda.org/phpBB2/)Site of KiCad author (http://iut-tice.ujf-grenoble.fr/kicad/)

From KiCad

Česky Deutsch English Español Français Polski Português Русский 中文

This mini-tutorial introduces the use of theKiCad system. It walks you through the stepsof creating a simple circuit design, fromschematic entry through printed circuit artwork.Along the way it introduces you to variousKiCad features, and suggests efficient ways toaccomplish various tasks.

The KiCad manuals contain much informationbeyond what is presented in this tutorial.Consult them to learn more about using KiCad.

The example circuit is a simple RS232interface. Tutorial has images from a FedoraCore 3 (Linux) version. I updated this tutorialusing Maxim Max232A 16 pin DIP(http://pdfserv.maxim-ic.com/en/ds/MAX220-MAX249.pdf) .

1 KiCad Mini-Tutorial Scope2 Creating the KiCad project.3 Drawing the Schematic withEeSchema

3.1 The Add ComponentsTool3.2 Panning and Zooming3.3 The Add Powers tool3.4 The "Selection" tool3.5 The "Add Wires" tool3.6 Net/Bus Names3.7 The "Electrical RuleCheck" feature

3.7.1 The "Addnoconnect flag" tool3.7.2 Errors on powernets - PWR_FLAG

3.8 Editing component values3.9 The Netlist Generator

4 Assigning package types withCvpcb.

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

1 di 25 18.09.2010 01:35

Page 2: Mini Tutorial - KiCad

5 Laying out the circuit board withPcbnew.

5.1 Reading in the netlist5.2 Defining board size5.3 Spreading out the modules5.4 Placement aids

5.4.1 Ratsnests andAirwires5.4.2 Net highlighting5.4.3 Design RulesCheck

5.5 Auto-routing5.6 Manual layout

5.6.1 Deleting tracks5.6.2 Drawing tracks

5.7 Two-sided boards5.8 Multilayer boards5.9 Board outline5.10 Zone Fills

6 Viewing the board with 3D Viewer7 Generating files for PCBfabrication.8 Tutorial Omissions9 Acknowledgments

It's best to use a separate directory for each project; things can get confusing if you have files for different projects inthe same directory. Perform the following steps:

Create a directory (folder) named "RS232".1.Start the KiCad program.2.Create the project

In the KiCad toolbar, select the leftmost icon, whose tooltip is Create new project descriptor (or use themenu entry Projects > New Project Descr).In the Create Project files dialog, enter the name RS232, and use the Browse for other folders control tochoose the RS232 folder that you have just created.Click the Save button. A file named RS232.pro will be added to your directory. That file containssettings for this project.

3.

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

2 di 25 18.09.2010 01:35

Page 3: Mini Tutorial - KiCad

There are four large buttons in the pane at right of the KiCad window. From left to right, they are :

EeSchema (Schematic Editor)Cvpcb (Components to modules)Pcbnew (Board editor)GerbView (Gerber viewer)

Each button activates a separate program. We will use those programs in the order listed during this tutorial (except wewon't use GerbView).

Start the schematic editor - in the KiCad window, click on the large EeSchema button.When EeSchema first starts with a new project, it displays an alert dialog saying that the schematic filedoesn't exist. Just click OK.

The main tools that you use to draw schematics are on the vertical toolbar at the right edge of the window. Those toolslet you select objects, place components, draw wires, etc.

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

3 di 25 18.09.2010 01:35

Page 4: Mini Tutorial - KiCad

When you are finished using a tool, you can either select another tool from the right toolbar, or you can go back to the"selection" tool quickly by right-clicking and choosing End Tool from the pop-up menu.

The Add Components Tool

Activate the Add components tool - Click on the Place Component tool in the right vertical toolbar (its iconlooks like an AND-gate). The cursor should change from an arrow selection tool to a pencil. Click in thedrawing window to begin placing a component. A Component Selection dialog will appear, giving you severalways to choose a component:

If you know the exact name of the component, just enter it in the Name: field and hit Enter or click OK.1.If you know the approximate name, enter a search pattern (for example *C*) in Name: and hit Enter orclick OK. You'll get a Selection window that lists all the matching components.

2.

You can search by keyword by entering the keyword in the Name: field and clicking Search Keyword.You'll get a selection window. At present, many of the library components do not have keywords, so thisfeature is only marginally useful.

3.

You can select a component that you have used recently from the History list:4.The ListAll button brings up dialog from which you can select first the library, then a component withinthat library.

5.

The By Lib Browser button brings up the Library Browser, which lets you explore the libraries andview their symbols. When you have chosen the one you want, use the Insert component in schematic(in previous versions Export to Schematic) button at the right side of the library browser toolbar. Youcan also bring up the library browser from the Go To Library Browser button on EeSchema's horizontaltoolbar, but in that mode, there is no Insert component in schematic button.

6.

For now, click on By Lib Browser. In the left pane, select the library conn (connectors). In the adjacent pane,scroll down and select the DB9 component. A drawing of that component will appear in the right pane. In thetoolbar, click on the Insert component in schematic button (it's on the right, in previous versions was calledExport to Schematic).

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

4 di 25 18.09.2010 01:35

Page 5: Mini Tutorial - KiCad

Back in the drawing window, the component symbol will follow the mouse until you left-click to place it (youcan reposition it later if necessary). Flip the component left-to-right as follows:

Put the cursor over the componentRight-click, choose Orient Component > Mirror || (Y). The connection pins should now be coming outthe right side.Place the polarized electrolytic capacitors - With the Place Component tool still active, left-click in thedrawing window to get the component selection dialog back. This time try the List All button. In theSelect Lib dialog, select the Device library (double-click or use OK button).In the Select Part dialog, select CP (double-click or use OK button). Left-click in the drawing window toplace the component.Place the other four capacitors as shown in the figure. You can do it easily by double-clicking in theHistory list: of the Component Selection: dialog.

Add the other components listed below, using the techniques you've just learned.

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

5 di 25 18.09.2010 01:35

Page 6: Mini Tutorial - KiCad

2x 3-pin connectors (CONN_3 in the "conn" library)1x 4-pin connector (CONN_4 in the "conn" library)1x MAX232 chip (MAX232 in the "interface" library) (there's an identical copy in the "special" library)

Panning and Zooming

By the way, while you are working the drawing window, you can pan and zoom in several different ways :

The scrollbars at the bottom and right let you pan. Just move your mouse pointer into it.There are zoom buttons in the top (horizontal) toolbar.The right-click pop-up menu has zoom and centering functions.Finally, and perhaps most conveniently, if you have a wheel mouse you can zoom by rolling the wheel. Themouse wheel recenters the display around the current position of the mouse. Also, if you just click on themouse wheel, the display will recenter around the current mouse position. Ctrl+mouse wheel will panhorizontally, and shift+mouse wheel will pan vertically.

The Add Powers tool

EeSchema has "components" for power and ground connections. They aren't quite the same as other components,because they don't correspond directly to real parts with pins, but they do appear as symbols in the "power" library.You can add those components with the regular "Add Components" tool, but there's an easier way.

Activate the "Add Powers" tool from the right toolbar. It looks like a ground symbol. It works like "Addcomponents", but it restricts the list of choices to just the "power" library.

Add the power components listed below to your drawing.

1x +5V 2x GND 2x PWR_FLAG

The "Selection" tool

Activate the "Selection" tool - it's the arrow icon at the top of the right toolbar. It's the "default" tool, so you can getback to it from other tools by hitting Esc, or by right-clicking "End Tool". The cursor shape is an arrow when theselection tool is active.

In selection mode, you can perform various operations (move, reorient, copy, etc) on components by right-clicking withthe cursor over the component. In fact, you can also do those things in "Add component" mode, again by right-clickingover the component. The main difference between selection mode and the various "add" modes is what happens whenyou left-click. Left-clicking in an "add" mode adds the corresponding item (component, wire, etc), whereas left-clickingin selection mode lets you drag-select a rectangular region that can contain multiple objects.

Release the left mouse button at the end of a drag-select highlights the selected objects. If you then move the mouse,the selection will move. To do something else with the selection, right-click. The popup menu has several options,including Zoom, Place, Save, Copy, Drag, and Delete. "Place" is the same as just moving the selection andleft-clicking again, without ever right-clicking. "Save" copies the selection into a buffer from which it can later bepasted with the top toolbar's "Paste" button. "Copy" makes a new copy of all the selected items, so you are nowmoving the copy instead of the originals. "Drag" is like moving, except that wire ends that are outside the selectionregion will remain connected as the selection moves.

As an alternative to choosing the selection operation by right-clicking, you can use the Ctrl and Shift keys while you'redragging out the selection rectangle. Look at the popup menu to see which keys do what. It doesn't work to use Ctrland Shift after you have dragged out the rectangle; they must be down during the initial left-down that begins therectangle.

You can cancel a move by hitting Esc.

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

6 di 25 18.09.2010 01:35

Page 7: Mini Tutorial - KiCad

Arrange the components as shown in the figure below using the techniques described above. Figure describes allparts placed but not wired together

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

7 di 25 18.09.2010 01:35

Page 8: Mini Tutorial - KiCad

Now set the values of the capacitors to "0.1 uF" in accordance with MAXIM's spec sheet. To do that,right-click overeach capacitor, choose "Edit Component>Value" and change "CP" to "0.1 uF". If you have a lot of components withthe same value, you can save time by adding one of them, changing its value, then using "Copy Component" (from theright-click menu) to duplicate the component including the new value. If you prefer, you can set a component valueimmediately after adding the component - the right-click menu is available in "Add Component" mode.

In this design, the only components that need to have values set are the capacitors. For the other components, the valuefield contains the part number. The value field is generally used to distinguish between the variations of a genericcomponent with a given function and pinout. Such variations can include resistance, capacitance, frequency, speedgrade, etc.

"Edit Component>Edit" brings up a property sheet whereby you can change many different aspects of the component.We won't need that in this tutorial.

Assign reference designators - numbers like C1, C2, and U1 that identify the specific instance of each component.You could set them manually with right-click "Edit Component>Reference", but it's easier to let EeSchema do itautomatically. To do it automatically, click the "Schematic Annotation" button in the top toolbar (near the right end).You'll get a dialog that lets you choose the extent of the annotation (this sheet or all sheets, unannotated componentsonly or redo everything). Annotating replaces "?" characters in the reference designators with integers that are uniquefor each prefix, e.g. C1, C2, C3, U1, U2, etc. There's no particular reason why annotation has to be at exactly this point- it could be done earlier, or deferred until after wiring up the components, but it must be done before Electrical RulesCheck or Netlist Generation.

The "Add Wires" tool

Activate the "Add wires" tool from the right toolbar.

To connect two pins with a wire, left-click on the first pin and drag the mouse to extend the wire from that point. Eachleft-click will complete a line segment and you can drag a new segment from there. Clicking on another pin willconnect the segment to it and stop the process. If you are still dragging a segment after clicking on pin, it isn't reallyconnected. (This can happen if the component is off grid, or if you need to make one more right angle bend to get rightonto the pin.) (You can draw wires at any angle - not just horizontal and vertical - by clicking on the "Draw lines at anydirection" button at the bottom of the left vertical toolbar.)

A tip is to hold down the ctrl key and move objects using the left mouse button. That way connections will follow inmanner called rubberbanding or dragging.

While you are drawing a wire, you can end it prematurely (i.e. without completing a connection to a pin) by right-clicking. You can cancel it by hitting Esc. Experiment with the various right-click menu options to see how they work.The ends of dangling wires are marked with little squares. Keep an eye out for such markers to make sure that yourconnections really are connected.

When wires cross or make a "tee", if they are connected, the connection will be shown with a "junction" symbol (afilled square). If there is no junction symbol, it means they aren't connected. EeSchema usually adds junctionsautomatically, but if it makes a mistake, you can fix it. The right-click menu lets you add a junction (but only if themouse is over a wire) or delete a junction (only if the mouse is over a junction). This illustrates an important pointabout the KiCad user interface: the right-click menu offers a context-dependent set of operations that apply to theobjects underneath the mouse.

Connect the components with wires as shown in figure below (leave the PWR_FLAG detached for now).

Zoomed in finished wire connections:

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

8 di 25 18.09.2010 01:35

Page 9: Mini Tutorial - KiCad

Net/Bus Names

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

9 di 25 18.09.2010 01:35

Page 10: Mini Tutorial - KiCad

Activate the "Add wire or bus label" from the right tool bar

Enter the name and place the label either over a wire, bus or component connection. Note that for a net to be connecteda minimum of two pins must either be connected with a wire or the label must appear two or more times. Failure to dothis will result in a ERC violation report below. Single pin nets are not written to the netlist.

The "Electrical Rule Check" feature

The Electrical Rule Check (ERC) feature helps you verify that the connections are correct.

Run ERC - in the top toolbar, click on the "Schematic Electrical Rules Check" button (second from the right end).That brings up a dialog box. You could use that dialog's "Options" tab to configure ERC's response to different kindsof problems, but for this simple circuit we'll just use the default settings.

Click the "Test Erc" button.

Note: Sometimes when you do this, you'll get an alert box that says something like "Item not annotated: #FLG?" (or#PWR? or something like that). This means that you forgot to assign reference designators to some components. Youcan use the "Schematic Annotation" tool to assign all the reference designators automatically as described earlier.

(You could assign them manually, but finding them isn't always easy for complicated designs. The "Find Componentsand Texts" tool isn't as useful as it might be, because it treats the "?" character as a "wildcard", matching any singlecharacter, so a pattern like "#PWR?" will find components like "#PWR5" in addition to the unassigned ones. Atpresent, there is no way to "turn off" the wildcard meaning of "?". Another problem with "Find Components and Texts"is that it doesn't highlight the found component in a clear manner, so it's not always easy to identify which component itfound. One workaround is to zoom way in so the components are large. The find tool will usually center the displaynear the found component, and at large zoom factors you can usually tell which one it found.)

The ERC test will check the various electrical design rules according to the settings in the Options tab. For example,one rule is that a net can be driven by at most one "output" pin. You can configure whether specific kinds of problemsare ignored, flagged as errors, or warnings.

Note: It's not necessary to get a clean output from ERC test before proceeding with later steps of the design process.The tools will still work even if ERC complains about electrical design rule violations. But it's usually a good idea toat least look at each of the problem areas, because they often indicate legitimate problems such as wires that aren'treally connected.

ERC marks problems on the schematic with small arrows (and you can tell it to write the list to a file). To see whatproblem caused a specific arrow, left-click on the arrow and look in the status bar at the bottom of the window, nearthe left side. If you are having trouble finding some of the arrows, try the "Find components and texts" button in the toptoolbar (it looks like binoculars).

The "Add noconnect flag" tool

One common ERC report is a pin that is not connected to anything. In some cases that is a real problem; in other casesit's intentional. You can prevent ERC reports for intentional No-Connects by putting a special "noconn" marker on thepin.

Activate the "Add noconnect flag" tool - its near the middle of the right toolbar; the icon is an "X". When it's active,clicking on a pin places a "noconn" marker there.

You can delete a noconn marker with right-click "Delete noconn" if the mouse is over a noconn.

Add noconn markers to all of the unconnected pins that the ERC found (except for the PWR_FLAG; continue toleave that dangling for now) and rerun the ERC test. The result should look something like the figure below, indicatingonly 4 errors.

<figure>

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

10 di 25 18.09.2010 01:35

Page 11: Mini Tutorial - KiCad

Errors on power nets - PWR_FLAG

Click on the error marker (the little arrow) for one of the power symbols (GND or +5V) and look in the status bar atthe bottom left of the window. For our circuit, you should see a message like:

ERC << Warning Pin power_in not driven (Net 15).

This message indicates that the pin (and all such pins on similar power components) is supposed to have a powersource connected to it, but there isn't one. (VCC, GND, 3V3, and various other power net symbols are treatedidentically for this purpose.) A power source could be something like the output of a 78xx voltage regulator.

In this circuit, the power will be supplied externally through a connector. To eliminate this warning, we can tell ERCthat it's okay by connecting a PWR_FLAG to the net. PWR_FLAG is a special "virtual component" that does notcorrespond to a physical device. It exists just to satisfy ERC. PWR_FLAG's pin is declared to be of type "power_out",telling ERC that the net it's attached to has power. You need a separate PWR_FLAG to each power net. In this circuit,the only power nets are +5V and GND, but more complex circuits will often have several more power nets such as-12V, 3V3, and AGND.

The power components like GND and +5V are also "virtual", not representing physical devices. They have the specialproperty that all nets connected to a power symbol with a given name are really the same net, even across multiplepages of a hierarchical schematic.

Wire one of the PWR_FLAGs to one of the +5V nets, and another to one of the GND nets, and rerun ERC. That shouldget rid of the remaining ERC error reports. Figure shows no errors when all connections done right:

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

11 di 25 18.09.2010 01:35

Page 12: Mini Tutorial - KiCad

Editing component values

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

12 di 25 18.09.2010 01:35

Page 13: Mini Tutorial - KiCad

Before proceeding further, do a visual check to ensure that values are assigned to all of the capacitors ("0.1 uF"instead of "CP"). In addition to the right-click "Edit Component>Value" technique that we've already discussed, there'sanother way to edit a specific component field. If you put the mouse cursor directly over the field in question, theright-click menu will show additional commands "Move Field", "Rotate Field", and "Edit Field". Move and Rotate letyou reposition the field relative to the component symbol (this can help you make the drawing tidier). "Edit Field" letsyou change that field value, without having to select so many levels of nested popup menus. This works for theReference field in addition to the Value field.

Final schematic should look something like this

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

13 di 25 18.09.2010 01:35

Page 14: Mini Tutorial - KiCad

The Netlist Generator

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

14 di 25 18.09.2010 01:35

Page 15: Mini Tutorial - KiCad

Generate a netlist - click the "Netlist generation" button in the top toolbar. The dialog box that appears has tabs forvarious netlist formats; we will use the native "Pcbnew" format. Click the "Netlist" button, then click "Save", acceptingthe default filename which is derived from project name.

In order to develop a physical printed circuit board (PCB) layout corresponding to an electrical schematic, eachschematic symbol ("component" in KiCad nomenclature) must be associated with a physical package type ("module"in KiCad nomenclature). Physical packages/ modules are things like 16-pin DIPs, 44-pin leadless chip carriers, 1206SMT components, etc. For the purposes of PCB layout, the description of a "module" mainly consists of the package's"footprint" on a circuit board.

Some CAD systems associate components with package types in their libraries. In KiCad, the association is not builtinto the library. (The advantage of the KiCad scheme is that a single schematic component such as capacitor can beused with many different package types, for example axial lead, radial lead, and surface mount packages of varioussizes. This advantage is less compelling for modern VLSI components, in which the pin numbers often differ radicallybetween variants in different packages).

KiCad's "Cvpcb" program annotates the netlist that EeSchema created, adding to it the package type ("module")information that the physical layout program requires. Some of the associations can be done semi-automatically, usinga file describing default assignments, and others must be done manually.

Start Cvpcb either from one of the four large buttons in the KiCad project manager window or from the "Run Cvpcb"button in EeSchema's top toolbar. In most cases, Cvpcb will automatically load the netlist file for the current project.

Cvpcb's left pane lists the components in the current netlist - reference designator, value, and the associated module ifone has been assigned. The right pane lists the modules that are available. (The list of available modules depends onthe set of library files that are configured. You can add additional library files to the configuration with the Cvpcbmenu item Preferences>Configuration.)

To assign a module a component, first select the component in the left pane (click on the line, or use the arrow buttonsin the toolbar). Then choose a module in the right pane. Double-click on the (right pane) module name to assign it tothe selected (left pane) component. If you want to inspect the physical footprint of a module, single click to select itand click the "View selected part" button in the toolbar. That will bring up a window that displays the module'sphysical layout.

Assign modules to all the components according to the figure below:

Figure demonstrates completed list:

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

15 di 25 18.09.2010 01:35

Page 16: Mini Tutorial - KiCad

Then save the netlist with the "Save Netlist and Cmp list" toolbar button. It's best to save it to the default filename,which is the same netlist file that you started with. Cvpcb has added the new information to that file.

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

16 di 25 18.09.2010 01:35

Page 17: Mini Tutorial - KiCad

Cvpcb has an "Automatic associations" feature (accessed through a toolbar button) that lets you automate part of thecomponent/module association process. You first create an external file that defines the default module to use forsome kinds of components, so you don't have to assign each one individually by hand. That can be helpful for largeprojects.

Cvpcb can also create a "stuffing list" file (via the "Create stuff file" toolbar button) that lists the component referencedesignators and their associated modules / package types. That file is useful for assembling a circuit board after it hasbeen fabricated.

Start Pcbnew either from the large button in the KiCad project window or from the "Run Pcbnew" button inEeSchema's top toolbar.

Reading in the netlist

Read in the netlist file. If the netlist selection dialog doesn't start automatically, click the "Read netlist" 'button' in thetop toolbar.

In the Netlist dialog, click Select to get a file selector dialog,

then choose the netlist file (.net) that you have just created for our project. Back in the Netlist dialog, click Read toload the netlist file into Pcbnew, then Module Test to check for possible errors in the assignment of modules tocomponents.

Some common errors:

- a module with fewer pins than its associated component

- a module's pin designators don't correspond to the component's pin designators (for example the component pinsmight be numbered, while the module's pins might be identified by letters)

To correct such errors, you would need to either select a different module that matches the component, or to modifyeither the component or the module so that they match.

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

17 di 25 18.09.2010 01:35

Page 18: Mini Tutorial - KiCad

Note that you can reread the netlist into a partially designed board, for example if you make a change to the schematic.The details of this process are not be covered in this tutorial.

Defining board size

Select the "Edges Pcb" layer located in the top-right area of the program.

->

Then click on the "Add graphic line or polygon" on the right side toolbar list.

Draw the board outline in the working area of the window.

Spreading out the modules

When you load a new netlist, Pcbnew adds all of its modules to the drawing. It places them all in one place, on top ofone another, where they are sometimes difficult to find. If the drawing does not yet have a board outline, newly-addedmodules are placed at the intersection of the two blue lines above and left of the sheet frame. If the drawing does havea board outline, new modules are placed below the outline.

Separate the modules so they are easy to manipulate. First click on the "Mode Module ..." button in the top toolbar(second from right). You want that button to be in the "down" position. Then right-click in an open area of the drawing,and select "Glob Move and Place>Move All Modules". That will spread out the modules.

Move the group of modules to the center of the sheet as follows: Drag-select a rectangle containing all the modules(i.e. hold down the left mouse button while moving the mouse to the opposite corner of the rectangle). Release themouse button, the move the mouse so the rectangle is near the center of the red sheet outline. Left-click to place theblock in the new position, and click Ok on the dialog.

If you end a block operation with right-click instead of left-click, you'll get a popup menu that lets you can chooseoperations like Copy, Drag, Mirror, and Delete. "Mirror" is is how you move modules from the top "component" sideto the bottom "copper" side of the board, and vice versa.

At this point you could draw the outline of your circuit board. That would be especially appropriate if you alreadyknow the board form factor. In this tutorial, we'll decide on the board size later and wait to draw in the outline. When aboard outline has been defined, Pcbnew can place components automatically, but we're going to do a manualplacement.

Placement aids

Before we continue with placement, let's look at some of Pcbnew's features that can help us with that task. The mostimportant are ratsnests and airwires.

Ratsnests and Airwires

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

18 di 25 18.09.2010 01:35

Page 19: Mini Tutorial - KiCad

When you are moving a module Pcbnew will show "airwires", which are white lines connecting each of the modulespins to the nearest other place (pin or track) on the same net. The airwires dynamically change as you move thecomponent, "rubberbanding" and sometimes "snapping" to other nearer endpoints. This feature helps you findplacements with short overall connection lengths. You can turn the airwire feature on and off with the "ModuleRatsnest" button in the left toobar.

In addition to the per-module animated airwires, Pcbnew can display a "general ratsnest", showing all the unconnectednets for the whole drawing. That's useful for seeing "hotspots" in the drawing - areas where many nets cross. In laterstages of the layout process, it's helpful for locating nets that have not yet been routed. You can turn this feature onand off with the "General ratsnest" button in the left toolbar. If the ratsnests seem to display incorrectly, the "Redraw"command (in the right-click menu, or middle mouse button) will often fix the display.

If you want to leave "general ratnests" turned off for tidiness, but you still want to see the ratsnest for a specific pin orcomponent, use the "Display Local Ratsnest" tool in the right toolbar. When that tool is active, clicking on a pin ormodule will display its ratsnest. You can add additional ratsnests to the display by clicking on more modules, or clearthe display by clicking in an empty region. (You could see a module's ratsnest by moving it, but that would riskbreaking any tracks that are already connected to it. If you break tracks in this way, you would have to delete thetracks or some segments thereof and reconnect them.)

Net highlighting

The "Net highlight" tool (right toolbar) provides another way to see the connections for a particular net. With that toolactive, if you click on a pad or a track, all of the pads and tracks on that net will be highlighted. Clicking on a differentpad will change the highlight to the new net, and clicking in an empty area will clear all the highlighting.

Design Rules Check

The "Design Rule Check" (DRC) feature checks new tracks to ensure that things don't get too close together. (Theclearance rules are configured by the "Dimensions>Tracks and Vias" menubar item.) With "DRC on" (the default),Pcbnew will not allow you to place a track segment that violates the rules. While you are drawing a track segment, the"keepout area" around it is shown by narrow lines. If that keepout area overlaps an existing object, Pcbnew won't placethe segment when you click. DRC can be turned off with the "DRC Off" button at the top of the left toolbar.

Now let's return to the task at hand. Place the components as shown in the following figure. You can right-click overa module to select various ways to move and reorient it. Your component numbering (eg. C1..C5) may differ from theimage.

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

19 di 25 18.09.2010 01:35

Page 20: Mini Tutorial - KiCad

Auto-routing

Auto-routing can be done by exporting the unrouted board to a java program found at freerouting.net.

I would suggest an addition to this tutorial about using freerouting to route a board spacing and setting tolerances soDRC and board companies work.

Having placed all the modules, let's try the auto-router. The auto-routing commands are accessed with the right-clickmenu, but you first have to enable them by clicking the "Mode Track and Autorouting" button in the top toolbar.

We wish to make a single-sided board for this simple circuit, so we'll tell the auto-router to use only one side.Right-click in an empty area and select "Global Autoroute>Select layer pair". In the dialog, select "Copper" for bothTop Layer and Bottom Layer, and click OK. (Some people call it the "solder side" instead of the "copper side".)

Now right-click in an empty area and select "Global Autoroute > Autoroute All Modules". Since this is a small circuit,you should soon see a routing similar to the one in the figure below. (For complex circuits or slow machines therouting process can take several minutes.)

<figure>

In addition to autorouting everything at once, you can tell Pcbnew to autoroute a single module, net or pad. Right-click"Autoroute" over a module to route all the nets connected to that module. Right-click "Autoroute net" over a pad toroute the entire net connected to that pad. Right-click "Autoroute pad" over a pad to route a portion of the net, fromthat pad to a nearby neighbor. You can use these to help the autorouter to do a good job by choosing the order in whichnets are routed.

Manual layout

Manual intervention is usually necessary to complete the layout. Often the autorouter does not find a way to routesome of the nets - those unrouted nets are displayed with ratsnest lines. For some of the routed nets, the user will oftenprefer a different routing than the one the autorouter chose.

To fix such problems, you might have to delete some of the routed tracks (particularly ones that "block" importantrouting zones) and either re-run the autorouter, route some of the tracks manually, or some combination of the two.

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

20 di 25 18.09.2010 01:35

Page 21: Mini Tutorial - KiCad

The following figure shows a layout that was redone manually. In order to reduce the risk of short circuits during laterfabrication steps, the manual layout avoids having tracks pass between pairs of IC pins.

<figure>

The following manual-layout techniques will help you complete the layout:

Deleting tracks

From the right-mouse menu you can delete single track pieces. If you want to delete several tracks in succession, it'sfaster to use the "Delete items" tool in the right toolbar (the icon looks like a pencil eraser). Notice the special cursorshape when Delete tool is active. Remember to turn off the Delete tool when you're done (right-click "End Tool", orchoose a different tool from the right toolbar, or just hit the Esc key), so you don't accidentally delete something later.

When using the right-mouse to delete tracks, you can choose to delete either a Segment, a Track, or a Net. A"segment" is a piece of track between two "nodes" (a node is a place where the track can change direction). A "track"is a connected set of segments between two module pads. A "net" is all of the tracks that are associated with a givenschematic net.

Drawing tracks

To draw a new track, use the "Add tracks and vias" tool from the right toolbar. To start a track, left-click on a pad.Extend the track line to the next corner and left-click again to place the corner node. (If the corner does not "stick"when you try to place it, the Design Rule Checker found a problem. A small white arrow shows the interfering object.)Continue extending the track and placing corners as necessary. When you reach the destination point (typically a pad),finish the track by either double-clicking on the destination point, or with right-click "End Track".

While you are drawing a track, Pcbnew highlights all of the items that are supposed to be attached to that net - bothpads and already-placed tracks. It also displays a white ratsnest line from the starting pad to the nearest pad on the net,and yellow airwires to all of the other pads on that net. That helps you see possible destinations for your new track.

The Design Rule Checker will prevent you from connecting a new track to an existing item (track, pad, or via) on adifferent net from the one you're routing. It won't even let you get too close to such an item. ("Too close" is defined by"menubar > Dimensions > Track and Vias > Clearance".) This means you cannot connect things on the board unlessthey are connected on the schematic!

Connect the remaining nets - the DB9 connector pins on the component side of the board. On the real circuit board,which is intended to be single-sided, we'll need to use wires or jumpers for those connections, but we can use Pcbnewto represent those wires as if they were component-side PCB tracks. This will also give us an opportunity to illustratePcbnew's multiple-layer capabilities.

See Also: Manual_Routing_Notes

Two-sided boards

Earlier, we told the autorouter to use only the copper side, and we've been using that side for our manual routing too.Now we want to start using the component side too. There are several different ways to control the layer selection,depending on which tool is active.

With the "Add tracks and vias" tool active, right-click "Select Working Layer" chooses the electrical layer fornew tracks.With the "Add tracks and vias" tool active, right-click "Select layer pair for vias" gives you a dialog similar tothe global autorouter layer dialog, so you can select top and bottom layers for new vias.With the Selection tool active, right-click "Global Autoroute > Select Layer Pair" controls the layers theautorouter uses.With the Selection tool and most of the other tools, right-click "Select Working Layer" controls the layer forsubsequent drawing commands (in addition to electrical layers like copper and component, you can also drawon auxiliary layers like silkscreens and solder masks).

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

21 di 25 18.09.2010 01:35

Page 22: Mini Tutorial - KiCad

Activate the "Add tracks and vias" tool - right-click "Select Layer Pair" and choose Top Layer = Component ,Bottom Layer = Copper.

Connect the DB9 pins. Start drawing a track from one of the MAX232 pins that is supposed to be connected to theDB9 connector. That track should start out on the copper layer. Extend the track toward the DB9 as shown in thefigure below.

<figure>

When you get near the DB9, right-click "Place Via" and then extend the track over to the DB9 connector pin. Noticethat the track switched to the component side after the via. (The board could still be fabricated as single sided, usingjumper wires instead of the component side tracks.)

Repeat the process for the 2 remaining unconnected nets as shown in the figure below. Now that you are drawing onthe component side of the board, you have two options for connecting the remaining tracks:

a) You could start the track at the DB9 connector and move toward the MAX232 part, switching automatically to thecopper side when you place a via, or

b) You could manually switch back to the copper side, then start the track at the MAX232 end. To switch manually,either right-click "Select Working Layer", or choose "copper" from the drop-down list near the right end of the toptoolbar.

<figure>

If you need to move a module to the other side of the board, use right-click "Invert Module". The pads will changecolor, showing you that they are on the other layer, and the drawing will change to its mirror image, consistent with theflip that must occur to put the device "upside down".

Multilayer boards

We've been working with only two layers, but Pcbnew can handle more layers. The menu item "Preferences > GeneralOptions" lets you choose anywhere from 1 to 16 copper layers.

Board outline

Draw the board outline. There's a special "Edges PCB" layer for this purpose. You can select it from the drop-downlist in the top toolbar, or with right-click "Select Working Layer" (but the right-click method won't work if the "Addtracks and vias" tool is active).

There's a feature that's very helpful for drawing board outlines - you can add full-length crosshairs to the cursor. Theymake it much easier to draw rectangular shapes, and also to line up objects. To enable the crosshairs, click on the"Change Cursor Shape" button in the left toolbar.

After selecting the "Edges PCB" layer and turning on crosshairs, choose the "Add graphic line or polygon" tool fromthe right toolbar. Draw a board outline as shown below, closing the figure by double-clicking or right-click "EndDrawing". While you are drawing, note the X,Y coordinate display in the status bar at the bottom of the window. Thatcan help you get the board dimensions right.

<figure>

There are other tools for drawing circles, arc, text, etc. They are useful not only for board outlines, but also fordrawing on auxiliary layers like silkscreens and solder masks. This tutorial does not explore that topic in detail.

Zone Fills

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

22 di 25 18.09.2010 01:35

Page 23: Mini Tutorial - KiCad

A completed board.

An axonometric view of the boardfrom component side.

At this point, we could fabricate the design, but instead we'll do one lastoptimization. We'll fill the open areas on the copper side with a copper zone. Inaddition to the extra electrical grounding, it reduces waste because lesscorrosive liquid ("etchant") is needed to dissolve away the copper. (It alsomake mechanical etching or PCB milling feasible.)

Select the Net to Connect to the Zone If you want the zone to be connected toa net (for example GND), select that net using the Net Highlight tool. You mustfirst wire up the net with traces before filling in the zone, or you will get DRCerrors. If you do not want the zone to be connected to a net, make sure that nonet is currently highlighted (also look in the status bar at the bottom of thewindow).

Activate the "Add zones" tool - click on the "Add zones" tool in the right toolbar. Use the left mouse button to drawa zone boundary, double-clicking to complete the polygon. Then, in an empty area, right-click "Select Working Layer"and choose the copper layer. In an empty area inside the board outline, right-click "Fill zone". You'll get a dialog withseveral options controlling the filling process. Experiment to see how they work. If you don't like the result of a fill,right-click "Delete Zone" and try again. If there are unfilled "islands", you can fill them too by doing the fill operationwith the mouse over those zones.

Two fill results are shown below, with different settings for "Grid" (0.010 and 0.005).

The "Zone Limit" boundary can only be edited using development version later than Jan, 16th 2008. Otherwise, youhave to delete it and start over. This can be tedious if you want to revise your layout. One workaround is to draw aboundary with a track that is not associated with any net. You can draw such a track by turning DRC off. The zone fillwill stop at that track (assuming that it is not highlighted when you perform the fill), and you can later reposition thetrack with the usual track editing commands.

You can look at a 3D representation of the board by selecting "3D Display >3D Display" from the menubar. The 3D Viewer lets you rotate the image to seeit from any angle. The 3D view doesn't show filled zones, because they wouldobscure everything else.

The 3D view always shows tracks and vias; it shows the part packages too ifthe necessary library files are present. The 3D view of this design can be moreelaborate if you copy some 3D components from the author's web site (addressat end).

To change it so you see a socket instead of the MAX232 device, bring up it'sModule Properties dialog (either by double-clicking in an free area over themodule with the Selection tool active, or with right-click "Edit Module"). Selectthe "3D settings" tab. Browse to find the file "soquete_16.wrl". (It will be easier to find your additional 3D shape filesif you place them in the project directory or a subdirectory.)

The 3D view of a device can consist of several different pieces, so you could display both the socket and also the partin the socket. To do that, go into the "3D Settings" dialog as before and this time click on "Add 3D Shape". Browse toselect the shape "dil_16.wrl", and set the Y Offset to 0.1500. That will lift the part picture off the board so it appearsto be in the socket. You could have done this in the other order too - instead of first changing the dil_16 to a socket,you could have just change the dil_16's offset to 0.1500 and then added the socket as the second shape.

You could also use the new capacitor models (c_vert_c1v5.wrl) from the author's web site. It's not a good idea tochange the models in the original KiCad libraries. Instead, put the new models in a separate directory and edit themodule properties to refer to the file in the new directory. The result should look like the following figures.

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

23 di 25 18.09.2010 01:35

Page 24: Mini Tutorial - KiCad

If you use an outside service to make your PCBs, you will need to generate Gerber files describing the layout. Youmay first need to add fiducial marks to your drawing with the "Add Mires" tool in the right toolbar. There's also an"Adjust Offset" tool so you can control the origin for drill and placement files. To make Gerber files, use the Plotcommand (button on top toolbar, or menu item "Files>Plot"). Select the Gerber output format, and set the other optionsaccording to your fab shop's requirements.

If you plan to make the boards yourself, with either the thermal or the photographic method, you should print checkplots on ordinary paper before doing the final plot on the real medium. The check plot can help you get the scale right,compensating for variations in printers. With the author's printer, it was necessary to set the scale factors to 1.03480 tomake the printout dimensionally accurate.

To determine the correct scale factor, measure the size on the check plot of an object of known size, or compare adimension with a corresponding measurement inside Pcbnew. The "Add cotation" tool in the right toolbar can be usefulfor this purpose, and you can also look in the bottom status bar to find accurate cursor positions.

Also check that your components fit properly on the check plot. It can be very embarrassing to discover after you havefabricated a board that you have used the wrong pad layout for a part.

After you have adjusted the scale, you can do the final print. Be sure to select the correct layers before printing!

There are many aspects of KiCad that this tutorial does not address. Information about them may be found in theon-line help. Here is a partial list of such things:

PreferencesLibrary EditingDRC ConfigurationLabelsMulti-section devicesHidden pinsPolar CoordinatesBusesHierarchical (multi-page) drawingsBill of MaterialsCommunication between EeSchema and PcbnewRevising designsSilkscreens and other layersChanging the sizes of various itemsGrid and unit issuesRescuing board designsDevice documentation featurescross-probing between EEschema and Pcbnew

The mini-tutorial was originally written in Portuguese by:

Author: Renie S. Marquet 16/09/2005Analyst of SystemsNiterói -RIO DE JANEIRO - Brazil Hobbysta of electronics:site: http://www.reniemarquet.cjb.netemail: [email protected](check the site's Kicad area for new tips and components)

The original Portuguese version is available from that web site.

The tutorial was converted into HTML and text by several volunteers, and machine-translated from Portuguese into

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

24 di 25 18.09.2010 01:35

Page 25: Mini Tutorial - KiCad

English.

Mitch Bradley paraphrased it into proper English, added Wiki formatting, and added additional explanations.

Dave added figures 22 Mar 2006

Retrieved from "http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial"

This page was last modified 23:20, 5 September 2010.This page has been accessed 73,909 times.Content is available under GNU Free Documentation License 1.2.Privacy policyAbout KiCadDisclaimers

Mini tutorial - KiCad http://kicad.sourceforge.net/wiki/index.php/Mini_tutorial

25 di 25 18.09.2010 01:35