A Klipper plugin for accurate Z homing

Overview

Stable Z Homing for Klipper

A Klipper plugin for accurate Z homing

This plugin provides a new G-code command, STABLE_Z_HOME, which homes Z repeatedly until the Z offset stabilizes. This is useful if you have a printer which homes by pushing the nozzle against the Z endstop, where any plastic on or oozing from the nozzle can affect the Z offset and hence cause variation in the height of your first layer. The plugin can optionally run a G-code script before each probe, allowing you to clean the nozzle immediately before the offset is measured.

Feed the Llama

This plugin is developed in my spare time. If you like it, please consider supporting further development and updates by making a donation.

Feed the Llama


Motivation

To illustrate the problem this plugin is designed to solve, here is an experiment run on a Voron V2.4, with the nozzle pushed against a pin connected to a microswitch used as the Z endstop. I measured the probed Z offset every 10 seconds, starting with the extruder cold, and heating the extruder to the printing temperature for ABS (250C here). The nozzle was not scrubbed or cleaned in any way before or during this run, for demonstration purposes.

You can see that the Z offset varies by as much as 0.15mm during the run. As the plastic on the nozzle melts and gets squashed, the nozzle appears to move 0.15mm closer to the bed. Then, the filament in the nozzle oozes, pushing the nozzle up by 0.10mm over the next minute. Finally, as the oozing subsides, the offset settles at around -0.10mm.

Graph

Installation

Clone the repo into the home directory of your Pi, then symlink stable_z_home.py into your Klipper installation, like this:

$ cd ~/klipper/klippy/extras
$ ln -s ~/Klipper-Stable-Z-Home/stable_z_home.py .

Add the following to your Klipper config file, adjusting the G-code, which will be run before each probe attempt, to your needs:

[stable_z_home]
gcode:
    # use nozzle brush to clean nozzle; requires PURGE parameter, see below
    CLEAN_NOZZLE PURGE=0  

You can then add STABLE_Z_HOME to your PRINT_START macro, to replace the final G28 Z you may have there. A good time to do this is between heating the extruder and your final purge, e.g.:

[gcode_macro PRINT_START]
gcode:
    # ...
    M104 S{EXTRUDER}
    M109 S{EXTRUDER}

    STABLE_Z_HOME  # instead of G28 Z

    CLEAN_NOZZLE PURGE=1
    # ...

Note that to use the CLEAN_NOZZLE macro, which is from edwardyeeks' excellent purge bucket and nozzle scrub macros which can be found here, you need to extend the macro with a PURGE argument which allows you to scrub the nozzle without purging. Skipping the purge before each probe attempt saves time and minimizes oozing. The macro is easily extended like this:

[gcode_macro clean_nozzle]
# Add a parameter at the top, with default value 1 (purge).
default_parameter_PURGE: 1

# ...

gcode:
      # ...

      # Replace the "if" condition around the purge section in the macro as follows.

      ## Check if user enabled purge option or not.
      {% if params.PURGE|int == 1 %}
      
        # ... perform the purge ...
      
      {% endif %}
      
      # ...

Configuration

The following parameters can be adjusted in the [stable_z_home] section:

[stable_z_home]
#gcode:
#  The G-code to run before each probe attempt. The default is none.
#retries:
#  The maximum number of probe attempts allowed. The default is 20.
#window:
#  The number of samples to use in the tolerance window. The default is 4.
#retry_tolerance:
#  The maximum range between the min and max values of the Z offset in the window
#  to consider the offset stable and complete the procedure. The default is
#  0.0025mm.

The parameters RETRIES, RETRY_TOLERANCE, and WINDOW, can also be passed to the STABLE_Z_HOME command, in which case they override the defaults set in the config section above.


Copyright (C) 2021 Matthew Lloyd

Owner
Matthew Lloyd
Matthew Lloyd
edgetest is a tox-inspired python library that will loop through your project's dependencies, and check if your project is compatible with the latest version of each dependency

Bleeding edge dependency testing Full Documentation edgetest is a tox-inspired python library that will loop through your project's dependencies, and

Capital One 16 Dec 07, 2022
A simple desktop application to scan and export Genshin Impact Artifacts.

「天目」 -- Amenoma 简体中文 | English 「天目流的诀窍就是滴水穿石的耐心和全力以赴的意志」 扫描背包中的圣遗物,并导出至 json 格式。之后可导入圣遗物分析工具( 莫娜占卜铺 、 MingyuLab 、 Genshin Optimizer 进行计算与规划等。 已支持 原神2.

夏至 475 Dec 30, 2022
Validate UC alumni identifier numbers with Python 3.

UC number validator Validate UC alumni identifier numbers with Python 3. Getting started Install the library with: pip install -U ucnumber Usage from

Open Source eUC 1 Jul 07, 2021
Minecraft Multi-Server Pinger Discord Embed

Minecraft Network Pinger Minecraft Multi-Server Pinger Discord Embed What does this bot do? It sends an embed and uses mcsrvstat API and checks if the

YungHub 2 Jan 05, 2022
A python library with various gambling and gaming classes

gamble is a simple library that implements a collection of some common gambling-related classes Features die, dice, d-notation cards, decks, hands pok

Jacobi Petrucciani 16 May 24, 2022
Imports an object based on a string import_string('package.module:function_name')() - Based on werkzeug.utils

DEPRECATED don't use it. Please do: import importlib foopath = 'src.apis.foo.Foo' module_name = '.'.join(foopath.split('.')[:-1]) # to get src.apis.f

Bruno Rocha Archived Projects 11 Nov 12, 2022
Demo of patching a python context manager

patch-demo-20211203 demo of patching a python context manager poetry install poetry run python -m my_great_app to run the code poetry run pytest to te

Brad Smith 1 Feb 09, 2022
python for windows extensions

This is the readme for the Python for Win32 (pywin32) extensions source code. See CHANGES.txt for recent changes. 'setup.py' is a standard distutils

27 Dec 08, 2022
Python MQTT v5.0 async client

gmqtt: Python async MQTT client implementation. Installation The latest stable version is available in the Python Package Index (PyPi) and can be inst

Gurtam 306 Jan 03, 2023
Programa principal de la Silla C.D.P.

Silla CDP Página Web Contáctenos Lista de contenidos: Información del proyecto. Licencias. Contacto. Información del proyecto Silla CDP, o Silla Corre

Silla Control de Postura 1 Dec 02, 2021
python scripts to perform coin die clustering (performed on Riedones3D).

python scripts to perform coin die clustering (performed on Riedones3D).

Sofiane 2 Apr 29, 2022
Little tool in python to watch anime from the terminal (the better way to watch anime)

anipy-cli Little tool in python to watch anime from the terminal (the better way to watch anime) Has a resume playback function when picking from Hist

sdao 97 Dec 29, 2022
This is a Fava extension to display a grouped portfolio view in Fava for a set of Beancount accounts.

Fava Portfolio Summary This is a Fava extension to display a grouped portfolio view in Fava for a set of Beancount accounts. It can also calculate MWR

18 Dec 26, 2022
Wrapper for the undocumented CodinGame API. Can be used both synchronously and asynchronlously.

codingame API wrapper Pythonic wrapper for the undocumented CodinGame API. Installation Python 3.6 or higher is required. Install codingame with pip:

Takos 19 Jun 20, 2022
Python project setup, updater, and launcher

pyLaunch Python project setup, updater, and launcher Purpose: Increase project productivity and provide features easily. Once installed as a git submo

DAAV, LLC 1 Jan 07, 2022
Tools for collecting social media data around focal events

Social Media Focal Events The focalevents codebase provides tools for organizing data collected around focal events on social media. It is often diffi

Ryan Gallagher 80 Nov 28, 2022
Скрипт позволяет заводить задачи в Панель мониторинга YouTrack на основе парсинга сайта safe-surf.ru

Скрипт позволяет заводить задачи в Панель мониторинга YouTrack на основе парсинга сайта safe-surf.ru

Bad_karma 3 Feb 12, 2022
Dump Data from FTDI Serial Port to Binary File on MacOS

Dump Data from FTDI Serial Port to Binary File on MacOS

pandy song 1 Nov 24, 2021
Malicious Document IoC Extractor is a collection of scripts that helps extracting IoCs from various maldoc families.

MDIExtractor Malicious Document IoC Extractor (MDIExtractor) is a collection of scripts that helps extracting IoCs from various maldoc families. Prere

Malwrologist 14 Nov 25, 2022
This simple script generates a backup of a given Python and R environment

Python Environment Backup It’s always good to maintain your Python and R Anaconda environment packages properly listed and well-kept in case you have

Andrew Laganaro 1 Jul 13, 2022