PCB Milling - Bed Levelling


Looked at using the MPCNC for milling PCB’s and decided to give it a try. Used Eagle PCB to design a simple circuit and produced the necessary Gerber files. Initially used Flatcam V8.5 and converted the Gerber files to GCode useable for the MPCNC. Results from milling the PCB were to be expected - areas of the PCB had different depths of cut due to the bed not being level.

I then researched bed levelling and came to the conclusion that I could use the available setup within the Marlin configuration, however this required setting up the code within configuration.h file. I gave it a go and managed to get the bed levelling working fine. The code requires enabling of linear bed levelling, setting the bed size to PCB size being probed and setting of grid points being probed. In my case the PCB size is 100x70mm and set the grid to 5 x 5 array.

Next steps are to design suitable clamp to hold the PCB edges to the spoil board and produce some PCB’s.

Note that during my research I came across upgrade to the current version of Flatcam, a nightly upgrade is produced available for download as Windows installer - this has some significant additional features over V8.5 including Marlin post processor.

One question, I assume that with the bed levelling that after this is completed running the PCB gcode files takes the bed levelling compensation into account?

Comments and suggestions welcome.


The best way is to start by milling the bed level where you want to place a PCB, if that is not enough then add the leveling. Start by milling the surface flat though. That alone should solve most issues.

PCB milling is one of my big goals with the MPCNC that I’m building (along with a few other big goals and a bunch of smaller ones). A friend has tried milling them with v bits and small end mills and wasn’t happy with the results. I hope that we prove him wrong and I suspect the leveling is going to be one of the big issues (I haven’t finished building mine, yet. But, it is started and I have almost all of the parts ready). It really depends on how fine the detail you’re trying to achieve. I’m perfectly content with through-hole. But, I would like to be able to do SMT as well, and the smaller the parts, the more that everything comes into play. I was wondering about Marlins bed leveling routine and I’m glad you got it working, at least to some extent. I’ve heard several had excellent results with thin double-sided tape or 3M spray adhesive and I wonder if it might not be best to do the milling on a flat metal bed, because of metal’s relative resistance to dimensional change when compared to wood and such. Of course, I’ll need to have a lot of confidence in my machine and technique before I go that route, just for fear of a sudden or thoughtless plunge into the bed. That probably wouldn’t be an inexpensive recovery if it happened.

The problem I am encountering with milling PCB’s is that the blanks sourced from China are not level or flat, of a batch of 15 size 100x70mm FR2 single sided PCB’s the thickness varies from 1.45mm to 1.73mm, even single boards vary in thickness across the PCB, in one case 1.68mm to 1.73mm. Here in the UK there are not many sources of blank FR2 blank PCB’s, hence having to source from China. I understand from various sources that FR2 is the best option to use rather than FR4 fibreglass.

Another issue is that the PCB’s are not exactly flat, they bow across the length and width making it difficult to have any consistency. I tried clamps and double sided tape to try and get good results, however the milling varies across the board. Hence my decision to try out the bed levelling features available within Marlin.

I came across website www.autoleveller.co.uk that has stand-alone software to level gcode files, unfortunately does not run on Marlin.

Cliff, I agree with your comments on flat metal bed, something I have been looking at, came across this on the autoleveller site:


This looks good and will use as an example later on once I have verified the bed levelling. Currently I am making clamp on my 3D printer and will use a prototype to hold the PCB’s. The jig I would ultimately make would include fixings for double-sided PCB’s. As mentioned in my original post I highly recommend the latest developer edition of Flatcam, has many new features.

I tried to upload video of the bed levelling but failed miserably, tried to upload using my Google Phot0’s folder, will try another source.



1 Like

Hi Rob,

Do you insert G29 at the start of your gcode to autolevel? Do you set the bed size to the board size to prevent the the whole table from being measured? Is there a way to set the grid size within the gcode or does this have to be done in the Marlin firmware? For now, I’m running everything off an SD card and really didn’t want to hookup my PC directly to the machine.



You may try to use this one