EagleCAD Tutorial

This is a tutorial on how to use EagleCAD to design electronic circuit schematics and PCB layouts.  The PCB design files can be sent out to a PCB manufacturer to fabricate your own custom circuit boards.  I originally developed this tutorial as a presentation to the members of the Atlanta Hobby Robot Club.  The full tutorial can be download in PDF form at the bottom of this page.

Designing a PCB using EagleCAD

Yes, you can design your own custom PCB and this tutorial will show you how. It is easier than ever to design your own PCB and having it manufactured is not as expensive as you may think. This tutorial will show you how to use CadSoft EagleCAD to design a schematic, layout a PCB, and generate Gerber files to send to a PCB manufacturer. As an example project, we will make a USB Night Light. Powered by a USB port, this circuit board has a light sensor and will turn on a couple LEDs when the ambient light drops below a set level. 

Special thanks CadSoft for offering the free hobbyist version of EagleCAD and also to Sparkfun.com who has created some of the best Eagle CAD introductory tutorials on the internet.
WHY DESIGN A CUSTOM PCB?
 Pros:
Small Size and Weight
Place components wherever you want
Use any component you want
Use PCB as robot structure
Use Surface Mount parts
Reliable connections
Easier to replicate
 Cons: 
Takes time to design
Hard to reconfigure / rework
Not good for initial prototyping
Need to learn electronics
Need to learn soldering 

Pololu 3Pi Robot uses a custom PCB
The Pololu 3Pi Robot demonstrates the benefits of a custom PCB.
Protractor PCBA with Components Populated
Custom PCB designed for the Protractor Sensor

PCB Layers

Before we design a circuit board, let’s take a look at the layers that make up a PCB.
  • Substrate – Typically made of Fiberglass, this layer provides mechanical strength to the board.
  • Copper – This is where the wires are that connect all the parts. In a PCB, these wires are called Traces.
  • Soldermask – A layer of insulating film that covers the Copper. Gaps in the Soldermask expose sections of copper so that the parts can be connected to the Traces with solder.
  • Silkscreen – A layer of ink that is printed on top of all other layers, typically white or black. Reference designators, names, values, logos, or any other useful information can be put on the Silkscreen.
  • Via – Copper-plated hole used to make connections between copper layers
The above layers are repeated on the bottom side of the board in addition to the top, creating a 2 layer circuit board. Most hobbyist projects work well with 2 layer boards, although it is possible to have boards with many internal layers.
PCB Layers

EagleCAD Layers

EagleCAD also has layers. In the Schematic view it’s perfectly fine to use the default layers. Since a circuit board has a top, bottom, and layers in between, it will be useful to know what the layers are in the Board view so they can be turned on and off as needed.
  • Top, Bottom - Copper Traces, these are the wires connecting parts
  • Pads - Where to solder connections are made between Parts and the Board
  • Vias - Copper plated through-holes that connect traces on Top to Bottom
  • Unrouted - Shows what connections need to be made
  • Dimension - The outline of the PCB
  • tPlace, bPlace - Shows outlines of the part locations
  • tNames, bNames - Reference Designators of the parts, e.g. R5, C1, etc.
  • tValues, bValues - Part Values, e.g. 10k, 0.1uf
  • tOrigins, bOrigins - Small + signs you click on to move the parts around
  • tStop, bStop - Where the Green film stops, exposing the copper
  • Holes, Drills - Holes are not copper plated, Drills are for Vias and are plated
  • tDocu, bDocu - Similar to tPlace/bPlace but more detailed
  • tRestrict, bRestrict – Restricts where the copper can fill in a pour
  • tKeepout, bKeepout – Indicates areas in which parts should not be placed  

Gerber Files

Gerber Files are a common file format used to document a PCB design to send to a manufacturer. Each Gerber File represents a layer of the PCB. To generate each Gerber File, the appropriate layers in EagleCAD must be assigned to a layer of the PCB
Gerber File Layers

What You Need

Before we get started, a number of items must be downloaded and installed. Sparkfun.com has a good tutorial for installing and setting up EagleCAD which can be very helpful. Here’s what we need:
If you have a particular PCB manufaturer in mind, it is better to use their Design Rule file and CAM file instead.

How to Make a Schematic in Eagle

As mentioned above, this tutorial will guide you through designing a USB Night Light.  The basic steps are as follows:
  1. Open Eagle -> Control Panel window appears
  2. Options - Directories, Add file path of Sparkfun Libraries as Directory if not already
  3. File -> New -> Project -> USB Night Light
  4. File -> New -> Schematic -> Save As "USB Night Light R1"
  5. Control Panel -> Libraries -> Sparkfun... a. Add all the Parts in the PARTLIST below to the Schematic b. When adding the LMV358 Op Amp, click twice on the schematic window so that both gates appear
  6. Use the Move, Rotate and Mirror commands to orient the symbols on the schematic as shown below
  7. Use the Wire command to connect parts, see schematic below a. Verify "NETS" layer is selected in the toolbar
  8. Add Junction dots at all the net intersections
  9. Use the Label command to display the names of some of the Nets -> N$1, N$2
  10. Use the Name command to rename the Nets -> 5V, GND, SENSE, REF, etc.
  11. Use the Value command to assign values to each component
  12. Use the Text command to add a name and/or description of the circuit a. In the Toolbar, change to the "INFO" layer, change the text size if desired
  13. Use the ERC tool to perform an error check
  14. Correct or Approve any Errors and Warnings found 
USB Night Light Parts List


USB Night Light Schematic

How to Make a PCB in Eagle

USB Night Light PCB Layout
  1. Open EagleCAD. In the Schematic window, go to File -> Switch to Board. Opens a new window where the PCB is created.
  2. Click on "Display". Verify the useful layers are visible: 
    • Top, Bottom, Pads, Vias, Unrouted, Dimension
    • tPlace, bPlace, tOrigins, bOrigins, tNames, bNames,tValues, bValues
    • tStop, bStop, tKeepout, bKeepout, tRestrict, bRestrict
    • Drills, Holes, tDocu, bDocu
  3. Open the "Grid" and verify the Size is 0.05 inch. Turn on the Display if you like and choose Dots or Lines.
  4. Click on "Move" and adjust the Dimension lines to a reasonable size
  5. Place the parts inside of the Dimension outline
    • Start with placing any connectors and Mounting Holes
    • Hint: Hit the Ratsnest button to redraw airwires after moving parts
    • Move and Rotate other parts to minimize crossing of airwires
    • Use the Mirror command to flip the LEDs to the Bottom side of the PCB
  6. Click the "Route" command, and choose the proper settings in the toolbar.
    • Set the Layer to Top, Wire Bend type as "_/" or "/-", trace Width to 0.016.
    • Set the Via style to Round, Drill Size to 0.023, and Diameter to auto.
  7. Click on an airwire close to a pad and begin making connections.
    • Hint: Traces should be routed away from the pads, especially pads that are closely spaced.
  8. Create a Via to jump from Top to Bottom layer
    • Click the airwire connecting the LED to the Resistor.
    • While routing the airwire, left-click in open space and then change the layer in the toolbar.
    • The trace changes color, and a Via is created once the connection is made.
  9. Create Traces and Vias as necessary until all connections are made and there are no more airwires.
    • Hint: Visit http://www.4PCB.com/trace-width-calculator.html to calculate trace width vs current
  10. Select the "Text" command, type "USB Night Light" and hit OK.
    • In the toolbar, change the text Layer to tPlace, Size to .07, Font to Vector, and Ratio to 15%.
  11. If the Names and/or Values are going to be on the silkscreen, all text should be formatted
    • Smash each part. HINT: See Advanced EAGLE on next page to use the command line to smash and format.
    • Right click on each Name and Value , Set Size >= 0.032 mil, Font = Vector, Ratio = 15%
    • Move the Names and Values around to not overlap any parts. It may help to make the grid size smaller.
    • HINT: When moving items, hold down CTRL while left-clicking on an item to snap the origin to the grid.
  12. Create a GND pour on the bottom side of the board.
    • Click the Polygon command.
    • In the toolbar, set the Layer to Bottom, Wire Bend type to "_|", Width = 0.012, Isolate = 0.012, Thermals On
    • Draw a box directly on top of the Dimension lines.
    • Use the "Name" command to set the Name of the dashed line to GND. Click Ratsnest to draw the GND pour.
    • Repeat on the Top layer. 
  13. Click the DRC button to check for errors.
    1. Click the "Load" and select the SparkFun.dru file downloaded from Sparkfun.com then hit “Check”
    2. Review any errors. Fix or Approve them as necessary.
  14. Generate Gerber Files. Click on CAM to open the CAM processor window.
    1. Go to File -> Open -> Job and select SFE-gerb274x.cam downloaded from Sparkfun.com
    2. Each tab represents a Gerber file to be generated.
    3. Notice which Eagle layers are mapped to which Gerber file layers in the scrolling list on the right.
    4. The Top Paste tab is for making a Solder Paste stencil. It can be deleted if not needed.
    5. In the Top Silkscreen tab, select tValues in addition to tNames and tPlace if you want the values shown
    6. Click Process Job to generate the files. Close the CAM processor window. Don't save changes to SFE-gerb274x.cam if prompted. Save your changes as your own custom .cam file if you want.
  15. Look at the current project folder within the Eagle Control Panel window. Note the new files GBL, GBO, GBS, etc.
  16. Install and Open Viewplot V1.5 to check the Gerber Files
    1. Go to File -> Load Files. Navigate to the current Eagle project folder "USB Night Light"
    2. Hold down CTRL to select the Gerber Files GBL, GBO, GBS, GTL, GTO, GTS, and TXT, and click Open
    3. Click OK on the Read Files window.
    4. Select "Leading Zero Suppression" and "2 4" as the Drill Format on the Load Drill File Window, click OK
    5. In the lower left, select which layer to be shown on top. Zoom in and inspect each layer.
    6. If there are any issues, go back to EAGLE and fix the issue. Delete the original Gerbers, generate new ones and reinspect.
  17. Find a PCB manufacturer and place an order for their PCB fabrication service that matches your board
    1. iTead Studios
      1. Extremely low cost for 10 boards, fair quality, choice of PCB thickness, color and finish
      2. Near zero customer service - if your files are bad, you’ll never know until you get your boards
    2. OSH Park
      1. Reasonable cost, high quality, all boards are 0.063” thick, purple soldermask, and ENIG finish
      2. Reasonable customer service – if your files are bad, they’re likely to contact you and let you fix it
    3. Place the Gerber files in a .zip file and send to the PCB manufacturer per their ordering instructions.
    4. If the manufacturer has their own .CAM or .DRU file for EAGLE, use their file to check your design and generate your gerbers instead of the Sparkfun files.

ADVANCED EAGLE

EagleCAD has a command line just below the toolbar which can help eliminate tedious tasks.  Check out the following examples:
  • To smash all parts at once, type in the following commands:
display none tOrigins bOrigins;
group all;
smash (>0 0);
display last;
  • To format all Names and Values at once, type in the following commands:
display none tNames bNames tValues bValues;
group all;
change size 0.032 (>0 0);
change font vector (>0 0);
change ratio 15 (>0 0);
display last; .

EagleCAD has User Language Programs (ULP) that do all kinds of fancy things.
  • In the Schematic window, go to File -> Run, BOM.ulp
  • In the Board window, go to File -> Run, statistic-brd.ulp
  • In the Board window, go to File -> Run, spiral-coil.ulp
  • Panelize.ulp makes it possible to panelize a board design, see this tutorial for details.
Ċ
William Moore,
Sep 25, 2016, 4:37 PM