When you are making some DIY device, you will approach a point when you will have to decide whether to use of the shelf, prebuilt or fully assembled boards or to make your own. I have already talked about how to make yourself a professionally made board in this DIY generator’s post. Although a professional board is a good solution for a finished project, it might not be a convenient solution while you are still in the development process and there might be changes in the board’s layout. So, this post/tutorial is going to be about how to make a PCB with a CNC router.
Table of contents
- CNC vs other methods
- Tools, parts and software used
- Making gerber files
- FlatCam – toolpath generation
- Engraving, drilling and cutting the board
- Summary
CNC vs other methods
So, why you should use a CNC router to cut a PCB instead of using other methods?
Let’s start from the probably simplest method – to order PCBs from a professional manufacturer. It is the easiest way, because it does not require any manufacturing work to be done by you. It only needs to be ordered from one of the PCB manufacturers (which I have shown in this post). Usually, 10 small PCBs could cost about 5-10 USD. If you want to get it for the smallest price – you will have to choose the cheapest shipping, which can additionally cost around 5-10 USD. If you want to get them as fast as possible, you will have to pay for more expensive shipping (20-30 USD). Overall this manufacturing solution in my opinion is acceptable when you need more than one final version PCB. It is not very convenient for developing process, because you will probably need only one PCB manufactured and shipped as soon as possible and, in this case, it will be quite expensive.
So, for developing process, when you need one PCB and its layout might be redesigned during assembly or testing, a home made solution is quite logical choice (of course, if you want to do it by yourself).
Quite popular home-made manufacturing process includes an UV light and some chemicals. The process is quite tedious: you have to print out the PCB view on a transparent paper or a film, then place the board (which is also covered with a photoresist layer) with the printed mask under UV light for several minutes. After that, it goes to NaOH bath where UV exposed photoresist layer is washed off. Finally, the board goes to etching bath to leave the traces on the board. It takes about 2 hours and even then, you have a board which still needs to be cut to the size and holes to be drilled. So, it takes quite a lot of time, but in the end, you can get a high-quality board with fine (0.2 mm, ~8 mils) traces.
Another method is a “heat transfer”. During this process you print out the board image with a laser printer (only this kind of printer can be used) on a smooth surface paper. Then you place it on the board and using an iron you heat up the paper – the ink also heats up and sticks to the board. After that, you need carefully tear off the paper while leaving the ink stuck to the board. Finally, the PCB goes to etching. In this case you will still have to cut the board to the right size and drill the holes (if needed). It might be good enough solution when the traces are thick, but there might be some problems when the ink does not stick to board as evenly as you would like to. Also, this method is a bit cheaper, because the PCB is without the photo-resistive layer (the board itself is cheaper).
Lastly, you can make the PCB with a CNC router. First of all, this process is convenient, because all work is done by the machine – cutting the traces, board edges and even drilling the holes. Also, if you already have a cheap CNC engraver – this method is the cheapest one. If you don’t have the CNC, then it will be more expensive than other methods (on the other hand, others need a LaserJet/laser printer, so it is more of a compromise in price). Because it is very convenient solution (at least for me), in next steps I am going to walk through how the PCB can be made using this method.
Note, that in most cases, a home made PCB does not have copper plated vias and holes. So if you are making two layered board, the traces on the different layers needs to be connected by a peace of wire.
Tools, parts and software needed
Tools
- A CNC router/engraver. This is the most expensive part of the whole process, but even the cheapest one should be sufficient.
- V shape engraving bit. For routing PCB traces. (Affiliate: Aliexpress)
- Straight 0,8 mm diameter (can be thicker) router bit (Affiliate: Aliexpress). Used to cut out the PCB to the needed size.
- CNC drill bit set (Affiliate: Aliexpress). They are used to drill the holes and vias.
- A knife. For cutting off the engraved board from a whole peace.
- Sandpaper. To sand down PCB’s rough edges.
Parts and materials
- A PCB board (Affiliate: Aliexpress)
- Some screws to hold the board in place while engraving/cutting.
- Double sided tape could be used to secure the board on the table, but it might come loose during board edge cutout.
Software
- FlatCAM – used to generate gcode needed for a CNC machine.
- KiCAD (or alternative) – used to create the board’s layout (it won’t be covered in this tutorial).
- CNC Host software. There is different software for different types of machines, some come with a CNC machine while others don’t. It is used to transfer gcode from a PC to CNC controller.
Making gerber files
How to design you own PCB with CAD tools (like KiCAD) will not be a part of this tutorial.
Also, how to get gerber (manufacturing) files from an already finished KiCAD project is briefly written in an older project’s post.
FlatCAM – toolpath generation
The PCB is going to be a simple adapter board used to break out 18 pin LCD flat cable to a regular pin header.
Isolation toolpath
Firstly let’s make isolation code which will cut all traces.
Open FlatCam.
Select File-> New Project. An empty project will open:
On top tool bar press “Open Gerber” button (most left).
Select .gbr file wich has needed copper layer. In my case it was [..]-F_Cu.gbr file. Also, you should open Edge-cut layer gerber file. Finally open drill file by pressing “Open Excellon” button in the top toolbar and selecting .drl file.
In my case, when I opened those three files, I saw such view:
Now it is a good moment to decide where your origin point will be. It will be the same starting point on your CNC machine. Select “Set origin” button and press on the board where you want to place it. I placed it like that (red cross):
Now, select on your copper layer gerber file in top left corner and open tab “selected”. In this tab press “Isolation Routing”. Here I have only changed tool diameter in the table and its form to “V”. You might change it to your tool’s measurements:
After doing that, press “Generate Isolation Geometry”. The program should add additional lines (toolpaths) to the drawing and “selected” tab will open again automatically:
Here I have changed “V-Tip Dia” to 0,25 mm. Usually tip diameter is either 0,2 or 0,3, but as I did not know what the actual size was, I have just used value in between those two. Although I did not change any other parameter, it might be different for you. If you have V bit with other angle, change it in “V-Tip Angle”. You can change other parameters like “Travel Z” or “Feedrates”, but default values usually work fine.
After setting preferred values press “Generate CNCjob Object”. The layout view should change to reflect the movements of the cutting bit:
Finally press “Save CNC Code” to save the toolpaths to the local disk.
Edge cutout toolpath
Next, let’s make a gcode which will cut the PCB edges.
Open “Project” tab and select Edge Cuts gerber. Then, open “Selected” tab and press “Cutout Tool”. A new tab will open with the settings. As I was using a tool with 0,8 mm diameter, I have changed “Tool Diameter” to 0,8 mm. I have also changed “Gap size” to 1 mm, so the tabs which are left to hold the PCB in place will be small enough to be cut off with a knife.
You should change parameters according your used tools and/or preferences and press “Generate Rectangular geometry” (or “Generate Freeform Geometry” if you have a PCB with an irregular shape). New geometry will be added to the layout view:
Next, open “Selected” tab. There, all default values should be sufficient, press “Generate CNCJob Object”:
Finally, after generating edge cut toolpath (which is added to the drawing) save it by pressing the “Save CNC Code” button:
Drill toolpath
Open “Project” tab again.
Select your .drl file and open “Selected” tab. In this tab I have changed the Z federate to 200 to make the drilling slower, other settings were left default:
Next, press “Generate CNCJob object”:
Finally press “Save CNC code”.
Modifying .nc files
Now you should have three .nc files (gcode for tracing, edge cut and drilling). What I did additionally, I have added “G92 X0 Y0 Z0 “ line (without quates) to the start of each file, and “G1 X0 Y0 Z0” line in the end of each file. The G92 line tells the CNC machine that the current tool position is (X0,Y0,Z0) point – which is our origin. The G1 code in the end just returns back the tool to the origin. Of course, it will depend on your setup and you might not need this file modification.
Engraving, drilling and cutting the home made PCB
So, when you have all the needed gcode files, next step is to cut the PCB.
First thing to do is to fix down the PCB to the CNC’s table. Next, insert V shaped engraving bit into the chuck:
Although there a some good calibration method of how to position the CNC bit in respect of the PCB’s surface, I just eyeball it. Because board’s surface area is usually a lot bigger than the PCB which needs to be cut out, placing the bit inside the board’s surface according to X and Y axis is sufficient. What needs to be positioned quite precisely is the tip of the bit in Z axis. I place it just barely touching the board’s surface:
So, that first point where CNC bit’s tip is barely touching is your zero point, which should be used as a starting point during all cuts. Also, you could make some test cuts before cutting the final board. For example, in my case I had a dull V shaped bit which instead of engraving the board made a mess:
To start the first cut, your CNC should execute the first gcode file generated in the previous steps.
After the engraving is finished, the traces should be clearly visible:
Afterwards, you will have to change the V bit to a Drill bit. Usually the drill bit’s diameter is selected according to the components which will be placed into the holes. I have used an 0.9mm drill bit from a drill bit kit.
While changing the bit, I personally just lift up the chuck along the Z axis, while maintaining the same X and Y positions. After the change, I again lower the drill bit till it barely touches the board:
Yet again it will be our zero point. Note, that X and Y coordinates are the same as in the engraving with the V bit step. Execute the next gcode file:
You should get nicely drilled holes.
Last step is to cut the PCB’s edges. For this purpose a 0.8 mm straight routing bit should be used. Actually, the diameter could be different, just know that the thicker the bit is the thicker the cut and more of the PCB’s surface is just cut away. The bit change procedure is the same as it was done previously: change the bit without moving X or Y axis and lower the Z axis till the bit touches the board’s surface:
Then, execute the last gcode:
Finally, you should get a finished board which only needs to be cut off with a knife:
When it is separated from the whole board and sanded down, the PCB looks like this:
Summary
To sum up, making your own PCB with a CNC might seem difficult from a first glance, because there are a lot of small steps to be done. But when you get used to the software and the CNC setup, this method will be one o the fastest and most convenient ones to manufacture a printed circuit board.