@@ -164,7 +164,7 @@ Now add a reset button. Suitable value for capacitor is found in the MCU data sh
...
@@ -164,7 +164,7 @@ Now add a reset button. Suitable value for capacitor is found in the MCU data sh
### 13) Power LEDs and test points
### 13) Power LEDs and test points
In order to see that your system is correctly powered and to have easy access to probing your signal lines etc, it is recommended to add test points to your board in form of exposed pads. Preferrably use a pin header footprint for your GND test points however, so you can clip the scope probe's GND alligator clip to it. Provide at least one GND test point for each subcircuit block on your boards. You don't need to stuff them with pins by default during assembly, but it is nice to have the option to add those in when troubleshooting.
In order to see that your system is correctly powered and to have easy access to probing your signal lines etc, it is recommended to add test points to your board in form of exposed pads. Preferably use a pin header footprint for your GND test points however, so you can clip the scope probe's GND alligator clip to it. Provide at least one GND test point for each subcircuit block on your boards. You don't need to stuff them with pins by default during assembly, but it is nice to have the option to add those in when troubleshooting.
It is also recommended you add LEDs to your power rails so you can see they're powered up correctly. You can use an LED such as [this red one](https://www.elfa.se/en/smd-led-645nm-0805-65cd-30ma-kingbright-kptd-2012surck/p/30118951), together with a suitable current limiting resistor. The forward voltage drop of a red LED is around 1.8V, aim for a forward current of about 2mA. You can use this [LED calculator](https://ohmslawcalculator.com/led-resistor-calculator) to calculate suitable resistor values for your LEDs. Use resistor values from the E12 series.
It is also recommended you add LEDs to your power rails so you can see they're powered up correctly. You can use an LED such as [this red one](https://www.elfa.se/en/smd-led-645nm-0805-65cd-30ma-kingbright-kptd-2012surck/p/30118951), together with a suitable current limiting resistor. The forward voltage drop of a red LED is around 1.8V, aim for a forward current of about 2mA. You can use this [LED calculator](https://ohmslawcalculator.com/led-resistor-calculator) to calculate suitable resistor values for your LEDs. Use resistor values from the E12 series.
...
@@ -236,3 +236,128 @@ In Canvas look for Lab1-Review, and submit links to the repositories you have re
...
@@ -236,3 +236,128 @@ In Canvas look for Lab1-Review, and submit links to the repositories you have re
Address the raised issues, and commit your fixes. This is an iterative process, where you help each other coming up with a working solution by leading questions, hints etc. (Just giving the answer directly is not particularly fruitful, its a learning process right.)
Address the raised issues, and commit your fixes. This is an iterative process, where you help each other coming up with a working solution by leading questions, hints etc. (Just giving the answer directly is not particularly fruitful, its a learning process right.)
Once you have addressed all issues, look in Canvas for Lab1-Final, and submit a link to your repository.
Once you have addressed all issues, look in Canvas for Lab1-Final, and submit a link to your repository.
---
## Lab 2 (Layout)
The main topic of this lab is to give you a good understanding on how to place the components on the Printed Circuit Board (PCB) and route the traces.
## Task 2
Read the whole lab instruction before you start.
## 1) Creating a foot-print for the PMW3389DM
Most components come with a ready made KiCad footprint (in either the stock libraries or some 3rd party library, e.g. [snapeda](https://www.snapeda.com)). However, for the PMW3389DM you need to create your own. Check in the [data-sheet](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwiHvuC1trXuAhXFk4sKHfqDA-cQFjAAegQIARAC&url=https%3A%2F%2Fwww.pixart.com%2F_getfs.php%3Ftb%3Dproduct%26id%3D4%26fs%3Dck2_fs_cn&usg=AOvVaw1A1rR533Pt-7EgnVSS-_ch), section 2,3 for detailed geometry. Use the footprint editor (`Edit PCB Footprints`) to make a [footprint](https://forum.kicad.info/t/tutorial-how-to-make-a-footprint-in-kicad-5-1-x-from-scratch/11092).
Set the grid to fit the spacing between the pins (1.78mm/0.070 inch) between pins, so a grid at 0.035 inch works. Notice, the sensor uses a skewed non standard offset between the rows (offset by 0.89mm/0.035 inch). Spacing between rows are 14.48mm/0.570 inch (unfortunately this won't match the grid though).
Once you have made the footprint save it and go back to the schematic and associate the PMW3389 to your newly made footprint.
## 2) Design rules
You will now create a layout for your project. This is where you physically place the components on the PCB and draw the copper traces to connect the components. Before you start placing the components you have to setup some "design rules" for the layout so the manufacturer can make the PCB.
We use Aisler, and their 2-layer "Beautiful Boards" with [specs](https://aisler.net/help/design-rules-and-specifications/specifications). Aisler directly accepts KiCad designs, which is great as we don't need to worry about exporting to other formats (such as Gerber). Moreover, there are ready made templates for setting up your KiCad project to fit their manufacturing process. [KiCad-Templotes](https://github.com/sethhillbrand/kicad_templates)
KiCad uses text files both for storing configuration parameters and your actual design. (Normally its a bad idea to fiddle with machine generated files manually, but they are actually quite readable and fairly easy to understand/navigate.)
- Start KiCad and open your project.
- Open the schematic of the project and generate a netlist-file, see buttons at the top.
- Click on the button ”Run Pcbnew to layout printed circuit board”, (see buttons at the top).
- Make sure that the grid is set to ”mm” and change the grid size to 1,0mm.
- Click on the Read netlist button and select your newly generated netlist-file, click Read Current Netlist.
- Click on the menu File/Board Setup/Design Rules, you should set:
| Requirement | Value |
| -------------------- | ------- |
| Minimum track width | 0,2mm |
| Minimum via diameter | 0,4mm |
| Minimum via drill | 0,3mm |
| Minimum hole to hole | 0,25 mm |
(We don't use micro vias in our designs.)
- Under "Net Classes" we add a new class. Click on the ”Add” button to add a classes named Power, and set the track width to 0,5mm. We want this net to handle more current, hence we use a wider trace.
- Transfer GND, 1.9V, 3.3V and 5V to the (new) Power net class. Now you can close the Board Setup (and return to it later if you want to change some setting).
## 3) Place you components
- Select the layer `Edge.Cuts`, found to the right, and draw a rectangle 40mm x 40mm.
The 40mm x 40mm rectangle is your workspace for this lab. When you are working with your project you need to adopt it to fit into your mouse shell.
You will see that after reading in the netlist, your components are just lumped together so you will need to place your components in the yellow square that you crated earlier.
Rotate and move around the components and try to minimize
the crossed paths of the un-routed lines (gray lines). All components should fit inside the 40mm x 40mm rectangle.
Common practice for placing your components:
- Overall layout: Where you want your connectors, buttons etc. dictates the layout. For now, the USB and PWM3389 is important, later buttons/wheels, additional LEDs etc. need to be carefully considered. Check, e.g., how mice sensors are typically placed relative to the center/hand placement.
- Components are typically designed with layout in mind, consider the orientation/placement to reduce routing complexity. (E.g., inputs are grouped on one edge, outputs on another. Analog pins are grouped allowing to split ground planes etc.)
- Most datasheets will give an example layout for decoupling and interconnects, these are helpful to give an initial idea.
- Place your MCU and it’s decoupling capacitors first. The decoupling capacitors should always be near it’s pins, this is needed to eliminate power-noise to the MCU.
- Place other noise sensitive components, then finally the rest of the components.
Hint! You can uncheck unnecessary layers and just keep ”F/B.Cu”, ”F/B.SilkS” and Edge.Cuts. If you have the schematic window zoomed in next to the layout window, you can see which component you have selected and it will make it easier to know which is what.
## 4) Route the traces
You will now draw where the copper should be placed, red means top layer and green means bottom layer.
- Change the grid size to 0,1mm.
- Click on the button ”Route tracks”.
- Click on a pad you could like to connect, press ”V” if you need to do a via, route your way to the another pad.
- Do this for all gray lines. (Unconnected == 0)
Hint! While having the routing tool selected, right click/Routing options... and change between Shove and Walk around.
No more gray lines?
- Select front copper layer.
- Draw a filled zone in the rectangle, Associate it to the GND net.
- Do the same thing for the back layer.
You have now created two ground planes, one one each side of the PCB. Alternately you may have a power power plane and a ground plane. You may activate to `Show filled areas in zones`, to see where copper will be poured.
Placement and routing is an iterative process, you will likely need to try different options/approaches until you have your final layout.
## 5) Cut-out for the PMW3389DM
The sensor requires a cut-out, look in the data-sheet for exact dimensions. You can use the edge cut layer to make the cut out. Alternatively, you can make the edge cut a part of the footprint (but I have never done that, so not sure how hard it is, [see](https://forum.kicad.info/t/create-a-custom-shape-hole/12646)). Activate to `Show filled areas in zones`, to see verify that you don't pour copper under the the sensor.
## 6) Design Rule Check (DRC)
The Design Rule Check give you warnings if you don’t comply with the Design rules that you previously setup. It will give you warnings on short circuits, clearance issues etc..
- 1 Click on Tools/DRC, see that the options comply to the manufacturers specification.
- 2 Fix errors.
- 3 Repeat point 1 until errors == 0.
---
## First Submission Lab 2
In Canvas look for Lab2-First Submission, and submit a link to your repo there before the deadline.
## Review Lab 2
You will be assigned two repositories to review. Clone the repositories and compare to your solution.
Check each that each of the 6 steps has been correctly conducted, and comment on possible problems with the layout.
Make an issue in each repository that you review with detailed comments to the author/repo owner. Later follow up on those comments and close them when your issues have been addressed to your satisfaction.
In Canvas look for Lab2-Review, and submit links to the repositories you have reviewed before the corresponding deadline.
## Final Lab 2
Address the raised issues.
Once you have addressed all issues, look in Canvas for Lab2-Final, and submit a link to your repository.