loading

In this tutorial, we are going to be using EagleCAD, a PCB design tool, to generate toolpaths for fabricating circuit boards using a Stepcraft CNC Mill (or any other CNC mill that accepts standard G-code). Through this tutorial, I am going to assume a familiarity with EagleCAD and with basic CNC operation. Knowledge of G-Code is not expected. This process has been tested using a Stepcraft Mill, and the UCCNC controller software. I don’t see any reason why it shouldn’t work with other mills/controllers that accept normal G-code, but it has not been tested. Feel free to beta test.

If you are unfamiliar with EagleCAD and CNC stuff these links are a great primer.

  • Sparkfun’s excellent EagleCAD tutorials #1, and #2.
  • G-code, and other CNC stuff @ CNC Cookbook

The Eagle file I'm working off of here is attached to this page. Feel free to download it for reference. All of the traces and outlines are already drawn.

Step 1: Install the Software

Before I get started, I want to acknowledge that there are some great tools out there for generating gcode for milling pcbs. FlatCam and pcbgcode are two that are used often. There are a couple major differences from what we are going to do.

Flatcam and pcbcode automatically generate milling paths to outline each trace, we are going to be drawing our own. This allows for more control over where the tool moves and makes more efficient and faster jobs and less wear on the tools. We're using a ULP (more on this later) inside of Eagle, so there is no separate software to install. This simplifies the workflow. And finally, we will have our Drills actually milled to size. This means that if you draw a 1/4inch hole, it will be milled to 1/4inch instead of requiring a 1/4inch drill bit to drill the hole.

We are going to be using a User Language Program inside of EagleCAD to generate our gcode. To install it, download it from this page and put a copy in /Eagle/ulp/. Restart Eagle and you should see it in the control panel. To run a ULP, simply type RUN in the command line followed by the name of the ulp, but we'll get to that later.

First lets draw some lines

Step 2: Setup the EagleCAD Project

We're starting with a very simple Eagle file. It's a resistor, an LED, and a two pin header for power. The completed files are attached to this page. At this point I've already laid out the board. I am displaying Layers 1-20, 45, and 46. I find it easiest to draw toolpaths this way, without any extraneous information displayed.

We're going to start by drawing in the Mill toolpaths. As mentioned above, we can use 4 different endmills here, a 0.01inch, 0.015inch, 0.031inch, and 0.062inch. The width of the Wire we're drawing selects the tool. To select a tool, simply change the width of the Wire to match the diameter of the tool. I like to use the largest tool possible for a situation. In this example I will be using a 0.031 endmill because I don't need anything smaller. For some fine pitch surface mount parts you will need to go as small as 0.01 to fit between the leads. In the Command Line type: "layer 46" to select Layer 46 for drawing, then type: "wire" to select the Wire tool. Change the width of the Wire to 0.031 by typing into the dropdown menu then draw wires around each trace, isolating them from the others. You'll notice the wire over-laps the pads of the 2pin header slightly, this is not a problem. If you don't like it, you can use 0.062 width here instead.

Next is Drills. Each hole that goes all the way through the board is included in the Drills file, and they are all milled to size. This includes three different elements, Holes, Vias and Pads (only through-hole pads). Drills also uses a 0.031 endmill, so if you have a Drill with a diameter smaller than the endmill diameter, it isn't going to work (and will create an error in the gcode file). Using endmills other than 0.031 is currently not supported. I have two 0.125 holes on this board for mounting. With Drills, there is no need for additional prep work before running the ULP.

The Dimension layer is next. This is the layer that defines the outline of the board. The Dimension layer is Layer 20, and the outline is by default a Wire with a width of 0. It will generate a toolpath no matter what the width for a 0.031 endmill. These toolpaths define the path of the CENTER of the tool, which means with a tool diameter of 0.031, the board will be undersized by 0.031. If you don't need a precisely sized pcb, don't worry about it. If you do, you must offset the Dimension outline be 0.0155inch from the center of the board. I also like to change the width of the Wire to reflect the tool diameter.

Step 3: Generate Gcode

In the command line, type: “run stepcraft.ulp” and you should see a dialog pop up. You will need to measure the thickness of your PCB carefully and input it into the Dialog Box (in mm). You can also change the target layers for the Milling and Dimension toolpaths, and the milling depth. I use 1.6mm thick FR-2 PCB’s with 1oz copper cladding, and these setting work well for me. You can also select (or de-select) any of the three outputs if you don’t want to generate a Mill, Drill, or Dimension file.

Under the Advanced tab, you can change the speeds and feeds for each different tool, and select what you want to export with the Drills file. Please use caution when changing these values, tiny end mills are fragile and expensive.

Once the settings are set, press Generate, and it should produce 3 files in the folder of your .sch and .brd files. They will be labeled filename_mill_031.nc, _drill.nc, and _dimension.nc. These are your 0.031 mill file, your drill file, and your dimension file. Open them in a text editor and you’ll see g-code. Open them with a g-code visualizer, such as camotics, and you should see the toolpaths.

Step 4: Run the Jobs

From here you can run the files as any other job in UCCNC. I do the Mill, then Drill, then Dimension jobs. You want to do Dimension last, because it will cut out the board. I have a piece of upsidedown PCB as a waste-board which I have faced so that it is perfectly level and flat. I use double sided tape to hold down my work pieces.

Getting the Z axis zeroed correctly and accurately is REALLY important for doing PCB milling. If you're off by a few thousands of an inch it's easy to break these tiny endmills. Using a touch-off sensor would be very helpful here, see my Instructable on building one if you like.

All is ok. but its not generating milling file.. only creates dimention.nc and drill.nc file
<p>hy</p><p>looks great. i have a eagle board where the Millpath is in the Layers 16, 17 and 18. is it possible with your ULP to create the nc file also from more then one layer. the drill and dimenson nc file are created perfectly. thank's</p><p>remo</p>
The answer to what you're asking is this:<br>It will only work to have your milling paths on one cohesive layer for each bit size you plan on using. <br>Probably the bigger issue here is that you're drawing milling paths on layer 16, which is the bottom copper layer. Don't do that. <br>You can move wires to different layers by getting the info of each segment and assigning it to a different layer. Or you can just re-draw them. <br>Does that help? <br>Also post a picture of what you're working on! Glad you're using this tool.
<p>thanks for the replay. the pcb Eagle file ist the following:</p><p><a href="http://support.pc-service.at/selfbus/Dimmer/KNX_3Dimmer_TS-DIL_Triac_V1C.zip" rel="nofollow">http://support.pc-service.at/selfbus/Dimmer/KNX_3D...</a></p><p>and the Project i'am workink on it:</p><p><a href="http://selfbus.myxwiki.org/xwiki/bin/view/Selfbus/3+Kanal+PWM+Dimmer" rel="nofollow">http://selfbus.myxwiki.org/xwiki/bin/view/Selfbus/...</a></p><p>Is there a way to generate NC with your ULP?</p><p>regards remo</p><p><br></p>
<p>My ULP generates NC files, that's what it does. </p><p>What mill are you using?</p>
<p>hey</p><p>my Mill ist a Stepcraft 420 with HF 500 Spindle. </p><p>I want to Test your ULP File at X-Mas Days. </p>

About This Instructable

15,565views

164favorites

License:

More by kinasmith:How to Mill a circuit board with a Stepcraft Mill and EagleCAD Make a Tool Length sensor for Stepcraft 2 CNC Compost Sensor 
Add instructable to: