Introduction: How to Convert and Mill Your PCB Layouts on Your CNC

Picture of How to Convert and Mill Your PCB Layouts on Your CNC
This is a small tutorial showing how to deal with the problems converting your PCB Schematics to G-Code to be able to Mill it.

Used Software.
DipTrace :
CopperCAM :
Mach3 :

I used DipTrace form y PCB Layouts but any software cable of saving Gerber files can be used. Its Free if you can be under 300 pins. Witch works fine for most of my projects.

To control my CNC Mill I use Mach 3, but any other software can be used such as LinuxCNC and EMC2.
But for me I think the 175$ for a Mach 3 License is well spend since it’s a great peace of software.

I also got an license for CopperCAM for 80 € which is good given out and don’t have to mangle with a lot of conversation programs and scripts. Her I gave a great GUI and can see what’s happens and change the settings easily.

I will make the Tutorial both as a Video and Images Step by Step Guide

The Video can be seen her, the Image and Text Step by Steps on the next pages.

Step 1: Exporting PCB Design

Picture of Exporting PCB Design

Have your PCB Design Loaded in DipTrace and go to File /Export / Gerber…

Select the Top Layer and click Export chose Yes to use the automatically apertures and save the File eg. “Top.gbr”
Select Board Outline and click Export chose Yes to use the automatically apertures and save the File eg. “BoardOutline.gbr”

Close the Export Gerber window.
Select File /Export / N/C Drill…

Check the settings and click Export chose Yes to use the automatically tools and save the File eg. “Through.drl”

Then Close DipTrace and start CopperCAM.

Step 2: Exporting G-Code in CopperCAM

Picture of Exporting G-Code in CopperCAM

Start CopperCAM

Goto Files / Open / New Circuit.. and select the file Top Layer file “Top.gbr”

Goto Files / Open / Drills.. and select the file N/C Drill file “Through.drl” and click Yes if the Drill Holes look to be placed correct.

Goto Files / Open / Additional layer.. and select the file Board Outline file “BoardOutline.gbr” and click Yes if Board Outline look to be placed correct.

Select Layer 6 (Card Cutout)

Goto Files / Offset.. set Dx = -2,5 and Dy=-2,5 and click OK, this will place the PCB Layout in the correct place in the Card Cutout.

Select the Calculate isolating toolpaths icon, select the number of extra contours the engraving bit shall run abound the tracks. I use 1 both places. And click OK

Now you should see how your PCB will look like. The view is from the Top thru the board to it have to be inverted. But we will do that under the export process.

Select Parameters / Tool library..

And set up the number of tools you are going to use.

For my example
1 : 10 degree V-Bit for Engraving
2 : 1,3 mm Drill for Cutting
3 : 0,8 mm Drill for drilling 0,8 mm holes.
4 : 1.2 mm Drill for drilling all 1,2 mm holes and those a bow. So that I don’t have to change drills too often.

And click OK

Select File / Origin

Enter the values X=2 and Y=2 and select OK

This will change the Origin Point where the CNC will start from so that the start point is where the corner of the board so that you easily can position the CNC and don’t get too much waist material.

The White Cross will mark the Start Point.

Select Parameters / Select tools.. her you can change some option on how your G-Code shall be with travel speed and use of Bits with more.

I change under Drilling Tools “Use for each drill the closest small tool, with circular boring
And “Allow circular boring for all holes over “ is set to 1 mm.

In my setup, it will then end up with one file for 0,8 mm drilling and one for 1,2 mm and it will then use the 1,2 mm drill for all holes witch is bigger, this saves me a lot of changing drills since I can do it all with only 2 drills.

Click OK

Then to the last steps exporting the G-Code for the tool’s.

Click the Mill Icon to generate the Output files.

Select Section #1 and chose “Engraving layer #1” check the Flip X box.
This will invert the design.

Select OK, this will Open a Notepad windows with the G-Code for the selected task. Save that eg. As “Engrave.txt”.

Click the Mill Icon again and change the  Section #1 to Drilling (Tool #3 ø 0,8) check the Flip X box.
Select OK, this will again Open a Notepad windows with the G-Code for the selected task. Save that eg. As “drill_08.txt”.

Click the Mill Icon again and change the  Section #1 to Drilling (Tool #4 ø 1,2) check the Flip X box.
Select OK, this will again Open a Notepad windows with the G-Code for the selected task. Save that eg. As “drill_12.txt”.

Click the Mill Icon again and change the  Section #1 to Cutting out check the Flip X box.
Select OK, this will again Open a Notepad windows with the G-Code for the selected task. Save that eg. As “Cutout.txt”.

Now you have 4 files with G-Code for the necessary tasks.

You can run them in the order you like. But you should always run the Cutout as the last one.
I prefer the following order.
1 : Engrave
2 : Drill 0,8
3 : Drill 1,2
4 : Cutout

Now start your favorite Milling program and get ready to Mill.
A video of this process of my example is in the last port of the Video.

Step 3: The Finish Result

Picture of The Finish Result

Her are 6 images showing the PCB after each step.

1. After Engraving.
2. After 0,8 mm Drill
3. After 1,2 mm Drill
4. After 1,2 mm Cutout
5. The cleaned and ready to use PCB
6. The Complete and assembled PCB


victoriano (author)2017-08-28

Some body know how to put a circular card contour in coppercam ??

Balintos (author)2016-12-04

Does anyone know how to make coppercam to put a line number (N***) in front of every line? I have a demo Mach3 and i can run only 999 line Gcodes, so I have to cut the g-code lists into 999 line pieces. Or is there any other solution?
Many thanks

petercd (author)Balintos2017-01-23

Use Florian Balmer's Notepad2 and under the "view" tab, select "line numbers".

ZawZ3 (author)2016-06-29

I need control circuit diagram,please give me

ZawZ3 (author)2016-06-29

I need control circuit diagram

RudyD7 (author)2016-02-15

Thanks for tutorial....

avinashk (author)2016-01-13

HI dear centauri, thank you very much for sharing such a useful info. as i ma a layman in software part i was not able to generate g codes to run my diy cncs,finally today i could generate some n run my m/c, however request pls kindly post some info about mechanical cad cam,wit g code generation. regards n keep posting such info

gta18 (author)2015-11-10

Hi, can you post the gcode files too? I want quickly check my 3040 cnc router and see how it performs with engraving pcb's. Thank you very much!

RafaelL3 (author)2015-03-08

hi I have a question, how do you control the axis z? my machine starts on and the axis z does not go up and then down instead just keep the same altitude and damage the PCB.


centauri_dk (author)RafaelL32015-11-02

I zet my Z axe with a Probe witch i have made a tutorial about her

lakmal roshan (author)2015-08-09

I have create PCB by dip trace and convert it to g cord by copper cam

after that i was loaded the g code file to mach 3 and run the machine.

but drawing scale is wrong. what is the reason my mach 3 is licence version

please give me solution

It can be if ist in mm or inches its how your pcb software export the files and how you import and export it in CopperCam again.

JasonMB1982 (author)2015-10-30

How long did it take for you to receive your coppercam license once you sent payment? It's going on 5 days since I sent payment now and I don't get a response to emails from them either.

centauri_dk (author)JasonMB19822015-11-02

I got the Licens the day after i orderd it.

maher471 (author)2015-10-31

great work

maher471 (author)2015-10-31

great work

lakmal roshan (author)2015-08-09

lakmal roshan (author)2015-08-09

ashokejia (author)2014-12-29

my copper-cam is not generating board outline gcode but the engraving and drilling are generating please what can cause it, i have follow the step by tutorial and video on youtube everything seems to be ok this is the code it generate for the cutting

(( CopperCAM 3 - 17/11/2008 / ISO-Mill Output )

( C:\COPPERCAM\CopperCAM.iso created 29/12/2014 at 07:29 )

( Workpiece dimensions: 46.914 x 67.081 x 2 mm )

G00 G90 G94 G71 G40 G54 G80

T2 M06

M03 S8000

G00 F3000

G00 Z2




with this the main gcode is not generate how can i resolve it


jpcgt (author)2014-10-17

Hi everybody, FlatCAM has become the most powerful open-source PCB to G-code out there and has a new website:

jpcgt (author)2014-02-14


I just released a program for preparing PCB for a CNC router/milling machine. It's free, open source, and aiming to be more powerful than what's out there already. Check it out at:


centauri_dk (author)2014-01-04

I am actually using cheap v-bits from eBay.
I also had problems with the tip breaking off. But looked like it was because when I run through my gcode it got to deep in the PCB because of the start distance of my V-Bit and the PCB Board.
I then began to use the Probing Method as I also have made a tutorial about
With this I am 100% sure that the Tip of the V-Bit is just touching the PCB Board.
You can also use a piece of paper and move it around under the V-But and lower the V-Bit until you can’t move the paper anymore then you also know that you are right on the PCB Board.
Hope that helps.

marzouin (author)2013-12-30

Hi, Nice video!

I've been trying to mill pcd with the same setup that you are using (mach3/coppercam and a cnc). But I have difficulties to do thin trace. I've tried many ebay's carbide cutter but their tips always break. What are you using ?

araripe (author)2013-07-12

Congratulations. Very good instructions. It will be very useful to me. How much lines of gcode was generated to this pcb? Is there an free (or trial) alternatives apps to CooperCam? I just finishing constructing my cnc and I am in test phase. I would like to try milling a pcb but I want to try some apps before choose the one I will pay for licenses. By now, my cnc is working well with mach3 (trial) and gcode files written by myself.

centauri_dk (author)araripe2013-07-15

Hi Araripe
First Yes there are Alternatives to CopperCAM, there is
But i personally found CopperCAM the easiest to use. So for me the Money was well spend.
You can also use alternatives to MACH 3 which is Free and run uner Linux as, EMC2 and LinuxCNC.
Because with the Free version of MACH 3 has the limit of 300 lines of G-Code you cant make much.
Just for a simple design an my PCB design her the number of code lines is.
Engraving = 1735
Drill 0,8 mm = 91
Drill 1,2 mm =47
Board Cutout = 25
So as you can see the Engraving part would be a problem with the Free MACH 3 version.

incognito0288 (author)2013-07-07

nice instruction s

About This Instructable




More by centauri_dk:Mach3 Zero Probe ToolMach3 Camera ControlHow to Convert and Mill your PCB Layouts on your CNC
Add instructable to: