Setting the Z Offset (Home & Probe) in Marlin Firmware

Technically speaking, the 3D printer does not have direct information about the exact positioning of the printhead at any given time, as the positions are always calculated based on external data, such as the distance of the printhead to the endstops, the offset values configured by the user, and, if available, the readings of an automatic bed leveling sensor.

As a result, ensuring that all the components of the 3D printer are positioned correctly, whether it’s the levelness of the print bed or the position of the printhead relative to the print bed, is one of the essentials of 3D printer calibration that always require to be as precise as possible for a successful print, as any discrepancy causes the 3D printer’s calculations to be flawed.

In today’s article, we will have a tutorial on setting the home Z offset and the probe Z offset values in Marlin firmware, in particular, which are two fundamental positioning-related parameters that can easily make or break your prints due to their direct impact on the space between the nozzle and the print bed, also known as the nozzle gap.

So, how can you set the home Z offset and the probe Z offset values in Marlin firmware?

To set the home Z offset value in Marlin firmware, you can use either the M206 or the M428 G-code commands, where the former allows you to specify the Z offset manually, and the latter uses the printer’s current position.

On the other hand, to set the probe Z offset value in Marlin firmware, you can use the M851 G-code command, where you can specify the probe Z offset (and also X and Y offsets) that you would like to utilize.

Next up, we will be diving further into the processes of setting the home Z offset and setting the probe Z offset in Marlin firmware to make things as straightforward as possible and quickly discuss the differences between the Z probe offset and the Z home offset, which are two parameters that get mixed up very frequently.

How to Set the Z Offset (Z Home Offset) in Marlin Firmware?

As setting the home Z offset value in Marlin firmware is all about using the correct G-code command to conduct the process, there is barely any difficulty caused by technical complexity once you exactly know what to do.

There are two ways to set the Z home offset value in Marlin firmware, which are to use the M206 (Set Home Offsets) and M428 (Home Offsets Here) G-code commands, with both of these commands operating in a different way to achieve the same results.

Using the M206 G-Code Command

The M206 G-code is the first of the two commands that you can utilize to set the home offsets of your 3D printer in Marlin firmware.

To specifically set the Z home offset value with the M206 G-code command, you will need to pass the Z parameter to it, along with the value that you would like the new Z offset to be.

For instance, if you would like to set the Z home offset value to -0.5 with M206, the command you should be sending is as follows:

M206 Z-0.5

As you can see in this example, we have passed the Z parameter, along with a value of -0.5, to the M206 G-code, which tells the 3D printer that we are setting the Z home offset value, in particular, to -0.5.

Remember to invoke the M500 (Store Settings) G-code command to save the settings to the EEPROM if you would like the modification you have performed to be permanent and persist across power cycles.

Using the M428 G-Code Command

The second command for setting the Z home offset value in Marlin firmware is M428, which allows you to conduct the process in a different way.

To set the Z home offset value with the M428 G-code command, you will need to move the printhead to the correct Z position first and then invoke the M428 G-code command after, which will set the Z offset based on the printhead’s current position.

For instance, if you would like to set the Z home offset value to 1.5 with M428, the commands you would need to invoke would be as follows:

G1 Z-1.5

M428

In this example, we started by moving the printhead to the Z-1.5 position, and invoked the M428 G-code command right after to set the home offsets according to the printhead’s current position.

As a result, the old Z-1.5 position became the new Z0 position, meaning that the new Z home offset value became 1.5.

Remember to invoke the M500 (Store Settings) G-code command to save the settings to the EEPROM if you would like the modification you have performed to be permanent and persist across power cycles.

How to Set the Z Probe Offset in Marlin Firmware?

Similar to setting the Z home offset value in Marlin firmware, setting the Z probe offset also requires the execution of a specific G-code command responsible for configuring the probe offsets, and once you know which command to use, the process becomes trivial.

To set the Z probe offset value in Marlin firmware, you will need to invoke the M851 G-code command with the Z parameter and the value that you would like to set the Z probe offset value to.

For instance, if we assume that you’re setting the Z probe offset value to 2, the command you would need to utilize is as follows:

M851 Z2

In this example, we have passed the Z parameter along with a value of 2 to the M851 G-code command, which tells Marlin to set the probe Z offset value to 2.

Z Probe Offset vs. Z Offset (Z Home Offset) – What Is the Difference?

Due to both their names and their purposes being extremely similar, the Z probe offset and the Z home offset parameters are frequently mixed up, creating discrepancies in the configuration that usually end up with failed prints or errors from the 3D printer.

The purpose of setting the Z home offset value is to specify how far off the nozzle is from the print bed when it homes and triggers the endstop, which will allow the 3D printer to use this value to bring the printhead to its true zero position after homing.

On the other hand, the Z probe offset value serves the purpose of specifying the Z distance between the nozzle and the pin of the automatic bed leveling sensor, which once again allows the 3D printer to move the printhead to the position where the nozzle is correctly positioned relative to the print bed after homing.

While both of these values essentially fulfill the duty of correcting the nozzle’s position after the homing process, using the Z home offset value is appropriate for scenarios where a standard Z endstop is used, whereas the usage of the Z probe offset value is only suitable when an automatic bed leveling sensor is involved.

Wrapping Up

While the probe Z offset value only comes into play if you are utilizing an automatic bed leveling sensor, correctly configuring both the probe Z offset and the home Z offset values is vital for the success of the 3D printing process as they directly determine the positioning of the nozzle in respect to the print bed.

To quickly recap, as the usage of either the M206 or the M428 G-Code command is suitable for the purposes of setting the home Z offset (and any other home offset value), you can feel free to utilize the one that you find to be more convenient.

On the other hand, when it comes to setting the probe Z offset value, the G-code command you will need to utilize is M851, which is the umbrella command for setting the X, Y, and Z probe offset values whenever it becomes necessary.

Happy printing!