Question: Can a "ZMin-while-probing" be set? Meaning a minimum Z height the printer bed can move to, while Z Probing.

Purpose: For safety reasons should the probe switch not fire for some reason.


in Marlin Configuration.h, I see you can set the height of the Z Axis before deploying the ZProbe:


In the context of this question, this is effectively a "ZMax-while-probing", i.e the lowest possible the print bed will be before Z Probing commences.

I am looking for a "ZMin-while-probing" equivalent. The reason for this is just an added safety check - I know that if the probe switch doesn't fire by Z<=25, then it is not going to, and with this particular printer configuration, that would result in the Z Probe being driven into the printer bed.

Does a setting already exist to create a sanity-check here?


1 Answer 1


You have not stated the version of Marlin you are using. I will assume we are discussing the latest Marlin 1.1 RC8.

There is no longer any Z_PROBE_DEPLOY_HEIGHT but in earlier Marlin versions it did not function as you think; it was used to signify the amount of Z travel to execute prior to Z probe deployement. This is to ensure available space for servo-mounted, sled, or other types of "stowed" probes. This was not a limit to the Z travel, but the amount of Z travel to always execute before begining homing. If a printer without Z_MAX_ENDSTOP is left at maximum travel position, using non-zero Z_PROBE_DEPLOY_HEIGHT could crash a bot into the Z maximum end position.

In these previous versions of Marlin, the homing height was computed by a combination of the above constant adding and subtracting to/from some others, which has since been replaced by the simpler and singular Z_HOMEING_HEIGHT (which works indpendant from the new Z_CLEARANCE_DEPLOY_PROBE):

//#define Z_HOMING_HEIGHT 4  // (in mm) Minimal z height before homing
(G28) for Z clearance above the bed, clamps, ...

#define Z_CLEARANCE_DEPLOY_PROBE   10 // Z Clearance for Deploy/Stow

The absolute value of the maximum bed positions are used in Marlin as sanity check to ensure no axis moves greater than this amount in one movement in either positive or negative direction:

#define Z_MAX_POS 200

If your probe does not function correctly, no ficticious Z_MIN_WHILE_PROBING will prevent a faulty probe from causing a head crash into the bed, so it is not implemented, allowing the Z_MAX_POS sanity check to prevent the Z axis stepper from continuing to run indefinitely during a fauly probe condition.

If your Z_MIN_WHILE_PROBING were implemented, if the printer were powered off (or Marlin crashed, etc) with the head at any Z distance greater than Z_MIN_WHILE_PROBING there would be no mechanism to begin a print on the next poweron, since Marlin will never move in the negative Z axis except during G28 probing and after probing completes successfully. The only way to recover in this case would be for someone to continually attempt to both home the printer then power-cycle, moving the head Z_MIN_WHILE_PROBING closer to the bed each iteration. This would be an unacceptable user exerience.

Further, if Z_MIN_WHILE_PROBING were implemented, the only percieved safety measure it would add is that during probe failure, the Z stepper would crash into the bed and continue to run for only Z_MIN_WHILE_PROBING stepper rotations instead of Z_MAX_POS rotations. Regardless, the bed would be impacted so there is hardly any additonal safety added and a stepper driver should not overheat or cause any more damage (other than what was already done to the bed) in a single Z_MAX_POS length of rotations.

For more piece of mind during homing, you may use the Z_MIN_PROBE_ENDSTOP feature with a normally-closed limit switch wired to an available pin on your control board:

// Enable Z_MIN_PROBE_ENDSTOP to use _both_ a Z Probe and a Z-min-endstop on the same machine.
// With this option the Z_MIN_PROBE_PIN will only be used for probing, never for homing.

Then use the Z_MIN_WHILE_PROBING feature to move the head above the Z_MIN_PROBE_ENDSTOP home position to perform probing. This will ensure that the printer will crash for only Z_PROBE_OFFSET_FROM_EXTRUDER Z stepper rotations if the probe malfunctions:

#define Z_PROBE_OFFSET_FROM_EXTRUDER 0   // Z offset: -below +above  [the nozzle]

In summary, to prevent the head from crashing into the bed, you must ensure your Z probe is functioning correctly :)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .