HOPE Lab 2: Light Sensor Layout

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.

Finding Some Parts

Before you move get to assigning footprints, you should get familiar with real parts and how to find them. Follow this hands-on Digikey search walkthrough.

You will need to show your Digikey cart from this activity for checkoff, so don't skip it!

Footprint Assignment

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 view a quick video tutorial and walkthrough of how to assign footprints, check out the video below. If not, continue forward with the steps.

  1. 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.
"Assign footprints" window

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).

Suggested footprints to use

PCB Layout

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.

  1. Update your PCB from schematic to start off your layout. To do this, open the PCB Editor from either the main window or the schematic editor (second bottom from the right in the toolbar). If this is the first time you are opening the PCB editor you'll likely get a pop-up that asks to configure the global footprint library table; select the recommended option just like when setting up the schematic editor from last time. Click "Update PCB with Change Made to Schematic" in the top toolbar. It looks like this:

Update PCB from Schematic

If you've done everything correctly so far, there should be no errors in the "Update PCB from schematic" window, as shown above.

If the "Update PCB from schematic" button is greyed out, make sure you're opening up your KiCad project from the ".kicad_pro" file. There's also individual files such as ".kicad_sch" but they're not inherently connected to each other so you won't be able to synchronize your schematic and layout.

Now, let's do some basic environment setup before we actually getting started.

  1. For this project at least, make sure that you are set up to use mils. Press the "mil" button in the left sidebar. (What is mils and why is it used for layout? Try searching around online if you're interested)

  2. 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.

  3. Get to the board setup window by clicking on the board setup tool in the top toolbar. It looks like this:

Board Setup
Pre-layout setup

In Board Stackup->Physical Stackup make sure Copper layers is set to 2. (This should be the default). Click OK to close the window

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:

Example of a completed layout (with slightly differing footprints)
  1. 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.
Part placement and orientation (note that the potentiometer footprint differs)
  1. 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.

  2. 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.

Routing Traces

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! You can hide the GND ratnests by going to the Nets tap on the right window, and clicking the eye icon next to GND

  1. Delete track segements by selecting the segment and pressing 'Del'. To delete the full track, select a segment and press 'U' to select the entire track and then press 'Del' to delete. You can also right click for more options.

  2. 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 to connect traces on different layers.

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.

Switching routing to the back side copper
  1. If you find it hard to draw out traces for all the connections, you should try to move and reorient the components themselves.

  2. Now let's define the board outline. Set your grid size to something large, 50 mil+. This will make drawing an outline easier. Add edge cuts for the board. These are the physical boundaries of your board. Select the Edge.Cuts layer and, using the line tool, draw a rectangle that contains all the footprints and traces on your board.

  3. Add a ground plane/ground pour to cover 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. It's also the reason why you don't connect ground with traces above.To do this:

    1. Select the 'F.Cu' (Front Copper) or 'B.Cu' layer and click the Add filled zones icon in the right toolbar. Click on a corner of your board outline. Select GND as the net. Check Constrain to H, V, and 45 degrees and then press OK.
    2. Draw the ground plane polygon. Make sure it follow your Edge Cuts outline. Click your starting point to close the ground pour polygon.
  1. 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!

Lab Checkoff

Make sure you have...

  • Completed schematic from the previous lab

  • Completely routed PCB layout (no remaining ratsnest lines, has ground planes, passes DRC, etc.)

  • Proper board edges defined

  • Reasonable layout

  • Digikey Cart (see Finding Some Parts Section)

Back to HOPE main page