Make your own free website on Tripod.com
An introduction to designing printed circuit boards (PCBs) with gEDA and PCB

An introduction to designing printed circuit boards (PCBs) with gEDA and PCB

Hobbyist electronics have come home in a major way. A lot of the things that formerly needed to be done professionally can now be done fairly easily in one's own home, with inexpensive tools. One of the things that has opened up for hobbyists is the field of printed circuit board (PCB) design. It used to be that if hobbyists wanted to make their own circuit boards, they had to carefully design a stencil, overlay the stencil on a copper-clad board, and etch the board in a chemical bath in the kitchen sink.

Times sure have changed. Today, not only are there a whole host of PCB fab (fabrication) houses which will professionally custom-manufacture the circuit boards you design at a reasonable cost, there are several inexpensive or free computer programs to help you design those circuit boards. Some companies--most notably Pad2Pad--combine both, allowing you to design your board with their software and then place an order from within the program. There are also some excellent open-source programs to aid in this process.

Most notable among these open-source software packages is gEDA, probably the premiere open-source EDA (Electronics Design Automation) package available. gEDA comes with several tools. The centerpiece of these is gschem, which is the schematic designer (also known as a "schematic capture" program). gEDA is also associated with a host of separately-developed programs, most notably PCB, which (as you might have guessed) is simply a PCB design editor.

You can download gEDA from its homepage at www.geda.seul.org.

You can download PCB from its homepage at pcb.sf.net.

Although these tools use a standard GUI interface, they can still be somewhat challenging to use, especially if you've never designed a PCB before. This page endeavors to introduce the reader to the process of designing PCBs with gEDA and PCB. Although the information here is intended for people new to PCB design, it will also be useful for experienced PCB designers who are new to the gEDA and PCB programs.

(Note that after making this page, I discovered an alternative to gEDA: KiCad is also an open-source package that includes both schematic-capture and PCB-layout software, and it comes with both Windows and Linux release versions. It has a reputation as being better than gEDA for those new to the field or who are making relatively small and simple projects, but less appropriate for scaling up to large or "professional" level projects. After sampling both packages, I personally feel like KiCad's interface is a little easier to jump into for those just getting started with the programs, but that's a purely subjective statement, and you should probably test both packages yourself to find out which one works better for your needs.)


Terminology

Before we begin, some definitions of a few key terms associated with the PCB design process are probably appropriate.

component: A part. This can be a resistor, capacitor, chip, or any other piece that is meant to be affixed to a PCB.

pin: A connection point on a component. Although the term originated with DIP chips, which use actual pins, the term can also be used more generally to refer to non-pin-shaped connections on any electronic component.

pad: More specifically, a flat "pin" on a surface-mount component. Also used to refer to areas of exposed copper on a PCB that are meant to have components soldered to them.

net: A group of logical "pins" which are considered to be directly connected to each other. For example, if pin 5 on chip U1 is directly connected to pins 8 and 14 on chip U2, then those three pins, collectively, comprise a net.

netlist: A list of all nets in an electronic design.

footprint: A symbol used to represent the exact size and shape of a physical component.

via: A hole drilled through a PCB. Classically, vias went through a PCB and connected the outer layers, but in today's age of multi-layer PCBs, vias may join inner layers as well. Indeed, some vias do not go all the way through a PCB. These are called "buried" or "blind" vias.

trace: A line of copper on a PCB, used to connect different pins together.

route: Used as a verb, to draw lines which connect pins on a PCB. Used as a noun, a line in a PCB program which will become a trace when the board is manufactured.

rats nest: When a list of components and a netlist are first imported into a PCB design program, the PCB does not yet have any routes defined. As such, the program usually simply draws each net with a thin, straight line extending directly between all connected pins. On a complex design, these lines look incredibly messy, and so they are called the rats nest.

rat line: A line comprising a rats nest, i.e. a line representing a logical net which has not been routed into a physical trace yet.


An overview of the PCB design process flow

Although very simple circuit designs can be designed directly on a PCB, most practical electronic designs today consist of two primary stages: Schematic design, and layout design.

The schematic is a logical diagram of all the components in the design, and the connections between their pins. The schematic simply contains pictures of symbols representing all the components, and lines indicating connections between these components. The shape and direction of these lines will not impact the final product; only where the lines begin and end. However, schematic designers usually strive to keep their lines neat and uncluttered for human-readability purposes. Ultimately, however, the schematic defines nothing more than a list of all the components in the design, and the connections (nets) between those components. Thus, when the schematic design is done, the schematic program exports the design as two key files: The BOM (Bill Of Materials), which simply lists all components in the design, and the netlist.

Once the BOM and netlist files are created, they are imported into a PCB layout program, which defines all the physical ("mechanical") aspects of the PCB, from the size and shape of the board and location of the components down to the routing and thickness of the traces on the board.

There once was a time when schematic design was the better part of electronics design. Choosing what components to use and what pin connected to what other pins was mostly what electronic engineers did all day. PCB layout was something of an afterthought, because in most cases, it didn't matter too terribly much where you placed components or how you connected them, as long as you connected the right pins together. In such times, PCB layout was arguably little more than a game of connect-the-dots.

This certainly has changed. Electronic designers work much less with discrete components like inductors and capacitors and more with integrated circuits (ICs), all-in-one chips which simply present you with an array of pins that you need to design onto a PCB. Although these ICs usually require a handful of supporting components, connecting these up in a schematic is pretty straightforward, as the datasheet (manual) for the IC will usually explain exactly what needs to be connected where. In many cases, you can practically copy-and-paste a schematic from the IC's datasheet directly into your design. These ICs, however, are usually high-speed components, and when electronics start running at high speeds, physical placement on the PCB becomes much more important. It becomes crucial to minimize trace length so that high-speed signals are not adversely impacted by needing to travel long distances, and so it becomes important to place components wisely and route traces carefully in the PCB layout program.

Once the PCB layout process is complete, the PCB is exported into a set of "Gerber" (RS-274-X) files, which is a standard file format that defines the physical characteristics of a PCB and all its layers. With a set of Gerber files prepared, you can send the Gerbers to a PCB fab house, which will provide them with all the information they need to manufacture your boards.


gschem

Navigating the gschem window is fairly straightforward. To zoom in and out, you can use the mouse scroll wheel. If your mouse doesn't have a scroll wheel or you prefer to use the keyboard, you can press Z to zoom in and SHIFT-Z to zoom out.

In gschem, all parts are called "symbols".
Each symbol is defined in its own file.
Symbol files have a .sym extension.
For example, the symbol file for the 7805 (3-pin 5-volt positive DC regulator, a common power regulator IC) is called lm7805-1.sym.

Schematics (like the ones you'll create) have a .sch extension. For example, if you made a power supply, you might save the file as PowerSupply.sch.

Press i in gschem to add a component.

Once placed, you can rotate the selected component(s) around the mouse cursor by typing er. You can also mirror (flip) components by typing ei.

Draw connections ("nets") by pressing n and then clicking whatever you want to connect. Once you're done placing nets and want to go back to the basic select mode, you can do so by pressing s.

Although you can happily create schematics in gschem without having to worry about components' footprints, when it comes time to actually make your PCB layout, you'll need to specify a footprint for each component in the schematic, or else those components without a footprint will simply be dropped from the layout file. So if you're planning on turning this schematic into an actual PCB, you'll need to know how to assign footprints to each part.

To create a footprint for a part in gschem, select the component with the left mouse button, then right-click on it and select "Edit..." This will pop up an "Edit Attributes" window. The lower half of this window allows you to add attributes to parts. Select "footprint" as the attribute to add and type a footprint name in the "Value" field.

PCB has a library of several common footprints and will recognize the following standard SMT sizes as footprint names:

0201
0402
0603
0805
1008
1206
1210
1806
1825
2706

For your reference, the following are also some common footprints you might use which PCB recognizes, along with brief descriptions:

DIP20 (20-pin DIP chip)
DIP40 (40-pin DIP chip)
JUMPER1 to JUMPER12 (1-pin to 12-pin single-row headers)
SIP1 to SIP13 (SIPs)

The link from gschem to PCB

gsch2pcb

When you're done creating your schematic, you'll want to convert it into a PCB file so that PCB can load it. gEDA helpfully supplies a utility for this very purpose called gsch2pcb. This utility can be downloaded as part of gEDA's "utils" package.

The syntax for gsch2pcb is ultra-simple:

gsch2pcb foo.sch

This will process a schematic file called foo.sch and generate two files called foo.pcb and foo.net. The former is the PCB file, while the latter is a netlist.

gnetlist

gnetlist is a netlist generator, but it can also be used to create a BOM (Bill Of Materials), which is simply a list of all the components in the schematic design.

gnetlist can also do some amount of DRC (Design Rules Checking), which basically means automatically checking your schematic design against several pre-defined rules to ensure that there are no errors or design problems in the schematic. This will help you ensure that the schematic is sound and ready to use before you start importing it into your PCB layout program.


PCB

Layout files in PCB have (amazingly enough) a .pcb extension. So, a power supply PCB might be called PowerSupply.pcb.

You can load .pcb files using the "Load layout" command on the File menu. You can also load accompanying netlist files using the "Load netlist file" command from the File menu.

Unfortunately, PCB does not currently seem to support ECO (Engineering Change Order) files, which are analogous to "patch" files in the software world: They are small files which contain a list of fixes that need to be applied to an existing PCB file.

As in gschem, PCB allows you to zoom in and out with the mouse scroll wheel, or with the keyboard using Z and SHIFT-Z.

Components

You can view and browse PCB's fairly extensive library of available footprints by opening up the Library window. You can do this by either going to the Window menu and choosing Library, or simply by pressing i.

You can place components on your PCB by simply clicking on the component in the Library window. Once this is done, you can click within the PCB window to place the component. However, unless you are building the PCB from scratch in the PCB program, you should probably not do this. In a real-world design flow, all components should be added in the schematic editor, and the resultant parts list should be imported into the layout editor; you should not add components in the layout editor, as this would change the original schematic.

You can drag components around in PCB with the left mouse button as long as the SEL (select) tool is selected. (Activate the select tool by clicking on it, or by pressing F11 or SPACEBAR on the keyboard.) You can drag the entire window's contents around with the right mouse button.

You can position components to exact X,Y coordinates using the MoveObject command, which will act upon the object underneath the mouse cursor. To do this, type the following in the PCB window:

:MoveObject(X,Y)

...Where X and Y are, of course, the coordinates of where you want to move the object to. (PCB uses a colon to invoke the typed-command line.)

You can see information about a component, including its current X,Y position, by using the "Generate object report" command, which can be invoked from the Info menu or by pressing CTRL-R. This will also show dimension information for the component. However, PCB does not currently seem to support auto-dimensioning to create dimension lines on an annotative PCB layer.

You can search for components by going to the Select menu, pointing to "Select by name", and then choosing "All objects". If you type a component name in the resultant dialog box, PCB will highlight the component whose reference designator you typed.

You can also search for nets with the Net command, using the following syntax:

:Net(Find,netname)

...Where netname is the name of the net you want to highlight.

You can create new footprints in PCB by simply drawing the object you want to create in the main PCB window, then going to the Buffer menu and choosing "Cut selection to buffer," then clicking on the component, going back to the Buffer menu, and choosing "Save buffer elements to file".

Board definition

You can edit the layer definitions of the PCB, perhaps somewhat confusingly, by going to the File menu and choosing Preferences. The resultant dialog box doesn't actually edit the PCB program's general preferences; rather, it allows you to edit specific properties of the PCB you're currently editing, including the layer definitions in the "Layers" section and the actual size of the PCB in the "Sizes" section.

Note that, also somewhat confusingly, PCB refers to actual physical layers on the board with the terminology "layer groups," while the "layers" that appear in PCB are simply logical groupings of different objects visible in the program. For example, by default, there are "layers" called "solder", "GND-sldr", and "Vcc-sldr" in one layer group, which are all supposed to be part of the solder side of the board. These three in-program layers exist to allow you to color-code your traces (obviously, one's for Vcc power traces, one's for ground traces, and the other is for all other traces), but these three in-program layers all correspond to a single physical layer on the manufactured board.

Currently, PCB only seems to support rectangular boards; you cannot draw a polygon and have it be the PCB outline.

Drawing rat lines and traces

Once you have components in the PCB window, you can draw rat lines and actual traces with the Line tool. (Activate the Line tool by either clicking on it, or by pressing F2 on the keyboard.) The Line tool is context-sensitive depending on what layer is the active layer. If the "rat lines" layer is active, using the Line tool will draw rat lines, which will modify the netlist. Otherwise, it will put down copper tracks that will end up appearing on the PCB itself. You can change the thickness of the tracks that will be drawn by clicking on the "Route Style" button, or you can choose from one of a few presets. Again, since the netlist should be defined in the schematic editor and not the PCB layout editor, you probably shouldn't draw new rat lines unless you're building the entire PCB from scratch in PCB.

You can create copper planes (large blocks of copper, usually used either for power or ground nets to reduce the impedance associated with regular thin traces) by simply using filled rectangles or polygons. (Press SHIFT-P to close a polygon you're drawing.)

Vias

You can put vias on the PCB by simply selecting the Via tool (either by clicking on it or pressing F1) and then clicking on the PCB. Vias have two sizes: The "ViaSize", which most engineers would call the "outside diameter" (the size of the plated area surrounding the via hole) and "ViaDrill", the "inner diameter" or the size of the actual hole that gets drilled in the PCB. The PCB program currently appears to only support end-to-end vias, not buried or blind vias. If you look at the bottom of the PCB window, you'll see a section on the status line that says "via=x(y)", where x is the currently-set via outer diameter and y is the currently set inner diameter.

Completing the layout process

After you're done designing your PCB layout, it's usually a good idea to check your design. While no amount of automated checking can replace human understanding of exactly what you're doing, DRC is quite helpful, and PCB includes the ability to check DRC rules for clearance. You can set the active PCB's DRC rules in the Preferences window under the "Sizes" section. When you're ready to invoke DRC, just type the following command:

:DRC

PCB does not currently appear to have more advanced electrical DRC to check things like trace impedance, etc.

Once your layout is complete, you can export the layout by going to the File menu and choosing "Export layout". If you export Gerber files and wish to check them, you can view them using gerbv (Gerber viewer), which is available from gerbv.sf.net.

Back to the main page