Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

KiCad: Install

Welcome to the rst in a series of tutorials on KiCad, the electronic design automation (EDA) package. This tutorial contains a short overview of KiCad, followed by a section on getting KiCad installed on your Windows or Linux PC.

Overview
The KiCad suite is a group of programs for electronic design automation. It is available for the following operating systems: FreeBSD Linux Most Unix-like operating systems Microsoft Windows family of operating systems

The KiCad program is a project manager that groups various programs and les together to allow for the capture of schematic drawings and layout of PCBs. The package includes: Eeschema - the schematic editor Pcbnew - the PCB editor Cvpcb - to associate schematic components with physical modules (symbols/footprints) Gerbview - to visualise Gerber les

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

Each project will generate a series of les as you progress through the EDA workow. They are grouped together via the project le (*.pro). Files that make up your KiCad project include: *.pro - project le *.sch - schematic le *.brd - printed circuit board le All les are ASCII text. This is useful because it enables you to write scripts to automate mundane tasks.

Installation
Lets get down to installing KiCad on your system. The KiCad home page is located at www.kicad-pcb.org. From the home page you will nd a download link on the right. The download page contains ocial builds for Windows and Linux. There are also ocial distribution packages for various Linux, BSD and Unix-like distributions. Snapshots are available for Mac OSx. This tutorial will focus on binary installations. Building KiCad from source is not hard, but is beyond the scope of this tutorial. Ubuntu KiCad is in the Ubuntu universe repository and can be installed by issuing the following command from the console: sudo apt-get install kicad Fedora KiCad is in the RPM Fusion repository and can be installed by issuing the following command from the console as root: yum install kicad Windows Download the Windows installer from the ocial build on the KiCad download page. Save the executable to the local machine and run it to install KiCad.

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

KiCad: Project Manager


The KiCad (kicad) executable is the project manager of the KiCad suite. It coordinates the EDA workow.

Above is the KiCad version in the Ubuntu 12.04 repository. I am not sure of the version number. The latest stable version is KiCad-2012-01-19. There is a change to the look and feel of KiCad in the development source code repository. The functionality is the same, with a few added tools. Just the look and feel is modernised. Below is the development head version.

I am running the development head version so it may look slightly dierent to what you are running. Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

Project Manager
The project manager lists the project les on the left hand side in a le tree. The right hand panel contains 5 icons which represent the various tools that make up the KiCad suite. Clicking on them launches the associated tool. They are, from left to right: Eeschema - the schematic editor Cvpcb - to associate schematic components with physical modules (symbols/footprints) Pcbnew - the PCB editor Gerbview - to visualise Gerber les Bitmap2Component - to import logos (bitmaps) into Eeschema

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

KiCad: Schematic Capture


Up until now we have been dealing with the periphery of KiCad. We are ready to start our Kicad tutorial in earnest. Your EDA workow begins with schematic capture. This is where you design your circuit or simply capture it, if it is already designed. The design of a circuit is beyond this tutorial. Here we will capture a simple circuit and become familiar with the concept of schematic capture. When you rst launch Eescheem you will get an info message box informing you that no schematic (*.sch) le exists for the project. Press the OK button to continue. Before we begin capture, a quick overview of the toolbars & menus.

All toolbars will display a tool-tip if you hover your mouse over them. This will help you identify the correct toolbar item as we progress in the tutorial. The left vertical toolbar contains GUI display properties. The right vertical toolbar is used to manipulate the schematic. The top horizontal toolbar has a number of functions which I will discuss as we get to them. We are going to capture a very simple circuit. It will consist of a battery, an LED, a resistor and a switch. In the next tutorial, Component Design, we will move on to a more advanced circuit, that includes a used dened component. A quick word on terminology. In KiCad, the symbol you place on a schematic is called a component. The physical footprint of that component that you place on a PCB is called a module. Below is the circuit we are going to capture.

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

Placing Components Towards the top of the right hand toolbar is a Place a component button. Hover over the icons to nd the correct one. When the tool is selected, it will be highlighted. Move the cursor over the page and left mouse click. The Component Selection dialog will appear. To start with we are going to use the Select by Browser option. When you become familiar with component names, there are quicker ways to do this. But for now we will take the long way around.

In the Component Selection dialog click on the Select by Browser button. This will bring up the Library Browser.

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

The Library Browser shows the libraries in the far left list. Next it lists the components from the currently selected library. Finally a symbol for the currently selected component is displayed on the right. You will slowly become familiar with the standard libraries & build a lot of your own libraries. For this tutorial, all used components are going to come out of the device library, which contains discrete. Find the BATTERY component and then click the insert component into schematic button, which is highlighted in the image. Again, hovering over buttons shows their tooltips. Your cursor will now contain the battery symbol. Click somewhere on your schematic to place it. While you are working in the schematic capture you can right click to bring up a context menu at any time. If you do not want to place the currently selected component, right click, while the symbol is active and choose cancel.

To manipulate already placed components, select the pointer icon from the top of the right hand toolbar, hover the mouse over the component and right click to bring Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

up its context menu. You will also see a number of shortcut keys listed to the right of each menu option. For instance, the Delete Component menu option has the word delete to the right of it. To use the shortcut key, hover the pointer over the component and press the shortcut key (no mouse click). To delete the duplicate BATTERY component, hover over it and press the delete key on the keyboard. These shortcut keys are something I nd very useful and for me make KiCad a pleasure to work with compared to other EDA packages that I have used.

Time for you to place a number of components. Remember, they all come from the device library. Place one of each on your schematic, using the Library Browser as discussed. BATTERY SW PUSH LED R

You should end up with something like this. Use the context menu to move the components. If you want to use the shortcut it is M. After you have your components placed we will begin to wire up the circuit.

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

Before we can wire, we need to rotate our BATTERY component. Use the context menu to rotate the component. Choose Orientate Component then Rotate +. You can also use the shortcut key R.

Wiring
To wire your component, you use the Place a Wire button from the right hand toolbar. Once selected, click on a component pin and draw a wire to another component pin. Once you have completed this, you should have our basic circuit completed.

You may have noticed that your component references are values such as BT?, D? & R?, while in the picture they have numbers assigned to them. We need to Annotate our schematic.

Annotation & Netlists


The connection between your schematic & PCB layout is the netlist. A netlist is a le that uniquely identies all the pins of all the components on a schematic and the connections between them. In order to identify the components, they each must have a unique reference. KiCad can automatically assign references to each component in the schematic. On the top toolbar (towards the right) is a button Annotate the Components in the Schematic. Use the tooltips to identify it and click it to bring up the Annotate Schematic dialog.

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

Leave all the defaults and click the Annotation button in the Annotate Schematic dialog. A conrmation dialog will appear. Accept it with OK button. Your schematic components will now all have a unique reference on them. You can now close the Annotate Schematic dialog with the Close button, Final step is to generate the netlist. In a bigger schematic you would rst perform an Electrical Rules Check. That is beyond the scope of this tutorial. I will be covering that at my course at House4Hack and may write a tutorial on it at a later date. On the top toolbar, nd the Generate Netlist button and click it to bring up the Netlist dialog. Leave all the default and click the Netlist button. A Save Netlist File dialog will appear. Again accept the defaults and click the Save button.

A note on the Save Netlist File dialog. It creates a new netlist le, if the le does not exist. It updates the existing le if it does exist. It does not overwrite existing les. This is important to remember. We will be using this feature later on to move between schematic and PCB editing.

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

Wrap Up
Save you work from the le menu. We are done for now. In the next tutorial, we will build a more advanced circuit that will include user dened components. Later we will use the generated netlist le in PCB layout.

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

KiCad: Component Design


In the last tutorial we performed schematic capture on a simple circuit. We are now going to expand on what we learned, creating a more complex schematic which will include components that are not available in the standard component library. We will look at creating our own components. To make the tutorial more tangible, I am going to use the House4Hack aquaponics project as an example. We are going to capture the schematic of the aquaponics controller. Not only will this introduce component creation. It will also introduce the power symbols and demonstrate how to group portions of the schematic into logical blocks. This is the schematic that we are going to capture. The L78M05ACDT-TR linear regulator and the ATTINY85 components do not exist in the standard library. We are going to create them.

Lets get started by adding all the components that do exist to a schematic in a new project. From the KiCad project manager, click File then New from the menu. Choose a suitable location and save the new project as aquaponics.pro. Once that is complete, open Eeschema and add the following components to the schematic. I am using the references from the image above, also providing the standard library name and component name. P1, P3: library=conn, component=CONN 2 P2: library=conn, component=CONN 4 C3, C4: library=device, component=C D1: library=device, component=BRIDGE D2: library=device, component=LED D4: library=device, component=DIODE Q1: library=device, component=NPN

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

R1, R2, R3, R4, R5, RC: library=device, component=R Place the components in the rough position and orientation as seen in the image. To move a component remember the M shortcut key. To rotate the component orientation remember the R shortcut key. Another shortcut key that is useful is the C shortcut key to copy a component. Instead of going back to the Library Browser every time you need to place a resistor, hover over an existing one, press C and then click to place the copy. Remember to have the pointer selected to access the context menu. Once you are complete, you should have something that looks as follows:

Component Creation (new library)


Lets start with a component for the linear regulator. We need to read the datasheet of the new component to identify the component pins. You can nd the datasheet for this regulator on RS components website (L78M05ACDT-TR). Click the PDF link towards the bottom of the page under Product Details.

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

Above is the pinout extracted from that datasheet. The pins have no numbers so how are we going to number our schematic component. If you use a KiCad standard module library module (during PCB creation), then the pinout must correspond. If you are going to make your own module footprint then it does not matter, so long as your custom component, custom module and the datasheet match. Dont worry about it now. Once you have completed this series of tutorials and produced a PCB you will understand. For now, accept that the pinouts are: 1 INPUT, 2 OUTPUT & 3 GROUND. Lets start creating our custom component. In Eeschema, nd the top horizontal toolbar button Library Editor - create and edit components by mousing over the toolbar and looking at the tooltips. Clicking this button will bring up the Component Library Editor: no library selected window.

From the horizontal toolbar in this new window click the Create a new component button. This will bring up the Component Properties dialog.

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

The component must be named. Give it a Component name of L78M05ACDTTR. You can leave the rest of the dialog on its defaults. Press the OK button to continue. If you zoom in you will see the name and a references have been placed in the middle of the page. A quick note on navigating around the page. One of the fastest ways to move around the page is zoom out / zoom in. Use the wheel of your mouse to zoom. When zooming in, you can place the cursor at the point where you want to centre the zoom action. This is far quicker than using the scroll bars to move around. This works in all the tools of the KiCad suite. I normally move the name and reference out of the way and o to the side. You can use the M shortcut key or the right click context menu. Lets add our rst pin to the new component. On the right verticle toolbar nd the Add pins to the component button by hovering the mouse and reading the tooltips. Select the tool and click somewhere in the page. The Pin Properties dialog appears.

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

The pin should be named and numbered. Enter Vin as the name and 1 as the number. The lower right of the dialog will display a preview of what the pin will look like. The small circle on the pin indicates the wire connection point. The name text will appear inside the component outline. Play around with the Orientation dropdown and see this preview change. This rst pin will have Right orientation. Drop down the Electrical type and have a look at the options. The Electrical type of the pin will come from the parts datasheet. It will be used during Electrical Rules Check (ERC) to ensure that you have not made wiring mistakes. Pin 1 is going to be a Power input pin. Leave the remainder of the dialog elds on the defaults and press the OK button. Now left click somewhere on the sheet to place the pin. This component has 3 pins. Follow the steps outlined above to add all the required pins. Use the M shortcut to move the pins around until they match the image below. The pins to add are: Pin 1 Vin : orientation=right, electrical type=Power input Pin 2 Vout : orientation=left, electrical type=Power output Pin 3 GND : orientation=up, electrical type=Power input

If you place a pin with incorrect orientation or want to edit some of its properties, you can get back to the Pin Properties dialog in a number of ways. With the arrow tool selected from the right hand toolbar you can: 1) double click a pin, 2) right click it to bring up the context menu and choose Edit Pin or 3) hover over it and use the E shortcut key. Now draw a rectangle around the component and move the component name and reference. To draw the rectangle, nd the rectangle button on the right hand toolbar entitled Add graphic rectangle to component body. Select it and left mouse click towards the top left of the component. Now move the mouse towards the bottom right of the component. A rectangle will follow. Once at the correct location, left mouse click again to place the rectangle. Finally use the M shortcut to move the component name and reference to the correct location. When you are done, your component should look like the image below.

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

Two steps remain outstanding. We need to save our component into a library and then tell Eeschema to use our new library. For this rst component, we will create a new library (aquaponics.lib). For the second component (ATTINY85) we will add it to the existing aquaponics.lib. Still in the Component Library Editor nd the button on the top toolbar labelled Save current component to new library. Click this and the New Library dialog appears. Rename the library to aquaponics.lib. Make sure you are in the correct directory (project directory) and press the Save button. You will get an information dialog saying that the new library will not be available until it is loaded by Eeschema. Dismiss this with the OK button.

We can now exit the Component Library Editor with the menu File then Quit. Component Library Path EEschema needs to know where to nd libraries that you are using in your schematic. The library we just created is not yet available to EEschema. In EEschema go to the Preferences then Library menu. The following dialog will appear.

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

Press the top Add button. Notice that there are two add buttons. One for component libraries and a second for the library search path. I am not going to deal with search paths in this tutorial but they are pretty simple. Just add a directory to the path where you store your custom libraries. We dont need to do this right now. Once you have clicked the Add library button, the Library les: dialog will appear. Navigate the le system and nd aquaponics.lib which we created in the last step. Finally click the Open button to add the library. Then click the Ok button to dismiss the library preferences dialog.

Component Creation (existing library)


We still need to create the ATTINY85 component. We will create this in an existing library (aquaponics.lib). From Eeschema select the Library Editor: create and edit component toolbar button from the top toolbar. It may open with our previously create L78M05ACDT-TR component in it. From the Component Library Editor window, nd the top toolbar button labelled Select working Library. Clicking it brings up the Select library dialog. Navigate this dialog and nd the aquaponics library and click OK to dismiss the dialog.

Now nd the top toolbar button Create a new component. Click it and name the new component ATTINY85. Move the name and reference o to the side. The Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

ATTINY85 is an 8 pin device. Add the 8 pins required. Arrange the pins and place a rectangle around the component. Move the name and reference to the appropriate locations. The pins to add are as follows: Pin Pin Pin Pin Pin Pin Pin Pin Pin 1 2 3 4 5 6 7 8 5 PB5 : orientation=right, electrical type=bidirectional PB4 : orientation=right, electrical type=bidirectional PB3 : orientation=right, electrical type=bidirectional GND : orientation=right, electrical type=Power input PB0/MOSI : orientation=right, electrical type=bidirectional PB1/MISO : orientation=right, electrical type=bidirectional PB2/SCK : orientation=right, electrical type=bidirectional VCC : orientation=right, electrical type=Power input PB0/MOSI : orientation=right, electrical type=bidirectional

When you are done, you should have something that looks like the image below. To save the new component into the current library choose the Save current library to disk button from the top toolbar. You will get a couple of conrmation dialogs. Include last component changes? & Modify library le aquaponics.lib? Accept them both with Yes.

You can now close the Component Library Editor.

Finishing Our Schematic


Now that we have created our two needed components, we can place them on the schematic and wire everything up. Remember that the ATTINY85 & the L78M05ACDT-TR will be found in the aquaponics library. Once you have wired everything up, your schematic should look like the image below.

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

Named Nets (Labels) Before we go on to placing power components, I want to explain named nets or labels. Wires on the schematic do not need to be physically connected in order for them to be logical connected. Obviously, if they are physically connected, then they are logically connected. The wires, are referred to as nets. In an earlier tutorial, we created a net list. The net list uniquely identies every component/pin and the connections between them. In that tutorial we Annotated our schematic. That gave every component a unique reference. Every net that is generated also has a unique name. If you have not supplied a name for a net, a randomly generated, unique name is assigned to the net.

The image above contains three explicitly labelled nets. Pin 7, 6 & 5 of the ATTINY85 are logically joined to pins 1, 2 & 3 of the connector even though they are not physically joined. When drawing a wire, you can right mouse click at any point to bring up the context menu. From the context menu you can choose Wire End to end the wire without connecting it to another component. This results in an unconnected net. You must Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

now explicitly name the net in order to connect it. The net names in the image are explicitly set to SCK, MISO and MOSI respectively. On the right hand toolbar nd the button Place a net name (local label). Select it and left mouse click the schematic to bring up the Label Properties dialog box.

Provide a name for the net in the Text eld. You can change the Orientation as needed. Dismiss the dialog with the OK button. Your cursor will now have the newly created net name attached to it. You will notice a small black square at the start of the net name. You will also notice a small green square at the end of the unconnected net (wire) that you created earlier. Left mouse click the the small green square of the unconnected net to assign the net name to it. If you want to edit the properties of an already placed label (perhaps its orientation is wrong), you can do it in a number of ways. With the pointer tool selected from the right hand toolbar: 1) double left click the label, 2) right click the label and choose Edit label or 3) hover over the label and use the E shortcut code.

Power Components
Power components are special components within Eeschema. While you can actually place them with the Place a component toolbar button on the right hand toolbar, a quicker way to add them is via the Place a power port on the same toolbar. All power components have explicitly named nets. For example, if you place a ground component its net name is GND. A VCC power component has the net name VCC. This means that the power components do not need to be physically connected in order to be logically connected. Lets add the remaining power items to the schematic. We are going to add GND, +6V & +5V components. After that we will add power ags (PWR FLAG). I will explain those shortly. Add GND rst. Select the Place a power port tool from the right hand toolbar. Left click somewhere in the schematic. This will bring up the Component selection dialog.

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

This time there is no Select by Browser button. Instead, click the List all button. This will bring up the Select Component dialog. Navigate the dialog and nd the GND component. Select it and press OK to dismiss the dialog.

The cursor will now have the GND component attached to it. Left mouse click on the schematic to place it. Do the same for +6V, +5V & PWR FLAG. Once you are done your schematic should look like the image below.

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

A quick explanation of power ags. If you design a circuit that includes a known power source component, such as a battery, the Electric rules checker (ERC) can determine where the input power for the circuit is derived from. If you have a header placed, to which you are going to inject external power into the circuit, the ERC cannot determine where the input power will be coming from. The PWR FLAG is a logical component that will not appear on your PCB. It serves the function of telling the ERC where input power is derived from.

Wrap Up
You have almost completed you schematic. You still need to annotate it and then generate a netlist. Do that now. If you forgot how to do that, look back to the previous tutorial (KiCad: Schematic Capture) to refresh your memory. Save your work when you are done. In this tutorial a more complex schematic was captured. Custom components where designed. The concept of named nets was introduced. Power components where explain. Next time we will associate modules (PCB footprints) to our components contained in our netlist. We will also start laying out our PCB.

Copyright c Guy van den Berg 2012 - Creative Commons Attribution Share-Alike 3.0 License - http://creativecommons.org/licenses/by-sa/3.0/

You might also like