# About PCB layout and routing

This section answers general questions about PCB technology. If you’re just beginning to learn about electronics, you might benefit from some of the answers given here.

## What's a footprint? What's a via? What's a track?

You can find a glossary of terms here.

# PCB Tools

This section provides answers about the open-source layout tool “PCB” itself.

## Where can I read about the basics of using pcb?

The pcb manual contains a concise description of the user interface in the section “Getting Started”(version 20060822)

## I found a bug! What can I do about it?

1. Start by reading the pcb bug reporting page.
2. Check, what it needs to reproduce the bug.
3. Ask on the geda-user mailing list if there is a work around, or has been dealt with in the bleading edge version of pcb. Note that you must subscribe to the geda-user e-mail list before you can post to this list.
4. Check, wether the issue is already in the bug tracking system of pcb. If not, file a bug report. Make sure to give every information necessary to reproduce the bug and add the version of pcb that contains the bug.
5. Finally, as with all open source projects, you may flex your programming muscles and try to squish the bug yourself. Please file a patch of the changes you had to make to the BTS of pcb. The patch will be gladly accepted to improve the next release of pcb.

## How can I set the manufacturing rules to use (i.e. drill diameters, trace width/space specs)?

This topic is covered in the documentation available at the PCB website.

# Non-obvious aspects of the GUI

## Auto-pan bugs me. What can I do about it?

- You can tell, whether the screen will auto-pan by looking for little squares at the end of the cross hair cursor.
- Auto-pan can be toggled during move with a right mouse button click.
- Auto-pan speed can be set in `$HOME/.pcb/preferences`

## The delete key sometimes refuses to delete

Probably you try to delete a selected object. In pcb the delete button does not act on the selection, but on the object currently under the mouse. Consequently nothing will be deleted if an object is selected and the mouse hovers at some other place. Bottom line: Just position the mouse over an object and press the delete button. No need to select the object.

However, the Select menu contains an action that lets you delete the current selection. Currently, there is no accel key attached to this action.

Note, for versions younger than summer 2007 this issue is resolved. The delete key acts on selected objects too.

## I try to move an object, but pcb won't let me! What can I do about it?

Most probably the object is locked. To see, wether it indeeed is, select-all-connected-objects from the select menu. Locked objects won’t highlight. Use the lock tool to unlock the object in question. Note, that the lock tool always toggles the lock state of the object you click at. Afterwards an n object report pops up that contains the lock state in the last line.

If you want to remove all locks, you may consider to remove all occurences of the string lock in the *.pcb file with your favorite ascii editor.

# Footprint issues

## How do PCB's footprints work?

PCB supports two entirely separate footprint library mechanisms:

1. The first is referred to as the “oldlib”, “pcblib”, or the “M4 library”. This system uses the macro language M4 to generate footprints on the fly. The M4 library is fairly large. A powerful feature of the m4 library is that an entire family of footprints can quickly be defined by defining an appropriate base macro. Several standard families of footprints exist in pcblib. Starting with the pcb-20070208 snapshot, the entire m4 library is available as “newlib” footprints (see the following paragraph) under the name “pcblib-newlib”.
2. The second footprint library for PCB is called the “newlib”. Newlib footprints are defined using ASCII text files which call out each graphical primitive which makes up an entire footprint. Newlib footprints can either be created graphically using PCB or via any other method which can produce a text file (text editor, awk/perl/ruby script, etc.). The use of a scripting or programming language is especially powerful because you can generate large footprints or families of footprints.

Therefore, during layout, you can use footprints which are distributed with PCB, you can find footprints via a web search, or you can create your own, and put them in a dedicated directory. The pcb manual has complete and up to date documentation for the element file format. Gedasymbols.org has a number of user contributed footprints. A somewhat incomplete but useful tutorial is available on the web at: http://www.brorson.com/gEDA/ (search for the term “newlib”).

## Where can I get pre-drawn footprints for PCB?

Currently, the best place to get footprints (besides in the PCB distribution) is the gEDA Symbols website. John Luciani's website has a large number of footprints and tools. Also, Darrell Harmon provides a nice footprint generating script on his website. You are welcome to contribute to the project and share your footprints. Finally, you can ask on the geda-user list, and somebody might take pity on you and send you a symbol. Note that you must subscribe to the geda-user e-mail list before you can post an e-mail to the geda-user list.

## I want to use PCB to do layout. How do I know what value to use for the footprint attribute?

This question is a common one amongst new gEDA users. Indeed, helping newbies determine the appropriate footprint names lies at the core of the ongoing light vs. heavy symbol debate. In the current, light symbol gEDA/gaf distribution, you need to attach the footprint attribute at the schematic level (i.e. using either gschem or gattrib). The name of the footprint to use depends upon whether you are using the newlib or the M4 library (pcblib).

### Newlib

The newlib stores one footprint per file, and the footprint names used by the newlib are the file names of the footprint files.

There are several ways to determine the newlib footprint names to use:

- You can browse the available footprints by running pcb and opening the footprint library window (available from the menu bar via “Window → library”). Click on the “newlib” library group, and then select a sublibrary to browse its symbols. The name of each footprint appears in the “Elements” window on the right hand side of the footprint library browser. Use the name exactly as it appears in the browser for the footprint attribute in gschem or gattrib.
- The newlib footprints distributed with PCB are stored in the directories under `${PREFIX}/share/pcb/newlib`. (`${PREFIX}` is the install directory you specified when configuring/building PCB.) The name to stick in the “footprint” attribute is the filename of the footprint you wish to use.
  For example, on my machine I installed gEDA with the prefix `/usr/local/geda/`. The 0805 package (for SMT resistors or caps) lives in a file with absolute path
  `/usr/local/geda/share/pcb/newlib/generic_SMD_packages/0805_reflow_solder`
  Therefore, to use this footprint on a component I set its “footprint” attribute to `0805_reflow_solder` using gschem or gattrib.
  Note that if the newlib symbol you want to use lives in a non-standard directory, gsch2pcb needs you to specify a path to that directory, either within your project.rc file (if you use one) or using the `–elements-dir` flag (from the command line).
- Finally, since each new design typically requires you to draw at least a couple of new footprints, it’s likely you will have a local “footprints” directory. As previously, the footprint name to use is the filename you assign to each of your new footprints. Again, don’t forget to add a line to your project.rc file telling gsch2pcb where to find your local footprints. Alternately, you can run gsch2pcb with the `–elements-dir` flag set to point to your local footprint directory.

### M4 library

The M4 library stores the footprints as M4 macros; there are usually several (many) footprints contained in each footprint file. The different footprints in a single file are generally variations on a single pattern (e.g. DIP-8, DIP-14, DIP-16, etc.) The easiest way to find the correct footprint attribute name is by browsing through the “pcblib” library in the PCB library window. The footprint attribute is given in square brackets in the description. Also you can view the list of footprints from pcblib at the gEDA Symbols webpage.

The following m4 libraries have received more attention and improvements than the others:

- ~amp for Amp connectors
- ~amphenol for Amphenol connectors
- ~geda for many diverse parts used in basic design using gEDA (resistors, caps, etc).
- ~bourns for products like trim pots from Bourns
- ~cts for products like resistor packs from CTS
- ~johnstech for Johnstech sockets
- ~minicircuits for Minicircuits specific footprints
- ~panasonic for some Panasonic specific footprints

Finally, for both the newlib and the M4 lib, it is extremely important that you verify that the footprint name you use instantiates *exactly* the footprint you want when you place it in PCB. Therefore, it is critical to inspect the footprint before you use it. You can verify the footprint you want to use by clicking on it in the “footprint library” window, and then placing it onto an empty spot in PCB’s drawing area. Manually inspect the footprint to ensure that it has the correct number of pins/pads, correct dimensions, etc.

Also, once you generate Gerber files, make sure you inspect all footprints instantiated in your Gerbers using gerbv (or an equivalent Gerber viewer) before you send your design out for fabrication.

## What is the recommended way to deal with different footprints for the same sort of device?

For example, an opamp may be DIP8 or SO8. A resistor may be 0603, 0805, 1208, or through-hole. How do I know what package and footprint to use, and how do I manage the choices?

First off, the footprint you should use is a decision for you to make, not your CAD tool. It is up to you to choose your preferred package type/footprint, and then attach the correct footprint attribute to the component in the schematic. Once you have choosen which package (and footprint) you wish to use, then either find an appropriate footprint, or draw one yourself and save it in a local directory.

As far as managing the footprint choices (and indeed the large number of component attributes you are likely to have): Use gattrib. That’s what it’s for.

## How do I draw a new footprint?

Everybody does this a little differently. Some people draw the footprint entirely using PCB. Some people first draw a preliminary footprint in PCB, and then finish it off by hand editing it (e.g. using emacs). Some people write Perl or Python scripts to autogenerate footprints.

- use a text editor. See the manual on footprint creation by Stuart Brorson for the details.
- draw the part in PCB and save as a footprint. See the howto by Karel Kulhavy
- or use a python script by Darrel Harmon for “two pad”, “SOxx”, “tabbed” and QFP” style
- or use a perl script by Stuart Brorson for two pad SMT components
- or use a perl script from John Luciani – can be adapted to DIL, SOxx-Style, QFP, or even circular arrangement of pads.
- or use the web based application dilpad written by DJ Delorie for “SOxx” style footprints.

## How do I edit/change an existing footprint?

You can convert a footprint into a ordinary layout, edit the parts and convert them back to footprint. In the following list the parts in mono space font are actions from the buffer menu.

1. Select element
2. Copy selection to buffer
3. `Break buffer into pieces`
4. `Paste buffer to layout`
5. Do the desired changes
6. Select all objects that belong to the footprint
7. `Copy selection to buffer`
8. `Convert buffer to element`
9. `Paste buffer to layout`
10. Place the mouse over the pads that got rounded during step 4 and press q. This squares off the rounded pad edges.
11. Go over every pad, press n and give a name to the pad
12. Select everything and `copy selection to buffer`
13. `Save buffer as elements to file`. The footprint file will created at the path where pcb was called.

Alternatively, you can use your favorite text editor and edit the source code of the footprint.

## What is the proper way to make a double-sided footprint?

You can use the “onsolder” flag to place pads on the opposite side of the board. You would have something like this for a connector on both sides of the board:

`Pad[-40000 -7000 -40000 7000 2700 2400 3000 “B1” “B1” “square”]`
`Pad[-40000 -7000 -40000 3000 2700 2400 3000 “A1” “A1” “square,onsolder”]`

If you draw the footprint with pcb-GUI and do convert-buffer-to-element, the lines on the second layer become pads with the onsolder flag. Yes, it is the second layer, regardless its name.

## How do I add a footprint library to PCB?

Adding footprint libraries can be done from the GUI:
File –> Preferences –> Library –> FOOTPRINTDIRECTORY
Alternatively you can edit the file `$HOME/.pcb/preferences`. Make sure, no instance of pcb is currently running. Look for the line that starts with “library-newlib”. Don’t forget to include the new directory into either your gsch2pcbrc, or your local gafrc file (if you are using gsch2pcb, that is).

## How do I update a footprint in my layout?

There is no way to automatically replace all instances of a footprint with the new version, yet. But there is a special mode of the buffer-paste tool, that will reduce the amount of clicks for manual replacement.
Use the Window→Library dialog box to manually choose the new footprint. The tool becomes the buffer-paste tool, with the new footprint preloaded. Rotate it if needed with Buffer→Rotate Buffer. Position the new footprint over the old one, and shift-left-mouse-click to replace the old footprint with the new one. Watch out for being 180 degrees off, use ‘o’ to check the rats nest after each placement, and undo if it appears you placed it backwards.

## PCB is not finding my footprints. Why?

The footprint path that PCB uses is defined using the `Pcb.elementPath` variable in the app-defaults file named `PCB`. The path for the `PCB` file is set using the `XAPPLRESDIR` environment variable which is typically set from within the wrapper script named `pcb`.

## Now that I have all of these footprints where do I put them?

I prefer to place all “production-ready” footprints in a single directory that is not in the gEDA/PCB install tree. When a new version of gEDA/PCB comes out I do not make any changes to project files or libraries. If there are newlib footprints in the PCB library that I want to use I copy them to the “production-ready” footprint directory.

Rather than change configuration files to get gsch2pcb to find the footprints I create a wrapper script called `sch2pcb` that contains the footprint path. All users use the same script and access the same production footprints.

To use the `sch2pcb` script that is listed below replace the string `FOOTPRINT_DIR` with your footprint directory:

    #!/bin/bash
    gsch2pcb --elements-dir FOOTPRINT_DIR $@

Or another user’s version:

    #!/bin/bash
    #this script was written by John Luciani
    gsch2pcb --elements-dir /home/user/pcb/footprints/user --use-files $@

Alternatively you can make use of a project file which gsch2pcb reads for its options. For example the file `myproject` could look like this:

    schematics myschematic.sch myschematic2.sch
    elements-dir /myfootprintdir
    output-name mypcb
    skip-m4

The example file searches through `myfootprintdir` for footprints used in `myschematic.sch` and `myschematic2.sch` and creates `mypcb.pcb` skipping m4 style footprints. gsch2pcb is then called with the project file as an option.

    gsch2pcb myproject

## What's this business about flashed pads?

Pads may be “flashed” as opposed to “drawn”. In the old days, the photo plotters had a big wheel with holes called apertures cut in it. The machine would turn the wheel to pick the correct aperture, position the film at the right place relative to the aperture and turn on a light that would shine through the aperture and expose the photo sensitive film behind. A “flashed” pad means that the pad shape and size exactly matched one of the apertures and to make a pad, you’d position the aperture over the pad location and flash the light (like a camera flash). A “drawn” pad by contrast is one where you’d use a small aperture, position it, turn on the light and then draw back and forth until you drew your pad shape. Think of this like taking a marker and coloring in a pad.

Since these aperture wheels were physical things that had to be made, companies would typically have a set aperture list that they’d use for everything so they wouldn’t have to buy a new aperture wheel every time they ordered boards. This is why the older RS274-D (“gerber”) files did not include the aperture list but instead there would be a single aperture file that got used over and over.

Now the plotters I believe are all laser plotters and the concept of flashed vs drawn doesn’t have much bearing on exactly what happens mechanically during photo plotting. Also, there is no problem with changing aperture lists all the time. This is part of why the newer RS274-X format with embedded aperture definitions exists. Still, you’ll see in RS274-X files that some pads are in fact specified as flashed vs drawn.

# Component placement

## How do I rotate a selection (i.e. of more than one item)?

1. Select the items
2. Buffer → Cut selection to buffer
3. Buffer → Rotate buffer 90 deg CCW (or CW)
4. Click anywhere on the board and the selection is pasted on the design again.

Note: Square pads may not clear polygons correctly. Rectangular pads are ok, though. This is a known issue caused by the difficulty to know the reference direction of a square pad.

## How do I rotate objects by an arbitrary angle?

1. Cut the object into the paste buffer.
2. Type ":FreeRotateBuffer(45)". The colon will open the command line. Replace “45” with the angle you want to rotate by.
3. Paste the object back to your board.

Note: For internal reasons, FreeRotateBuffer does not work with exact squares. As workaround use two or more polygons that add to give a square.

## How do I move objects by an arbitrary distance?

1. Let the mouse hover over the object to be moved.
2. Type ":MoveObject(x,y,unit)". The colon will open the command line. Replace “x” and “y” with the desired coordinates and “unit” with either “mm”, or “mil”.
3. Type [return].

If both coordinates are prefixed with a "+", or "-" the move is relative to the current position. Else the object is moved to absolute coordinates.

## How do I move objects to an absolute location?

Use the command “MoveObject()" as described above.

## How do I change the size of a graphical object (such as text, silkscreen lines, etc)?

- Mouse over the object and hit [`s`]. This will increase the size of the object you are mousing over.
- Mouse over the object and hit [`<shift>-S`]. This will decrease the size of the object you are mousing over.

You can alter the increase/decrease quantum using the file → preferences → increments menu.

## How do I put components on both faces in PCB?

There are two ways to do it:

- Pressing the tab key will alternate the active side between the component and solder sides. When you place components, they will go on the active side.
- If you are viewing one side of the board, place a component there and (with the cursor over it) press the [`b`] key (wich means, send the component to the Back side) the component go to the other side of the board.

## I cant't move the components on the other side of the board!

The mouse is only sensitive to components on the active side of the board. This prevents ampbiguities with components placed on both, top and bottom. By default, top side is active and the bottom side is the “far side” whose components are ignored by the mouse. You can swap the roles of the sides to make components on the far side accessible. The key-accels [tab], [shift-tab], [ctrl-tab] and GTK-HID, or ~/.Xdefaults for the Lesstif-HID). Example for such a setting:

    route-styles = Signal,1000,3600,2000,1000:Power,2500,6000,3500,1000:Fat,4000,6000,3500,1000:Skinny,600,2402,1181,600

Be sure, to remove any route-style line in ~/.pcb/preferences . Else, the line in settings will be ignored.

The line tool knows about different modes to deal with transversal connections. The status line on the bottom of the page tells, which mode is in effect:

1. 45° plus vertical/horizontal (status line: “\_”)
2. vertical plus 45° (status line: “_/”)
3. either vertical or 45° (status line: “45”)
4. arbitrary angle (status line: “all”)

The way to access these modes differs among the GUI versions. The current GTK snapshot (v20060288) defaults to “_/” but can be temporarily turned to “\_” with the shift key. You can switch to 45° mode with the slash key “/”. For arbitrary angles, press the period key “.”, or choose “enable all line directions” in the setting menu.

## I got stuck! How do I go back?

The universal undo key [`U`] works even while in the middle of track layout actions. It will remove the last segment but keep the line tool attached to the mouse. So you can immediately go on routing and find a better way.

## How do I move one set of layer tracks to a different layer?

1. Select the tracks. It’s easiest to do this if you shut off everything but that layer first (i.e. silk, pins, other layers, etc).
2. Now set the current layer to be the new layer. Yes, the layer might get displayed; not a problem as you’ve already selected the tracks you want.
3. Press [`shift-M`] to move all the selected tracks to the current layer.

## How do I achieve open vias clear of soldermask

In pcb vias are covered by soldermask by default. You can achieve open vias by setting their clearance value to a proper value. This can be done individually for every object, or collectively for selections of objects.

For individual vias:

1. Turn on the soldermask layer. This will make the k key refer to the soldermask clearance instead of polygon clearance.
2. Position the mouse above the via (mouse cursor will change in recent versions of pcb)
3. Type [`k`] several times until soldermask clearance exceeds the diameter of the via pad. Every strike of the key will increase the clearance by 2 mil. The first strike will let the pad of the via pop through the soldermask color. Yet, the actual clearance is only 2 mil at this point. You can decrease the clearance by using the [`<shift>-K`] key.

For groups of vias:

1. Turn on the solder mask layer.
2. select the all the vias you want to clear from soldermask. You may switch off all the other layers to conveniently collect exclusively the vias.
3. Type [`<ctrl>-K`] key several times. [`<shift>-<ctrl>-K`] will decrease the clearance of all selected objects.

The command interface provides more control over the actual size of the clearance. Type ":" to get the command line window, then type:

    ChangeClearSize(SelectedVias, <delta>)

where `<delta>` is a size given in 1/100 of a mil. Thus the number 3000 corresponds to 30 mil. Simple integers for `<delta>` will set the clearance to this value. If the value is preceded by a minus "-" or a plus "+" the clearance will be decreased or increased. This also works with `SelectedPins`, `SelectedPads`, `SelectedLines`, `SelectedArcs` or even `SelectedObjects`.

## How do I change the soldermask clearance around a hole/pad?

By default holes and pads will be cleared by an amount given in the corresponding footprint file. Sometimes this clearance might not be what your design needs. You can change the clearance on the fly for individual holes and pads just like vias. See the paragraph above for the details. If pad clearance is not compatible with the demands of your pcb-fab you may consider to make local copies of the footprint files and change the clearance accordingly.

## How do I change the size of my tracks?

There are a number of ways to change the size of already laid down tracks:

1. Use [`s`] and [`shift-s`] to increase and decrease the size of the track currenty under the mouse cursor.
2. choose `Select/Change_size_of_selected_objects/Decrement_lines_by_4mil` from the `Select` menu. The actual amount of change can be set in `File/Preferences/Sizes`. This only acts on the tracks. So the selection may contain components, text, vias and the like.
3. Select the tracks to be changed and type `:ChangeSize(SelectedLines,+4,mils)`. The colon gets you to the command line and `ChangeSize()` is the command version of the previously described action. Replace “`+4`” by the amount you want to increase the track size. Use the minus sign to decrease the tracksize. If you omit the sign the command sets the track size to the value given.

## How do I drive a via to connect a track to a ground plane on a different layer?

1. Set the GND plane layer as the active layer.
2. Select the “via” tool.
3. Place the via where you want it to live (left click to place).
4. Now select the “thermal” tool.
5. Left click on the via you just placed.
6. Now change the active layer to your desired routing layer.
7. Select the “line” tool.
8. Route the track on the active layer to or from the via as usual.

## What is the easiest way to create a "thermal via"?

A “thermal via” is not a via with a thermal relief. Rather, it’s a via with no thermal relief punched into polygons on both sides of the board. These vias get filled with solder to help create a large thermal mass to be used as a heat sink. For more info, see Freescale App-Note AN4005.

Here are some suggestions:

- Draw a rectangle to comfortably surround the vias. Then, mouse over the rectangle and hit ‘s’. This will flood the thermal reliefs on the vias. If you want to ever de-solder the part from the back, make sure the pad on the opposite side has the solder resist cleared.
- Just put a normal thermal relief on the via and then shift click on it to cycle through to the one with no relief.

## I want to draw a track between two segments on the same net, but PCB won't let me! Why?

You are likely drawing tracks with auto-DRC on. To connect the two segments, here are some suggestions:

- DRC enforcement uses the ratsnest to determine where a track is allowed to go. Thus, you must have the ratsnest drawn in order to make connections in auto-DRC mode. Otherwise you will not be allowed to connect (or approach) any copper that is not already connected to your net. (If the rat visibility bothers you, you can hide the rats layer – but the rats must exist).
- You should also refresh the rats regularly when drawing. Hit [`o`] to redraw/re-optimize the rats. Make sure a rat is visibly connecting the two pieces of metal you want to connect.
- It is also possible that you will experience this situation when drawing tracks between pins in a connector. In this case, it is possible that your track width violates the clearance requirements of the pin field. Try decreasing the pin-to-metal clearance, or use a narrower track width.
- Sometimes this route-blocking behaviour can come about from an error in your netlist. Don’t end refdes’s with lower case letters - they’re reserved for gates within devices. End with upper case or a digit; the lowercase letters are simply ignored.

## PCB seems to munge my components names and complains that it can't find proper nets for the pins! How come?

Most likely you named them such that pcb believes they are one part. Lower case letters at the end of a refdes are ignored. Thus, the components U2foo and U2bar both look like U2 to pcb. When building the rat nests pcb is will look for nets to U2 that, of course don’t exist. Lower case letters are meant to differentiate slots of a multi-component. E.g. the four opamp symbols of a quad operational amplifier.
Bottom line: Don’t use lower case letters at the end of a refdes, unless you know what you are doing.

## How can I set color and thickness of the rats nests?

You can set the color of the rats in `File - Preference - Colors - Main colors`

There is currently no GUI way to set the rat width, but you can edit your `$HOME/.pcb/preference` file manually. Close all instances of pcb and look for the line that starts with `rat-thickness`.

Values 0..19 are fixed width in screen pixels. Anything larger means PCB units (i.e. 100 means “1 mil”). On zoom, PCB unit rats will scale accordingly.

## Where is that last remaining rat?

Sometimes remaining rats are hard to see, because they have zero length. This will be the case if a via is missing for some reason. You can make them pop into your eye by setting the rat thickness to some big value e.g. 3000 mil. Rat thickness is set in `$HOME/.pcb/preference`.

# Beyond tracks and footprints

## How do I trace a drawing, a print, or another PCB?

See the page http://www.delorie.com/pcb/bg-image.html at DJ Delorie’s PCB HID website.

This is a great way to trace hand-drawn artwork or another PCB, say one you made in software with a proprietary format, which you’d now like to ‘unlock’. Furthermore, you can use the background image as tool for making board revisions or redesigns.

If you don’t like to use PCB confined to the area of the board, i.e. if you want margins around your board, then add them in the GIMP. I like to make a 1.00000 inch margin around the board. When you set your PCB size in PCB, you’ll want to add the margin area. CTRL-M will help you verify the scaling. Also, the time to correct distortions from your scanner, or from your drawing is before you load it, in the GIMP or the like.

## I can't copy component pads in a layout. What gives?

Question: I want to copy a section of my existing layout to another spot.

I can select the existing area. Everything turns pretty blue.

“Buffer”–>“Copy Selection To Buffer” seems to succeed (no complaints).

Then I go to paste the copied area… and all that moves are a couple of traces and some vias. The pads I’ve painstakingly created aren’t copied. What gives!?!?!?

Answer: If the silk layer is off, you can’t copy elements through the paste buffer. Weird, but that’s how it works. Therefore, turn on the silk layer before trying to copy a section of a layout.

## How do I fill areas with copper?

Use rectangles and polygon planes. These items will always avoid vias, pads and pins. Tracks are also avoided, if they have the clear polygons flag set. (menu: Settings/Enable_new_lines_clear_polygons). Since version 20070208 of pcb the resulting polygon will be one contiguous piece. Isolated snippets are removed.

## How can I assign my polygon to a net?

Polygons are not “assigned” to nets, they’re connected to them. Pads are the only carriers of netnames in pcb. This means, you need to design some copper to connect the polygon with a pad. The net of the pad automatically transfers to the polygon.

## How can I connect tracks, pads, or vias to my polygon?

There are different ways to adequately connect different types of objects to a polygon:

- tracks: Set the join flag of the track. You can do this with the [`j`] key, while the mouse hovers above the track. Alternatively you can select the lines and apply the command “SetFlag(selected,join)". For new lines, you can uncheck the new-lines-clear-polygons in the settings menu. The polygon will immediately flow into the track.
- pads: Currently, there is no way to directly connect a polygon to a pad. Draw a track without the join flag from the pad to the polygon. (see above)
- pins and vias: Choose the thermal tool (“THRM”). Select the layer the polygon sits on. Shift-Click on the via to circle through the available styles of the connection.
- polygons: Just define them geometrically overlapping.

## The polygons are shorting my tracks! What can I do about it?

You didn’t have “Enable_new_lines_clear_polygons” checked in the settings menu when you layed down the tracks. Enter “changejoin(selected)” in the command window to toggle this flag for all tracks that are currently selected. The keyboard shortcut to this action is [`shift-j`]. If you want to set or clear the join flag rather than toggle it, you can use the commands “SetFlag(selected, join)” and “ClrFlag(selected, join)". See the SetFlag description in the pcb manual for more details on these commands.

## How do I change polygon clearance?

Press [`k`] to increase the clearence of the object under the cursor. Use [`ctrl-k`] to increase the clearence of selected objects. Add the [`shift`] modifier to decrease the clearence. To change a whole track press [`f`] to find all segments that are connected to the object under the cursor and apply the action “select(connection)”.

The amount of the increment can be configured in the dialog File/Preference/Increments.

## How do I hide the polygons while I edit the layout?

Put the polygons (and rectangles) on a separate layer. Use the preference to make sure, this layer is not in the same group as the tracks. Disable the layer by a click on the corresponding layer button in the main window. After you are finished with the changes, use the preference dialog to let the polygon layer join the layer of the tracks. You will have to save and reload the layout to trigger recalculation of polygons so they are adapted to your edits. Alternatively a restart will recaalculate the polygons too.

## Polygons are making the GUI sluggish. What I can do about it?

Parts of the polygon that are not connected to some net are automatically eliminated. This effectively removes dead copper. While this is desirable for the actual board, it requires calculation of quite extensive algorithms. So it is not necessarily a bug, but a price to be paid for a powerful feature. Still, there is a couple of things you can do to improve the situation:

- Temporarily hide the polygons. (see above)
- Choose “thin draw poly” from the settings menu to display only the outlines of the polygons and disable dead copper removal. In recent versions of gschem, i.e. later than september 2007, you can select through the polygons.
- Make sure, you don’t have redundant polygons defined, which multiply overlay the same area. These polygons won’t display becaus they shade each other. But they demand calculation resources. The best way to check for redundant polygons is to edit the source of your layout with an ascii editor.

## After I defined those ground planes, pcb takes ages to load. How come?

Polygon calculation is potentially an expensive operation in terms of processor cyles. Unless your layout is pretty complex, you most likely have redundant polygons defined. Look into the source of your layout to find and delete unnecessary polygons. If this does not apply, see above for possible measures to ameliorate the situation.

## How do I edit polygons?

There are four basic ways to edit polygon outlines. You can move and delete vertices and you can insert vertices using two techniques. Polygons can be edited equally well in “thin line draw” mode (settings –> enable thin line draw) or in normal mode. Moving a vertex is easily accomplished by un-selecting your polygon and then clicking and dragging that vertex to a new location. To delete a vertex, a corner in your polygon, put your crosshairs over the point and hit ‘delete’ on the keyboard. To insert a vertex, you’ll use the insert tool (’insert’ keystroke). Start by clicking the edge you want to split with a new point. Click and drag a new point into the polygon. A variation on this technique is 1) click to select, followed by 2) click to place new vertex.

(NOTE: Inserting points into polygon will generally work ONLY with “all direction lines” enabled (’settings –> enable all direction lines’). This is because PCB has a powerful 45/90 degree constraints system. If you try to insert new vertices into a polygon that don’t fall onto lines of proper 45 and 90 degree constraints, PCB disallows the action!)

## How do I place vias that connect to a polygon for full thermal dissipation or full shielding integrity?

Often it’s useful to have vias connect completely to a polygon (a field of copper) for heat transfer– the apparent problem is that PCB polygons have only a single “clear pins/vias” flag for the entire polygon (toggled by the [`s`] key). Our goal is to only connect some of the pins/vias to the polygon, but to connect them better than a thermal does. Here are a few ways to do this:

One way, you’ll make an object that’s almost just like a thermal in that it goes between your via and the polygon–the difference is that you’ll actually create an annulus to completely fill the space between the hole and polygon (which because it’s clearance is turned on, is not connected to the pin). This annulus is four arc segments. You can copy these four items to the buffer to create a “zero-clearance thermal tool”. The drawback of this trick is that when you change via size, you’ll also have to modify the size of these filler parts.

The arcs allow you to use this fill trick in tight places by only placing, say two of the four arcs.

Another trick is to make a zero-length line. Take a single line segment and move the end-point on top of the start-point. Now you have a “single point line” (a circle) with the diameter equal to the line thickness. Move to different layers ([`m`] key) as you see fit. Place this object centered on your via to connect it to a polygon.

Power-users may want to keep a small custom library of these parts by saving them as elements. It’s also handy to put these “parts” in one of your PCB buffers so they’re at your fingertips.

You can also add another polygon on-top of the polygon to which you want to connect you vias. You’ll un-set the “clear pins/vias” flag and the vias will be connected to the larger polygon underneath.

## Can polygons be un-masked? (Can a polygon be made bare-copper with no solder mask?)

Currently, there is no way to directly make polgons clear solder mask. The usual workaround is to work with pads.

1. Draw a track in the middle of the desired no solder mask area. Every track will become a pad.
2. Select the tracks
3. Do convert-selection-to-element from the select menu
4. Activate the solder mask layer. The solder mask should keep clear of the tracks
5. Increase the clearance of the pads to match the desired bare copper area. To do this, press [k] while the mouse cursor hovers above the pads.
6. Optionally press q to set the square flag of the pads.

While the pad witdth is limited to 250 mil, clearance can be arbitrary.

## How do I place mounting holes?

Use a footprint for the mounting hole or place a via.

If the pads surrounding the mounting hole need to be electrically connected then you should show the connection in your schematic. Add a symbol for the mounting hole and change its footprint attribute.

My preference is to create PCB footprints for the various types of mounting hardware. I have a variety of silkscreens for various hardware combinations (hex nut, hex nut with washer, etc.) The silkscreen provides a convenient placement reference during PCB layout.

For footprint examples see http://www.luciani.org/geda/pcb/pcb-footprint-list.html#Hardware.

## Why is it possible to make a thermal for pin, but not for a pad?

The reason is that pins usually have sufficient spacing that the plane surrounding them remains intact on all sides and pads usually are so tightly spaced that they do not. Because of this you must manually draw the thermal “fingers” to connect the pad to the ground plane. Be sure that you have the settings such that new lines connect to planes when you draw them. If you need to make several such thermals, spend a little time making the first one just the way you want then copy the fingers to the buffer and paste it where you want the others.

## Can PCB be used to make single layer boards?

It’s all just names when you’re doing single sided. There’s no such thing as a single sided board in pcb - just a double sided board with nothing on one side.

Design for two-sided, but with all the traces on the solder side. If you use the autorouter, turn off all but the bottom layer. This will make the autorouter stick to that layer. If you need wire jumpers, you have two options to let pcb know there is a valid connection: You can draw tracks on top layer similar to a two layer layout. Alternatively you can Create a “jumper” symbol in the schematic and put that in places where you need a jumper. This is likely to be a major pain, but you can enforce dimensions of the jumpers this way if you care.

Single sided boards do not have plated holes, so pad diameter for pins must be greater, usually two to three times the drill size. Some footprints in the default library have very small pads which will be too weak if used for single sided board. Tweak them to your needs and place them in a local library.

When you dump your gerbers, delete the component side one and rename the plated-holes one to unplated-holes. Voila! A single sided board.

## What resources exist to process PCB files using scripts?

One of PCB’s great features is that it uses an easily understood ASCII file format. Therefore, many people use scripts (commonly Perl) to process their boards in various ways. You can use these scripts either as they are, or modify them to suit your own goals. Here are some links to available scripts:

1. John Luciani has a large number of scripts available on his website. Included in his collection are scripts for generating footprints, as well as
2. David Rowe has scripts for updating elements as well as adding/subtracting PCB files from each other on his website.
3. Stuart Brorson wrote a simple script which generates footprints for two terminal SMT passives. A gzipped tarball is available here .
4. The website gedasymbols.org has gathered a collection of footprints, symbols, scripts, and other materials from many different gEDA contributors. The website is organized by contributor, so if you take the time to browse around there, you may find exactly what you are looking for!

## How do I import external vector graphics?

There is a third party open source utility called pstoedit that converts postscript data to pcb format. It is included in most major linux distributions. You can use your favorite vector graphics utility to produce a logo or any kind of fancy layout. Export as eps if you can and make sure that your logo fits into the bounding box (check with a postscript viewer such as ggv). If there is no eps export available, you can produce postscript by printing to a file. In this case you may add a bounding box with ps2epsi. Call pstoedit with the option "`-f pcb`” to produce a valid pcb file that contains the graphics as tracks on layer 1. Load this file to pcb. The graphics will sit somewhere on the lower left of the view port. You may have to zoom out to get it on the screen.

Import of external vector graphics is usefull if an irregular shape of the pcb is required. Use the cut buffer to copy the shape to your actual design.

## Is there a way to import a DXF drawing from mechanical CAD applications?

There is no import filter to directly load a DXF file to pcb. However, the open source application qcad can open DXF files and export them as postscript. The tool pstoedit can turn this postscript file into a format readable by pcb (see above).

## What is the best way to do weird footprints?

Sometimes footprints call for shapes that are difficult to achieve with the restricted graphics GUI of pcb. It may be easier to start with a the vector drawing application inkscape and convert to pcb. In inkscape:

- draw the weird shape with lines. Lines don’t have to be straight.
- save as eps (uncheck “make bounding box around page”)

Convert to pcb format:

- pstoedit -f pcb > footprint.pcb

In pcb do:

- File - load-layout-data-to-buffer
- edit to your needs (lines only, no polygons)
- select the bunch of lines
- copy to buffer ( ctrl-c )
- Buffer - convert-buffer-to-element
- Buffer - save-buffer-elements-to-file

In a text editor:

- add the same pin number to all the lines with search and replace
- save as *.fp at a place where pcb is looking for footprint libraries

## How Do I attach a name to my layout?

You can set the name of the current pcb with `Menu Edit - Edit name of - layout`. This sets the title attribute of the layout. This attribute is used for the export actions. It does not interfere with the file name.

## Is there a way to do multiple instances of a subcircuits?

The GUI provides no way to do similar subcircuits automatically. You can copy groups of tracks and vias. However, you have to place the footprints manually. Deactivate “Auto-enforce-DRC-Clearrance” in the edit menu during placement. Else pcb won’t let you connect the footprints with the copied tracks and vias.

John Luciani wrote a pair of perl scripts that can do better than that. The script sch-matrix places multiple copies of a basic block on the sheet. It increments the numbers and positions of the symbols as needed. The layout script pcb-matrix arranges multiple copies of a sample layout in a matrix way. The result is a matching pair of schematic and layout with a subcircuit repeated multiple times. See Johns website for the details and a download of the scripts.

The pair of scripts was written a few years ago and is not used regularily. They may need to be updated when used with recent versions of pcb. Contribution of bug reports and/or patches are welcome.

# Auto Router

## How do I make the most of the auto router?

1. Turn off visibility of any layers you don’t want the router using.
2. Turn of via visibility if you don’t want it to introduce any new vias.
3. Use only plain rectangles for power/ground planes that you want the router to use. (Use the rectangle tool rather than the polygon tool!)
4. Make at least one connection from any plane you want the router to use to the net you want it to connect to.
5. Draw continuous lines on all routing layers to outline keep-out zones.
6. Use routing styles in the netlist to have per-net routing styles.
7. Set the current routing style for any nets not having a defined route style in the netlist.
8. Disable any nets that you don’t want the autorouter to route – double-click them in the netlist window to add/remove the “*”.
9. Create a fresh rat’s nest. (press the [o]-key)
10. Select “show autorouter trials” in the settings menu if you want to watch what’s happening.
11. Choose “autoroute all rats” in the connection menu.

Note on disabled nets: If you will be manually routing these later not using planes, it is usually better to let the autorouter route them then rip them up yourself afterwards. If you plan to use a ground/power plane manually, consider making it from one or more pure rectangles and letting the autorouter have a go at it.

If you really want to muck with the router because you have a special design, e.g. all through-hole components you can mess with layer directional costs by editing the autoroute.c source file and changing the directional costs in lines 929-940. and try again. Even more mucking about with costs is possible in lines 4540-4569, but it’s probably not such a good idea unless you really just want to experiment.

## How do I force the autorouter to only put traces on a particular layer?

Just unselect the layers you don’t want (usually green and blue) by clicking on the name of the layer. then press autoroute.

## How do I make autorouter leave particular nets alone?

Open up the netlist window. It has options for including or excluding nets from the ratlist. If you use the GTK-HID double-click a route to disable it. Make sure, only the nets you want are enabled. Optimize the rats with key [o]. Do “autoroute all rats”.

## How do I force the autorouter to route only within my pcb outline?

You can have the autorouter work only within a given area by drawing a copper polygon conforming to your board’s boundary and placing it in each layer you’re trying to autoroute. You can also use this trick to autoroute only with small areas. Of course, if you accidentally have a net touching the polygon, all routes will get shorted to that net.

## How do I route power and ground planes with the autorouter?

Connect the polygon that will become your power planes to a net and the autorouter will figure it all out. You may need some trick polygon clearances to get power routing _and_ routing within a board outline.

## The layout produced by the autorouter is inefficient!

This is a technological limitation of the current auto router. It is gridless and uses geometric rectangles only.

## The layout produced by the autorouter is ugly!

Have you tried the various clean-up tools under connects–>optimize routed tracks?

# Gerber files, prints and other I/O issues

## Is is possible to produce output without GUI intervention?

Yes, you can tell pcb on the command line to do an export. All the parameters set in the print dialog can be used in the command line too. Some simple examples:

Gerber files:

    pcb -x gerber --gerberfile BOARD BOARD.pcb

Postscript formated print:

    pcb -x ps --psfile BOARD.ps BOARD.pcb

PNG format:

    pcb -x png --dpi 300 --only-visible --outfile BOARD.png BOARD.pcb

Different output procedures allow for different options. See the output of `pcb --help` for details.

## How do I make a board outline to go with my gerbers to the board maker?

You can add an outline layer to your pcb projects. PCB interprets any layer called ‘outline’ (edit –> edit name of –> active layer) as though it is the absolute edge of the pcb. PCB prints gerber files that rigidly represent this.

You can enter your outline layer thru PCB’s GUI. You just draw the lines of the board outline. You can generate boards of any shape this way.

It’s also possible to edit the native .pcb file format of your layout. I usually use Layer 8 for outlines:

    Layer(8 "outline")
    (
    	Line[x1 y1 x2 y2 1000 2000 0x00000000]
    	Line[x2 y2 x3 y3 1000 2000 0x00000000]
    	Line[x3 y3 x4 y4 1000 2000 0x00000000]
    	Line[x4 y4 x1 y1 1000 2000 0x00000000]
    	Line[<more points go here for non-square boards> 1000 2000 0x00000000]
    )

## Yes, I tried that, but the gerber exporter didn't give me an outline file. Why?

By default, gsch2pcb creates layer groups in a way which prevents your outline layer from being treated properly. So you should remove all the unnecessary layers (i.e, all but your copper layers and silkscreen), then add an outline layer (named `outline`), on which you define your outline. The gerber exporter should then give you the outline gerber file.

## How do I make sure, that the design contains only certain hole sizes?

Some fabs provide lists of standard drill sizes and charge extra if the design contains additional sizes. You can put this list in a “vendor resource file”. This file may also exceptions and specify if the nearest diameter should be chosen, or rounded up to the next size in the list. See the section Vendor-drill-mapping in the pcb manual for the syntax of this file.

Load the file to pcb with Load-Vendor-Resource-File from the main menu. Alternatively, you can use with the command :LoadVendor(drillfile). Substitute “drillfile” with the name of your file.

On load, pcb will substitute drill sizes so that the layout conforms to the list. If you want to apply an already loaded vendor resource file again, you can do Apply-vendor-drill-mapping from the connects menu.

## I'm done with my layout. How should I check my design?

- Run a check of design rules either through the command interface (“DRC()") or from the menu (Connects - Design Rule Checker). You can set the rules in the sizes section of the preference dialog. Results of the check are shown in the log window.

Besides running the DRC checker, it is essential to check your Gerber files. The gEDA Suite includes the program “gerbv” for this task. Here are some things to check/verify:

- Check that all trace widths are the correct size. Also make sure your trace widths and metal-metal separations are above the minimum specified by your PCB vendor.
- Check that all hole diameters are called out at the correct size.
- Check that metal annular rings around holes/vias are large enough. The annular ring is the distance between the hole’s edge and the outer diameter of the metallization. The annular ring must be large enough to accomodate drill location + layer registration + other manufacturing inaccuracy. This information should be available from your PCB fabrication house; they normally publish the minimum annular ring requirements in their manufacturing rules document.
- Check that your antipads (clearance around holes/vias) are large enough. This information should be available from your PCB fabrication house; ask them for their manufacturing rules document.
- Verify that no soldermask or silkscreen overlays a copper pad or through-hole.
- On plane layers, verify that at least some vias connect to it (yes, I have seen a board where the entire ground plane was floating – not done in pcb btw)
- On plane layers, verify that at least some vias _don’t_ connect to it.
- Do a visual sanity check of all layers. Nothing detailed, just does it look approximately like you think it should.
- Are all layers negative/positive as they should be? Note that some fab houses want positive layers only. PCB will automatically create negative Gerbers on outer layer planes with no tracks. If you want an all-plane layer to be output as a positive layer, draw a single track somewhere in an unused part of the plane. This will trigger PCB to render that layer as a positive layer.

# Exporting Other Formats: Raster and PS Files

## What is xy-max in the PNG export dialog box?

It limits the size of the image to NxN pixels, but maintains the aspect ratio. For example, if you set it to 400, a 6000×8000 mil board would yield a 300×400 image, but a 6000×4500 board yeilds a 400×300 image.

# Customization

## I don't like that old-style black background. How can I get a light canvas?

In GTK-HID there is a preference dialog in the file menu. The Colors tab presents a convinient way to set all the colros pcb uses via the standard GTK color chooser. The colors are saved to $HOME/.pcb/preferences on shut down of the application. With Lesstif-HID there is no preference dialog. Colors can be set in `$HOME/.pcb/settings`

## How do I set the default values of the postscript dialog?

You can set the default options of the postscript printing dialog as command line parameters when invoking pcb. Type `pcb –help` for a list of available options. These options can also be set in a file `$HOME/.pcb/settings`. A settings file for a4 paper, no alignment marks, multi page output would contain:

    media = A4
    align-marks = 0
    multi-file = 1

# You didn't answer my question. What other resources exist for PCB information?

http://www.luciani.org/geda/pcb/faq-pcb-footprint.html
http://pcb.sourceforge.net/faq.html
http://pcb.sourceforge.net/pcb-20060822/pcb.html#Top

You can get fast responses from the geda-user email list. If you haven’t found an answer to your question about PCB on this page, or in the other documentation, then post to the list! Note that you must subscribe to the geda-user e-mail list before you can post to the list. The gEDA e-mail lists, and their archives, are at: http://geda.seul.org/mailinglist/index.html