Skip to main content

Homing Override - Homing Override Configuration

Overview​

This page provides two Klipper Homing Override reference configurations to optimize the 3D printer homing process, improving safety and accuracy.

Configuration List​

ConfigurationFeature DescriptionApplicable Scenario
Configuration 1Basic homing override + bed centeringStandard homing process optimization
Configuration 2Nozzle temperature check + safe homingSafe homing in high-temperature environments

Configuration 1: Basic Homing Override​

Feature Description​

  • Automatically detects if Z-axis is homed; sets a virtual Z position if not
  • Automatically moves to the center of the bed before homing the Z-axis
  • Supports independent X, Y, Z homing commands
  • Reads printer maximum travel using printer.configfile.config

Complete Configuration​

[force_move]
enable_force_move: true

[homing_override]
axes: z
gcode:
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}

; If Z axis is not homed, set virtual position and raise
{% if 'z' not in printer.toolhead.homed_axes %}
SET_KINEMATIC_POSITION Z=0
G90
G0 Z5 F600
{% endif %}

{% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %}

{% if home_all or 'X' in params %}
G28 X
{% endif %}

{% if home_all or 'Y' in params %}
G28 Y
{% endif %}

{% if home_all or 'Z' in params %}
; Move to bed center [Important] Prevent collision when homing Z
G0 X{max_x / 2} Y{max_y / 2} F3600
G28 Z
G1 Z10 F2000
{% endif %}

Key Code Explanation​

G0 X{max_x / 2} Y{max_y / 2} F3600

This line of code moves the nozzle to the center of the bed before homing the Z-axis.

  • X{max_x / 2}: X-axis moves to half of the maximum travel (bed center X coordinate)
  • Y{max_y / 2}: Y-axis moves to half of the maximum travel (bed center Y coordinate)
  • F3600: Movement speed of 3600mm/min (60mm/s), rapid movement

Why is moving to the bed center necessary?

  1. Avoid Collisions: Prevents the nozzle from hitting leveling knobs or other obstacles at the edge of the bed during homing
  2. Improve Accuracy: The bed center is usually the flattest area, resulting in more accurate homing
  3. Compatibility: Supports various probes like ALPS, BL-Touch, EDDY

How to modify the movement speed?

  • Locate the line G0 X{max_x / 2} Y{max_y / 2} F3600
  • Change F3600 to your desired speed value
  • Recommended range: F1800-F3600 (30-60mm/s)

Usage Example​

G28 ; Home all → Check Z → Home XY → Move center → Home Z → Raise

Configuration 2: Homing Override with Temperature Protection​

Feature Description​

  • Includes all features of Configuration 1
  • Adds nozzle temperature check
  • Automatically cools down to a safe temperature when too high
  • Restores original temperature settings after homing is complete

Complete Configuration​

[force_move]
enable_force_move: true

[homing_override]
axes: z
gcode:
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
{% set e_target = printer.extruder.target %} ; Save target temperature
{% set fan_speed = printer.fan.speed %} ; Save fan speed

; If Z axis is not homed, set virtual position and raise
{% if 'z' not in printer.toolhead.homed_axes %}
SET_KINEMATIC_POSITION Z=0
G90
G0 Z5 F600
{% endif %}

{% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %}

{% if home_all or 'X' in params %}
G28 X
{% endif %}

{% if home_all or 'Y' in params %}
G28 Y
{% endif %}

{% if home_all or 'Z' in params %}
; Temperature check [Modifiable] Change 150 to your temperature threshold
{% if e_target >= 150 or printer.extruder.temperature >= 150 %}
M106 S255 ; Turn on fan to aid cooling
M109 S150 ; Wait for cooling to 150°C [Modifiable]
{% endif %}
M106 S0 ; Turn off fan

; Move to bed center [Important] Prevent collision when homing Z
G0 X{max_x / 2} Y{max_y / 2} F3600
G28 Z
G1 Z10 F2000

; Restore temperature and fan speed
M109 S{e_target}
M106 S{fan_speed}
{% endif %}

Temperature Protection Logic​

  1. Check Temperature: Checks if the nozzle target or actual temperature is ≥ 150°C
  2. Turn on Fan: M106 S255 turns on the cooling fan at full speed
  3. Wait for Cooling: M109 S150 waits for the nozzle to cool to 150°C
  4. Turn off Fan: M106 S0 turns off the fan to prepare for homing
  5. Execute Homing: Move center → Home Z → Raise
  6. Restore State: Restores original target temperature and fan speed

How to Modify the Temperature Threshold​

  1. Find the two locations marked [Modifiable]
  2. Change 150 to your desired temperature value
  3. Both locations must be changed to the same value simultaneously
  4. Save and restart Klipper

Usage Example​

G28 ; Home all → Check temperature → Cool down (if needed) → Move center → Home Z → Restore temperature


Loading...