Understanding X and Y Axes Limits and Homing

The X and Y Axis

Klipper needs to know from its printer.cfg settings how far the X and Y axes can safely move without hitting the printer’s frame.
It also needs to know where the origin (X=0 / Y=0) is. This origin is the beginning of the usable printer bed.
In the following, we assume a Cartesian printer that follows the conventions of a Cartesian Coordinate System. This is also the reason why it is a quasi-standard to define the origin as the left-front corner of the bed. This way, all logic and movement easily aligns with the familiar Cartesian coordinate system.

Viewed from the nozzle, the Cartesian coordinate system is shown in the following figure1):

:exclamation: Important
For simplicity, the following is assumed:

  • The origin (X=0 / Y=0) is defined in the front left corner of the bed
  • The moving part is the nozzle / print-head, while the bed remains static
  • Moving the bed will flip the logic for the Y-axis:
    • On a static bed, the head will move to the front to reach Y=0
    • On a moving bed, the bed will move to the rear to reach Y=0
  • The location where an endstop is mounted does not matter. All that matters is the role that is assigned to the respective endstop in the configuration
  • This is a general explanation of the logic and does not cater to any specific setup.

Basic Homing Theory

  • After the printer is started or the power to the steppers is turned off, Klipper does not know where the print head is. In this state, any movement is dangerous because the movement limits are unknown, which can easily lead to a crash → Homing is needed
  • There are two different basic homing scenarios:
    • Homing towards position_max and position_endstop also near the max position
    • Homing towards position_min with position_endstop also near the min position
  • position_endstop must always be between position_min and position_max or an error is thrown
  • The dominant homing direction is determined by the proximity of position_endstop to position_min respectively position_max. The head moves to the nearest position in each case
  • Homing towards position_max
    • Klipper starts moving in the positive direction (usually to the right for X and to the back for Y) until it hits the endstop
    • After hitting the endstop, Klipper now knows that the bed’s origin (X=0 / Y=0) is position_max millimeters away from the current position
  • Homing towards position_min
    • Klipper starts moving in the negative direction (usually to the left for X and to the front for Y) until it hits the endstop
    • After hitting the endstop, Klipper now knows that the bed’s origin (X=0 / Y=0) is position_min millimeters away from the current position

Homing to position_max

  • Kinematic Limits define the maximum travel before either an endstop or the frame is hit.
  • position_max is the distance in mm between the endstop and the bed’s left edge (X), respectively the bed’s front edge (Y).
    • In this setup, position_max typically is equal to position_endstop
    • From the position_endstop Klipper needs to travel in the negative direction this amount of millimeters in order to reach the origin
    • This defines the origin X=0 and Y=0 where the usable part of the bed starts.
  • position_min would allow the print head to move past the origin into the negative quadrant of the coordinate system.
    • If the space between the bed and the frame allows it, this setting can be useful, e.g. to increase the probeable area of the bed.
    • It does not change the origin.

Homing to position_min

  • Kinematic Limits again define the maximum travel before either an endstop or the frame is hit.
  • position_min now is the distance in mm between the endstop and the bed’s right edge (X), because the head already is in the negative quadrant.
    • In this setup, position_min typically is equal to position_endstop
    • From the position_endstop Klipper needs to travel in the positive direction this amount of millimeters in order to reach the origin
    • This defines the origin X=0 and Y=0 where the usable part of the bed starts.
  • Both logics can be mixed, depending on the printer physical layout.
  • position_endstop always must be equal or greater (less negative) than position_min

Usable Printer Bed

  • Due to the printer’s / print head’s geometry and attached parts (fans, probe etc.), it is not uncommon that some areas of the bed cannot be reached
  • As discussed above, position_endstop and position_max / position_min will still define the start of the usable bed, but this does no longer align with the physical boundaries of the bed
  • In the slicer, this “effective size” needs to be set
    • The slicer will define its own center of the bed as the middle of this range
    • Viewed from the physical boundaries of the bed, the print might appear off-center
  • All this relates to the nozzle coordinates. When tuning such values, the GET_POSITION command provides the relevant information

Mesh Coordinates vs. Nozzle Coordinates

  • The relevant coordinates for the bed mesh (mesh_min / mesh_max) do not relate to the nozzle coordinates but to the actual coordinates of the probe’s tip
    • The probe’s tip coordinates are defined as offsets to the nozzle coordinates via the x_offset / y_offset settings in the [bltouch] / [probe] section
    • It is important that these offsets are as precise as possible
  • The easiest process to determine the proper starting and ending coordinates for mesh_min / mesh_max is:
    1. Home the printer
    2. Move the head towards the left-front corner until you have positioned the probe’s tip as close as possible to this left-front edge
    3. Issue the GET_POSITION command and get the nozzle coordinates
    4. Correct the obtained X value with the x_offset and the Y value with the y_offset (mind the algebraic sign)
    5. Enter the corrected values as mesh_min
    6. Repeat steps 2. to 5., but this time place the probe’s tip as close as possible to the back-right corner and use the result for mesh_max
  • Setting these coordinates wrongly typically will lead to a Move out of range: X Y Z [E] error

Diagrams are created with Excalidraw and are attached for future reference:
Diagrams.zip (13.5 KB)

1) Credits to @mental

13 Likes
Setting X/Y Min Max?
Pinter not printing in the center of bed
Move out of range: 5.000 232.000 5.000 [0.000]
How is the definition position_endstop applied?
I don't really understand what the homimg process is like in klipper
Understanding X and Y limits and homing....Questions
Honestly im about to give up on klipper, its just getting ridiculous at this point
Help setting origin & X/Y axis limits
Move out of Range during Mesh Calibrate
Z-axis values of position_min & position_endstop with endstop sensor BELOW the bed
Move out of range: 1.000 -25.012 10.000 [0.000]
Home_xy_position for bed center parameters don’t match bedsize
Understanding Understanding X and Y Axes Limits and Homing
Ender 3 with btt skr e3 v3 board and cr-touch
Z tilt problems
Another Move out of range error
First Klipper Build Actuator Help
Calibrate after homing generates this error Move out of range: -22.000 -32.000 5.000 [0.000]
Always have Move out of range on bed mesh calibrate
Move Out Of Range Issue pls help - Bed Mesh Calibrate
Out of range after the relocation of CR touch
[Solved] Z Tilt Adjust making bed alignment far worse
Always have Move out of range on bed mesh calibrate
E3S1Pro Meshes off the bed first probe attempt
Move out of range error after homing
Help with "Move out of range"
Z_TILT for 4 stepper_z
Move out of range: 5.000 -20.250 5.000 [0.000]
Prints are shifted
ANet A6 X&Y Offset
Where are printer.cfg and enisy-rambo.cfg for Prusa i3MK3S+?
Config help KlipperK1
Out of Range Error -- help a noob
Printer wint print in center
Bl touch cant reach end of the bed
Help! Move out of range: -20.500 14.000 8.000 [0.000]
Move out of range error / Klipper / Cura
About the Knowledge Base category / Table of Contents
Nozzle hits bed when using bed mesh
Hybrid Corexy seems to need inversion
Mirrored Prints
Understanding X and Y limits and homing....Questions
I need some help, newbie in trouble
X and Y endstops are triggering ok, connected to the right ports but endstop X acts on Y movement and vice versa
Bed_Mesh magnified to points off the bed
CoPrint - Multicolor Printing Setup Help
Z-Tilt adjustment should respect probe offsets
Not able to print after setting up printer
Corexy homing moves diff direction after first probe
Probe Offsets not being used to move tool head during PROBE command
Difficulties with Z probe "No trigger on z after full movement"
Kobra MAX/CatBoat - Move out of range while homing z