# How do I set my Z offset?

After watching every possible YouTube video on the subject and reading any source available, and although I'm a PhD and quite computer savvy, I still can't make my Anet A6 (no probe) behave in terms of Z offset. I upgraded to silicone bed buffers instead of the stock springs; now my bed is ~5 mm raised, and I don't know how to proceed. Some observations:

• G28 makes the nozzle go to the center of the bed. Display says X 111 and Y 111. Is it preferable to set the home to the bottom-left corner, or is the center just fine?

• G28 makes the nozzle squish the bed ~5 mm deep.

• I've tried the G92 approach and the M428 approach. I can't quite understand what's the difference between them. Can anyone explain why sometimes the former is used and sometimes the latter?

• I had high hopes for M428. What could be simpler? You physically guide the nozzle to where you want it to be, send the command, and that's your new 0,0,0. But I guess not. Since my "home" is at 111,111 and apparently M428 can only be used at a maximum of 20 mm from 0, I get a "too far from reference" error message.

• At any rate, both approaches (also M206) haven't helped. When I G28, the nozzle still squishes the bed. The display either says Z 5 or Z -5 or whatever I've played with, but the nozzle still squishes the poor bed.

• In my LCD menu (Marlin 1.1.9), I don't have Control -> Motion -> Z offset. Since many videos recommend using this, this is quite sad. Can anyone tell me why this option is absent?

• On a very conceptual level, I can't quite understand why in all the video guides the bed screws are completely ignored when discussing Z offset. One guy showed how he's correcting his Z offset 0.3 mm using G-code. But he could've easily done it by adjusting his screws... They all say "Z offset means the distance between your nozzle and bed, and here is how to adjust it". Now comes G-code, or LCD menu, etc. But why is everyone forgetting that you can adjust the distance between your bed and nozzle using the screws?! I can't seem to wrap my head around this. In my case, of course, I can't use the screws -- they've reached their limit, so I need to add extra using G-code. But nobody seems to really explain this nicely...

Summary: I urgently need a walkthrough for 6-year-olds. Make that 4-year-olds.

So the new silicone buffers raised the bed by 5 mm? When this happens, you should raise the endstop also with 5 mm. Else the printer will go down to the Z endstop that is effectively 5 mm below the level of the bed. I guess the buffers cannot be compressed by 5 mm, so you need to move the endstop up to the level your buffer compression is in reach of.

No software offset will work (for your current setup: homing on the bed surface does not work as the switch need to be triggered prior to having any offset in play) other than a hardware change or compression of the buffers of 5 mm. It would only be possible to use a software offset when the nozzle homes off the bed surface (next to the bed). The only thing you would have had to do is add in your start G-code:

G0 Z5   ; Move the head to 5 mm
G92 Z0  ; Call this Z = 0


If #define Z_SAFE_HOMING is enabled, you should comment the line in the configuration file to make it home Z at the homed X, Y position.

I will not go into all G-codes, details are read on the G-codes Wiki pages and Marlin firmware G-codes, these won't be able to help you out unless you fix the homing on the bed surface. Currently, you need to do a hardware fix, your endstop is below the surface level of the bed. Alternative is to remove homing Z above the bed surface and redefine the Z offset. A hardware fix is a better solution, and if you manage to print a fancy Z endstop holder and counterpart with a screw you will be able to level the bed more easily.

E.g. M428 can set an offset, yes, but, it needs a reference; that reference is the homing reference or the current position. The current position of a printer that is just turn on is meaningless, it can be everywhere in the print volume. So you need to trigger the endstops first, that is not possible when it is not reachable (without compressing the bed).

• @0scar♦ So in conclusion, all I need to do is get rid of my homing-in-center-of-bed (by uncommenting #define BED_CENTER_AT_0_0 in my firmware, I suppose?), and then all my troubles are over and my offsets will work? – Pixie Jan 18 at 19:22
• I agree with all 0scar advices. Bit funny idea: I would say that there is an alternative solution, but still hardware and I never tried to do that: (1) add the second (upper) endstop for Z (or move & reverse the existing one), (2) change your firmware to reverse Z homing direction (find the highest point, and probably disable Z backoff too), and then in G-Code assume this position to be exact high value (e.g. use G92 Z250 to fix that). Then your actual offset is applied without homing down into bed! I would like to see proof of concept :) – octopus8 Jan 18 at 20:40
• @Pixie, "get rid of my homing-in-centerbed" --> not only, you need to target Z outside of the bed. You would need to ensure homing order (first X or Y, then Z) and backoff to move carriage behind the bed (like -30 or 250, I do not know Anet A6!). Configuring such backoff may not be possible. Firmware may have settings enabled to block it at all. Or you can home each axis separately (e.g. G28 X) and trick the firmware - e.g. after X=0 you call G92 X50 and then can move outside bed (and crash into the frame?), then home Z. Very exaggerted, tricky method, error prone, not worth effort at all. – octopus8 Jan 18 at 20:54
• @Pixie your bed center cannot be in the middle, only a few printers have that. SAFE_HOMING should be in comments. As BED_CENTER_AT_0_0 should be in comments as well. – 0scar Jan 19 at 22:24

Setting any offset will move the whole print ("effectively shifts the coordinate space") - so you can set up for printing above or below bed, or shifting several cm to the right, for example - and then your print may not actually fit the printing space. For example: my frame is blocking X moves at the top, I can set the 20 mm X offset to avoid accident when printing high (so shift the print). Or when setting the new print on top of another print, thus shifting the position, etc. If you call M428 in any position, then current position will become the new offset. Current offset settings is reported by M503 (or M206 without parameters).

Also G92 is used as ad-hoc operation when relative positioning is used. It makes sense for extruder movements, but is not used for moving the printing head in practice. I would say that any such calls for X,Y,Z sound like some hacking, and you should know exactly what you are doing for tricking printer's logic this way. I would avoid this at all.

Normally (0,0,0) for cartesian printers is nearest-bottom-left point of the bed. If properly zero the printer is what you are trying to achieve, then you should:

• zero any X,Y,Z offsets: M206 X0 Y0 Z0 (unless some is justified like in the frame example)
• save this setting for future: M500
• home the printer - it zero the position, and then automiaticall backoff to some "safe distance" (programmed in firmware)
• use LCD to move carriage back to zero: at least for the Z axis
• regulate bed screws to fit the zero position of printing head

There are settings in Marlin's file Configuration_adv.h:

• Marlin 1.1:

#define X_HOME_BUMP_MM 5
#define Y_HOME_BUMP_MM 5
#define Z_HOME_BUMP_MM 2

• Marlin 2.x:

#define HOMING_BUMP_MM      { 5, 5, 2 }       // (mm) Backoff from endstops after first bump


They do not change the zero (do not set offset), but force the carriage to move away from zero during homing operation and (Marlin 1.1) after homing, becuse usually it is convenient. Marlin 2.x offers separate parameter for final backoff:

//#define HOMING_BACKOFF_MM { 2, 2, 2 }


If you would like to center the head after homing, I would suggest to use these settings.