find.c: Fix flag passed to ListStart() in DRCFind().
[geda-pcb/pcjc2.git] / doc / gs / fb-smt.texi
blob45202acc97024aae6c420cbc68bab1b84a01350f
1 @node SMT Blinker
2 @section SMT Blinker
4 The third and final board in the ``first board'' series will teach you
5 about multi-layer boards, vias, and SMT components.  Again, we assume
6 you've done the other two boards, and will not re-explain concepts
7 taught there.  We will be using the same circuit as the last board,
8 but to make things interesting, we will be adding some constraints.
9 The board must be as small as possible, EMI-proof, and able to handle
10 rework.  Ok, I'm making this up, but what it means is that we will be
11 using the smallest components a hobbyist can expect to use, a
12 four-layer board, and more vias than would otherwise be needed.  We do
13 this to give us the opportunity to learn these techniques, without
14 spending undue time due to an overly large schematic.
16 We begin with the same schematic as before.  To assist us in assigning
17 power planes, we need to name the power rails in the schematic.  See
18 the @code{gschem} documentation for details, but what you want is to
19 name the ground net @code{GND} and the power net @code{Vdd}.  Set up a
20 new @code{fb-smt.prj} project file as before.  Use @code{gattrib} to
21 set the footprint attributes as follows:
23 @multitable @columnfractions 0.25 0.15 0.15 0.15
24 @item @tab @b{refdes} @tab @b{footprint} @tab @b{value}
25 @item @tab C1 @tab 0402 @tab 1uF
26 @item @tab J1 @tab pj102.fp @tab PJ102
27 @item @tab LED1 @tab 0402 @tab RED
28 @item @tab R1 @tab 0201 @tab 100k
29 @item @tab R2 @tab 0201 @tab 100k
30 @item @tab R3 @tab 0201 @tab 3.3k
31 @item @tab U1 @tab MSOP8 @tab LMC555CMM
32 @end multitable
34 Run @code{pcb} and set up your blank board.  Put ``component'' and
35 ``component side'' in group 1.  Put ``GND'' in group 2, ``power'' in
36 group 3, and ``solder'' and ``solder side'' in group 4.  Switch to the
37 @mnu{Change} tab, select the solder layer in the main window, and
38 move the solder layer down under the power layer.
40 @img{fb-smt-1}
42 Set the board size to 50 mm by 50 mm.  To set a metric size, use the
43 @mnuuu{View,Grid units,mm} menu option.  Then, the @mnu{Sizes}
44 preference will use millimeters.  Set the DRC values to 0.35 mm (about
45 13.5 mil) for drill and 0.15mm (about 6 mil) for everything else.
46 Save your board, exit @code{pcb}, and run @code{gsch2pcb fb-smt.prj}.
47 Go back to @code{pcb}, import and disperse the new elements, and load
48 the netlist.
50 As before, move the labels out of the way and size them accordingly.
51 You should end up with something like this:
53 @img{fb-smt-2}
55 The final size of our board will be 12.5mm wide by 18 mm high, not
56 much bigger than the power jack.  Start by rotating the power jack to
57 face down, and put its mark at 5.5mm by 7mm.  The LED goes just above
58 it, with R3 to the right of the LED.  The rest of the elements will go
59 on the other side of the board.  Here's how:
61 For each element that needs to go on the other side of the board,
62 place the crosshair over the element and press the @press{B} key
64 @center @image{fb-smt-3} @image{fb-smt-4}
66 The element shows as a light gray because it's now on the ``far side''
67 of the board (Note that one of the layer buttons says @mnu{far side}
68 on it).  You can flip the board over (making the far side the near
69 side, and visa-versa) by pressing the @press{Tab} key.  Since the
70 elements we need to place are on the far side, now, flip the board
71 over.  Note that this is an up-down flip, so the power jack now
72 appears in the lower left corner instead of the upper left.  There are
73 other types of flips you can do by using @press{Shift-Tab} (left-right
74 flip), @press{Ctrl-Tab} (180 degree rotation), or
75 @press{Ctrl-Shift-Tab} (nothing moves, sort of an X-Ray view).
77 Anyway, move the remaining elements around so that they look like
78 this:
80 @img{fb-smt-5}
82 When routing a multi-layer board, I find it best to start with the
83 power and ground planes.  First, resize the board to be 12.5 mm wide
84 by 18 mm high, and flip it so you've viewing the component side (the
85 side with the power jack).  If your version of @code{pcb} does not
86 permit sizes this small (some versions have a one inch minimum, others
87 0.6 inch), save the file, exit @code{pcb}, and edit @code{fb-smt.pcb}
88 in a text editor so that the @code{PCB} line looks like this:
90 @example
91 PCB["" 49213 70866]
92 @end example
94 When you run @code{pcb} again, the board will have the right size.
95 Set your grid to 0.5 mm and make sure it's visible.  There are two
96 ways to create a ``plane layer'', which means a layer that's mostly
97 copper.  Such layers are often used for power and ground planes.  The
98 first way is to use the polygon tool; the second is to use the
99 rectangle tool, which is just a shortcut for the polygon tool.
101 Make the GND layer the current layer and select the POLY tool:
103 @img{fb-smt-6}
105 The polygon tool works by clicking on each corner of the polygon, in
106 sequence.  You complete the polygon by either clicking on your start
107 point again, or by pressing @press{Shift-P}.  We will create a polygon
108 that's 0.5mm away from the board edge.  In these images, we start at
109 the lower left corner and work our way around clockwise.  When we
110 click on the lower left corner again, the polygon is created:
112 @center @image{fb-smt-7} @image{fb-smt-8} @image{fb-smt-9} @image{fb-smt-10} @image{fb-smt-11}
114 In this case, we're just drawing a rectangle, but if you need any
115 other shape, just click on the corners as needed.  As a shortcut, you
116 can create a rectangle with the rectangle tool, which creates
117 rectangle-shaped polygons.  Make the power layer the current layer and
118 select the RECT tool:
120 @img{fb-smt-12}
122 Like the polygon tool, the rectangle tool works by clicking on
123 corners.  However, you only have to click on two diagonally opposite
124 corners, like this:
126 @center @image{fb-smt-13} @image{fb-smt-14}
128 If the color difference is too subtle for you, you can choose other
129 colors through the @mnuu{File,Preferences} menu option.  We will set
130 the GND layer to green and the power layer to red for the remainder of
131 this tutorial.
133 To connect the ground and power planes to their respective nets, we'll
134 use a thermal to connect the power jack's pins to them.  We could also
135 just draw a line from the pin to the polygon, but thermals are better
136 suited to this task.  Select the THRM tool:
138 @img{fb-smt-16}
140 What the thermal tool does is connect (or disconnect) thermal fingers
141 between pins or vias, and the polygons around them.  Each time you
142 click on a pin or via, the thermal fingers are connected to the
143 current layer.  We want to find the pin on the power jack that's
144 connected to ground in the schematic, and connect it to ground on the
145 board.  We use the netlist dialog to do so.  First, optimize the rats
146 net with @press{O} and make the GND layer current.  If the netlist
147 dialog isn't shown, use @mnuu{Window,Netlist} to show it.  Select the
148 GND net and click on @mnu{Find}:
150 @img{fb-smt-17}
152 Notice that one of the pins on the power jack has been highlighted.
153 That's the one that is supposed to be connected to the ground plane.
154 Click on it to create a thermal:
156 @img{fb-smt-18}
158 If you optimize the rats nest again, the rats won't connect to that
159 pin any more, and the other pins and pads that need to connect to the
160 ground plane are now marked with circles, meaning ``these need to be
161 connected to a plane''.  Anyway, make the power plane the current
162 plane, find the VDD net in the netlist and create its thermal on the
163 found power jack pin.  Note that the green GND thermal fingers on the
164 other pin show through the gap in the red power plane - thermals are
165 created on a specific layer, not on all layers.
167 @img{fb-smt-19}
169 If you tried to autoroute the board at this point, it would just
170 connect all those power and ground pins to the power and ground pins
171 on the power jack.  So, we will first tie all the power and ground
172 pins to their planes manually, using vias.  We're doing this mostly to
173 demonstrate how to do it, of course.  The first step is to place the
174 vias.  Select the VIA tool from the left panel:
176 @img{fb-smt-20}
178 Click on the @b{Route Style} button to bring up the route styles
179 dialog, and set @b{Via hole} to 0.4mm and @b{Via size} to 0.8mm.  Also
180 set @b{Line width} to 0.25mm.  Create vias near the pins that are
181 connected to the planes, as such:
183 @img{fb-smt-21}
185 Note that I've shut off the ground and power planes, as well as rat
186 lines, to help you see where the vias should go.  Shut off the GND
187 plane and ``find'' the VDD net again, to highlight which rat circles
188 (and thus their vias) need to connect to the power plane.  Like you
189 did with the power jack's pins, use the thermal tool to connect the
190 relevent vias to the power plane.  Repeat for the GND plane.
192 @center @image{fb-smt-22} @image{fb-smt-23}
194 Now you have to connect the vias to the pins that need them.  For the
195 LED it's easy, that trace goes on the top.  Make the component layer
196 the current layer and use the LINE tool like you've done before to
197 draw a line from the via next to the LED, to the pad on the LED that's
198 connected to VDD.  For the other connections, you'll want to flip the
199 board over, so use the @press{Tab} key to flip the board over, make the
200 solder layer the current layer, and connect the rest of the power/gnd
201 pins to their vias.  If you press @press{O} now, you'll see that all the
202 rat-circles have gone away:
204 @center @image{fb-smt-24} @image{fb-smt-25}
206 The last step is autorouting.  Hide all the power, ground, and silk
207 layers, optimize the rats nest (@press{O}), and run the autorouter,
208 optimizer, and miterer.  Done!  Here's what the board looks like with
209 the ``thin draw polygons'' setting checked, to only draw outlines for
210 the power and ground planes, along with some photo-quality prints:
212 @center @image{fb-smt-26} @image{fb-smt-top} @image{fb-smt-bottom}