In our previous tutorial, we demonstrated how to set up design rules in KiCad, which included how to create a netlist and how to import it to the board file. Today, we will show you how to place components in KiCad. We will also cover how to define your PCB outline.
Here we have created a circuit that converts and transfers data from USB to controller. FTDI chip is used to convert the differential pair output from USB circuit to 8-bit data, which is fed to the controller. The process is controlled by Atmega328P controller. Circuits are shown below:
The important sections are marked in the above picture,
- USB connector
- Differential pair output connection between USB to FTDI chip
- 8-bit output pins
- Control pins
The controller circuit is shown below:
Let’s now assume that this is the circuit we are working on. Here, you can see a USB connector and a differential pair which is going to this chip. These eight data pins and four control lines here all go to the controller. The controller is powered using a 9V input that is converted to 5V using a regulator. We have already created a netlist using the Generate netlist option. From our netlist, we have imported all the components in the board file.
Watch how to generate a netlist in KiCad!
These are all the components from the schematic. We have set all the rules, such as the track widths and vias we will require. Right now, the grid is set to 50 mils but it should be at 5 mils, which is normally the grid setting when you need to place components in KiCad. Before doing the placement, we need the board outline, so let’s define the edges of the board. Keep the grid at 100 mils so it is easy to draw the outline.
To set up your board, please follow the procedure:
Click on the board setup icon to set your board > a window will pop up > you can configure your text, net classes, tracks, vias and solder mask here.
We have selected a 62-mil thick 4-layer board. Layer 2 is ground, Layer 3 is power, and the top and bottom are signal layers. In Net Classes, we have set the differential pair widths and gaps to 8 mils. There are two types of power: USB power and regulator power. And we have set all the different net tracks over here. We have set the solder mask clearance to zero. We are now good to go with the placement.
Also read: How to Export Gerber and Production Files in Altium Designer
How to draw the board outline
Before we show you how to place components in KiCad, it is necessary to draw the board edge. On the right-hand side, click Add Graphic Lines. Now you can see all the board layers. Select the edge cuts layer. You need to draw the exact board edge that will be cut during manufacturing. So you have selected the edge cuts layer and the grid is at 100 mils. Now click the screen and start drawing. Make sure your line is straight. You now have defined the borders. This will be your actual PCB.
On the right-hand side, click Add Graphic Lines > Select Edge.Cuts from the layers > Draw outline
Now, you need to set the origin on the left bottom of the board. Go to Place, select Grid Origin, and place it at the left bottom corner. The first placement task is placing the mounting holes. There are four mounting holes in this schematic: H1, H2, H3, and H4. Let’s go back to the board to begin the placement.
How to Place Components in KiCad
Mounting Hole Placement
There are two ways to find components. You can press key T on your keyboard and a pop-up will appear. Type your component name or select it from the list. Another way to find your component is to press keys CTRL+S. Type the name and the component will be highlighted. If you want to select it, press key T. You can now put all the components outside of the board to place them one by one.
Press T on your keyboard > Select your component
There are four mounting holes in our schematic: H1, H2, H3, and H4. So these mounting holes will be present among components, we have to search and find it.
Change the grid to 5 mils. Press key M and place the mounting hole in the corner. We are randomly placing this M1 but mounting holes should have fixed locations. And repeat with the three other mounting holes. Once placed, the mounting holes shouldn’t move. Click them and select the footprint option. Now right-click and select Locking and Lock. The mounting hole is fixed. If you try to move it, a pop-up will warn you about the locked item.
To lock your component, right-click on the mounting hole > select Locking > Lock
We will place components one by one to the board. To do that, first, we must put all the components outside of the board. Select and drag all the components out of the board.
You can see there are many connections. If you find it confusing, you can turn off these wires. Go to View, click Show Ratsnest and the wires will disappear. We prefer to keep them as they indicate the connections.
After mounting holes, the next step is to place the connectors. Because connectors should be in a particular direction as per the device design, which cannot be compromised, so we choose the connector next.
The next step is to place the connectors. Always refer to your schematic while you place components in KiCad. This is the 9V Jack connector, which is the J1 connector, and we want to place it first. Let’s go to the board again. Press key T and type J1. Once J1 is selected, press key R if you want to rotate it, and place it. After placing the connectors, it is a best practice to lock them. Right-click, choose Locking and Lock.
Again, always refer to your schematic while you place components in KiCad. You can see that there are capacitors connected to five volts traces.
We have placed these capacitors on the side in schematic so this doesn’t get too congested. These capacitors will be placed at the output of this regulator. And these two capacitors are used as decoupling capacitors for pins, 7 and 20 of the micro-controller. This capacitor will be placed at the output pin of this regulator. And the surge suppressor needs to be placed near to the connector because it is used to suppress any surge voltage coming into the circuit. As you can see, you just have to go with the flow of the schematic.
So as per the schematic surge suppressor (D2) is the next. Now search for D2. Press R to rotate it and place it at the right place.
Let’s now place the capacitor C1, which will be at the input pin of the regulator. Find C1 first, and place the regulator near to this capacitor, or place the regulator first and then place the capacitor near to this pin. Select the regulator first, rotate it and place it here. Now C1. Search C1 and place it close to this pin. You can see this is the input pin of your regulator and we have placed the capacitor close to this pin.
In this way, we have placed the connector-regulator circuit as per the schematic.
This is how you can place components in KiCad, while following the schematic. Remember that you have to keep your power, analog and digital sections separate so they don’t interfere. As you can see, this is the J1 connector, this is the suppressor, this is the capacitor close to this pin. C2 is at the output of the regulator and there is C7 here. This is the electrolytic capacitor and this is C2 which is at the output of the regulator. You can see this flow. The input is coming from here to there, the output is generating from here and is going to this component. There were two capacitors, one near the pins 7 and 20. Place the capacitor close to the input pins. And there is one more capacitor which is placed over here, this is pin 21. You can see this connection, both are the same nets. So these two capacitors are placed close to the pins.
The next step is the placement of the crystal. It is best to place the crystal as close as possible to the micro crystal input pins. These two pins are nothing but crystal input pins, this is the crystal and there are two capacitors. There are two capacitors connected to the 16-megahertz crystal. Those should be close to the crystal. And you can see, there are three more connectors in the circuit. Here you have a connector, a second connector and a third connector.
All of these lines are input-output pins of the regulator. If we connect this pin over here, it won’t be a problem, it will work. But if you connect this over here, then the two connections will overlap each other, and it will create problems while routing. To avoid this, it is recommended to pre-plan your connections so that when you place components in KiCad, it won’t affect your routing.
This is the USB section. These are the three connectors we were talking about: J3, J4, and J5. The USB connector consists of six pins. But the pin number six is common for two pins of the shield of the connector. There are also voltage suppressors for the two differential pair inputs and one is synced to the main supply voltage, Vbus.
These three should be close to this connector so that it doesn’t allow the unwanted voltage to enter into the circuit. And we have these two resistors. This particular connection is important: this is a differential pair working at high-frequency, at around 12 megahertz.
This differential pair should be routed properly, with proper length matching, meaning the skew should be minimum between the two lengths. This is an important parameter to consider while placing. Place it in such a way that this particular point and this particular point are both face to face so that it is easy to rout them.
This is the USB connector, and these two pins are the differential pair inputs. One pin is going over here. This is the surge suppressor, right after the connector. And this is another trace. This is also a suppressor right after the input. And here, this pin is VCC which is also going to my surge suppressor. You need to place the surge suppressors first, and after that, the differential pair so it would be in a straight line. These two lines are going through the surge suppressor to the two resistors.
The next step is to follow the sequence of the supply voltage. Before coming into the circuit, the Vbus needs to go through this surge suppressor. Then, this capacitor should be close to the Vbus before going to the ferrite. After that, we want to place the capacitor C13 over there, and C11 and C10 over there by pins 3 and 26.
This is the capacitor, right after the surge suppressor. It is going to the ferrite bead. And after, it should go to the capacitor. And from there, you can see this particular capacitor over here, which was going to one of the inputs, is going over there. Similarly, this is one capacitor over here, which is placed close to this. And we can figure out two more components over here.
This is a resistor and this is a capacitor. You can see these two points, this is R4 and this is C8. R4 is taking from VCC and is giving to AVCC. But before going to AVCC, it should first pass through C8.
This is a capacitor and this is a resistor. This point is coming through VCC, through this capacitor and into the input of the microcontroller. You need to follow the circuit. Once the placement is finalized and everything is properly maintained as per your requirements, you can start routing.
Sierra Circuits’ KiCad PCB plugin can be accessed within the KiCad design file. The advanced plugin enables you to get your PCB quote quickly without exiting the KiCad UI.
KiCad Design Guide8 Chapters - 98 Pages - 110 Minute Read
- Creating a component symbol library
- Setting up board parameters and rules
- How to route differential pairs
- How to place of components