With KiCAD it is possible to easily make your electronics dreams come true. In this tutorial we’ll go through the whole process from an idea to a 3D render of a PCB with the use of KiCAD.
First we’ll need to download KiCAD. I’ll be using version 4.0.5. for Windows (10) for this tutorial. KiCAD is totally free and can be downloaded here.
Making a schematic
After installing and starting KiCAD you’ll see the main workspace.
Most work will happen with the first and third button of the 8 big buttons. Each button represent a seperate program that is used to make the PCB.
Start a new project by pressing CTRL+N or by clicking File > New Project > New Project. Give the project a nice name and after that press the first big button on the left.
A program called Eeschema will start now. In this program we will be making our schematic. You will see a big white canvas with a red border. The schematic will be made within this border. To the right are a few buttons we will be working alot with and to the left are a few buttons we’ll leave alone for now.
We will be making a LED strip with 8 manual selectable LED’s. This is done by a DIP switch, 8 resistors and 8 LED’s. We’ll use a screw terminal as input for the power supply. Ofcourse this is a very easy project but it’s all for you to get used to KiCAD.
First press the place component button or SHIFT+A and click somewhere within the red borders. A new screen will pop up where you will have to pick the component to place in the schematic. All components are stored in libraries. There are libraries for LED’s and resistors etc. The project will have a few default libraries imported already but the one we’ll need for the DIP switch isn’t included in any of them. Therefor we’ll need to import that library ourselves.
Close the component selection screen and go to Preferences > Component Libraries. Press the most upper ‘Add’ button and find switches.lib. Open it and close the component library screen. Now go back to the component selection screen.
Go to switches and select SW_DIP_x08 and press OK. The component will be stuck to your cursor so find a nice spot and drop it there. Congratulations you placed your first component!
Now for the other components:
- 8 Resistors: Type R as filter and choose R. This is a standard resistor schematic symbol. Repeat this another 7 times or press C when hovering over a resister to copy it.
- 8 LED’s: Type in LED as filter and choose LED. This is also a standard schematic symbol for a LED. Do the same as above to get 8 of them.
- Screw terminal: Type in screw as filter and select Screw_Terminal_1x02 from the conn library.
Wire it all up
Now that we have all the components on screen, we’ll have to connect them together. Press the Place Wire button or SHIFT+W and connect them in the following way:
Don’t worry too much about overlapping labels, you can move them by hovering over them and pressing M. You can find the +5V and GND symbols by pressing the Place Power Port button or SHIFT+P.
The schematic is almost done. First we’ll want to give the resistors a value. Do this by hovering over the R of a resistor and press V. A screen will pop up where we can change the R into any value. Let’s do a quick Ohm’s law calculation to find out what value we need:
Calculating the current limiting resistors value for the LED’s
We’ll most likely be using a standard 5mm red LED. These LED’s burn nicely when 20 mA flow through them. Because we probably use an Arduino or other digital output, we’ll be working with a 5V power supply to the LED’s. Now you might think: “We got the amps, we got the voltage… we can calculate the resistance needed!”. That’s not completely true! A LED is a weird thing as it needs at least (about) 2 volts to start working. Therefor we need to subtract 2 volts from the supply voltage. Let’s see:
U = 5-2 = 3 v
I = 20 mA
R = ?
R = U / I = 3 / 20mA = 150 Ohm
Seems like we’ll need to give the resistors a value of 150 Ohm.
Finishing the schematic
When all the resistors have a value we’ll need to number all components so it is easier to refer to them. We luckily don’t have to do this manually! Press the Annotate schematic components button on the top bar. The following screen will popup:
Use the above settings and press Annotate. Before annotating the components you might have noticed that the components said things like R? and D?. When annotating these question marks change into a number.
The last step is to check if there are no bugs in the schematic like unconnected components. Press the Perform electric rules check button . In the new popup press Run.
Two error messages appear and in the schematic there will be an arrow pointing at the places where the error is found. In KiCAD you have to ‘drive’ power pins to make this error go away. To do this go back to the schematic and press the place power port button again. Type pwr_flag as filter and choose PWR_FLAG. Add two of these in the schematic and copy the power ports and connect them in the following way:
Run the Perform electric rules again and see the errors disappear.
Now that we are done with the schematic, it’s time to assign footprints to the components. Footprints contain the solder pads (and silkscreen) that correspond to the physical components. This will be used later when designing the PCB. Press the Run CvB button . It will take a while for the screen to load. The following screen will appear:
In the left column are the available footprint libraries, in the middle are our components in the schematic and to the right are the available parts in the library. Assign components in the following way:
- LEDs (D1 – D8):
- Resistors (R1 – R8):
- Dip switch (SW1):
- Screw terminal (J1):
The screen should look like this now:
Press the save button and go back to the schematic.
Generating the Netlist
By generating the netlist we make a file that the PCB designing software can understand. The netlist contains the information about the footprints and labels to name a few. To make a netlist, press the Generate netlist button on the top bar and then press generate and save the file.
Now it’s time to make the PCB!
Making the PCB
Get back to the mainscreen and press the third big button from the left. PCBNow will open.
You’ll see the same kind of screen as in Eeschema. Our PCB will be made within the red borders. Let’s import the netlist so the program knows what it’s going to work with! Press the Read netlist button in the top bar. The following screen will popup:
Use the same settings and press Read Current Netlist. Open the file we made earlier. If everything went right there won’t be any errors during opening. Press Close and see how all components are dropped on top of eachother. To spread these out press the mode footprint button . Now right click on the components and select Global spread and place > Spread out all footprints. This will evenly spread the components for a better overview.
Arranging the components
Now it’s time to arrange the components in a logical way. Hover over a component and press M to move a component. Try to make the arrangement efficient, aesthetically pleasing and logical. Try to have the gray lines overlap as little as possible. I arranged it like this:
Now it’s time to connect all the components. Press the add tracks and vias button on the right bar and start routing all components by laying tracks between all gray lines. A gray line will disappear when the connection has been made. Don’t route the grounds yet! We’ll use a trick to do that!
For this design the routing is fairly easy but what if gray lines overlap often? We are using a two sided PCB which means we have two layers to work on! To the right is a menu with all the available layers.
As you can see we are working on the F.Cu layer. F means Front and B means Back. You can use the ‘page up’ and ‘page down’ keys to switch between F.Cu en B.Cu. This is very useful cause it grants the ability to go under or over an already laid track like so:
After laying all tracks except the grounds my PCB looks like this:
Now it’s time to magically connect all grounds together. We do this by making a ground plane. Before doing that, we’ll have to define the edges of the PCB. In the layer menu select the Edge.Cuts layer. Now select the Add graphic line or polygon tool on the right sidebar. Draw a nice rectangle or other creative shape around the components but keep in mind to leave a little space when drawing next to the solder pads. My design looks like this:
Maybe I should’ve left more space between the components but for now this will be quite aesthetically pleasing. Now it’s time for the ground plane!
Go back to F.Cu or B.Cu and select the Add filled zone tool and click on any edge of the edge cuts we just made. A screen will popup asking you what plane you want to make.
Select GND in the Net menu and click OK. Now trace the edge cuts and at the end double click to make the plane. Red dashes will appear around the edge cuts. Now right click somewhere on the board and select Fill or refill all zones. The board will magically look professional! Notice how all gray lines are gone and the ground pads have small connections going to them.
The last thing to do now is to look at your PCB in magical 3D! Go to View > 3D Viewer or ALT+3 and the 3D render will pop up!
Noticed any mistakes or have questions? Just leave a comment! Feedback is always welcome.