CNC Probing

When you are milling PCBs with a CNC having a level surface is extremely important and can be very difficult to achieve. This post describes some of the techniques I used to get a level surface so I could mill PCBs with reasonable quality.

Milled PCB

Milling a PCB requires cutting away just 0.05mm of copper (or less) from the surface. If you cut too deeply you will damage the cutting tool tip and, due to the arrow shape of the cutting tool, make your isolation cuts too wide - reducing the width of the resulting tracks. If your cut is not deep enough the tracks will not be isolated and your board will have short circuits.

There are three main steps you can do to ensure you have as level a work surface as possible:

  1. Make sure the CNC bed itself is as level as it can be.
  2. Use a sacrificial surface (like a piece of wood) and mill out a pocket that will be parallel to the tool tip movement.
  3. Once your blank PCB is mounted for milling use a height probe and level correction to account for any remaining errors.

The first step is very dependant on your physical CNC. My machine, a generic CN3020T has an aluminium bed which is bolted to the chassis and is very difficult to level across it's entire area. I measured a 2.5mm difference between the highest and lowest points and there is very little I can do about that.

CN3020T CNC Router

I have seen some people replace the aluminum bed with a wooden one and mill it flat. You don't need to replace the entire bed to get the same effect though - you can simply use a sacrificial layer on top of the bed instead.

The point of leveling is to ensure that the working surface is parallel to the movement of the cutting head. The easiest way to do this is to mill a pocket out of a sacrificial piece of wood and then use that as the platform for your workpiece, the surface of this pocket will be level to the cutting head.

Milled PCB Pocket

For my PCB milling I used a piece of soft pine and milled out a region large enough to hold the largest blank PCB I wanted to work with. I also drilled holes for some mounting screws to hold the PCB in place during milling - this ensures that the PCB is in the same place during each operation making it easier to set the origin for the working co-ordinates.

Once the PCB is in place we now have it relatively flat. Unfortunately it still won't be flat enough - blank PCBs tend to flex in storage and, depending on how it is mounted, will tend to bow upwards in the middle. This is where we need to start probing - first, to measure how flat we have the board and secondly to apply corrections to the height values in the gcode to account for any differences.

Probe Connections

A probe is essentially a switch which closes when it comes into contact with the surface of the work piece. When using conductive material like a PCB you can simply attach the positive line of the probe to your tool tip and the negative to the PCB itself. Using the probe command (G38.2) will move the tool until it comes into contact with the PCB and report the current position. Software that drives the CNC such as LinuxCNC or bCNC for GRBL based controllers generally have direct support for probing.

bCNC Probing Interface

bCNC has support for a 'scan' operation which will probe the work area at regular intervals and build up a height map of the surface - this data can be saved to a file for analysis. I wrote a small Python script that takes this file and uses MatPlotLib to generate a height map image so I can more easily visualise what the surface of the board looks like. Here is a sample image generated with straight probing:

Probing Height Map

During the probing process there is no downward pressure on the board from the tool tip - it stops moving as soon as it makes contact. When you are milling though the tool tip is trying to cut into the board and pushes it down - a bowed board will give way to the pressure and move downwards with the tip resulting in shallow cuts like the ones shown below.

Shallow Cuts

What we need to do is apply some downward pressure during the probing process so the board is pushed flat against the underlying surface before the probe comes into contact with it. This is referred to as a 'pressure foot' and there are some commercial models available. My solution was a little bit more home brew though, I used a small (about 1 inch diameter) silicon ball, drilled a hole through it for the probe and cut away the top so it would fit around the spindle mount. The material the balls are made of tends to crumble very easily so I wrapped some tape around the outside to stop it from breaking apart.

Pressure Foot Assembly

When positioned on the spindle there is about 2mm between the bottom of the ball and the tip of the tool. As the head moves downwards the ball pushes the PCB down and then starts compressing allowing the probe to approach the PCB surface. When the height measurement is taken the PCB is firmly pressed against the bed and the bowing is eliminated.

The final step is to adjust the actual cutting depth to take into account the height differences in the surface. If you are using bCNC it will do this for you if you have scanned the board height or loaded a probe file. As bCNC sends the gcode to GRBL it will adjust the height of the commands (breaking long linear cuts into a sequence of shorter ones if necessary) before passing them along. The end result is nice equal depth cuts across the entire surface.

In my setup I found that the first probe of a scan was not giving accurate results which throws the auto levelling process off in the area around that point. I haven't found the reason for this yet but I have come up with some work arounds. The first, which I mentioned in this Google+ post is to give the boards a light coat of paint before milling. If any cuts are not deep enough the board can be placed in etchant for a while to remove the left over copper.

Etching Black PCB

Because bCNC is an open source project, I could come up with a software work around as well. I modified the code for surface scanning to take three measurements at each point and discard the highest and lowest values; storing the middle value as the height for that point. The first tests I've done with this modification have been succesful but I still need to find the underlying cause of the problem.

Probing isn't limited to PCB milling either. As I mentioned earlier in the post the bed of my CNC isn't particularly flat - a 2.5mm difference between the highest and lowest points. Even when milling wood, especially engraving detail into a work piece, this can have a negative impact on the result. Because wood isn't conductive a different method of probing is required - my plan is to simply mount a pushbutton on the end of the spindle and probe with that. It won't have the same resolution but will help to correct the worst of the height errors.