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

Is there a way to save the file as an older version?

As new features are added to the file format, older versions of pcb might choke on portions of the layout using the bright new features. To prevent this kind of misbehavior, the pcb file contains a note on the minimum version string for the binary. Older versions of pcb refuse to load a layout saved by a newer pcb binary. This was the case for the addition of holes in polygons in 2010. You need a pcb that was compiled from source later than June 2010 to open these layouts.

Unfortunately, there is no way to save the layout in a way that allows older versions of pcb to read the file. However, if don't use the holes in polygon features, you can just hand-edit the file version header back to 20070407 and open the file with the older pcb binary.

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 bleeding 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, weather 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 bug tracking system. 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 manual.

Non-obvious aspects of the GUI

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

The auto pan feature was removed in September 2011. So install of a more current version might help.

If you use an older version of PCB, you can do this:

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, you can delete the current selection with the backspace key.

I try to move an object, but pcb won't let me!

Most probably the object is locked. Locked objects won't highlight. To see, whether it indeed is, Select all connected objects from the Select menu. Locked footprints are shown with a little L at their diamond shaped insertion mark. 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. Afterward, an 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 instances of the string lock in the *.pcb file with your favorite ascii editor.

A different reason for numb objects is “Only Names” in the settings menu. When checked, the selection tool will exclusively act on text. This is useful with crammed layouts. There is a complementary setting “Lock Names”, too.

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?

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:

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:

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

How do I edit/change an existing footprint?

You can convert a footprint into an ordinary layout, edit the parts and convert them back to footprint. In the following list the parts in bold italic font are actions from the Buffer menu.

  1. Select element
  2. Copy selection to buffer ([ctrl-c]).
  3. Break buffer elements to pieces. Pins become vias and pads become tracks. Unfortunately, some information is lost during the process. Namely, the square flag names of pins and pads. You have to regenerate this information later.
  4. Paste buffer to layout
  5. Do the desired changes. Note, that only vias, tracks and rectangles are allowed. No text, no arcs, no general polygons.
  6. Select all objects that belong to the footprint
  7. Copy selection to buffer ([ctrl-c]). The position of the crosshair will determine the origin of the resulting footprint. The origin will be marked with a little diamond.
  8. Convert buffer to element. This converts vias to pins. Tracks and rectangles get SMD pads.
  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. Place the mouse somewhere where there is no pad or pin and give a name to the symbol.
  13. Move the name to the place where you want the refdes or the value to appear.
  14. Select everything and copy selection to buffer ([ctrl-c])
  15. Save buffer elements to file.

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

How do I move the diamond of a footprint

The origin of a footprint is marked with a little diamond. To move it to some other position relative to the footprint you have to modify all coordinates. This can be done manually with a text editor. If you want to do it from within the GUI, you need to break the footprint into pieces and assemble it again. See above for a detailed checklist. Note, that the position of the diamond is determined by the position of cross hair when copying to the buffer.

Yes, this is tedious. The reason for it is the lack of a real footprint editing mode in pcb. You are invited to write one.

pcb does not save silk when I try to make a footprint

The silk of footprints can only deal with lines and arcs. All the other objects like polygons, rectangles and text are silently omitted during Convert buffer to element. If you need text in footprints you have to literary draw the letters with the line tool.

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 BufferConvert 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 can I achieve pads without paste?

Sometimes, exposed copper should not receive solder paste. A common example is the pads of an edge connector. This can be achieved with the nopaste flag. Currently, there is no GUI way to set the flag. Use a text editor to add this flag to the pads of a footprint.

How do I add a footprint library to PCB?

Adding footprint libraries can be done from the GUI:
FilePreferences…LibraryFOOTPRINTDIRECTORY
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 WindowLibrary 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 BufferRotate 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

Component placement

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

  1. Select the items
  2. BufferCut selection to buffer
  3. BufferRotate 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)?

You can alter the increase/decrease quantum using the FilePreferences…Increments menu. (Note, this setting is currently broken)

How do I put components on both faces in PCB?

There are two ways to do it:

I can'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 ambiguities 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 [ctrl-shift-tab] will do the trick. These accels combine the swap with different vertical and horizontal flips. Specifically:

How do I know, which side a component sits on?

If the component is on the currently far side of the layout, its silk layer is drawn in grey. If unsure, deactivate the far side with the “far side” button, at the bottom of the layer button row. This should remove the silk of all far side components from the view.

How do I define a silkscreen layer for the other side of the board?

Although only one silk layer button is visible in the GUI, silkscreen for both sides is automatically configured. In default view the silk layer button refers to silkscreen on the component side of the board. To place text or lines on solder silk you have to flip the board with the tab key (or shift-tab if you prefer a left-right flip). This is like physically turning the board to the other side. It turns the solder layer on top, and component layer on bottom. Objects on component silk layer will be greyed out. If you draw to silk, lines will always go to the current top silk layer, which is solder now. The same happens to components and their silk screen. Flip the board again to return to default view.

Why text I add to the solder side not reversed?

Add it while the board is flipped (Tab). Just selecting the solder side is insufficient. New text always reads correctly from the side you're looking at.

Is it possible to use an arbitrary grid spacing?

Yes. You can use the command setvalue(grid,value,unit). To do this:

  1. Type ”:SetValue(grid,=x,unit)”. The colon will open the command line. Replace “x” with the desired grid spacing and “unit” with either “mm”, or “mil”.
  2. Type [return].

How do I set the origin in pcb?

The absolute origin is always in the upper left corner of the accessible area. This cannot be set to some other place. However, coordinates of objects can also be given relative to the current grid. In the GTK2 version of pcb coordinates are shown in the upper right corner of the main window. The right pair is the absolute position, while the left pair reflects the position relative to an arbitrary marker. This marker is set to the current position of the mouse by the key sequence [ctrl-m]. You may want to set the marker to a grid point or a specific pin.

How do I measure distances and dimensions of components?

Use [ctrl-m] to set the origin and read the distance of the mouse pointer relative to this point on the upper right of the pcb window. Some objects like vias and tracks yield useful information in object reports. Access the report of the object currently under the mouse pointer with [ctrl-r].

How do I hide rats of specific nets?

In the netlist window, doubleclick on the specific rat name, then press 'o' on your board window. Your rats are hidden for that net. In the Netlist window an asterisk appears in from of the rat name. To reverse: follow the same procedure.

Routing

How do I route a connection from solder to component side and back?

While using the line tool, use the number keys on top of the keyboard to switch layers. A via will be placed automatically at the endpoint of the last complete segment.

How do I change the routing style?

There is a set of predefined sizes for routing. The sets bear suggestive names (Signal, Power, Fat and Skinny). Hit the button “Route Style” to configure the sizes of the current set to your needs. You can set the names and the default values of these parameter sets in a config file ( ~/.pcb/settings for the 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 'All-direction' lines in the Setting menu.

Routing Issues

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 currently under the mouse cursor.
  2. Choose SelectChange size of selected objectsLines -10 mil from the Select menu. The actual amount of change can be set in FilePreferences…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 track size. 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:

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:

PCB won't let me connect to copper that is not connected to anything!

This is a known weakness of the Auto-enforce-DRC mode. In this mode, the line tool will only allow you to connect to copper with the same net as the place where the track started.

There are two ways to connect to unconnected copper, anyway: Obviously, you can temporarily deactivate Auto enforce DRC clearance in the Settings menu. A second way uses the fact that auto-DRC relies on the found flag:

  1. enter the “line” mode ([F2]).
  2. hover the mouse cursor over the unconnected copper.
  3. press [f] to mark it as “found”.
  4. start the line from somewhere else. Both should now be marked with the “found” color and should be connectable.

I want to draw two vias very close to each other, but PCB won't let me!

Unfortunately, older versions of PCB not only prevent you from placing overlapping vias but drop them on load. In December 2010 this overly cautious behavior was fixed. If you really need overlapping vias, you have to install a version of pcb younger than that.

The 2011 version of PCB still won't allow you to place vias so close that their holes overlap. However, it won't complain if you managed to work-around this restriction. E.g. place tiny vias and increase their size afterwards.

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 FilePreferences…ColorsMain colors

There is currently no GUI way to set the rat width, but you can edit your $HOME/.pcb/preferences 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/preferences.

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: SettingsNew lines, arcs 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:

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

You didn't have New lines, arcs 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?

In pcb, the polygon itself has no built-in clearance. It is the tracks, pads and pins that bear this property. This means, you can adjust the clearance individually:

Make sure, the soldermask layer is not active. Else the following will apply to the soldermask rather than to the polygon. Press [k] to increase the clearance of the object under the cursor. Use [ctrl-k] to increase the clearance of selected objects. Add the [shift] modifier to decrease the clearance. 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 FilePreferences…Increments. (Note, this setting is currently ignored)

The above only applies to one object at a time. You can manipulate the clearance of all selected objects with the action ChangeClearSize(Selected,<amount>,<unit>). The parameter <amount> should be a number. A prefixed sign means increment, or decrement. A prefixed = sets the clearance to the following value. The parameter can be mil or mm. If not specified the units will default to the internal unit of 0.01 mil.

In addition, there is a special action that acts only on objects with clearance below a given minimum: MinClearGap(Selected,<amount>,<unit>).

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

Put the polygons (and rectangles) on a separate layer. Use the Preferences… dialog 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 Preferences… 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 recalculate 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:

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

Polygon calculation is potentially an expensive operation in terms of processor cycles. 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 (SettingsThin draw poly) 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'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 polygons 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 width is limited to 250 mil, clearance can be arbitrary.

How can I increase the size of all pins?

This is a two step process. First select the objects you want to manipulate. Then act on the selection:

  1. select all components. You may shut off all layers except silk so the select tool doesn't catch tracks.
  2. from the menu choose SelectChange size of selected objectsPins +10 mil

You may rip off the sub menu at the dashed line to make it stay on the screen for convenient repeated application.

Alternatively, issue the ChangeSize action with the command tool:

ChangeSize(SelectedPins, SIZE)

Replace SIZE with the desired size, given in 1/100 mil. 1mm = 3937. If SIZE is prefixed by ”-” the size is decreased. If the prefix is ”+”, the size is increased. If there is no sign, it is interpreted as an absolute value. Refer to the pcb manual for the syntax of the ChangeSize action.

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 useful 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 the vector drawing application inkscape and convert to pcb. In inkscape:

Convert to pcb format:

In pcb do:

In a text editor:

How Do I attach a name to my layout?

You can set the name of the current pcb with menu EditEdit name oflayout. 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 clearance in the Settings 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 regularly. They may need to be updated when used with recent versions of pcb. Contribution of bug reports and/or patches are welcome.

Can I overlay a bitmap in the background?

There is a special option to put a bitmap graphic in the background of the canvas. The image can be in jpg, png, or ppm format. Use gimp, or any other image manipulation program to make the image look hazy so it does not interfere too much with the actual layout colors. Call PCB like this:

$ pcb --bg-image background.png layout.pcb

The image will be scaled to the size of the canvas. See the howto page by DJ Delorie for a screenshot of pcb with background image.

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 off 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 Auto-route all rats in the Connects 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 Auto-route 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 ConnectsOptimize 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

Encapsulated Postscript:

pcb -x eps --eps-file BOARD.eps

Multi page formated Postscript 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 can I print specific layers only?

In the GUI:

From the command line:

pcb -x eps \
  --layer-stack "outline,top,silk" \
  --as-shown \
  --eps-file "foobar.eps" BOARD.pcb

The layer-stack string can contain a comma separated list of the layers used in the GUI. You have to give the option ”--as-shown”. Else, a default layer stack file will be used. In addition there are a number of tokens that are technically no layers like “pins”, or “invisible”. If you put an unknown token in the layer-stack string, pcb responds with a list of known layer names.

How can I print the bottom side of the board?

From the command line: Add “solderside” to the layer-stack string of the print command. Example:

  pcb -x eps --layer-stack "silk,solderside" \
     --as-shown \
     --eps-file "/tmp/foobar.eps" BOARD.pcb

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

PCB interprets the lines in a layer called ‘outline’ as the absolute edge of the pcb. If no such layer is present, you can either rename a layer (EditEdit name ofactive layer). Or you can add a layer from scratch (FilePreferences…LayersAdd) and rename it accordingly. Note, that the name of this layer is case sensitive.

You can enter your outline thru PCB’s GUI. You just draw the desired outline with the line tool or the arc too. Most fabs will cut the board at the center of the lines. You can generate boards of any shape this way. Arcs, polygons and text in the outline layer also enter the gerber file.

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

PCB will produce a gerber file called $NAME.outline.gbr that exclusively contains the objects in the outline layer.

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 FileLoad vendor resource file. 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.

How many pads are in my layout?

Some board houses ask for the number of SMD pads to help them with their quote. You can use gerbv to extract this pad count from your layout.

  1. export the layout to gerbers
  2. open the file $NAME.frontpaste.gbr with gerbv
  3. choose Gerber codes report from the Analyze menu
  4. The tab “Aperture usage” gives the number of SMD pads.

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

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:

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 yields 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 Preferences… dialog in the File menu. The Colors tab presents a convenient way to set all the colors 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

How do I customize the mouse behavior?

There is no GUI way to modify the mouse behavior. However, you can adapt it to your needs without recompiling. This is how:

  1. locate the file gpcb-menu.res on your box. For lesstif there is a similar file called pcb-menu.res
  2. copy the file to $HOME/.pcb
  3. edit to your needs, save
  4. on start-up, pcb will read this localised copy. This will overwrite whatever settings were made by the system gpcb-menu.res

How do I temporarily change keyboard shortcuts?

The GTK version of pcb includes a neat way to change shortcuts on the fly:

This setting will be reset at the next session of pcb.

How do I permanently change keyboard shortcuts?

Default keyboard shortcuts are defined in files called gpcb-menu.res if you use the default GTK interface. On start-up pcb reads the configuration from a system path, e.g. /usr/local/share or /usr/share/. For permanent change of keyboard shortcuts you can copy the system file to $HOME/.pcb/gpcb-menu.res and edit to your needs. Settings in this file will overwrite the system configuration.

The lesstif interface reads pcb-menu.res files instead.

Can I customize the menu?

The menu is defined in gpcb-menu.res for the GTK-UI. You can place a localized copy in $HOME/.pcb/. See the notes above on configuration of keyboard shortcuts and mouse behavior.

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

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://wiki.geda-project.org/geda:mailinglists.