Z-axis values of position_min & position_endstop with endstop sensor BELOW the bed

Basic Information:

Printer Model: No-name (cartesian, IDEX)
MCU / Printerboard: no-name w/Atmega256 & TMC2209
Host / SBC: RPi Zero 2W
klippy.log: not available

The printer

I am trying to understand the kinematic model and proper configuration for the Z-axis values. The printer physically has 2 lead screws, 2 z-steppers, and 2 IR sensors on Z that trigger with head below the bed. The printer doesn’t have nozzle probe.

The problem

From what I put together it seems to be unusual to have
I think I am having two compounding issues here:

  1. I am not fully understanding how “position_min” and “position_endstop” are used.
  2. My Z limit sensor is below the bed, which is apparently unusual (?)

My understanding so far

  • position_min & position_endstop make complete sense to me for X & Y after reading @Sineos Understanding X and Y Axes Limits and Homing guide. In essence for X & Y they have some negative values so Klipper knows where (0,0) is. However, I cannot wrap my head around Z axis.
  • In my understanding position_min is the physical gantry limit. If I understand this correctly, this makes it almost an arbitrary number on Z, i.e. default 0mm is fine.
  • The position_endstop is confusing to me. The documentation offers no help saying that position_endstop is “Location of the endstop” which doesn’t help :wink:
  • If I apply the same logic as for X/Y and set it position_min and position_endstop to be equal and negative by the difference between physical endstop triggering and nozzle passing the paper test it will work. However, this means that the nozzle can still easily crash into the bed.
  • In my head, esp. after looking at Z_ENDSTOP_CALIBRATE & bed leveling guide, I would imagine position_min being the bed level with position_endstop < position_min to represent endstop being below the bed. However, such configuration is invalid.
  • Based on FAQ entry “Why is the Z position_endstop set to 0.5 in the default configs” (cannot link as a new user) it is almost implied that physical Z endstop should never be below the bed?
  • I can set position_min and position_endstop to 0 and use SET_GCODE_OFFSET Z=# after homing with a value that is a difference between endstop and top surface of the bed… but this doesn’t feel right.

What am I understanding wrong here? This seems like it should be a pretty easy setting to derive but it is giving me a headache for hours :slight_smile:

In general, please always post the klippy.log as it will give the supporters the needed insights into your config.

Regarding the z-endstop, there are basically two possibilities (when not using a probe, which is rather rare nowadays). The following explanation assumes your bed is moving and not the gantry:

  1. The z-endstop determines the z-axis 0: Here, the endstop-position equals the min-position and equals z=0. This means the endstop needs to be fine-tuned to properly give you the first layer height.
  2. The z-endstop determines the z-axis maximum: The bed moves all the way down until it hits the endstop (= position max = position endstop) and then moves up until it reaches z=0. Here, the endstop also needs to be positioned in a way that creates the proper first layer height.