Milling a PCB designed in Eagle with a ShapeOko 3

This post explains how I am milling PCBs, designed with Eagle, using a ShapeOko 3.
There are certainly many other ways of achieving this, like by using a probe.
But this is the simplest, while reliable, way that I found so far.

Design your PCB

The first step is obviously to design your PCB in Eagle.
I won’t go into the details about how to do that step into this post.

The example I am going to use is a SOP-16 to DIP adapter.
I currently need that adapter for my new CH340G SOP-16 chips.
I want to experiment with one of those chips, on a breadboard, before designing and soldering them on a real PCB.
That adapter will also be useful for any other SOP-4 to SOP-16 chips, so I will produce a few of them for future use.

eagle-sop-16-10

eagle-sop-16-2

Exporting GCode from Eagle

Once you are done designing the board, your are ready to export the GCode.
Open the Tool | Mill Outlines… menu option.

It will open the following screen:
eagle-sop-16-3

The screen capture shows you the settings I am using most of the time.
I will select the “mirror” option when I am using through-hole components on my board except in cases like this example where the headers don’t really have any orientation.
As explained a bit later, I am using a 0.5 mm engraving bit but I configure Eagle with 0.4 mm and get good results.

At the top of the screen, click the Z axis tab to go to the following screen:
eagle-sop-16-4

Again, the screen shows the settings I usually use.
Pay attention to the “Z milling down” value, which is at 0.1 mm.
I modify that value, directly in the GCode, once the file has been exported from Eagle.
The rest of the instructions will assume you are using the same value.

Press the OK button.
You will get a message, in German, saying that the gcode was exported.
The GCode is in a new file called something .ncd as in this screen capture:
eagle-sop-16-5

Fixing the GCode

The next step is to fix the GCode so it is understandable by our ShapeOko.

Removing or replacing GCode lines generated by Eagle

Instead of always fixing everything by hand, I wrote a small Java program that you can download from here. To get the program, press the “Download Zip” button, in Git. The zip file can be found in your “Downloads” folder.
I published the Maven project & source code.
I also included the compiled program (.jar file) that can be used directly instead of compiling the project.

Copy the fixer.jar file on your computer and then you can run the application like this:

   java -jar fixer.jar -input .\input.txt

Or simply copy the fixer.bat file in the same folder and use it to execute the program.
You will have to change the command line to put your input file name instead of input.txt.
I simply put the input file in the same folder as the fixer.jar file to make things simpler.

Here is what I get, on the console, with that example:

I:\>java -jar fixer.jar -input .\input.txt
Attempting to read file: .\input.txt
Finished reading the file: .\input.txt
Starting to fix GCode
Dec 22, 2015 6:42:55 PM gcode.fixer.linefixer.AbstractLineFixer logRemovingGCode
INFO: Removing the following GCode line: M48
Dec 22, 2015 6:42:55 PM gcode.fixer.linefixer.AbstractLineFixer logRemovingGCode
INFO: Removing the following GCode line: M71
Dec 22, 2015 6:42:55 PM gcode.fixer.linefixer.AbstractLineFixer logRemovingGCode
INFO: Removing the following GCode line: M999 Gesamt 16 ; CNC-Drills
Dec 22, 2015 6:42:55 PM gcode.fixer.linefixer.AbstractLineFixer logReplacingGCode
INFO: Replacing the following GCode line:
G36 T10
with:
G00 Z30.0 F200.0
G00 X0 Y0 F200.0
M06 T10
Finished to fix GCode
Starting to write output file: .drill.txt
Finished to write output file: .drill.txt

Attempting to read file: .\input.txt
Finished reading the file: .\input.txt
Starting to fix GCode
...
Finished to write output file: .traces.txt

Attempting to read file: .\input.txt
Finished reading the file: .\input.txt
Starting to fix GCode
...
Finished to write output file: .cut.txt

I:\>pause
Press any key to continue . . .

What did the program do to my GCode?

First of all, it didn’t change your original file! 🙂

The fixer created 3 files from your original Eagle GCode file:
– drill.txt for drilling instructions
– traces.txt for PCB traces instructions
– cut.txt for instructions to cut the PCB from the copper clad.

My first attempts with using GCode from Eagle were not great.
The CNC would mill the PCB traces properly but would also scratch the PCB copper surface at many places when re-positioning the tool. So, to deal with that issue, I had to cheat the CNC a little bit.

So, what I do now (when milling PCB traces) is the following:
– I find the real zero for the Z-Axis.
– I move the tool 1 mm up (if you don’t do that step, the tool may get broken when the CNC starts to move).
– I tell the CNC that this is the Z-Axis zero while the tool stands 1 mm above the surface.
– I update the GCode to tell the CNC go down by 1.2 mm while milling so it goes 0.2 mm deep in the PCB.
That way, I never have scratches on my board anymore.

So, the GCode fixer did the following changes to you GCode:

Replace: G01 Z-0.10
With:    G01 Z-1.20

Replace: G00 Z00.10
With:    G00 Z01.20

It also:
– Replaced G36 instructions with M06 and added instructions to position the router in a way that you can change the tool easily.
– Removed the lines with the following instructions: M30, M48, M71, M74, M999, #.
– Fixed G00 instructions to add a proper feed rate (speed at which the tool moves).
– Fixed G03 instructions to use (I,J,K) coordinated instead of (X,Y,Z)
– Replaced M998 instructions with “G00 X0 Y0”.
– Added “G00 X0 Y0” at the end of each file to the tool is at the original position.

Setup the copper clad on the CNC bed

Make sure the CNC bed is level.
Stick your copper clad to the CNC bed, with masking tape, like this:
cnc-copper-clad

Install drill bit and power on ShapeOko

We will first drill the holes on the PCB.
So, I insert a 1.0 mm drill bit into my router.

Then, I:
– Power the router
– Connect the USB cable from my ShapeOko to my PC.
– Power the servo motors
– Close the door of my CNC enclosure to reduce noise, dust and make it safer for me… just in case something breaks.

Calibrate to Zero

Using Carbide Motion, I move the tool until it is positioned to what I consider to be the position (0,0,0) for my project. For the Z-Axis, I simply move down the tool, by .1 mm steps, until I see it touches the copper.

Run Carbide Motion.
Click “Connect Cutter”.
Select the “Move Cutter” mode.

carbide-motion1
Use the controls to move your drill bit to the right position.
When positioning the Z axis, make sure to use the .1 mm move increment when you are getting close to the surface so you don’t hit the surface too hard and break the bit.

When the bit is at the right position:
– click the “Set Zero” button
– On that new screen, click the “Zero All” button, then the “Done” button
– Move the tool 1 mm above the PCB surface
– Click the “Quit Jog” button.

Your drill bit should now look like this:
1mm

Run the “drill.txt” GCode

In Carbide Motion:
– Click the “Load Project” button
– Select the “drill.txt” file
– Click the big “PLAY” button.
carbide-motion2
– Wait until it’s done drilling all the holes.
drilling

Install the engraving bit on the ShapeOko

First, POWER OFF YOUR ROUTER but DO NOT POWER OFF THE SERVO MOTORS so the router & tool don’t move.
Replace the drill bit with the engraving bit.
If you do not have enough room to switch the tool, you can go back to the “Move cutter” mode to move the router higher on its Z axis. This will not cause any issues.
I am using 0.5 mm engraving bits like this one (do not confuse with 0.5 mm drill bits):
20151221_153729
I prefer that tool to V-Shaped engraving bits. It is more expensive but much less sensitive to the accuracy of your Z position. If you go too deep, with a V-Shaped bit, the groove is larger than what you expected. With what I use, it simply makes no difference.

For that step, the calibration to zero is slightly different.

When the bit is at the right position (0,0,0):
– Move the tool 1 mm above the PCB surface
– click the “Set Zero” button
– On that new screen, click the “Zero All” button, then the “Done” button
– Click the “Quit Jog” button.

Yes, that means our Z-Axis zero is actually 1 mm over the PCB surface. This is to match the changes we did do the GCode previously.

Run the “traces.txt” GCode

Same steps as for the drill.txt file.

Install the cutting bit on the ShapeOko

We are now ready to cut the PCB from the raw copper clad.
To do so, we follow exactly the same steps as for the drill bit except that we use a 2 mm endmill instead.

Run the “cut.txt” GCode

Same steps as for the drill.txt file.

The end

You should now have your PCB. It is still fixed to the raw copper clad by a few small pieces of plastic that you can simply cut.
pcb-sop-16-final

sop-16-adapter.jpg

3 thoughts on “Milling a PCB designed in Eagle with a ShapeOko 3

  1. claudeSt

    hi, where can I buy a good quality of the the 0.5 mm engraving bit that you use to cut the board ? I used to use v shape engraving bit but with no good success.

    thanks

    Reply
    1. Francois Post author

      Hi Claude,

      Sorry for the late reply.

      So far, I have been using bits that can be purchased from eBay. But I will soon give it a try with “professional” bits. I will post something as soon as I have a chance to try them out!

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments Protected by WP-SpamShield Spam Plugin