MPCNC part 6

By telleropnul, July 19, 2019

It is now time to plot the obligatory MPCNC crown test pattern with a pen holder and pen.

MPCNC Sharpie / Pen holder

Crown test


This is the actual result of the very first time the machine was used to plot a file.  I had to restart the operation as the pen tip was a fraction too close to the surface and started dragging.  The second attempt completed successfully.

Fusion 360


Rename *.txt to *.cps and place inside “C:\Users\…\Appdata\Roaming\Autodesk\Fusion 360 CAM\Posts”

When generating Gcode in Fusion360 select “Setup” and select ‘Use Personal Posts’ from the drop down list.


So as a first attempt I created a drill grid for a 920x920mm spoilboard consisting of a 9 x 9 points grid with 100mm spacing and a 60mm edge perimeter:

I then generated a center drilling toolpath and loaded the MPCNC Fusion360 Post processor to generate Gcode:

The resulting metric Gcode file looks as follows:


I realized the spindle can’t quite reach the origin in the lower left corner of the spoilboard, so instead I moved the origin to the center of the spoilboard and regenerated the Gcode:


I then realized the spindle can’t quite reach the furthermost points either and I changed things accordingly:


When I ran the Gcode on the machine I realized my machine does not do absolute negative machine coordinates.  I can only go to G0 X0 Y0 but not G0 X-5 Y-5 for example.

I have dual steppers enabled, but not dual endstops (X1min + X2min + Y1min + Y2min) in Config_adv.h.  I do however have Xmin and Ymin enabled in Config.h.  I do not have limit switches installed.  As soon as you have Xmin and Ymin enabled, the machine will force you to stay within the bed area.  This means absolute negative machine coordinates are not allowed; you cannot move beyond the lower left corner.  When I power up the machine with the spindle located in the center of the spoilboard, this effectively becomes X0 Y0 Z0 and I cannot move to the left or to the bottom from here as that is considered outside of the bed area.

G54 Work (offset) Coordinates

I tried this:

  • Place the spindle in the bottom left corner as if Xmin and Ymin limit switches endstops had been triggered.
  • This would be my machine coordinates origin X0 Y0 Z0 when I power up the machine and gives me positive machine coordinates for all my moves from here.
  • Power up the machine.
  • Use G0 X… Y… to move the spindle to the center of the spoilboard and zero the X and Y work coordinates.

This should enable me to use positive machine coordinate throughout and be able to run my Gcode using work (offset) coordinates from the center of the spoilboard, using both positive and negative move values.

The problem is that CNC.js sends a G10 L20 P1 X0 Y0 Z0 to zero the work coordinates.  Marlin firmware uses G10 for retraction and does not support G10 L20 P1 X0 Y0 Z0 commands.

A more detailed explanation can be found here:

So ‘P’ represents work coordinate system (1-6) and corresponds to G54 – G59, respectively.   G53 is the machine coordinate system.  Marlin does support G54 – G59 work coordinate systems:

* CNC Coordinate Systems
* Enables G53 and G54-G59.3 commands to select coordinate systems
* and G92.1 to reset the workspace to native machine space.

CNC_Coordinate_Systems is enabled in my [Configuration_adv.h].  However, Marlin does not recognize G10 L20 P1 X0 Y0 Z0 commands unfortunately.

I have lodged a feature request with the great developer community of Marlin:

Let’s have a look at our options:

G53 Machine Coordinates without Xmin/Ymin

Another option is to simply stick with machine coordinates (G53) and forget about work coordinates (G54).  In order to get my machine to do absolute negative moves I would need to abandon endstops for Xmin and Ymin.  By commenting out Xmin and Ymin endstops in Config.h the bed area cannot be determined and as a result there are no restrictions on using negative coordinate values.  When you power up the machine with the spindle in the center of the spoilboard that will be your origin X0 Y0 Z0, but there is no monitoring of whether or not your move operations are within the bed area.  This is more dangerous as there is nothing keeping you from entering G0 X-10000000 and crashing the spindle into the rail.  This also stops any plans for using dual endstops for a perfectly square calibrated machine each time it powers up.

I like being able to power up my machine with the spindle in the bottom left corner and knowing that this will be my Xmin and Ymin endstop position.  I will not comment out Xmin and Ymin in the firmware!

G55 Work (offset) Coordinates + G92 X0 Y0

G10 L20 P1 X0 Y0 Z0 is identical to executing G54 followed by G92 X0 Y0 Z0 and then returning to the original coordinate system.

I did some more research and discovered Marlin treats G53 (machine coordinate system) and G54 (1st work offset coordinate system) the same.  You cannot set a new origin in G54 without it also affecting the origin of G53 and vice versa (!)

I have reported this as a bug on the Marlin github page issue tracker:

I discovered using G55 (2nd work offset coordinate system) works fine however.

So all I have to do is the following:

  1. Power up MPCNC machine with spindle in lower left corner.
  2. G21 ; millimeters
  3. G90 ; absolute coords
  4. G0 X200 Y200 ; move to center of spoil board.  Make sure CNC.js Axes widget shows machine / work offset coordinates.  Do not move spindle by hand (!)  You can use keypad jogging.
  5. G55 ; Switch to 2nd work offset coordinate system
  6. G92 X0 Y0 Z0 ; set new origin
  7. G91 ; relative coords – this isn’t strictly necessary as the Gcode script should always specify G20/G21 (inches / millimeters) and G90/G91 (absolete coords / relative coords) in the header.  Most scripts would use G91 anyway as all movement is relative to the origin.
  8. Run my Gcode script.

I tested this and it works properly.  Xmin and Ymin enstop positions also work correctly and are relative to the G53 machine coordinate system origin as they should.  Even if I am in G55 I cannot go past Xmin and Ymin, which is a nice safety feature.

The one disadvantage is that CNC.js Axes widget does not display G55 work (offset) coordinates.

CNC.js keypad jogging

In order to use CNC.js keypad jogging you will need to first disable / hide the Console Widget as otherwise the Console Widget will hijack all keyboard input.  Then, click on the keyboard symbol in the Axes Widget to enable keypad jogging.  Make sure to set the step size to a safe value before pressing Arrow Keys or Page Up / Page Down.:





<To be continued>


1. Spot drill hole pattern in spoilboard.
2. Manually drill through using suitable bit.
3. Insert (glue?) threaded inserts.

1. Spot drill hole pattern in CNC bed to hold down spoilboard.
2. Manually drill through using suitable bit.
3. Insert (glue?) threaded inserts.

Z axis min/max endstop.
Dual endstop micro switch calibration using Xmax and Ymax:
(MKS Gen L v1.0 + color/touch LCD)  -> LCD = extra CPU load + distraction ?)
Emergency stop ideas
Multimeter Z probe