‎ > ‎Diversions‎ > ‎

Milling a Copper PCB

How to mill a circuit board:

UPDATE: Check out my page on etching PCB's instead, it's much better!

From schematic to copper board, getting it done.

Note: This page is now *really* old, dating from about 2005. In the interim, I may have lost the images. I'll try to post them again, but it will probably take a while.

I have been creating PCB's for a number of years now, having tried every variant of circuit building from dead-bug circuit assembly, to solderless breadboard asembly, to soldering generic boards, ordering prefabricated PCB's, etching my own PCB's, and milling my own PCB's.

Only recently have I begun to mill my own PCB's, using a CNC milling machine in our lab at McGill. I actually bought the mill specifically for milling PCB's, making custom optical mounting parts, and for trying to make microfluidics.

Designing PCB's is easier than it would seem. Some software makes it extremely easy, such as PCB123, where you can create a schematic, and transfer it into a PCB design. Then the software will automatically submit the PCB design to the manufacturing company, and a few days later a polished board comes back in the mail.

The only drawback to the process is that the PCB123 services are fairly expensive for an iterative tinkering process like the one I go through. At 200$ a pop, it's not fiscally reasonable to try 10 variant circuits to see which one works (high speed, surface mount electronics are not very forgiving).

So I began milling my own boards. (All of the photos in the article are grouped at: Not currently grouped anywhere)

I use Eagle 4.14 Light from CadSoft to design and create the board layouts. While it's not very intuitive, it is versatile, in that it allows creation of custom part libraries. It also has functionality to do both the schematic design, and the PCB design, with a certain degree of automation on the process. The optimizers for generating circuit trace layouts are also very useful. Considering the features, and that the program is free (for small boards), this program is really the only option I really considered for my work.

I am usually fairly quick at picking up how to use software, but Eagle isn't intuitive, so I would highly recommend that anyone interested in using Eagle follow a tutorial online (this is an excellent eagle tutorial) before using it in their projects. I also found a detailed MIT tutorial/documentation manual for eagle. Especially useful is the portion of learning to create your own part library, as many common electronics parts are missing from the standard libraries.

Here is the circuit I'm trying to create. First is the schematic, drawn in Eagle, then the PCB design.

Once you have designed a PCB, it can then easily be exported to gerber, gerber 274x, or excellon formats. The export process is a bit confusing. In particular, when submitting projects to Alberta Printed Circuit, I had to iterate a few times to finally get things right. Mind you, the circuits APC made for me were absolutely perfect, and I would suggest that their poor customer support (I had trouble getting answers to my questions) was more than made up for by the quality of the circuits they produce.

Alternately, there are 'User Language Programs' in Eagle that allow the PCB's to be exported in other ways. For example, I used the outlines.ulp program to export an outline file for the top layer of my PCB. This created a file named pulser.scr, which contained the information necessary to mill a corresponding PCB, except in the wrong format.

The outlines file is exported with the dimensions in millimeters, with a series of wires specified as rectilinear points. The milling machine I have (the CNC-converted TAIG 2018, using kcam) requires g-code (a series of instructions for the milling machine), specified in inches.

Using outlines.ulp in Eagle to export g-code for milling

At David Setya Atmaja's website (Previously located at, but no longer functional), under part G. (G. Result), I found a description of how to export g-code from Eagle.

Unforutnately, The description given there is a bit vague, so I'm elaborating here.

First, design the PCB.

Next, we will export the PCB outline milling file, one layer at a time. I will give a description for how to mill the top-side of my PCB.

The exact description of how to use the outlines.ulp program is given in Application/EAGLE-X11/help/124.htm (in my Eagle 4.14 on Mac Os X).

Unfortunately, the help file incorrectly specifies how to generate outlines. It describes that the following steps are necessary, but in fact, they are not. Skip to the next bold statement unless you are interested in knowing what the incorrect help suggests...

You must define a POLYGON in the layer you wish to export the outlines for. To do this, click the polygon tool, choose the proper layer (I'm using the top layer), and draw a rectangle that includes your entire circuit.

Use the 'Name' tool to rename the polygon to _OUTLINES_, and change it's 'rank' to 6. First, use the 'Info' tool to check what the current rank is. My _OUTLINES_ polygon was of rank 1. Use the 'Change' tool, to change the rank to 6, by clicking Change->Rank->6, then clicking on the polygon. Verify that it has changed to rank 6 with the info tool.

Last, change the width of the polygon to the width of the milling tool, by clicking Change->Width->'...', and typing in the width of the milling bit. Mine is 0.01 inches (0.25 mm). Just to err on the safe side, I set the width of the lines to 0.02 inches. I could see the outline rectangle line become much more narrow. Last, click the 'Ratsnest' tool (it is at the bottom-left of the tool-panel, and looks like 5 green dots connected by diagonal lines). The polygon rectangle will seem to fill in.

Here's what you actually need to do:

In the Eagle control panel, I clicked 'User Language Programs'->'outlines.ulp', right clicked it, and chose 'run in board'.

I set the device as 'Script', the width to 0.02, the layer to '1 Top', and the output file as 'pulser_r2_.scr'.

Look in you project directory, you will have the necessary .scr file.

I wrote a program in Matlab, which I named gcoder.m, which converts the outlines file into a g-code file. A second program, called gcodeplot.m can be used to plot out the milling pattern that has been generated. This should produce a plot tracing the edges of your circuit wires.

Using gcodeplot.m is simple, just set the options at the top of the file (make sure it's reading your '.ulp' file). When you run the program, it will generate a plot that shows the board that should be milled. Using gcoder.m is just as simple (make sure it's reading your '.ulp' file, and the milling heights and feed rate are correct...). The gcoder.m program will output the gcode to screen, and you should copy and paste it (as plain text), into a file named 'pulser_r2.gc' (kcam tries to read '.gc' files by default).

Unfortunately, it seems that kcam only handles a few hundred lines at a time. So I need to break the g-code file into a series of files, each with less than 400 lines.

The following is a list of the example files, which are all included in this zip archive:

  • An example outlines file, generated by Eagle 4.14 lite.
  • gcoder.m for converting eagle outline files to gcode, which is used with Matlab (written with Matlab version 7, but should work with most versions).
  • gcodeplot.m for plotting the eagle outlines file, which is used with Matlab.
  • The G-Code produced by gcoder.m from the outlines file.
  • File 1 of the gcode, after being split into 3 files. Note that I also removed the feed rate commands later on.
  • File 2 of the gcode, after being split into 3 files. Note that I also removed the feed rate commands later on.
  • File 3 of the gcode, after being split into 3 files. Note that I also removed the feed rate commands later on.
  • Gcode I wrote to mark a 0.20 x 0.20 inch 'X' at the origin (position 0,0). This x is traced so that the machine can be re-aligned if it deviates from the true position.
  • Gcode I wrote to return the milling bit to the origin (position 0,0). This should center the bit over the calibration 'X'. If it deviates from the true position, then the machine can be precisely re-aligned manually (which doesn't take long).

Using the mill itself

Before trying to mill anything, I suggest that you test your code first. I thought about this for a long time, and the easiest way to test things without risking expensive milling bits is to mill into wax. Yes, wax. It's re-useable, and soft enough that it won't damage anything. On the downside, if it heats up, it will melt the wax, so you won't have a fine version of the milled object. Also, the little wax bits will probably clump back onto the surface, so you won't have a fine resolution. I didn't even use a milling bit, as I used a pen tip in the mill, and didn't turn on the spindle (I was just tracing the circuit into the surface).

After verifying that the g-code didn't push the head below the work-surface, I tried using a pen-tip to plot the circuit onto paper. This is a great way of checking to see if the circuit looks right (and to check for the precision of the machined traces). I spray-glued a paper index card onto plexi-glass, and placed a piece of cardboard under the plexi-glas. This ensured a bit of give under the plexi-glas, so that the pen tip wouldn't push too hard onto the surface. This gave an excellent trace of the circuit, giving me confidence that the process was right.

The results generally come out quite well, and I have successfully milled PCB's with this setup.

Important notes on milling PCB's

I have read that kcam requires a computer with a processor faster than 500 MHz. I have been using an original pentium-1 MMX 200MHz, with 40 megabytes of ram, under windows 98 to operate the mill. It does work.

When I use a feed rate of less than 4 inches per minute, I notice that a lot of steps are skipped. With the mill at 4 inches per minute, it runs fine so long as I regularly re-tune the machine (by forcing it to re-calibrate the system timing). I also re-calibrate the position regularly, milling a cross at 0,0 to use as a tuning point.

While milling my first PCB, I had some problems.

First, you will notice that the 0.5mm diameter bit milled the traces off the board completely. For creating circuits with surface mount components, you definitely need a 0.25mm diameter bit.

Once I started using the 0.25mm bit, I encountered a second set of problems. The traces were milled beautifully, however the registration would go off.

I milled the circuit to the right at 3 inches per minute, using an 'Injectorall' 3x4 1/2" double sided copper-clad 2oz copper plated 1/16" thick epoxy glass board. I used the 0.01" bit from KBC tools, SKU number 5-100-51005 (.010 4FL MINI CC CARBIDE END MILL MA FORD).

The bit worked extremely well, though because of the feed rate, the positional tracking was far off.

My second PCB worked quite a bit better.

This PCB turned out quite well.

This was done using a 6"x6", 1/16" thick double sided copper-plated PCB from ABRA electronics.

I'm not sure what the problem was, but I snapped two 0.01mm bits while milling this board. I had increased the feed rate to 5 inches per minute, but both bits held up for a while before snapping. I suspect that the copper is thicker on this board than on the Injectorall board I had previously used.

Most of the traces appear much rougher than the previous circuit I milled. There's a good reason for it: after snapping the two bits I had, I decided to use the broken bits as scribes. They worked incredibly well (considering they were broken).

The edges of the milled traces lifted slightly, as the bit wasn't cleanly cutting the copper out of the groove. So copper ridges were left once I was done. I sanded these off using a fine sand-paper, and tested to see if all the traces were electrically isolated from the uncut flat region of the board.

Most of the traces were fine, however, a few traces had small bits of copper bridging them. After scraping them out with the end of a pin, the traces were perfect (or at least good enough for government work).

I also made sure to re-calibrate position many times while milling this board, first by milling a cross into the 0,0 position, and then by re-centering the bit at 0,0 every few hundred GCODE lines. I also checked the z-position, and you'll notice the resulting 0.01mm diameter spots all over the board.

I still have to drill the via holes, and solder the parts on, but it looks like this board will work really well.