{"id":951,"date":"2015-03-20T05:21:07","date_gmt":"2015-03-20T05:21:07","guid":{"rendered":"http:\/\/www.richa1.com\/RichardAlbritton\/?p=951"},"modified":"2019-12-12T18:53:09","modified_gmt":"2019-12-12T18:53:09","slug":"create-g-code-from-an-eagle-file","status":"publish","type":"post","link":"https:\/\/www.richa1.com\/RichardAlbritton\/create-g-code-from-an-eagle-file\/","title":{"rendered":"Create G-Code from an EAGLE File"},"content":{"rendered":"<h2>Overview<\/h2>\n<p>Prototyping a circuit board\u00a0in this way is a good idea so you can be sure that things are working before sending your PCB off to a\u00a0fabricator. This method is also a good way to do low run or one off testing PCBs.<\/p>\n<p>G-Code is made up of some simple commands that tell a CNC mill how to move so that your designs come out correctly. This is also called a Tool Path. PCB-GCode is an add-on for EAGLE\u00a0that lets you create a Tool Path in G-Code so that it can be made by a CNC Mill like my Shapeoko 2. Though there are many ways to create G-Code for PCBs, I will focus on EAGLE\u00a0and PCB-GCode because they are rather easy to use and the software is free for making basic PCBs<!--more--><\/p>\n<h3>Software Used:<\/h3>\n<ul>\n<li><a href=\"http:\/\/www.cadsoftusa.com\/download-eagle\/\" target=\"_blank\" rel=\"noopener noreferrer\">EAGLE<\/a>\u00a0(Freeware version)<\/li>\n<li><a href=\"http:\/\/pcbgcode.org\/list.php?12\" target=\"_blank\" rel=\"noopener noreferrer\">PCB-GCode<\/a> (Utility for EAGLE)<\/li>\n<\/ul>\n<p>EAGLE\u00a0is free to use for making small PCBs. We will assume that you already have EAGLE\u00a0installed and that you know how to use it for creating a PCB design. If this is not the case, I recommend checking out any one of the many tutorials that people have made for EAGLE\u00a0like <a href=\"https:\/\/www.youtube.com\/watch?v=1AXwjZoyNno\" target=\"_blank\" rel=\"noopener noreferrer\">this one<\/a>.<\/p>\n<h2>Adding PCB-GCode to\u00a0EAGLE<\/h2>\n<p>Once EAGLE\u00a0is installed, PCB-GCode will have to be added to the User Language Programs list so it can be used.<br \/>\n<span style=\"color: #ff0000;\"><em>Note: These instructions are for EAGLE 7.2.0 running in Windows 7, but they should work for other configurations\u00a0as well.<\/em><\/span><\/p>\n<figure id=\"attachment_910\" aria-describedby=\"caption-attachment-910\" style=\"width: 300px\" class=\"wp-caption alignright\"><a href=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/02\/PCB-CNC-Mill1.png\"><img loading=\"lazy\" class=\"wp-image-910 size-medium\" src=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/02\/PCB-CNC-Mill1-300x274.png\" alt=\"PCB-CNC-Mill1\" width=\"300\" height=\"274\" srcset=\"https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/02\/PCB-CNC-Mill1-300x274.png 300w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/02\/PCB-CNC-Mill1.png 606w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-910\" class=\"wp-caption-text\">Figure 1<\/figcaption><\/figure>\n<ol>\n<li>Open <strong>EAGLE<\/strong>.<\/li>\n<li>From the <strong>Control Panel<\/strong> window, click <strong>Options<\/strong>.<\/li>\n<li>Under <strong>Options<\/strong>, click <strong>Directories<\/strong>.<\/li>\n<li>Add <span style=\"color: #0000ff;\">;$HOME\\eagle\\external_usr-lang-prog\\pcbgcode<\/span> to the end of what is already in the\u00a0<strong>User Language Programs<\/strong> field. <span style=\"color: #ff0000;\"><em>Note: Do not delete any other text unless you know what you are doing or you will loose access to other resources and libraries in EAGLE.<\/em><\/span><\/li>\n<li><span style=\"color: #000000;\">Click on the <strong>OK<\/strong> button.<\/span><\/li>\n<li>Now click <strong>Yes<\/strong> to let\u00a0the program create a new folder for this directory.<\/li>\n<li>Close <strong>EAGLE<\/strong> and open the\u00a0<strong>Documents<\/strong> folder on your computer.<\/li>\n<li>Open the\u00a0<strong>eagle<\/strong> folder.<\/li>\n<li>Open the\u00a0<strong>external_usr-lang-prog<\/strong> folder.<\/li>\n<li>Now place all of the files from the <strong>PCB-GCode Zip<\/strong> file into the\u00a0<strong>pcbgcode<\/strong> folder. (See Figure 1)<\/li>\n<\/ol>\n<h3>Setup PCB-GCode<\/h3>\n<figure id=\"attachment_954\" aria-describedby=\"caption-attachment-954\" style=\"width: 293px\" class=\"wp-caption alignright\"><a href=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Setup_PCB-GCode_01.png\"><img loading=\"lazy\" class=\"wp-image-954 size-full\" src=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Setup_PCB-GCode_01.png\" alt=\"Setup_PCB-GCode_01\" width=\"293\" height=\"121\" \/><\/a><figcaption id=\"caption-attachment-954\" class=\"wp-caption-text\">Figure 2<\/figcaption><\/figure>\n<p>Now that PCB-GCode is installed, we need to set up a few things so that it can easily generate G-Code that works with your CNC Mill. The settings I will be recommending are what I found to be the best for the Shapeoko 2, but they should work with any other CNC Mill that uses generic\u00a0G-Code.<\/p>\n<ol>\n<li>Open your EAGLE\u00a0file, then click the <strong>ULP<\/strong> icon.\u00a0(See Figure 2)<\/li>\n<li>Navigate to the <strong>pcbgcode<\/strong> folder\u00a0located in\u00a0<strong>Documents\\eagle\\external_usr-lang-prog\\<\/strong>.<\/li>\n<li>select the\u00a0<strong>pcb-gcode-setup.ulp<\/strong> file and click Open.<\/li>\n<li>The first time\u00a0<strong>pcb-gcode-setup.ulp<\/strong> is opened, you will be asked to select a default G-Code profile.<\/li>\n<li>\n<figure id=\"attachment_955\" aria-describedby=\"caption-attachment-955\" style=\"width: 300px\" class=\"wp-caption alignright\"><a href=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Setup_PCB-GCode_02.png\"><img loading=\"lazy\" class=\"wp-image-955 size-medium\" src=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Setup_PCB-GCode_02-300x184.png\" alt=\"Setup_PCB-GCode_02\" width=\"300\" height=\"184\" srcset=\"https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Setup_PCB-GCode_02-300x184.png 300w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Setup_PCB-GCode_02.png 826w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-955\" class=\"wp-caption-text\">Figure 3<\/figcaption><\/figure>\n<p>I selected <strong>generic.pp<\/strong> for my CNC Mill.\u00a0(See Figure 3)<\/li>\n<li>Click <strong>Accept<\/strong> when done.<\/li>\n<\/ol>\n<p>PCB-GCode is now ready to be used for generating G-code from your design.<\/p>\n<h2>Adjusting the Settings<\/h2>\n<p>The default settings the PCB-GCode uses may work for many CNC Mills, but I think they are set a little high and I did not have much luck with them. Lowering the feed rate reduces the stress on\u00a0the carbide milling bits so that they stay sharp\u00a0and it will make very\u00a0clean edges around\u00a0your traces. We also just want to take off the copper layer without going too deep into the broad. Here are the settings I have found to work the best with my Shapeoko 2 using a carbide engraving bit, drills, and a 0.0625 inch end mill.<\/p>\n<h3>Generation Options<\/h3>\n<p>These are basic settings for what types of Tool Paths you want to create and how detailed they should be.<\/p>\n<ul>\n<li><img loading=\"lazy\" class=\"alignnone wp-image-1735 size-medium\" src=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/pcb-settings1--300x194.png\" alt=\"\" width=\"300\" height=\"194\" srcset=\"https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/pcb-settings1--300x194.png 300w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/pcb-settings1--768x496.png 768w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/pcb-settings1-.png 947w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>The <strong>Top Side<\/strong> and <strong>Bottom Side<\/strong> setting will depend on whether\u00a0you will be making a single or double\u00a0sided PCB. We will get more into that later.<\/li>\n<li><strong>Show preview<\/strong> is always good to have checked so you can see that everything turned out how you expected it to. I like to keep the Width and Height of the preview window at 800 x 600.<\/li>\n<li><strong>Generate milling<\/strong> is used for cutting the PCB outline. The one issue that I have with this option is that it cuts all the way through the carrier board\u00a0using just one pass. This puts a huge amount of stress on the end mill resulting in jagged edges, misalignment, and broken bits unless you go really slow. If you have any other way to cut out the final PCB, I would go with that. I will have more info on other options later in the tutorial.\u00a0When I do use this option, I set a depth of -0.064\u00a0inches\u00a0or\u00a0about 0.002 in over the measured thickness of my carrier board. Alternately, you can use this option to draw symbols\u00a0in the PCB by setting the depth to\u00a0-0.005\u00a0inches.<\/li>\n<li><strong>Generate text<\/strong>\u00a0is used to engrave text onto your PCB. Only\u00a0text that uses the Vector font and is on Layer 46 Milling will be included in the G-Code. I have this option checked\u00a0and set to a depth\u00a0of\u00a0-0.005\u00a0inches.<\/li>\n<li><strong>Spot drill holes<\/strong>\u00a0will make\u00a0small marks wherever a hole will be drilled after the trace isolation cuts are made. This helps the drill bits get nice and centered when drilling the holes. Do not set the depth for this very high or you will damage your bits. I have this option checked\u00a0and set to a\u00a0depth\u00a0of\u00a0-0.015\u00a0inches.<\/li>\n<li><strong>Prefer climb<\/strong>\u00a0setts the overall direction that the CNC Mill should move in for milling. I do prefer to have my mill do climbing cuts and that is why I have this option checked.<\/li>\n<li><strong>Isolation<\/strong> lets you control how the software will outline each of your traces. These settings depend heavily\u00a0on the tip diameter of the end mill or\u00a0engraving bit that will be used to outline your traces.\u00a0We will talk more about this later on.\n<figure id=\"attachment_962\" aria-describedby=\"caption-attachment-962\" style=\"width: 300px\" class=\"wp-caption alignleft\"><img loading=\"lazy\" class=\"wp-image-962 size-medium\" src=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/End_Mill_v_Engraving_Bit-300x220.png\" alt=\"End_Mill_v_Engraving_Bit\" width=\"300\" height=\"220\" srcset=\"https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/End_Mill_v_Engraving_Bit-300x220.png 300w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/End_Mill_v_Engraving_Bit.png 445w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-962\" class=\"wp-caption-text\">This is what a isolation cut loos like using an End Mill vs an Engraving Bit.<\/figcaption><\/figure>\n<ul>\n<li><strong>Single pass<\/strong>\u00a0only dose one outline around your traces. This potion should only be used if you are using a larger diameter end mill or if you are really good at soldering components without getting solder everywhere.<\/li>\n<li><strong>Minimum<\/strong> lets you set the smallest amount of space that your end mill or\u00a0engraving bit can cut. I have this set to 0 inches to ensure that every trace is outlined at least once to isolate it.<\/li>\n<li><strong>Maximum<\/strong>\u00a0sets the maximum spacing that you want cut around each trace. This will determine how many times the CNC mill will outline each trace. I set this option to\u00a00.015\u00a0inches to give me just enough room to easily solder things.<\/li>\n<li><strong>Step size<\/strong>\u00a0tells the software how much space your want between isolation passes. If you are using an end mill, this should be about 40% of the tip diameter of your bit.\u00a00.004 in.\u00a0Engraving bits can use a step size equal to the flat diameter of the bit because it is tapered and that\u00a0makes the\u00a0cuts wider as it goes\u00a0deeper into the carrier board.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>Machine<\/h3>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-1736 size-medium\" src=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/pcb-settings2-300x193.png\" alt=\"\" width=\"300\" height=\"193\" srcset=\"https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/pcb-settings2-300x193.png 300w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/pcb-settings2-768x494.png 768w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/pcb-settings2.png 945w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>These settings control how fast the CNC Mill will cut, details about your cutting tools, and the units of measurement you wish to use.<\/p>\n<ul>\n<li><strong>Z Axis <\/strong>lets you set some\u00a0standardized\u00a0milling depths.\n<ul>\n<li><strong>Z High<\/strong>\u00a0sets the safe height for the mill to move around without running into anything like your clamps.\u00a00.5 inches\u00a0is a safe bet for this.<\/li>\n<li><strong>Z Up<\/strong>\u00a0is the safe height for movements from one cut to the next.\u00a0I set this to\u00a00.1 inches.<\/li>\n<li><strong>Z Down<\/strong>\u00a0sets the cutting depth for the trace isolation. This should be set to go just bellow the copper layer. I use\u00a0-0.007 inches.<\/li>\n<li><strong>Drill Depth<\/strong> should be set to about 0.005 inches\u00a0below the thickness of your carrier board. So if your carrier board\u00a0is\u00a00.062 inches, you would set this option to -0.067 inches.<\/li>\n<li><strong>Drill Dwell<\/strong> tells the machine how long it should wait before pulling the drill bit back out of a newly drilled hole. About 1 second is good to get a cleanly drilled hole.<\/li>\n<\/ul>\n<\/li>\n<li>The <strong>Tool Change<\/strong> options don&#8217;t work so well, but I put 0 in for Position X and Y and 1 inch for Position Z.<\/li>\n<li><strong>Spindle<\/strong> is used to set the time it takes for the spindle to get to full speed once it is turned on. If your CNC Mill dose not automatically turn your spindle or router on and off, don&#8217;t worry about this setting.<\/li>\n<li><strong>Units<\/strong> tells the software what unit of measurement you want to use for everything. I left it on Inches, but you can use whatever you like best so long as you remember the difference\u00a0between 0.5 Inches and 0.5 Millimeters.<\/li>\n<li><strong>Feed Rates<\/strong> lets you set the optimal speed that your CNC Mill will move while cutting and drilling. This is very important to prevent your bits from braking and getting clean cuts. I have found that it is better to start these settings low if you are not sure what works best, then increase the speed if necessary. The Shapeoko 2\u00a0does not handle the stress of high feed rates that well so the following settings should work for any other CNC mill.\n<ul>\n<li><strong>Etch<\/strong> settings are used for the trace isolation outlines.\n<ul>\n<li><strong>X Y: <\/strong>20 in\/min<\/li>\n<li><strong>Z:<\/strong> 10 in\/min<\/li>\n<li><strong>Spindle rev\/min:<\/strong> 30000<\/li>\n<li><strong>Tool Dia.:<\/strong> 0.007 in<\/li>\n<\/ul>\n<\/li>\n<li><strong>Drill<\/strong> sets the drilling speed.\n<ul>\n<li><strong>Z:<\/strong>\u00a020 in\/min<\/li>\n<li><strong>Spindle rev\/min:<\/strong> 30000<\/li>\n<\/ul>\n<\/li>\n<li><strong>Mill<\/strong> settings are used for cutting out the PCB when finished. You may remember that I do not recommend using the Milling option unless you have no other way to cut your final PCB down to size. If you need to use this option, go <strong>very<\/strong> slow because it will put a lot of stress on your end mill.\n<ul>\n<li><strong>X Y:<\/strong> 2\u00a0in\/min (Yes, that is 2 inches per minute and that is still fast for my preference.)<\/li>\n<li><strong>Z:<\/strong>\u00a05 in\/min<\/li>\n<li><strong>Spindle rev\/min:<\/strong> 30000<\/li>\n<\/ul>\n<\/li>\n<li><strong>Text<\/strong> is basically the same as <strong>Etch<\/strong>, so I use the same settings.\n<ul>\n<li><strong>X Y: <\/strong>20 in\/min<\/li>\n<li><strong>Z:<\/strong> 10 in\/min<\/li>\n<li><strong>Spindle rev\/min:<\/strong> 30000<\/li>\n<\/ul>\n<\/li>\n<li><strong>Stencil<\/strong> settings can be used to cut out thinner sheets of plastic to use as a mask for solder paste. Though I have not used it, this would probably work well with the same settings as <strong>Etch<\/strong>.\n<ul>\n<li><strong>X Y: <\/strong>20 in\/min<\/li>\n<li><strong>Z:<\/strong> 10 in\/min<\/li>\n<li><strong>Spindle rev\/min:<\/strong> 30000<\/li>\n<li><strong>Tool Dia.:<\/strong> 0.007 in<\/li>\n<\/ul>\n<\/li>\n<li>Click on the <strong>?<\/strong> buttons if you really want to know what the <strong>Misc<\/strong> options are, but the are not important for what we are doing.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>GCode Options<\/h3>\n<figure id=\"attachment_969\" aria-describedby=\"caption-attachment-969\" style=\"width: 300px\" class=\"wp-caption alignright\"><a href=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Setup_PCB-GCode_05.png\"><img loading=\"lazy\" class=\"wp-image-969 size-medium\" src=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Setup_PCB-GCode_05-300x195.png\" alt=\"Setup_PCB-GCode_05\" width=\"300\" height=\"195\" srcset=\"https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Setup_PCB-GCode_05-300x195.png 300w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Setup_PCB-GCode_05.png 923w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-969\" class=\"wp-caption-text\">The GCode Options window<\/figcaption><\/figure>\n<p>I have found that PCB-GCode puts some rather long notes into the G-Code that it generates. This results in errors whenever I try and send the G-Code file to my CNC Mill. Un-checking all of the <strong>NC File Comments<\/strong> options will fix this issue.<\/p>\n<p>Unfortunately, the G-Code file for drilling still gives me an error due to a long notation at the top of the file. This is easy to fix and we will go over that in the Troubleshooting section.<\/p>\n<p>Under <strong>Other Options<\/strong>, I only check the <strong>Do tool change with zero step<\/strong> and <strong>Use simple drill code <\/strong>options. The <strong>Format<\/strong> should be set to\u00a0<strong>N%05d<\/strong> by default.<\/p>\n<p><strong>File Naming<\/strong> can be changed if you really want to, but I would just leave it alone.<\/p>\n<h2>\u00a0Prepping Your EAGLE File<\/h2>\n<h3>Wire Placement<\/h3>\n<p>The spacing between your wires and pads are dependent on how small of a milling bit you are using. If you are using an end mill with a 0.8 mm diameter tip, then all of your wires and pads should have at least 0.8 mm of spacing between them. This gets a little tricky when you are dealing with an engraving bit, because the cut widens as it goes deeper, but I would not worry about it unless you need a fine pitch. I tend to go with a 20\u00b0\u00a0engraving bit with a 0.2 mm tip. Soon I will try to do a 0.4 mm pitch using a\u00a010\u00b0 engraving bit with a 0.1 mm tip and I will update this tutorial on how that goes.<\/p>\n<p>To ensure that I get everything spaced correctly, I use the Design Rule Check (DRC) to let me know if my traces are to close.<\/p>\n<figure id=\"attachment_1004\" aria-describedby=\"caption-attachment-1004\" style=\"width: 300px\" class=\"wp-caption alignright\"><a href=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/DRC_setup_02.png\"><img loading=\"lazy\" class=\"size-medium wp-image-1004\" src=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/DRC_setup_02-300x173.png\" alt=\"Figure 4\" width=\"300\" height=\"173\" srcset=\"https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/DRC_setup_02-300x173.png 300w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/DRC_setup_02.png 831w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1004\" class=\"wp-caption-text\">Figure 4<\/figcaption><\/figure>\n<ol>\n<li>Open your EAGLE\u00a0file, then click the <img loading=\"lazy\" class=\" size-full wp-image-1007\" src=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/DRC_setup_01.png\" alt=\"DRC_setup_01\" width=\"19\" height=\"20\" \/>\u00a0<strong>DRC<\/strong>\u00a0icon.<\/li>\n<li>Click the <strong>Clearance<\/strong> tab.<\/li>\n<li>To ensure that all of your traces get isolated, change all of the values to the diameter of your milling bit. For example; I use an engraving bit that cuts at about 0.3 mm and that means I will change all values to 0.3 mm. (See Figure 4)<\/li>\n<li>Now click the <strong>Apply<\/strong> button.<\/li>\n<li>Click the <strong>Check<\/strong> button to look of <strong>DRC<\/strong> errors.<\/li>\n<li>If you have any errors, they will show in the <strong>DRC<\/strong> window.<\/li>\n<li>Double click an error from the list to show you where it occurs in your design.<\/li>\n<li>Fix or <strong>Approve<\/strong> your errors before running PCB-GCode to create the tool paths.<\/li>\n<\/ol>\n<h2>G-Code for Single Sided PCBs<\/h2>\n<h3>Top side or Bottom<\/h3>\n<figure id=\"attachment_1011\" aria-describedby=\"caption-attachment-1011\" style=\"width: 268px\" class=\"wp-caption alignright\"><a href=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Single_Sided_PCB_01.png\"><img loading=\"lazy\" class=\"size-medium wp-image-1011\" src=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Single_Sided_PCB_01-268x300.png\" alt=\"PCB with Top wires.\" width=\"268\" height=\"300\" srcset=\"https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Single_Sided_PCB_01-268x300.png 268w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Single_Sided_PCB_01.png 432w\" sizes=\"(max-width: 268px) 100vw, 268px\" \/><\/a><figcaption id=\"caption-attachment-1011\" class=\"wp-caption-text\">PCB with Top wires.<\/figcaption><\/figure>\n<p>There are two ways that you can design your PCB for a single sided board. You can design your traces from the top or from the bottom. Most of this depends on how you want to mount your components. Through-hole components are easier to solder on if you put them on the non copper side so that the pins stick out through the copper. Service mounted components can only\u00a0be placed on the copper side.<\/p>\n<figure id=\"attachment_1012\" aria-describedby=\"caption-attachment-1012\" style=\"width: 257px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Single_Sided_PCB_02.png\"><img loading=\"lazy\" class=\"size-medium wp-image-1012\" src=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Single_Sided_PCB_02-257x300.png\" alt=\"PCB with Bottom wires.\" width=\"257\" height=\"300\" srcset=\"https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Single_Sided_PCB_02-257x300.png 257w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Single_Sided_PCB_02.png 388w\" sizes=\"(max-width: 257px) 100vw, 257px\" \/><\/a><figcaption id=\"caption-attachment-1012\" class=\"wp-caption-text\">PCB with Bottom wires.<\/figcaption><\/figure>\n<p>This is where you may have to think a bit about your design. but no matter what you do, always keep your wires set to all Top or all Bottom. Components that use the green drilled Pads or Vias will automatically trace on the Top and Bottom of the PCBs.<\/p>\n<p>So if you are using through-hole components, you may want to do all of your wire connections using Bottom wires. Also be sure that you mirror any text that you want etched as well so that is shows up in the right place.<\/p>\n<h3>Creating the G-Code<\/h3>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-1735 size-medium\" src=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/pcb-settings1--300x194.png\" alt=\"\" width=\"300\" height=\"194\" srcset=\"https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/pcb-settings1--300x194.png 300w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/pcb-settings1--768x496.png 768w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/pcb-settings1-.png 947w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>Now we are ready to create the G-Code for this PCB.<\/p>\n<ol>\n<li>First, click the <img loading=\"lazy\" class=\"size-full wp-image-1020\" src=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/creating_g-code_01.png\" alt=\"creating_g-code_01\" width=\"24\" height=\"24\" \/><strong>ULP<\/strong> icon at the top of\u00a0your EAGLE\u00a0file.<\/li>\n<li>Navigate to the <strong>pcbgcode<\/strong> folder\u00a0located in\u00a0<strong>Documents\\eagle\\external_usr-lang-prog\\<\/strong>.<\/li>\n<li>select the <strong>pcb-gcode-setup.ulp<\/strong> file and click <strong>Open<\/strong>.<\/li>\n<li>Check-mark <strong>Generate Outlines<\/strong> and <strong>Generate drills<\/strong> for the <strong>Top<\/strong> or <strong>Bottom<\/strong> side\u00a0depending on how your PCB was designed.<\/li>\n<li>Don&#8217;t forget to check-mark the <strong>Generate milling<\/strong>,\u00a0<strong>Generate text<\/strong>, and <strong>Spot drill holes<\/strong> if those options are used in your design.<\/li>\n<li>When done, click <strong>Accept and make my board<\/strong>.<\/li>\n<li>A preview of the trace outline will display.<\/li>\n<li>Type the letter <strong>C<\/strong> to see the outlines more clearly.<\/li>\n<li>Inspect the preview to be sure that everything looks good.<br \/>\n<span style=\"color: #ff0000;\"><em>Note: if there are gaps between your outlines, try adding a box to define the outside edges of your\u00a0PDB.<\/em><\/span><\/li>\n<li>Type the letter <strong>Q<\/strong> to close the window.<\/li>\n<li>Click the <strong>OK<\/strong> button on the popup window to see the next preview.<\/li>\n<\/ol>\n<p><strong>Generate Outlines<\/strong> and <strong>Generate drills<\/strong> show up on the same preview. Other options like\u00a0<strong>Generate milling<\/strong>\u00a0and\u00a0<strong>Generate text<\/strong> will display a preview for the top, then one for the bottom. The G-Code files are saved to the same location as\u00a0your EAGLE file.<\/p>\n<h3>Know your starting point<\/h3>\n<p>The key difference between doing a Top or Bottom PCB is the point of origin. This is the point where the CNC Mill will start at. The point of origin is represented by a small + made of dotted lines.\u00a0Most programs\u00a0use a point of origin that is\u00a0in\u00a0the bottom left corner. This works out perfect if you designed your PCB with all Top wires. However, the point of origin is moved to the bottom right corner if your PCB was designed with Bottom wires.<\/p>\n<figure id=\"attachment_1013\" aria-describedby=\"caption-attachment-1013\" style=\"width: 681px\" class=\"wp-caption alignright\"><a href=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Single_Sided_PCB_03.png\"><img loading=\"lazy\" class=\"wp-image-1013 size-full\" src=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Single_Sided_PCB_03.png\" alt=\"Figure 5\" width=\"681\" height=\"306\" srcset=\"https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Single_Sided_PCB_03.png 681w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Single_Sided_PCB_03-300x135.png 300w\" sizes=\"(max-width: 681px) 100vw, 681px\" \/><\/a><figcaption id=\"caption-attachment-1013\" class=\"wp-caption-text\">Figure 5<\/figcaption><\/figure>\n<p>The simple way to deal with this change in the point of origin is to start the Bottom wire PCB in the lower right corner of your CNC Mills work aria. Though this will work, if you really need to start in the lower left, there is a way to know how far over you will need to move for the new point of origin.<\/p>\n<p>If you have\u00a0<strong>Show preview\u00a0<\/strong>enabled\u00a0in the\u00a0<strong>Generation Options<\/strong>\u00a0of <strong>PCB-GCode<\/strong>, you will notice something that looks like a red + with a circle on it. This is known as a registration mark. The registration mark shows you where the point of origin is and the two sets of red numbers tells you the exact distance that mark is from point 0.000, 0.000. You may notice that in figure 5, the registration marks are on opposite sides and the numbers are not the same.<\/p>\n<p>So if I were to start our CNC Mill at the bottom left corner, or X 0.000\u00a0and\u00a0Y 0.000, I would use the CNC software to move the X axis\u00a0to 0.811. One I am there, you can reset that new position as\u00a0X 0.000\u00a0and\u00a0Y 0.000 by using the Reset Zero button from your CNC Mill software.<\/p>\n<p>We will go over this again in a tutorial about setting your CNC Mill up and running the code.<\/p>\n<p>As for the cutting your PCB free of the larger board, I would create that tool path with a program like <a href=\"http:\/\/www.vectric.com\/products\/vcarve.htm\" target=\"_blank\" rel=\"noopener noreferrer\">VCarve<\/a>\u00a0or free software like <a href=\"http:\/\/www.easel.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Easel<\/a>. Just be sure that everything lines up with your point of origin from your\u00a0EAGLE\u00a0file.<\/p>\n<h2>G-Code for Double Sided PCBs<\/h2>\n<figure id=\"attachment_1017\" aria-describedby=\"caption-attachment-1017\" style=\"width: 400px\" class=\"wp-caption alignright\"><a href=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Two_Sided_PCB_01.png\"><img loading=\"lazy\" class=\"wp-image-1017\" src=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Two_Sided_PCB_01-300x162.png\" alt=\"This is what it all of the previews will look like for a two sided PCB.\" width=\"400\" height=\"217\" srcset=\"https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Two_Sided_PCB_01-300x162.png 300w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Two_Sided_PCB_01-1024x554.png 1024w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Two_Sided_PCB_01.png 1919w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><figcaption id=\"caption-attachment-1017\" class=\"wp-caption-text\">This is what it all of the previews will look like for a two sided PCB.<\/figcaption><\/figure>\n<p>Two sided PCBs work out the same way as the single sided boards\u00a0except that the registration mark is more important so that the top milling lines up perfectly with the bottom. You will want to run all of the G-Code for the Top first, then flip the PCB over to run all of the Bottom G-Code. For this type of board, I would recommend adding a set of holes that can be used to align the board properly when it is turned over. Just be sure that the holes you drill will be in the same place even when the PCB is flipped. I suggest placing these holes on all 4 corners of the PCB.<\/p>\n<p>We will get into more about lining up your PCB\u00a0in a tutorial about setting your CNC Mill up and running the code.<\/p>\n<h2>Troubleshooting G-Code Errors<\/h2>\n<p>The most common error that you will encounter has to do with long comments that appear at the beginning of the Drill files.<\/p>\n<p><a href=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Troubleshooting_G-Code.png\"><img loading=\"lazy\" class=\" size-medium wp-image-1021 alignright\" src=\"http:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Troubleshooting_G-Code-300x172.png\" alt=\"Troubleshooting_G-Code\" width=\"300\" height=\"172\" srcset=\"https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Troubleshooting_G-Code-300x172.png 300w, https:\/\/www.richa1.com\/RichardAlbritton\/wp-content\/uploads\/2015\/03\/Troubleshooting_G-Code.png 537w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>This error is easy to fix with the help of a text editor.<\/p>\n<ol>\n<li>Locate and open the <strong><em>(your file name)<\/em>.top.drill.tap<\/strong> file using a text editor.<\/li>\n<li>The comments are enclosed with\u00a0parentheses ().<\/li>\n<li>You can remove all of the comments from this file, but the long comment on line 4 is the most likely one to give you trouble.<\/li>\n<li>Save and close the file.<\/li>\n<li>Now open\u00a0<strong><em>(your file name)<\/em>.bot.drill.tap<\/strong> and repeat the process.<\/li>\n<\/ol>\n<p>All of the other files will run smoothly. However I would suggest, if you understand G-Code, that the following code be added just after the last Z movement.<\/p>\n<pre class=\"lang:default decode:true\">G00 Z1.0000\nG00 X0.0000 Y0.0000<\/pre>\n<p>This will bring the CNC Mill back to your 0, 0 \u00a0position so you are ready to load the next G-Code file.<\/p>\n<p>You can also add G21 to the very end to switch back from Inches to MM (the software default)<\/p>\n<p>For more about G-Code, have a look at these resources:<\/p>\n<ul>\n<li><a href=\"http:\/\/en.wikipedia.org\/wiki\/G-code\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/en.wikipedia.org\/wiki\/G-code<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/johnlauer\/Universal-G-Code-Sender\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/johnlauer\/Universal-G-Code-Sender<\/a><\/li>\n<\/ul>\n<div class=\"sharedaddy sd-sharing-enabled\"><div class=\"robots-nocontent sd-block sd-social sd-social-icon-text sd-sharing\"><h3 class=\"sd-title\">Share this:<\/h3><div class=\"sd-content\"><ul><li class=\"share-print\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"\" class=\"share-print sd-button share-icon\" href=\"https:\/\/www.richa1.com\/RichardAlbritton\/create-g-code-from-an-eagle-file\/\" target=\"_blank\" title=\"Click to print\"><span>Print<\/span><\/a><\/li><li class=\"share-email\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"\" class=\"share-email sd-button share-icon\" href=\"https:\/\/www.richa1.com\/RichardAlbritton\/create-g-code-from-an-eagle-file\/?share=email\" target=\"_blank\" title=\"Click to email this to a friend\"><span>Email<\/span><\/a><\/li><li class=\"share-facebook\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-facebook-951\" class=\"share-facebook sd-button share-icon\" href=\"https:\/\/www.richa1.com\/RichardAlbritton\/create-g-code-from-an-eagle-file\/?share=facebook\" target=\"_blank\" title=\"Click to share on Facebook\"><span>Facebook<\/span><\/a><\/li><li class=\"share-twitter\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-twitter-951\" class=\"share-twitter sd-button share-icon\" href=\"https:\/\/www.richa1.com\/RichardAlbritton\/create-g-code-from-an-eagle-file\/?share=twitter\" target=\"_blank\" title=\"Click to share on Twitter\"><span>Twitter<\/span><\/a><\/li><li class=\"share-end\"><\/li><\/ul><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Overview Prototyping a circuit board\u00a0in this way is a good idea so you can be sure that things are working before sending your PCB off to a\u00a0fabricator. This method is also a good way to do low run or one off testing PCBs. G-Code is made up of some simple commands that tell a CNC &hellip; <a href=\"https:\/\/www.richa1.com\/RichardAlbritton\/create-g-code-from-an-eagle-file\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Create G-Code from an EAGLE File<\/span><\/a><\/p>\n<div class=\"sharedaddy sd-sharing-enabled\"><div class=\"robots-nocontent sd-block sd-social sd-social-icon-text sd-sharing\"><h3 class=\"sd-title\">Share this:<\/h3><div class=\"sd-content\"><ul><li class=\"share-print\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"\" class=\"share-print sd-button share-icon\" href=\"https:\/\/www.richa1.com\/RichardAlbritton\/create-g-code-from-an-eagle-file\/\" target=\"_blank\" title=\"Click to print\"><span>Print<\/span><\/a><\/li><li class=\"share-email\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"\" class=\"share-email sd-button share-icon\" href=\"https:\/\/www.richa1.com\/RichardAlbritton\/create-g-code-from-an-eagle-file\/?share=email\" target=\"_blank\" title=\"Click to email this to a friend\"><span>Email<\/span><\/a><\/li><li class=\"share-facebook\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-facebook-951\" class=\"share-facebook sd-button share-icon\" href=\"https:\/\/www.richa1.com\/RichardAlbritton\/create-g-code-from-an-eagle-file\/?share=facebook\" target=\"_blank\" title=\"Click to share on Facebook\"><span>Facebook<\/span><\/a><\/li><li class=\"share-twitter\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-twitter-951\" class=\"share-twitter sd-button share-icon\" href=\"https:\/\/www.richa1.com\/RichardAlbritton\/create-g-code-from-an-eagle-file\/?share=twitter\" target=\"_blank\" title=\"Click to share on Twitter\"><span>Twitter<\/span><\/a><\/li><li class=\"share-end\"><\/li><\/ul><\/div><\/div><\/div>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"aside","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[80,79],"tags":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5AhH6-fl","_links":{"self":[{"href":"https:\/\/www.richa1.com\/RichardAlbritton\/wp-json\/wp\/v2\/posts\/951"}],"collection":[{"href":"https:\/\/www.richa1.com\/RichardAlbritton\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.richa1.com\/RichardAlbritton\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.richa1.com\/RichardAlbritton\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.richa1.com\/RichardAlbritton\/wp-json\/wp\/v2\/comments?post=951"}],"version-history":[{"count":5,"href":"https:\/\/www.richa1.com\/RichardAlbritton\/wp-json\/wp\/v2\/posts\/951\/revisions"}],"predecessor-version":[{"id":2283,"href":"https:\/\/www.richa1.com\/RichardAlbritton\/wp-json\/wp\/v2\/posts\/951\/revisions\/2283"}],"wp:attachment":[{"href":"https:\/\/www.richa1.com\/RichardAlbritton\/wp-json\/wp\/v2\/media?parent=951"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.richa1.com\/RichardAlbritton\/wp-json\/wp\/v2\/categories?post=951"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.richa1.com\/RichardAlbritton\/wp-json\/wp\/v2\/tags?post=951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}