Autoleveling feature is ability to probe user-defined areas for detect curved surface in your material.

This is especially useful for engraving metal surfaces with V-shaped cutters where any deviation in the Z-direction will result in wider or narrower traces. Eg for isolation milling PCBs where warpage would result in broken traces.

Auto leveling GRBL

How it works ?

Ultimate CNC using G38.2 will take Z values in different positions of XY (this we will name Grid Probe) and it will be stored in an array of floats.

The intermediate values of Z values are obtained via bilinear interpolation between the four nearest points. All G-code commands (like G00 or G01) whose length exceeds the Grid Probe are split up into sections smaller. It means, the software will modify your original G-code program.

G-Codes supported by Autolleveling feature:

  • G00, G01 linear motion

  • G02, G03 arc motion

  • G04 dwell

  • G20, G21 units

  • G90, G91 distance mode

  • S spindle speed

  • M-codes

There are some G-codes unsupported in some scenarios, then if you use in your G-code, verify carefully the G-code autogenerated:

  • G28 and G30

  • G81 and G82

Verify the new G-code generted

There are a lot of CAM programs than can generate G-code, and it can generate a lot of differents scenarios. For this reason, Ultimate CNC have implement a internal G-code processor to understant your original G-code. This way, the software can safely modify your G-code with the news Z values.

However, Ultimate CNC give you some tools to verify that the conversion is correctly done:

See the "Probe" plane

This plane show you the new Z value when in the original G-code was Z = 0, therefore you can verify that all new Z values have been processed correctly.

See the lines colors in the 3D Viewer.

All motion commands (G2, G3, ...) are converted to G00 and G01. It you can see with G00 color "green" and G01 with color "pink".

Simulate the G-code.

The new G-code will be sent to Grbl, but it don't generate any motion in your CNC machine. If some value is missing, Grbl throw error.


Probe pin invert

By default, the probe pin is held normally-high with the Arduino's internal pull-up resistor. When the probe pin is low, Grbl interprets this as triggered. For the opposite behavior, just invert the probe pin by selecting "yes". Disable with "no"

You may need a power cycle to load the change.

Z up

This parameter defines the Z-axis position which is high enough to safely travel of the X and Y axis with no risk of a tool collision.

Offset for Grid Probe

Add offset for the Grid Probe in G-code units (mm or inches). This number need to be more big than 0. We recommend use 1mm or 2mm.

Fast Z Probe and Slow Z Probe

The G38.2 command will move an axis at a specified speed and stop once contact has been made between Ground and the SEL pin on the CNC Shield (Arduino pin A5).

Slow: G91; G01 Z1; G38.2 Z-15 F10; G90

The command G38.2 Z-15 F10 will move the Z Axis a distance of -15mm slowly, at a speed of 10mm a minute until contact is made to ground.

Fast: G91; G38.2 Z-15 F100; G90

The command G38.2 Z-15 F100 will move the Z Axis a distance of -15mm slowly, at a speed of 100mm a minute until contact is made to ground.


To start "Autoleveling" click on the icon:

Autoleveling screen is enabled only when you are connected to Grbl board and you have load some g-code program.

Then will appears Autoleveling screen (Fig. 1), click on Start Probe

When finish to probe your board, you can repeat some probe point or continuing clicking in Autoleveling

Make sure you connect GND wire to the bit of the router and the A5 pin wire to the probing piece.

Auto leveling Configuration

Fig. 1

① Start Probe

Start Z probing data on "Grid Probe"

② Autoleveling

Modify your G-code program to use the new Z positions.


Show / hide grid probe.


Show obtained surface from Z probe data. The Blue color show the maximum values of Z, Red the minimum value and Green it the medium values.


Enable / disable autoleveling.

The Z probe data can be loaded and saved as files using "① load" and "② save".