In this KiCad activity, we'll be laying out the PCB for the schematic we created last week. Before you get started, if you haven't already done the reading for this week we recommend taking a look here.
What should have been completed so far is the circuit schematic. That is, we have transcribed our circuit's components and their connections into a format that KiCad, and hopefully others, can understand. Now, we need to tell KiCad what each of our parts look like physically on the board. First, we need to assign what each component actually looks like in the real world. Or at least, how they will look on our PCB. These representations are called footprints.
If you'd like to see a quick tutorial and walkthrough of how to assign footprints, check out the video below. If not, continue forward with the steps.
- Go to
Tools → Assign Footprints. Note that it may take a while to open as KiCad loads in all the footprint libraries. We have labeled the different sections of the window from A - E for your ease in following our instructions.
We have some suggested footprints to use for this lab below, but feel free to choose any that you like (so long as it makes sense for the part).
PCB Layout Setup
If you'd like to see a walkthrough of how to layout your PCB, check out the video below. It goes through the entire process of PCB layout. If not, continue forward with the steps.
- Update your PCB from schematic. One way to do it is from the schematic editor:
Tools → Update PCB From Schematic. This should open up the Pcbnew window and a popup window.
If you get the warning: "Cannot update the PCB, because the Schematic Editor is opened in stand-alone mode. In order to create/update PCBs from schematics, you need to launch Kicad shell and create a PCB project.", just open the application Pcbnew in a new window and continue.
If you've done everything correctly so far, there should be no errors in the"Update PCB from schematic" window, as shown above.
Now, let's do some basic environment setup before we actually getting started.
- Make sure that you are using the Modern Toolset. Preferences → Modern Toolset (Accelerated).
- Also make sure that you are set up to use inches. Press the "in" button in the left sidebar. (Why the inferior imperial measurement system? Try searching around online if you're interested)
- Set your grid size to a standard 50 or 25 mil grid. When working with others' designs, using a common grid unit size will help make sure your components and tracks line up with theirs.
Get to the board setup window by
File → Board Setup. Set Preset Layer Groupings to "Two layers, parts on front" in the 'Layers' page (default screen that the Board Setup should open with).
For those with some PCB design experience, feel free to set your design rules such that your board will fall under Bay Area Circuit's Standard Capabilities
Placement and Routing
In the end, we want something that looks like this:
- First step is to move and orient components as you would like them to be on the board. It is recommended to position the op-amp IC first, and to keep the inputs/outputs accessible at board edges. Move components by mousing over them and pressing 'm'. To rotate, type 'r'. Click to place back down.
Finish placing the components on the board. Feel free to place them however you wish, but try to minimize the number of crossing white wires. These wires (called the "ratsnest") indicate intended connections as defined in the schematic.
Try disabling the view of the 'F.Fab' layer by unchecking its checkbox in the 'Layer Manager' window on the right. It will help make things look neater.
Routing: drawing out the physical connections between the components. First, you may want to change your grid size to something smaller, such as 10 mil. You need to route a physical track for each white line you see connecting different pins. Use the 'Highlight Net' tool to easily visualize to-be-made and made connections.
Don't worry too much about GND connections in your routing, and do the other connections first. Take a peek at the next step about ground planes to understand why!
Delete segments by pressing 'Backspace', or use 'Del' to delete the full track, or right click for more options.
You may realize that one layer might not be enough to ensure no overlaps. Use func. key 'Page Down' to switch to the bottom layer. 'Page Up' will return you to the top layer. You can use VIAs (Vertical Interconnect Access), an electrical connection between multiple physical layers in a circuit board to connect traces on different layers. Note that because all the chosen component footprints are through-hole, that is, connected to the board via via like holes, independent vias are (ideally) unnecessary!
Vias are an available by: Pressing 'v' while in trace routing mode (i.e. you're in the middle of routing a trace and want to jump to the other layer) or using the 'add via' button in the right tool panel.
If you find it hard to draw out traces for all the connections, you should try to move and reorient the components themselves.
Feel free to do whichever you want first: ground plane or edge cuts (board outline). Edge cut instructions can be found right after the ground plane instructions.
Add a ground plane/ground pour to this board on both the top and bottom layers. A ground plane is a fill of copper dedicated entirely to the GND net. It is generally a good idea because it makes routing easier and reduces ground noise. To do this:
Set your grid size to something large, 50 mil+. This will make forming a neat pour polygon easier.
Click the 'Add filled zones' icon on the right-hand side toolbar then click on the screen where you want the first corner of your ground plane to be. A settings window should pop up. Select 'F.Cu'/'B.Cu' for Layer and 'GND' for Net. Don't worry about the other settings for now.
Draw the ground plane polygon. Make sure it encompasses all the parts and traces, make extend beyond your edgecuts, if you did them first. It does not hurt at all to go big, the edge cuts will "trim" it neatly for us.
Finish drawing the ground plane by clicking the other four corners of the polygon. Double click on the last corner to close the polygon.
- Repeat the above steps again to make a second ground plane for the other
copper layer ('F.Cu' or 'B.Cu' that you have not yet done).
If you update any other part of your board (add new traces, move a component, etc.), press 'b' to re-fill all filled zones. If you find the filled zones visually impairing, you can unfill with 'ctrl+b' or change how they are viewed. Fill visibility buttons exist on the left toolbar, try to find them!
- Add edge cuts for the board. These are the physical boundaries of your board. Select the 'Edge.Cuts' layer and, using the poly-line tool, draw a rectangle that contains all the footprints and traces on your board. If you already did all the ground planes, make sure that your edge cuts stay within the ground polygons.
Make sure you have...
Completed schematic from the previous lab
Completely routed PCB layout (no remaing ratsnest lines, has ground planes, etc.)
Proper board edges defined