# How to set the Z home offset

I have what I thought would be a simple question.

I don't have an auto leveling probe, I do my leveling manually with 4 screws and a piece of paper (I measured the thickness to 0.1 mm).

For the longest time I would have trouble with the first layer, sometimes having to give the bed screws a quarter turn to bring the bed up a bit. I would see that the nozzle seemed quite far away from the bed. This went on for the longest time and I just chalked it up to the quality of my printer.

I realized recently that when I level the bed, I am inserting a piece of paper in between the nozzle and the bed. Obviously, I should be taking the thickness into account as a 0.1mm thick piece of paper accounts for 50 % higher than the nozzle should be for a 0.2 mm first layer height.

My question is, how do I set (either in Cura or directly in Marlin config) the z home offset to account for the 0.1 mm thickness of my calibration paper?

• The idea (as I understand it) is that the thichness of the paper equals the distance you want the nozzle to be from the bed. You do not adjust anything in sw. Maybe you can clarify what you mean with "trouble". If it is that the print does not stay attached then maybe you should look at the bed temperature instead. – Tomas By Oct 23 '18 at 21:01
• – Matthew Goulart Oct 23 '18 at 22:38

It is preferred to get the distance correct by hardware changes (leveling screws). But it is possible to do it with software. You can not only change the Z offset in the slicer or in the configuration of Marlin, but also with G-code commands.

The "paper drag" method is perfect for determining the correct Z level. Once you leveled with the paper, you do not need to create an offset to account for the paper thickness, however, there are purists that do that. So basically, what we call Z=0 is in fact Z="paper thickness", unless you are a purist. But a slightly larger gap makes printing much easier. Too small heights cause e.g. rippling effects or too much pressure build-up in the nozzle. In order to change your offset after leveling, you could try one of the following methods. This is sometimes a useful method for creating a little extra offset for printing PETG, but personally I do not do that.

In Ultimaker Cura: Open the plugin manager ("Toolbox"->"Browse packages...") and install "Z Offset Setting", a new parameter will be available in the "Build Plate Adhesion" settings menu called "Z Offset". (See also this older, not up-to-date answer)

In Marlin configuration file, modify the MANUAL_Z_HOME_POS constant:

//#define MANUAL_Z_HOME_POS 0

In G-code:

By adding the following lines to your start G-code (see e.g. this answer) using the G92 G-code command:

G0 Z0.2 ; Move the head to 0.2 mm (so now 0.3 on your machine)
G92 Z0  ; Call this Z = 0

or when you are able to connect to the printer over USB using a printer terminal (e.g. Pronterface, Repetier or OctoPrint) using the M206 G-code command:

M206 Z-0.2 ; Will raise the Z height by 0.2 mm
M500       ; Stores the offset in memory

Alternatively, when you cannot connect through a terminal, putting the last 2 lines in a text file and saving that as a .gcode file on an SD card and "printing" the file will also store the new offset (if M500 is enabled in the configuration file: #define EEPROM_SETTINGS // Enable for M500 and M501 commands)

• I had seen the plugin for cura but it felt hacky to me especially since this seems like it would be a universal requirement for everyone without auto bed leveling. Is this what everyone else does?? – Matthew Goulart Oct 23 '18 at 20:38
• @MatthewGoulart Preferred solution is to correctly level the bed from a hardware point of view (what most people do). From the software solutions I prefer the M206 / M500 as this stores this for all models you print. If you do it in the slicer or startcode, you need to remmeber that, e.g. when you change slicer. – 0scar Oct 23 '18 at 20:53
• Sorry if this question has an obvious answer, but how would you level it on a hardware level? Are you saying I give the screws an extra 1/8 of a turn after leveling with the paper? – Matthew Goulart Oct 23 '18 at 21:04
• When you say "Once you leveled with the paper, you do not need to create an offset to account for the paper thickness" are you implying that most people just ignore the offset introduced by the paper? Are you saying I should just not take it into account? – Matthew Goulart Oct 23 '18 at 22:26
• @MatthewGoulart - Yeah, just ignore it. The paper width is your zero starting point. – Greenonline Oct 23 '18 at 22:36

Based on Oscar's solution using M206, I found it convenient to add in my MicroSD card a hierarchy of such gcode files to set the Z offset to every possible value in some range. For example, "printing" the file z_offset/1mm/1mm2/1mm275.gcode will set (permanently) the Z offset to 1.275 millimeters.

This hack is a workaround to the lack of Z offset setting in the printer's menu, and is an alternative to "hardware" Z tuning by moving the endstop. It can be useful when using different build plates with varying thickness, or attaching a pen or any other tool to the print head.

Here is a simple bash script which creates the files taking the MicroSD card location as argument:

#!/bin/bash -e

mkdir $1/z_offset for i in {9..0} do mkdir $$1/z_offset/"$$i"mm for j in {9..0} do mkdir $$1/z_offset/"$$i"mm/"$$i"mm"$$j" for d in 00 25 50 75 do echo -e \ M206 Z-$$i.$$j$$d\\nM500\\nM117 Z-offset="$$i"."$$j$$d"mm \ >$$1/z_offset/"$$i"mm/"$$i"mm"$$j"/"$$i"mm"$$j$d".gcode
done
done
done

I chose a 0.025mm resolution, as 0.1mm is slightly to coarse to adjust for first layer issues. Tested successfully on a Creality Ender 3 printer (which seems to have a 0.015mm resolution on the Z-axis).

You don't! Level the bed such that you know the nozzle is above the bed. Stop the print. Disable the steppers. Let it all cool down. Tram the bed (or what you call level). Then start the print again. It doesn't matter what first layer height your slicer thinks it is. All that matters is that it sticks and doesn't elephant foot. Note, if you are using glue stick or white glue (like I do) the thickness of the glue layer will be different between the edge of the glass (I assume you're using glass, otherwise you're never going to get a good tram) and the starting position of the prints.