Home icon

gEDA tutorial

This is a short tutorial on using gEDA for round-trip engineering.


Creating schematics

A screenshot of gschem

Start gschem with:

gschem  my-schematic.sch

Save the schematic and use:

refdes_renum  my-schematic.sch

..to automatically number all reference designators that end with "?".

Some useful keys ( Note: "v, e" means press [V] then [E])

Keys Effect
v, e View Extents: Zoom so that the whole schematic is in view
w Choose an area of the view to zoom in to
u Undo
Shift+R Redo

Some useful keys that affect the selected parts:

Keys Effect
m Move
Delete Delete
e, r Rotate
e, i Mirror
e, c Copy
e, e Edit attributes
a, a Add attribute
t, u Auto-number text

Common attributes:

Attribute Purpose
footprint Indicates the physical plan of the part on the PCB. DIP28N for example
value The value of a resistor or capacitor. Used to generate the BOM

Common footprints:

Footprint Usage
AXIAL_LAY s s is the pin separation, e.g. AXIAL_LAY 300
RADIAL_CAN d d is the diameter of the package, not the pin separation. RADIAL_CAN 200
DIP20 For a 20-pin dual in-line package
JUMPER4 For a 4-pin header
LED d d is the outside diameter of the LED in mils, e.g. LED 197 for a 5mm LED
HEADER10_2 10-way header with 2 rows, i.e. 5x2 header

Creating a .pcb from a .sch

A screenshot of pcb

Ensure that each part has a unique refdes and then:

gsch2pcb  my-schematic.sch

Scan the output for errors ( which are usually about missing footprints), correct and then re-run. If gsch2pcb outputs:

/usr/bin/m4:stdin:22: bad expression in eval:  /4

..then possibly a footprint is LED-197 when it should be LED 197.

Open the new PCB with:

pcb  my-schematic.pcb

Some useful keys:

Key Effect
F1 Via tool
F2 Line tool
F4 Text tool
F5 Rectangle tool ( for ground pours)
F9 Rotate tool
/ Changes where the line bends
m Move the element under the cursor to the current layer
M Move selected elements to the current layer
o Show the rats nest
e Hide the rats nest
Tab Show the other side of the board
u Undo
R Redo
B Move selected elements to the other side of the board

Round-trip engineering

Sometimes the schematic changes after some of the PCB has been laid out.

Once the schematic has been updated, ensure that the latest changes to the PCB have been saved and then re-run:

gsch2pcb  my-schematic.sch

gsch2pcb will edit my-schematic.pcb in-place to remove parts that have been deleted or had their footprint changed but it will put new parts and parts with new footprints in my-schematic.new.pcb. Assuming my-schematic.pcb is already open:

Ground pours

A ground pour makes routing easier because GND traces need not be laid out at all. Where a ground plane is present on a four-layer board, the signal will return through the ground plane directly underneath the trace above. A more roundabout return can cause RF problems in high-frequency boards. Pours are still good for conserving etchant though.

Creating gschem symbols

gEDA has a symbol creation guide.

To configure gschem to use a local component library, ensure that ~/.gEDA/gafrc contains something like:

(component-library "/home/neil/electronics/symbols")

Create a symbol with:

gschem BC549.sym

The .sym rather than .sch causes gschem to realise you'd like a symbol rather than schematic.

  1. select Add Pin to draw pins. Add boxes and lines too. For each pin:
  2. set pinnumber and pinseq to the same value (counting up starting at 1)
  3. set pintype to one of:
    • in: input
    • out: output
    • io: input/output
    • oc: open collector
    • oe: open emitter
    • pas: passive
    • tp: totem pole
    • tri: tristate (high impedance)
    • clk: clock
    • pwr: power/ground
  4. add attributes:
  5. device=BC549
  6. author=Neil Stockbridge <neil@example.com>
  7. numslots=0
  8. net=Vcc:7
  9. footprint=TO92
  10. refdes=U?
  11. Use:
    gsymcheck -vv BC549.sym
  12. Choose Symbol Translate from the Edit menu and use a value of 0

Add attributes above or to the right of the symbol otherwise they will be obscured when the symbol is translated.

Creating pcb footprints

When pcb has no footprint for your part, just make one!

mkdir ~/electronics/footprints/mine

..then in pcb, go to:

File , Preferences... , Library , Element Directories

..and change it to include:


..then make a file in ~/electronics/footprints/mine/BSA325.fp like so:

# Element( flags description blank blank mark_x mark_y text_x text_y text_direction text_scale text_flags
# Pin( x y thickness clearance mask drillhole name number flags
# ElementLine( x1 y1 x2 y2 thickness)
# ElementArc( centre_x centre_y radius_x radius_y startAngle deltaAngle thickness)  startAngle in degs, 0=East, +ve deltaAngle anti-clockwise
# Measurements are taken from the datasheet
Element( 0x00 "BS-A325* small seven-segment display" "" "BS-A325" 0 0 150 100 3 100 0x00)
  Pin(   0   0  60  70   0  28 "Common Anode"  "1" 0x101)
  Pin(   0 100  60  70   0  28 "f"             "2" 0x001)
  Pin(   0 200  60  70   0  28 "g"             "3" 0x001)
  Pin(   0 300  60  70   0  28 "e"             "4" 0x001)
  Pin(   0 400  60  70   0  28 "d"             "5" 0x001)
  Pin( 200 400  60  70   0  28 "Common Anode"  "6" 0x001)
  Pin( 200 300  60  70   0  28 "dp"            "7" 0x001)
  Pin( 200 200  60  70   0  28 "c"             "8" 0x001)
  Pin( 200 100  60  70   0  28 "b"             "9" 0x001)
  Pin( 200   0  60  70   0  28 "a"            "10" 0x001)
  ElementLine( -45 -70 -45 470 10)  # left, starting top-left going anti-clockwise
  ElementLine( -45 470 245 470 10)  # bottom
  ElementLine( 245 470 245 -70 10)  # right
  ElementLine( 245 -70 -45 -70 10)  # top

Values for thickness, drillhole and mask are diameters yet the clearance of a pin is specified as twice the minimum clearance, so a "clearance" of 30 tells the Design Rule Checker that there must be at least 15 mils between the edge of the pad and any other copper.

Thickness and clearance apply to DRC. Mask, thickness and drillhole apply to fabrication. Thickness is the diameter of the pad and "mask" the diameter of the hole in the solder mask:

pin metrics

When specifying drill diameters, add 19 mils to compensate for through-plating if having PCBs fabricated.

Don't forget when running gsch2pcb to specify the elements directory like so:

gsch2pcb -d ~/electronics/footprints  twin-bcd.sch

Publishing schematics

The built-in Write image feature produces lacklustre results with bitmap formats. Here's how to get better results, even if in monochrome:

A published schematic

Having a board fabricated