User Tools

Site Tools


geda:gsch2pcb_tutorial

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
geda:gsch2pcb_tutorial [2013/12/14 17:15]
vzh Uploaded a file with footprints and fixed a broken link
geda:gsch2pcb_tutorial [2017/08/10 19:12] (current)
fisichel Added "Add a ground plane" and "Add a via" sections to pcb
Line 1: Line 1:
 +//​Translations of this page are also available in the following languages://​ [[gsch2pcb_tutorial.ru|Русский]].
 +
 ====== gschem -> gsch2pcb -> PCB ====== ====== gschem -> gsch2pcb -> PCB ======
 This is a tutorial on the process of using gsch2pcb as an This is a tutorial on the process of using gsch2pcb as an
Line 18: Line 20:
 See the [[gsch2pcb_tutorial_ReleaseNotes|release notes]] for the history of this tutorial. See the [[gsch2pcb_tutorial_ReleaseNotes|release notes]] for the history of this tutorial.
  
-=====  Terminology ​ =====+===== Terminology =====
 With gschem, you add symbols representing electronic components to a With gschem, you add symbols representing electronic components to a
 schematic. ​ A symbol is a group of pins, attributes, and lines showing schematic. ​ A symbol is a group of pins, attributes, and lines showing
Line 65: Line 67:
  
  
-=====  Setup  =====+===== Setup =====
 You should have a directory structure in mind for organizing your You should have a directory structure in mind for organizing your
 design projects. The install of gEDA design projects. The install of gEDA
Line 72: Line 74:
 libraries of gschem symbols and PCB elements. libraries of gschem symbols and PCB elements.
  
-  *  Somewhere, probably under your home directory, create a directory structure for your projects. Use directory names you like, but this tutorial will reference the directory name structure I use: <​code>​gaf/​+  * Somewhere, probably under your home directory, create a directory structure for your projects. Use directory names you like, but this tutorial will reference the directory name structure I use: <​code>​gaf/​
 gaf/​gschem-sym/ ​                   Where I put the custom gschem symbols I create. gaf/​gschem-sym/ ​                   Where I put the custom gschem symbols I create.
 gaf/​gschem-sym/​transistors/ ​       You can organize your custom symbols into subdirectories. gaf/​gschem-sym/​transistors/ ​       You can organize your custom symbols into subdirectories.
Line 78: Line 80:
 These can also be organized into subdirectories. These can also be organized into subdirectories.
 gaf/​myproject1/ ​                   And finally, separate directories for each gaf/​myproject1/ ​                   And finally, separate directories for each
-gaf/​myproject2/ ​                       design project.  +gaf/​myproject2/ ​                       design project. 
-...</​code>​ With this organization,​ any custom gschem symbols and PCB elements you make can be common to all of your projects and this is good enough to get you started. However, I'll mention other possibilities which will be revealed below: ​ There can be project specific PCB **file element** subdirectories ​ or **m4 element** files. ​ Or, CAD administrators can set up site wide custom PCB **file element** directories and **m4 element** files. ​  +...</​code>​ With this organization,​ any custom gschem symbols and PCB elements you make can be common to all of your projects and this is good enough to get you started. However, I'll mention other possibilities which will be revealed below: ​ There can be project specific PCB **file element** subdirectories ​ or **m4 element** files. ​ Or, CAD administrators can set up site wide custom PCB **file element** directories and **m4 element** files. 
-  *  **gEDA setup:** the gschem, gnetlist, and other programs you may use such as gattrib, etc, all need to be able to find any custom symbols you will make, so you need to make your custom gschem symbol directories known to these programs in a gEDA gafrc file by adding **component-library** lines to either a user **${HOME}/​.gEDA/​gafrc** file or a project specific **gafrc** file in the project directory. ​ There is also a system wide **${GEDADATA}/​system-gafrc** file administrators can set up. The **HOME** and **GEDADATA** environment variables must be respectively set for those **gafrc** files to be found. For our directory structure setup above, we could add these lines to **${HOME}/​.gEDA/​gafrc** (plus lines for each additional **gschem-sym** subdirectory you want): <​code>​(component-library "​${HOME}/​gaf/​gschem-sym"​)+  * **gEDA setup:** the gschem, gnetlist, and other programs you may use such as gattrib, etc, all need to be able to find any custom symbols you will make, so you need to make your custom gschem symbol directories known to these programs in a gEDA gafrc file by adding **component-library** lines to either a user **${HOME}/​.gEDA/​gafrc** file or a project specific **gafrc** file in the project directory. ​ There is also a system wide **${GEDADATA}/​system-gafrc** file administrators can set up. The **HOME** and **GEDADATA** environment variables must be respectively set for those **gafrc** files to be found. For our directory structure setup above, we could add these lines to **${HOME}/​.gEDA/​gafrc** (plus lines for each additional **gschem-sym** subdirectory you want): <​code>​(component-library "​${HOME}/​gaf/​gschem-sym"​)
 (component-library "​${HOME}/​gaf/​gschem-sym/​transistors"​)</​code>​ or, in each project directory (like myproject1 and myproject2) there could be a **gafrc** file with the lines: <​code>​(component-library "​../​gschem-sym"​) (component-library "​${HOME}/​gaf/​gschem-sym/​transistors"​)</​code>​ or, in each project directory (like myproject1 and myproject2) there could be a **gafrc** file with the lines: <​code>​(component-library "​../​gschem-sym"​)
-(component-library "​../​gschem-sym/​transistors"​)</​code>​ More modern versions of gEDA (since 1.7.2) let you specify only one command to achieve this: <​code>​ (component-library-search "​../​gschem-sym"​) </​code>​ which will recursively scan all subdirectories for symbol libraries. See the [[geda:​gschem_ug: ​"config|gEDA gschem User Guide]] for further information on how to setup gEDA programs.  +(component-library "​../​gschem-sym/​transistors"​)</​code>​ More modern versions of gEDA (since 1.7.2) let you specify only one command to achieve this: <​code>​(component-library-search "​../​gschem-sym"​) </​code>​ which will recursively scan all subdirectories for symbol libraries. See the [[geda:​gschem_ug:​config|gEDA gschem User Guide]] for further information on how to setup gEDA programs. 
-  *  If you want a more detailed customization of gschem and gnetlist, you can override other initializations that are setup in the global rc files. In Debian, look at rc files in **/​etc/​gEDA/​** for settings you can make. For example, I like the light gschem background, so I also put in my **~/​.gEDA/​gschemrc** the line: <​code>​(load (build-path geda-rc-path "​gschem-colormap-lightbg"​)) ; light background</​code>​ +  * If you want a more detailed customization of gschem and gnetlist, you can override other initializations that are setup in the global rc files. In Debian, look at rc files in **/​etc/​gEDA/​** for settings you can make. For example, I like the light gschem background, so I also put in my **~/​.gEDA/​gschemrc** the line: <​code>​(load (build-path geda-rc-path "​gschem-colormap-lightbg"​)) ; light background</​code>​ 
-  *  **PCB setup: ** A PCB distribution usually is set up so that PCB will automatically look in a **packages** subdirectory of the working directory. ​ So, to make PCB find all the custom elements I put in **gaf/​pcb-elements** I make a link in each of my project directories. ​ Note that this link is actually not required when using gsch2pcb because, as described below, you may alternatively specify the **pcb-elements** directory in a **project** file.  But if you do want to make the link, in directory **gaf/​myproject1** enter the command: <​code>​ln -s ../​pcb-elements packages</​code>​ +  * **PCB setup: ** A PCB distribution usually is set up so that PCB will automatically look in a **packages** subdirectory of the working directory. ​ So, to make PCB find all the custom elements I put in **gaf/​pcb-elements** I make a link in each of my project directories. ​ Note that this link is actually not required when using gsch2pcb because, as described below, you may alternatively specify the **pcb-elements** directory in a **project** file.  But if you do want to make the link, in directory **gaf/​myproject1** enter the command: <​code>​ln -s ../​pcb-elements packages</​code>​ 
-  *  ** gsch2pcb setup: ** In each of your project directories,​ create a gsch2pcb project file which can be named anything that does not end in //.sch//. A project file will be created in the example below.+  * ** gsch2pcb setup: ** In each of your project directories,​ create a gsch2pcb project file which can be named anything that does not end in //.sch//. A project file will be created in the example below.
  
 This is all the setup you need beyond the initial install of the gschem, gsch2pcb, and PCB packages. This is all the setup you need beyond the initial install of the gschem, gsch2pcb, and PCB packages.
  
-===== Simple Example ​ =====+===== Simple Example =====
 Let's generate a trivial design from schematics to PCB layout Let's generate a trivial design from schematics to PCB layout
 almost as quickly as possible and then we can use it as a base for almost as quickly as possible and then we can use it as a base for
Line 112: Line 114:
  
 {{geda:​one-sch-1.png |one.sch}} Run **gschem one.sch** and create this schematic (the second opamp is redundant, but this is just a tutorial): {{geda:​one-sch-1.png |one.sch}} Run **gschem one.sch** and create this schematic (the second opamp is redundant, but this is just a tutorial):
-  * Open the select components dialog (type **i**)+  * Open the select components dialog (type <key>i</​key>​)
   * Make sure, the drop down menu at the bottom of the dialog is set to "​Default behavior - reference component"​.   * Make sure, the drop down menu at the bottom of the dialog is set to "​Default behavior - reference component"​.
   * Add the components:   * Add the components:
Line 118: Line 120:
     * From the **Input/​output** library one **output-2.sym**.     * From the **Input/​output** library one **output-2.sym**.
     * From the **Power rails** library one **gnd-1.sym**,​ two **vcc-1.sym** and two **vee-1.sym**     * From the **Power rails** library one **gnd-1.sym**,​ two **vcc-1.sym** and two **vee-1.sym**
-  *  Move components with the middle mouse button and rotate selected components by hitting keys **er** ​until everything is placed nicely. Rotate the bottom opamp and mirror it with the **ei** ​keys. +  * Move components with the middle mouse button and rotate selected components by hitting keys <​key>​e</​key><​key>​r</​key> ​until everything is placed nicely. Rotate the bottom opamp and mirror it with the <​key>​e</​key><​key>​i</​key> ​keys. 
-  *  Use the **n** key and the mouse to draw net connections.+  * Use the <key>n</​key> ​key and the mouse to draw net connections.
  
-The large frame of the titleblock is a component too. It has been locked for convenience to prevent the mouse from catching it all the time. To unlock it, select it by dragging with left mouse button held down and press [e - shift-L]. You can find title blocks with different sizes in the **Titleblocks** library. Remember, to lock the new title block with [el] while the title block is selected.+The large frame of the titleblock is a component too. It has been locked for convenience to prevent the mouse from catching it all the time. To unlock it, select it by dragging with left mouse button held down and press <key>e</​key> ​<key>shift-l</​key>​. You can find title blocks with different sizes in the **Titleblocks** library. Remember, to lock the new title block with <​key>​e</​key><​key>​l</​key> ​while the title block is selected.
  
-====Edit the attributes of the components on the schematic.==== +==== Edit the attributes of the components on the schematic ==== 
-{{ geda:​one-sch-2.png|one.sch}} For each component, select it and bring up its attributes window by hitting keys **ee**.  Do not edit the **refdes** attribute here, but do make these edits: +{{ geda:​one-sch-2.png|one.sch}} For each component, select it and bring up its attributes window by hitting keys <​key>​e</​key><​key>​e</​key>​.  Do not edit the **refdes** attribute here, but do make these edits: 
-  *  For resistors and the opamps, add visible **value** attributes and assign appropriate values to them (10K, TL072). Move these newly visible attributes to nice locations with the middle mouse button. ​ Zoom in and repeat clicking the middle mouse button if it is difficult to select them. +  * For resistors and the opamps, add visible **value** attributes and assign appropriate values to them (10K, TL072). Move these newly visible attributes to nice locations with the middle mouse button. ​ Zoom in and repeat clicking the middle mouse button if it is difficult to select them. 
-  *  For the resistors, add a **footprint** attribute and give it the value **R025** which is the PCB //m4 element// for a 1/4 watt resistor. ​ Make this attribute invisible. +  * For the resistors, add a **footprint** attribute and give it the value **R025** which is the PCB //m4 element// for a 1/4 watt resistor. ​ Make this attribute invisible. 
-  *  For the opamps, edit the already existing **footprint** attribute to be **DIL 8 300**. ​ Yes, include those spaces because **DIL** is a **m4 element** that takes two args. We're telling it to make a dual in line package with 8 pins in a 300 mil package. Edit the **slot** attribute of the second opamp to be **2**. ​ Its I/O pin numbers should change from (1,2,3) to (5,6,7). +  * For the opamps, edit the already existing **footprint** attribute to be **DIL 8 300**. ​ Yes, include those spaces because **DIL** is a **m4 element** that takes two args. We're telling it to make a dual in line package with 8 pins in a 300 mil package. Edit the **slot** attribute of the second opamp to be **2**. ​ Its I/O pin numbers should change from (1,2,3) to (5,6,7). 
-  *  For the output module port, edit its **net** attribute to be **vmixer:​1** and make it invisible. ​ Edit its **value** attribute to be **Vmixer**.+  * For the output module port, edit its **net** attribute to be **vmixer:​1** and make it invisible. ​ Edit its **value** attribute to be **Vmixer**.
  
 It may have occurred to you that this editing will be painful for a It may have occurred to you that this editing will be painful for a
Line 137: Line 139:
 attribute default that covers most of your uses.  Or, when you add your attribute default that covers most of your uses.  Or, when you add your
 first component, edit it to have a good footprint default and then copy it first component, edit it to have a good footprint default and then copy it
-(select it and hit the **ec** ​keys) for all+(select it and hit the <​key>​e</​key><​key>​c</​key> ​keys) for all
 remaining components instead of adding them from the library.\\ remaining components instead of adding them from the library.\\
  
Line 145: Line 147:
  
  
-====  Create schematic: two.sch ====+==== Create schematic: two.sch ====
 This will be really trivial and stupid since we're doing it only to This will be really trivial and stupid since we're doing it only to
-demonstrate multiple schematic capability. ​ +demonstrate multiple schematic capability.
 {{geda:​two-sch-1.png |two.sch}} Run **gschem two.sch:** {{geda:​two-sch-1.png |two.sch}} Run **gschem two.sch:**
-  *  Add component **title-B.sym** as you did in one.sch.+  * Add component **title-B.sym** as you did in one.sch.
   * Add components:   * Add components:
     * From the **Input/​Output** library one **input-2.sym**.     * From the **Input/​Output** library one **input-2.sym**.
Line 156: Line 158:
     * From the **Power rails** library one **gnd-1.sym**,​ one **vcc-1.sym** and one **vee-1.sym**.     * From the **Power rails** library one **gnd-1.sym**,​ one **vcc-1.sym** and one **vee-1.sym**.
     * From the **Connectors** library one **BNC-1.sym**.     * From the **Connectors** library one **BNC-1.sym**.
-  *  Move components and draw nets as before. +  * Move components and draw nets as before. 
-  *  Edit component attributes:​ +  * Edit component attributes:​ 
-    *  Input module port: edit **net** attribute to be invisible and have value **vmixer:​1** so this net will be connected to the **vmixer** in one.sch. Make the **value** attribute be **Vmixer**.+    * Input module port: edit **net** attribute to be invisible and have value **vmixer:​1** so this net will be connected to the **vmixer** in one.sch. Make the **value** attribute be **Vmixer**.
     * Resistor: give it invisible **footprint** attribute **R025** and a visible **value** attribute 10K.     * Resistor: give it invisible **footprint** attribute **R025** and a visible **value** attribute 10K.
-    *  Transistor: add **value** attribute **2N3904** and invisible **footprint** attribute **TO92**. +    * Transistor: add **value** attribute **2N3904** and invisible **footprint** attribute **TO92**. 
-    *  BNC connector: add invisible **footprint** attribute **CONNECTOR 2 1**. which is a **m4 element** that takes arguments and we're telling it to make a connector with 2 rows and 1 column. We put a BNC connector on the schematic, but I'm pretending we'll just jumper wires from this pc board header to a panel mounted connector.+    * BNC connector: add invisible **footprint** attribute **CONNECTOR 2 1**. which is a **m4 element** that takes arguments and we're telling it to make a connector with 2 rows and 1 column. We put a BNC connector on the schematic, but I'm pretending we'll just jumper wires from this pc board header to a panel mounted connector.
  
 Unfortunately,​ the 2N3904 symbol we added has the text "​2N3904"​ as an Unfortunately,​ the 2N3904 symbol we added has the text "​2N3904"​ as an
Line 180: Line 182:
 attributes and we can use the command **refdes_renum** to do this attributes and we can use the command **refdes_renum** to do this
 for both schematics at once.  So, save **two.sch**,​ quit gschem and run: for both schematics at once.  So, save **two.sch**,​ quit gschem and run:
-<​code>​$ refdes_renum --pgskip one.sch two.sch +<​code>​$ refdes_renum --pgskip one.sch two.sch</​code>​
-</​code>​+
 Run gschem on the schematics again to see how the components Run gschem on the schematics again to see how the components
 have been given a **refdes** attribute. ​ The //​--pgksip//​ option have been given a **refdes** attribute. ​ The //​--pgksip//​ option
Line 203: Line 204:
  
  
-====  Generate PCB Files from Schematics ====+==== Generate PCB Files from Schematics ====
 We have to fix one thing in **one.sch** before we can proceed. We have to fix one thing in **one.sch** before we can proceed.
 Run **gschem one.sch** and notice that **refdes_renum** has Run **gschem one.sch** and notice that **refdes_renum** has
Line 245: Line 246:
  
  
-====  Layout PCB Files ====+==== Layout PCB Files ====
 === Set the defaults === === Set the defaults ===
 {{geda:​board-1.png |pcb, step 1}}Run **pcb board.pcb**. You'll see grouped into a big pile the PCB elements for all {{geda:​board-1.png |pcb, step 1}}Run **pcb board.pcb**. You'll see grouped into a big pile the PCB elements for all
Line 272: Line 273:
  
 === Disperse the Components === === Disperse the Components ===
-{{ geda:​board-2.png|step 2}} +{{ geda:​board-2.png|step 2}}
 Use the middle mouse button to grab and move elements one Use the middle mouse button to grab and move elements one
 at a time until you have separated all the elements. at a time until you have separated all the elements.
Line 282: Line 283:
 === Load the Netlist === === Load the Netlist ===
 {{geda:​board-3.png |Step 3}} {{geda:​board-3.png |Step 3}}
-  * Go to **File->​load netlist file** and select **board.net** ​+  * Go to **File->​load netlist file** and select **board.net**
   * Do **Connects->​optimize rats-nest**. Now, the pins and pads of components should be connected with straight lines according to the  schematic. These are "​rats"​.   * Do **Connects->​optimize rats-nest**. Now, the pins and pads of components should be connected with straight lines according to the  schematic. These are "​rats"​.
  
-To minimize confusion, PCB tries to draw the rats of complex connections such that the sum of all rats is as short as possible. Try to drag an element to the other side of the working area. The rats will follow like a rubber band, but the end of the rats will not jump to a different node, although the resulting length might be shorter. The action **optimize rats-nest** rats will make the rats jump to this "​better"​ geometry. This action can be applied conveniently anytime with a stroke of the key **o**.+To minimize confusion, PCB tries to draw the rats of complex connections such that the sum of all rats is as short as possible. Try to drag an element to the other side of the working area. The rats will follow like a rubber band, but the end of the rats will not jump to a different node, although the resulting length might be shorter. The action **optimize rats-nest** rats will make the rats jump to this "​better"​ geometry. This action can be applied conveniently anytime with a stroke of the key <key>o</​key>​.
  
 === Place the Components === === Place the Components ===
-{{ geda:​board-4.png|Step 4}}You will have to replace the rats with traces that can be etched in copper. After "​Disperse all elements"​ the rats are usually in a random mess with lots of crossings. You should move and rotate the components around and try to disentangle the rats as much as possible. The key to a well routed pcb is proper placement of the components. Although PCB tries to clean up the rats lines while you move the components around, it is good practice to occasionally initiate rats optimization with the **o**-key.+{{ geda:​board-4.png|Step 4}}You will have to replace the rats with traces that can be etched in copper. After "​Disperse all elements"​ the rats are usually in a random mess with lots of crossings. You should move and rotate the components around and try to disentangle the rats as much as possible. The key to a well routed pcb is proper placement of the components. Although PCB tries to clean up the rats lines while you move the components around, it is good practice to occasionally initiate rats optimization with the <key>o</​key> ​key.
  
  
-Select the **ROT** tool (**F-9**) to move elements with the +Select the **ROT** tool (<​key>​F9</​key>​) to move elements with the 
-middle mouse button and rotate them with the left mouse button. ​+middle mouse button and rotate them with the left mouse button.
 The right mouse button will move the viewport to the canvas when zoomed in. The right mouse button will move the viewport to the canvas when zoomed in.
-Zoom in and out with the mouse wheel or alternatively with **z** and **Shift z**.  +Zoom in and out with the mouse wheel or alternatively with <key>z</​key> ​and <key>Shift-z</​key>​
-Hit the **f** key while the mouse hovers over a pin to highlight +Hit the <key>f</​key> ​key while the mouse hovers over a pin to highlight 
-the particular that touches this pin to help visualize the routes.  +the particular that touches this pin to help visualize the routes. 
-Use **Shift f** to unhighlight. You can undo changes anytime with the **u** key.+Use <key>Shift-f</​key> ​to unhighlight. You can undo changes anytime with the <key>u</​key> ​key.
  
 Note: you can use the PCB auto placement Note: you can use the PCB auto placement
Line 310: Line 311:
 disperse function, but it is also much slower as layouts get larger. disperse function, but it is also much slower as layouts get larger.
  
-===Replace rats nests with routes===+=== Replace rats nests with routes ===
 {{geda:​board-5.png |Step 5}} At this point you can start routing traces between pins connected {{geda:​board-5.png |Step 5}} At this point you can start routing traces between pins connected
 by rats nest lines. ​ On the left PCB toolbar, by rats nest lines. ​ On the left PCB toolbar,
Line 316: Line 317:
 (solder, component, etc), and start drawing lines by selecting (solder, component, etc), and start drawing lines by selecting
 endpoints with the left endpoints with the left
-mouse button. ​ Again, it can help to use the **f** key to highlight+mouse button. ​ Again, it can help to use the <key>f</​key> ​key to highlight
 routes that need to be connected. routes that need to be connected.
 If you want to stop the current trace so you can start If you want to stop the current trace so you can start
Line 331: Line 332:
 areas around or step and repeat common trace patterns. ​ To areas around or step and repeat common trace patterns. ​ To
 select multiple objects with the **SEL** tool, click and drag select multiple objects with the **SEL** tool, click and drag
-to select rectangular regions, and SHIFT click to toggle additional+to select rectangular regions, and <​key>​Shift</​key>​-click to toggle additional
 selections to the currently selected set. selections to the currently selected set.
  
Line 354: Line 355:
 //Use separate window for command entry// option, then when //Use separate window for command entry// option, then when
 you bring up the Command window with **Window->​Command Entry** you bring up the Command window with **Window->​Command Entry**
-(or the ':' ​key), you will see a **Command Reference** expander+(or the <key>:</​key> ​key), you will see a **Command Reference** expander
 arrow. ​ Click on the arrow and a command reference will be shown arrow. ​ Click on the arrow and a command reference will be shown
 which lists some commands you can type in that may not be available which lists some commands you can type in that may not be available
Line 368: Line 369:
 inconvenient to be changing the Preferences each time.  For this, inconvenient to be changing the Preferences each time.  For this,
 you can select some lines, you can select some lines,
-bring up the command window (hit '**:**') and type in the command: +bring up the command window (hit <key>:</​key>​) and type in the command: 
-<​code>​ changesize(selectedlines,​ +3, mils)+<​code>​ 
 +changesize(selectedlines,​ +3, mils)
 </​code>​ </​code>​
 and the selected lines and the selected lines
Line 377: Line 379:
  
  
-===Looking ​at the other side of the board=== +=== Look at the other side of the board === 
-In some layouts it is important to put components on either side of +In some layouts it is important to put components on either side of
 the board, although not for the preceding example. In such a case the board, although not for the preceding example. In such a case
-the 'tab' ​key can be used to flip the board over and view it from the +the <key>tab</​key> ​key can be used to flip the board over and view it from the 
-back while the 'b' ​key can be used to put a selected component on the +back while the <key>b</​key> ​key can be used to put a selected component on the 
-other side of the board. ​+other side of the board.
 On dual sided boards it is also important to note what side a particular On dual sided boards it is also important to note what side a particular
-layer of traces is on. This can be seen, and set, in the +layer of traces is on. This can be seen, and set, in the
 File->​Preferences->​Layers->​Groups dialog. Layers on the '​component'​ side File->​Preferences->​Layers->​Groups dialog. Layers on the '​component'​ side
 will be on the top of the board and layers on the '​solder'​ side will be on will be on the top of the board and layers on the '​solder'​ side will be on
Line 390: Line 392:
 be fabricated in the same step (i.e. etched with photo-lithography) are grouped be fabricated in the same step (i.e. etched with photo-lithography) are grouped
 together. together.
 +
 +=== Add a Ground Plane ===
 +This section goes over how to add a ground plane. For this section, the top layer of the board looks like this:​\\ ​
 +{{geda:​170810_002_groundplane.png |top side}} \\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +If you haven'​t done so already, flip your board to the back side by pressing <​key>​tab</​key>​. You might have to move the vertical scroll bar to find your board. It's there. This is what it should look like:​\\ ​
 +{{geda:​170810_004_groundplane.png |back side}} \\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +{{geda:​170810_008_groundplane.png |bottom button}}Select the "​Bottom"​ layer from the left.\\ ​
 +\\ 
 +Use the {{geda:​170810_005_groundplane.png |RECT side}} rectangle (RECT) tool, click once in the upper left corner and then once again in the lower right corner.\\ ​
 +\\ 
 +{{geda:​170810_010_groundplane.png |rectangle}}\\ ​
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +PCB should fill in the area for you. Now, switch back to the top side using <​key>​tab</​key>​. You have just made a copper plane. We will make it a ground plane in the next section.\\ ​
 +\\ 
 +=== Add a via ===
 +Let's say we need to ground the pins from R102 and R201. We can use the copper plane we just created. A via will get you through the board. We will accept the defaults that are set using the route styles button. Feel free to open that dialog box and explore. \\ 
 +\\ 
 +{{geda:​170810_013_via.png |Route styles button}}\\ ​
 +\\ 
 +\\ 
 +{{geda:​170810_014_via.png |Via button}} Next, click on the via button, and click above and between the unconnected pins on R102 and R201.\\ ​
 +\\ 
 +{{geda:​170810_015_via.png |via placement}}\\ ​
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +We will connect to this via using the line tool. \\ 
 +Click the "​Top"​ button to make the top layer active. \\ 
 +Click the line button and click on the left resistor end, and then on the via. Press escape, then with the line tool again, click on the right resistor end, and on the via. \\
 +The top side is connected.\\ ​
 +{{geda:​170810_016_via.png |via placement}}\\ ​
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +Now, we need to connect the bottom side to the via. Press <​key>​tab</​key>​ and also press the "​Bottom"​ layer button to make it active. If the bottom layer icon has a little triangle in with mostly white space, it is hidden. Click in that box to make it visible. \\ 
 +{{geda:​170810_017_via.png |select tool}}Using the select tool, click on the via annulus.\\ ​
 +\\ 
 +\\ 
 +{{geda:​170810_018_via.png |via placement}}\\ ​
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +With the copper annulus selected, press ctrl-shift-k. That should shrink the clearance area of the annulus to allow the copper to touch the annulus.\\ ​
 +{{geda:​170810_020_via.png |via placement}}\\ ​
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +\\ 
 +The pins from the resistors are now connected to the plane you created earlier. You can click "​Top"​ and press <​key>​tab</​key>​ to get back to the top view of the board.\\
 +{{geda:​170810_022_via.png |via placement}}\\ ​
 +
  
 ===== Modifying Schematics ===== ===== Modifying Schematics =====
Line 430: Line 541:
 was installed). ​ PCB versions before 20031113 used **pcb_lib** instead was installed). ​ PCB versions before 20031113 used **pcb_lib** instead
 of **newlib** in the locations of **newlib** in the locations
-**/​usr/​local/​pcb_lib** or **/​usr/​lib/​pcb_lib,**. +**/​usr/​local/​pcb_lib**or **/​usr/​lib/​pcb_lib**.
 Once you find your **newlib** directory, Once you find your **newlib** directory,
 look at the file names in each subdirectory. ​ Each file name look at the file names in each subdirectory. ​ Each file name
Line 468: Line 579:
 have **net** attributes which can assign pins to a particular have **net** attributes which can assign pins to a particular
 net.  Instead of hooking up each opamp pin 8 to Vcc and pin 4 to net.  Instead of hooking up each opamp pin 8 to Vcc and pin 4 to
-to Vee on the schematic, we can have that happen automatically and+Vee on the schematic, we can have that happen automatically and
 eliminate the pins on the schematic. ​ To do this, just copy the eliminate the pins on the schematic. ​ To do this, just copy the
 original symbol to our custom gschem symbol directory, giving it original symbol to our custom gschem symbol directory, giving it
Line 480: Line 591:
 gschem opamp-dual.sym gschem opamp-dual.sym
 </​code>​ </​code>​
-  * Hit keys **en** ​to make attributes visible. +  * Hit keys <​key>​e</​key><​key>​n</​key> ​to make attributes visible. 
-  * Hit keys **ve** ​to view extents.+  * Hit keys <​key>​v</​key><​key>​e</​key> ​to view extents.
   * Left mouse click on pin 8 to select it.   * Left mouse click on pin 8 to select it.
  
Line 487: Line 598:
 {{geda:​gschem-sym-2.png |Step 2}} {{geda:​gschem-sym-2.png |Step 2}}
  
-  * Hit **Delete** key to delete pin 8.+  * Hit <key>Delete</​key> ​key to delete pin 8.
   * Similarly select and delete pin 4.   * Similarly select and delete pin 4.
   * Double click to select and edit the **slotdef** lines. ​ Edit them by removing the pins 4 and 8.   * Double click to select and edit the **slotdef** lines. ​ Edit them by removing the pins 4 and 8.
  
-== Add global Nets to in Numbers == +== Add global Nets to in Numbers ==
 {{geda:​gschem-sym-3.png |Step 3}}From the menu **Add->​Attribute** {{geda:​gschem-sym-3.png |Step 3}}From the menu **Add->​Attribute**
-  * Add a **net** attribute with value **Vcc:8** Select **Show Name &amp; Value** and make it invisible. +  * Add a **net** attribute with value **Vcc:8** Select **Show Name & Value** and make it invisible. 
-  * Add a **net** attribute with value **Vee:4** Make it **Show Name &amp; Value** and invisible.+  * Add a **net** attribute with value **Vee:4** Make it **Show Name & Value** and invisible.
   * Make the **device** attribute be just **OPAMP**.   * Make the **device** attribute be just **OPAMP**.
  
Line 507: Line 618:
  
 == Run gschem with the New Symbol == == Run gschem with the New Symbol ==
-{{geda:​one-sch-3.png |one.sch}} Run **gschem one.sch**. ​ Select and delete with the **Delete**+{{geda:​one-sch-3.png |one.sch}} Run **gschem one.sch**. ​ Select and delete with the <key>Delete</​key>​
 key both opamps. ​ Also delete the **Vcc** and **Vee** symbols that key both opamps. ​ Also delete the **Vcc** and **Vee** symbols that
 were connected to them.  Bring up the Add Components window were connected to them.  Bring up the Add Components window
Line 522: Line 633:
 existing **DIL** package from the layout. ​ If you did everything existing **DIL** package from the layout. ​ If you did everything
 right, running gsch2pcb should give: right, running gsch2pcb should give:
-<​code>​~/​gaf/​myproject1$ gsch2pcb project ​  ​+<​code>​~/​gaf/​myproject1$ gsch2pcb project
 Found a cpinlist head with a netname! [Vcc] Found a cpinlist head with a netname! [Vcc]
 Found a cpinlist head with a netname! [Vee] Found a cpinlist head with a netname! [Vee]
Line 545: Line 656:
 [[geda:​gschem_symbol_creation|Symbol Creation Document]] on the [[geda:​gschem_symbol_creation|Symbol Creation Document]] on the
 [[geda:​documentation|gEDA Documentation]] page. [[geda:​documentation|gEDA Documentation]] page.
- 
- 
  
 ===== Custom file elements ===== ===== Custom file elements =====
Line 568: Line 677:
 {{geda:​pcb-el-1.png |Step 1}} {{geda:​pcb-el-1.png |Step 1}}
   * Select the **VIA** tool and place two vias 400 mils apart.   * Select the **VIA** tool and place two vias 400 mils apart.
-  * With the mouse on the left via, hit the **n** key and give the via the name **1**. ​ Give the right via the name **2** +  * With the mouse on the left via, hit the <key>n</​key> ​key and give the via the name **1**. ​ Give the right via the name **2** 
-  *  Pin 1 will be the cathode and this must agree with the pin numbers in your diode gschem symbol.+  * Pin 1 will be the cathode and this must agree with the pin numbers in your diode gschem symbol.
  
-{{ geda:​pcb-el-2.png|Step 2}} +{{ geda:​pcb-el-2.png|Step 2}}
  
   * Select the **Silk** layer and the **LINE** tool.   * Select the **Silk** layer and the **LINE** tool.
   * Draw the component outline as shown with line width set to 10 mils and the grid setting set to 10 mils.   * Draw the component outline as shown with line width set to 10 mils and the grid setting set to 10 mils.
   * Draw the left fat cathode indicator with three lines after setting the line width to 20 mils.   * Draw the left fat cathode indicator with three lines after setting the line width to 20 mils.
-  * Don't let silk layer lines overlap solder pads. +  * Don't let silk layer lines overlap solder pads.
 Select the vias and the outline just drawn using the **SEL** tool Select the vias and the outline just drawn using the **SEL** tool
 and finish making the element: and finish making the element:
Line 586: Line 695:
 **Note:** if you save the element with a name which is the same **Note:** if you save the element with a name which is the same
 as a **m4 element**, gsch2pcb will preferentially use the m4 as a **m4 element**, gsch2pcb will preferentially use the m4
-element unless you give gsch2pcb the --use-files (or -f) option.+element unless you give gsch2pcb the %%--use-files%% (or -f) option.
 You may put **use-files** in a project file if you want to always You may put **use-files** in a project file if you want to always
 give priority to using **file elements**. ​ The m4 element names appear give priority to using **file elements**. ​ The m4 element names appear
Line 606: Line 715:
 section. ​ If you have not made that link, you can still tell gsch2pcb section. ​ If you have not made that link, you can still tell gsch2pcb
 about the elements directory with a line in a project file: about the elements directory with a line in a project file:
-<​code>​elements-dir ~/​gaf/​pcb-elements +<​code>​elements-dir ~/​gaf/​pcb-elements</​code>​
-</​code>​+
 Possibly you've noticed, but there are some things not right about the Possibly you've noticed, but there are some things not right about the
 **myproject1** example. ​ For one thing, silk layer lines are **myproject1** example. ​ For one thing, silk layer lines are
Line 625: Line 733:
 in the less common (3,2,1) configuration while the **2N3904-1.sym** in the less common (3,2,1) configuration while the **2N3904-1.sym**
 is like a npn-ebc symbol which needs a (1,2,3) numbering. ​ You can is like a npn-ebc symbol which needs a (1,2,3) numbering. ​ You can
-see the 2N3904 pin numbers in gschem by hitting the **en** ​keys+see the 2N3904 pin numbers in gschem by hitting the <​key>​e</​key><​key>​n</​key> ​keys
 (and don't be confused by the **pinseq** attribute that nearly (and don't be confused by the **pinseq** attribute that nearly
 covers up the **pinnumber**). ​ And in PCB, you can see the **TO92** covers up the **pinnumber**). ​ And in PCB, you can see the **TO92**
-pin numbers by hitting the **d** key with the mouse over+pin numbers by hitting the <key>d</​key> ​key with the mouse over
 the element. ​ To be sure you are seeing pin numbers and not pin the element. ​ To be sure you are seeing pin numbers and not pin
 names, select **Screen->​pinout shows number**. names, select **Screen->​pinout shows number**.
Line 646: Line 754:
 gafrc **component-library** lines and that gafrc **component-library** lines and that
 gsch2pcb can find them with **elements-dir** lines in a gsch2pcb can find them with **elements-dir** lines in a
-project file.  +project file.
  
  
Line 693: Line 801:
 directory will most likely be **/​usr/​share/​pcb/​m4** or directory will most likely be **/​usr/​share/​pcb/​m4** or
 **/​usr/​local/​share/​pcb/​m4**,​ while on earlier PCB versions it could be **/​usr/​local/​share/​pcb/​m4**,​ while on earlier PCB versions it could be
-**/​usr/​X11R6/​lib/​X11/​pcb/​m4** (run //gsch2pcb --help// or+**/​usr/​X11R6/​lib/​X11/​pcb/​m4** (run //%%gsch2pcb --help%%// or
 //gsch2pcb -v project// to see which of these directories gsch2pcb //gsch2pcb -v project// to see which of these directories gsch2pcb
 is using). ​ But if your install is somewhere else you will is using). ​ But if your install is somewhere else you will
Line 700: Line 808:
 **m4 elements** in the above examples and you will need to add **m4 elements** in the above examples and you will need to add
 the correct m4 directory to your **project** file with a line like: the correct m4 directory to your **project** file with a line like:
-<​code>​m4-pcbdir /​path/​to/​pcb/​m4 +<​code>​m4-pcbdir /​path/​to/​pcb/​m4</​code>​
-</​code>​+
 Just read the **.inc** files in the m4 install directory. ​ For Just read the **.inc** files in the m4 install directory. ​ For
 example, in the **misc.inc** file you will find the **R025** element example, in the **misc.inc** file you will find the **R025** element
Line 790: Line 897:
  
   * **pcb.inc** in our **myproject1** directory and the custom element will be local to this project.   * **pcb.inc** in our **myproject1** directory and the custom element will be local to this project.
- 
   * **~/​.pcb/​pcb.inc** and the element will be known to all of our projects.   * **~/​.pcb/​pcb.inc** and the element will be known to all of our projects.
- +  ​* **/​path/​to/​anyfile** if this path is made known to gsch2pcb by adding a line to a project file like: <​code>​m4-file /​path/​to/​anyfile</​code>​ Depending on whether you want the file known only to this project, to all of your projects, or to all projects of all users, this line may be added to any of the project files:<​code>​~/​gaf/​myproject1/​project
-  ​* **/​path/​to/​anyfile** if this path is made known to gsch2pcb by adding a line to a project file like:<​code>​m4-file /​path/​to/​anyfile +
- </​code>​ Depending on whether you want the file known only to this project, to all of your projects, or to all projects of all users, this line may be added to any of the project files:<​code>​~/​gaf/​myproject1/​project+
 ~/.gsch2pcb ~/.gsch2pcb
 /​usr/​local/​etc/​gsch2pcb /​usr/​local/​etc/​gsch2pcb
 /​etc/​gsch2pcb /​etc/​gsch2pcb
- </​code>​+</​code>​
  
  
Line 845: Line 949:
 )') )')
 </​code>​ </​code>​
-Run **gschem one.sch** and edit the **footprint** attribute of +Run **gschem one.sch** and edit the **footprint** attribute of
 the opamps to be **DILFAT 8 300**. the opamps to be **DILFAT 8 300**.
 Then run **gsch2pcb project** Then run **gsch2pcb project**
Line 861: Line 965:
  
  
-  * Put site wide custom PCB **file elements** under, for example, **/​usr/​local/​share/​pcb/​pcb-elements**. ​ Make this directory searched by gsch2pcb for all users by putting a line into **/​etc/​gsch2pcb** or **/​usr/​local/​etc/​gsch2pcb**:<​code>​elements-dir /​usr/​local/​share/​pcb/​pcb-elements +  * Put site wide custom PCB **file elements** under, for example, **/​usr/​local/​share/​pcb/​pcb-elements**. ​ Make this directory searched by gsch2pcb for all users by putting a line into **/​etc/​gsch2pcb** or **/​usr/​local/​etc/​gsch2pcb**:<​code>​elements-dir /​usr/​local/​share/​pcb/​pcb-elements</​code>​ If there are any site wide custom PCB **m4 element** files, for example, **/​usr/​local/​share/​pcb/​pcb.inc**,​ add another line into **/​etc/​gsch2pcb** or **/​usr/​local/​etc/​gsch2pcb**:<​code>​m4-file /​usr/​local/​share/​pcb/​pcb.inc</​code>​ 
- </​code>​ If there are any site wide custom PCB **m4 element** files, for example, **/​usr/​local/​share/​pcb/​pcb.inc**,​ add another line into **/​etc/​gsch2pcb** or **/​usr/​local/​etc/​gsch2pcb**:<​code>​m4-file /​usr/​local/​share/​pcb/​pcb.inc +  * If the default PCB m4 install is not **/​usr/​local/​share/​pcb/​m4,​ /​usr/​share/​pcb/​m4,​** or **/​usr/​X11R6/​lib/​X11/​pcb/​m4**,​ then make the install location known to all users of gsch2pcb by putting into **/​etc/​gsch2pcb** or **/​usr/​local/​etc/​gsch2pcb** the line:<​code>​m4-pcbdir /​path/​to/​pcb/​m4</​code>​ If the m4 program is gm4 instead of m4, add to the gsch2pcb file:<​code>​m4-command gm4</​code>​
- </​code>​ +
- +
-  * If the default PCB m4 install is not **/​usr/​local/​share/​pcb/​m4,​ /​usr/​share/​pcb/​m4,​** or **/​usr/​X11R6/​lib/​X11/​pcb/​m4**,​ then make the install location known to all users of gsch2pcb by putting into **/​etc/​gsch2pcb** or **/​usr/​local/​etc/​gsch2pcb** the line:<​code>​m4-pcbdir /​path/​to/​pcb/​m4 +
- </​code>​ If the m4 program is gm4 instead of m4, add to the gsch2pcb file:<​code>​m4-command gm4 +
- </​code>​ +
   * If there are site wide custom gschem symbols under some directory, you will have to edit the **system-gafrc** file and add **component-library** lines for them.   * If there are site wide custom gschem symbols under some directory, you will have to edit the **system-gafrc** file and add **component-library** lines for them.
  
Line 890: Line 988:
  
 Open the ps file and print only the pages that you will actually need for Open the ps file and print only the pages that you will actually need for
-fabrication. There are a large number of pages here, many of which you may  +fabrication. There are a large number of pages here, many of which you may 
-not need. +not need.
  
 If you find that your pads and traces don't print on the same page, or are If you find that your pads and traces don't print on the same page, or are
geda/gsch2pcb_tutorial.1387059329.txt.gz · Last modified: 2013/12/14 17:15 by vzh