Prototyping quality PCBs on a CNC router - Part I
This article lays out steps to develop quality prototype PCB's using a CNC routed approach, per the example in exhibit 1
Discussion
There are many steps in the development of PCBs no matter which approach is adopted, this approach uses two open source (free) software packages being KICAD and LineGrinder, and also one licensed software package being Mach 3
A key assumption in this article is that you are familiar with the tools at your disposal, in particular the operation of the CNC, and Mach 3 and LineGrinder. Inexperience shows in numerous failed attempts resulting in spoiled boards, and broken tool bits if you are learning these tools at the same time as attempting to make a usable product.
No guide would be complete without the mandatory safety warnings. Take care in using these tools, the machinery operates according to the instructions you give it, and does it quickly and powerfully. Use appropriate eye protection, keep loose clothing away from moving parts and ensure your emergency stop button works ( mine did not !!)
Good luck..
Routing Approach
The diagram below represents the high level tool chain used in this method, this article is aimed at the routing components related to using Mach 3 CNC routing software.
Mach 3 interprets the G Code developed by the LineGrinder , which has previously translated the Gerber output of KICAD schematic and PCB development software. In other articles we will discuss these elements
In essence this article focuses on the 6 steps on the right of the chart.
Mach 3 Step 1 – Bed Flatten
To have any confidence that your board will exit these 6 steps as a worthwhile product, it is important to ensure the CNC machine is working on a flat and level surface. The tolerances here are tight, so starting out flat is important, how you get to this position is not really important, but it is a mandatory first step.
The LineGrinder software provides a Bed Flattening option as part of the EdgeMill option module, alternatively Mach 3 comes standard with a wizard to cut a rectangular pocket.
Use a sacrificial piece of wood to hold your blank PCB and you can use either one of these tools to ensure the bed is flat and level Typically for a 250mm x 250mm (10” x 10”) you would need to take about 1mm (0.040”) across the whole surface.
The flattened area should be approximately 25mm (1”) wider all round than the blank PCB. Thus is to allow us to tape the board down. In my case that was 175mm x 230mm (7”x9”) for a 100mmx150mm (4”x6”) board.
Drill 4 holes manually using the CNC and a 2mm (0.08”) End Mill to hold board alignment reference pins which will align the blank board to the CNC X & Y axes (exhibit 3). I use panel pins
Exhibit 6 Cutting the edges
Exhibit 8 a few notes

Exhibit 1
Discussion
There are many steps in the development of PCBs no matter which approach is adopted, this approach uses two open source (free) software packages being KICAD and LineGrinder, and also one licensed software package being Mach 3
A key assumption in this article is that you are familiar with the tools at your disposal, in particular the operation of the CNC, and Mach 3 and LineGrinder. Inexperience shows in numerous failed attempts resulting in spoiled boards, and broken tool bits if you are learning these tools at the same time as attempting to make a usable product.
No guide would be complete without the mandatory safety warnings. Take care in using these tools, the machinery operates according to the instructions you give it, and does it quickly and powerfully. Use appropriate eye protection, keep loose clothing away from moving parts and ensure your emergency stop button works ( mine did not !!)
Good luck..
Routing Approach
The diagram below represents the high level tool chain used in this method, this article is aimed at the routing components related to using Mach 3 CNC routing software.
Mach 3 interprets the G Code developed by the LineGrinder , which has previously translated the Gerber output of KICAD schematic and PCB development software. In other articles we will discuss these elements

Exhibit 2 Toolchain
In essence this article focuses on the 6 steps on the right of the chart.
Mach 3 Step 1 – Bed Flatten
To have any confidence that your board will exit these 6 steps as a worthwhile product, it is important to ensure the CNC machine is working on a flat and level surface. The tolerances here are tight, so starting out flat is important, how you get to this position is not really important, but it is a mandatory first step.
The LineGrinder software provides a Bed Flattening option as part of the EdgeMill option module, alternatively Mach 3 comes standard with a wizard to cut a rectangular pocket.
Use a sacrificial piece of wood to hold your blank PCB and you can use either one of these tools to ensure the bed is flat and level Typically for a 250mm x 250mm (10” x 10”) you would need to take about 1mm (0.040”) across the whole surface.
The flattened area should be approximately 25mm (1”) wider all round than the blank PCB. Thus is to allow us to tape the board down. In my case that was 175mm x 230mm (7”x9”) for a 100mmx150mm (4”x6”) board.
Drill 4 holes manually using the CNC and a 2mm (0.08”) End Mill to hold board alignment reference pins which will align the blank board to the CNC X & Y axes (exhibit 3). I use panel pins

Exhibit 3 Reference Pins
Now tape down the blank board in this position using masking tape or similar. This is the last time we will use these pins/holes for this board. It is important though to ensure the board is aligned with the axis of the CNC., and securely held in the X, Y and Z planes. Remove the pins

Exhibit 4 Taping Down
Mach 3 Step 2 – Reference Pins
To accurately plot the Isolation Cuts top and bottom, the drill holes, and make edge cuts, LineGrinder requires the use of reference pins. These pins are identified as pads in KICAD, and have a unique size which is extracted by LineGrinder in converting the Gerber to G-Code.
In Mach 3, now that the blank board is secure, load the Reference Pins G Code.
Mount a 2mm (0.08”) End Mill in the CNC, set zero for the Z axis on top of the blank board. One simple way to do this is using the slow jog in Mach 3 ( I have it set at 5% of the fast jog), slowly move the Z axis down to the board moving a piece of paper under the End Mill. When the paper catches you are within 0.076mm (0.003”). Set the Z axis zero accordingly. You could also use a probe connected to one of the IO pins on the CNC controller

Exhibit 5 Checking Zero on the Z axis
Before running the Reference Pins file check the G Code to make sure the low Z figure is at least -10.mm (-0.375”) , this is necessary to ensure the pins are stable when located in the wood, below the board.
Now run the G Code, Mach 3 to drill your reference holes through the blank PCB and into the sacrificial wood below
Mach 3 Step 3 – Drill your holes
Change out the End Mill for the reference holes to the first (smallest ) drill size used in your PCB.
Usefully, LineGrinder puts the tool sizes at the top of the Drill Code file, so you can load the Drill Code into Mach 3 and set your drills up accordingly.
Set zero on the Z axis as you did for the End Mill above, and run the Drill Code saved from LineGrinder.. It is important here that the speeds and feeds are matched to the drill size, my recommendation is to use the speeds for the smallest drill for all drills 300mm/minute (10”) for X & Y and 150mm (5”) for Z
Make sure the drill depth is twice the board thickness 4mm (0.157”).
Now run the Drill Code in Mach 3
Mach 3 Step 4 –Cut the Top Layer Copper
Mount the Isolation Tool in the CNC I use either a 30 degree V Carbide tool, or alternatively a 10 degree tool. Special mention of caution with the 10 degree tools, they are quite fragile and easily snapped. Start out with a broader tool, even 45 degree works well if you have set up for wide tracks and spacings.
If you have set up a probe on your CNC controller use this to set your zero, if not the piece of paper method above works well, make sure you adjust the zero in the right direction (with paper and to tool catching, Z=0.003”. The tolerances here are tight, you will only be cutting 0.15mm (0.0032”), so setting the zero is important to do carefully.
If when you run the Isolation Cuts code you get inconsistent results, you can reset you zero to a thousandth deeper, and run the code again.
There is a trade-off here, the deeper you need to cut to get through the copper across your whole board, the wider the cut will be, and hence the bigger your traces and spacings need to be... If you choose a narrow tool bit E.g.10 degree, you need to exercise care with your speeds and feeds. Investing in the effort to flatten your sacrificial wood base really pays of here.
If you used the Probe method to set Zero, be sure and REMOVE THE PROBE NOW
Load the Top Level Isolation Code into Mach 3 and run the program
At this point your should have no misaligned holes, if you do better to stop now and go back and check your Gerbers first in GerbView, and then your drill and isolation overlays in LineGrinder
Mach 3 Step 5 – Cut the Bottom Layer Copper
Check the Top Layer copper carefully before doing anything else, if you need to re-run the program to ensure a clean isolation of tracks, reset the zero, and run the program again. On occasion, I re-run the Isolation Code, just to clean up the edges of the tracks. If necessary a quick rub over with 240 grit wet and dry paper will clean up most of any roughness left by a dull tool bit, or speeds and feeds that were too fast
Remove the tape and swap the blank PCB in the X or Y flip mode (matching what you selected in LineGrinder. Locate the board by inserting the Reference Pins milled in Step 2, Tape board down bottom side copper facing up.
Reset the Z axis zero, as you did in Step 4 above, this may not be necessary, but the tolerances are tight so better to bu sure than to have to re-run the job again. If you used the probe, then REMOVE THE PROBE NOW.
Load the Bottom Copper Layer G Code into Mach 3, and run the isolation cuts job. Once again carefully check the isolation of the traces, and clean up any swarf if necessary as per the top layer.
At this point your should have no misaligned holes, if you do better to stop now and go back and check your Gerbers first in GerbView, and then your drill and isolation overlays in LineGrinder
TURN YOUR BOARD OVER NOW, and tape it down again, using reference pins to align.
Step 6 – Mach 3 Edge Cuts
Turning your board over is important because even if you have rigorously mapped the reference holes in relation to the PCB it is unlikely there will be complete symmetry with the blank PCB or indeed even the edge cuts.
Load the Edge Cuts G Code into Mach 3. Mount an 2mm (0.080”) End Mill into the CNC, and set Zero on the Z axis as described above. I have not yet successfully used a smaller End Mill, though it must be possible.
For a 2mm End Mill I use a feed rate of 250mm (10.0”) per minute in the X & Y and 125mm ( 5”) on the Z axis. I have also set a TAB with of 1mm (0.039”) for the tabs holding the PCB to the blank.
Exhibit 6 Cutting the edges
Run the Edge Cuts G Code in Mach 3
Outcomes
Remove the blank, cut away the tabs, and sand them off and voila ! Exhibit 7 appears

Exhibit 7 A finished PCB
This is the first working PCB produced after many failed attempts (learning opportunities) . A couple of points to note :
- The nominal track size is 1mm (0.039”)
Exhibit 8 a few notes- Note though that the two tracks feeding the centre of the 8 pin DIP are 0.5mm (0.019”), this is about the smallest track size that can be produced using a 30 degree End Mill
- The reference holes in this case were outside the PCB border, easy to do in KICAD, but wastes a lot of PCB material
- There is a range of hole sizes used, smallest = 0.6mm, largest = 1mm
- This is a single sided PCB, a double sided version would use a lot less real estate
- Board size 43mm (1.7”) by 86mm (3.4”)
Notes
Circuits, Gerbers and G Code will be published as a part of subsequent article
Whilst there are many Youtube videos and websites which demonstrate the methods of translating a schematic into a routed PCB, much of what is captured here, is a result of my trial and error, as look for updates ongoing …. there are many parameters in these software packages and confusing messages, hopefully these notes contribute positively to the body of knowledge.
In a separate series I will document the KICAD and LineGrinder components, and also the machine and software settings in the meantime I'd recommend the following URLS as worthwhile resources in the trial and error process I followed
- KICAD – Contextual Electronics
- LineGrinder
- Mach 3
https://www.youtube.com/user/outland86/videos
Your feedback is always welcome, thanks for dropping by … Good luck
The second article in this series is located <<here>>
[…] We hope you find something useful in these notes, feel free to drop us a note if you have any questions … all the best, thanks for dropping by … The first article in this series is located << here >> […]
ReplyDelete[…] Routing CNC PCB’s Part 1 […]
ReplyDelete