Automatic Z-Offset Calibration - Danger Klipper documentation (2024)

This document provides information on calibrating the nozzle's Z offsetautomatically. With this enabled, manual Z offset or first layercalibrations are needless. It computes always the correct offset independantlyof the current temperature, used nozzle or used print bed or flex plate.

  • The Z endstop used in Voron V1 or V2 printers is a clever one because the nozzle clicks on a switch which is fixed to the print bed. This enables the exchange of nozzles without changing the offset (between switch and bed): Automatic Z-Offset Calibration - Danger Klipper documentation (1)
  • Or, by using a surface probing probe like a mag-probe as the Z endstop. This enables the exchange of flex plates without adapting the offset: Automatic Z-Offset Calibration - Danger Klipper documentation (2) An inductive probe would not work, since it does not probe the surface of the bed directly!
  • But, isn't it possible to get both of it?

It is possible and this it is what this extension does!

But, there are some requirements to use it:

  • A Z endstop where the tip of the nozzle drives on a switch (like the stock Voron V1/V2 enstop). It will not work with the virtual pin of the probe configured as endstop!
  • A (magnetic) switch based probe at the print head
  • Both, the Z endstop and mag-probe are configured properly and homing and any kind of bed leveling are working.
  • Attach and detach macros of the mag-probe are needed for this configuration.
  1. A normal homing of all axes using the Z endstop for Z (this is not part of this plugin). After that, there is a defined zero point in Z. From now on, everything is in relation to this point. So, a new homing would change everything, since the homing is not that precise.
  2. Determine the height of the nozzle by probing the tip of it on the Z endstop (like the homing in step 1. But this one can result in a slightly different value): Automatic Z-Offset Calibration - Danger Klipper documentation (3)
  3. Determine the height of the mag-probe by probing the body of the switch on the z-endstop: Automatic Z-Offset Calibration - Danger Klipper documentation (4)
  4. Calculate the offset between the tip of the nozzle and the trigger point of the mag-probe:

    nozzle switch offset = mag probe height - nozzle height + switch offset

    Automatic Z-Offset Calibration - Danger Klipper documentation (5)

    The trigger point of the mag-probe cannot be probed directly. This is why the body of the switch is clicked on the endstop indstead of the trigger nob. This is why a small switch offset is used here to reflect the offset between the nob and the body of the switch while it is triggerd. This offset is fixed.

  5. Determine the height of the print surface by probing one point with the mag-probe on the bed (preferably the center or the "bed_mesh:relative_reference_index" of a configured/used mesh).

  6. Now, the final offset is calculated like this:

    probe offset = probed height - calculated nozzle switch offset

  7. Finally, the calculated offset is applied by using the SET_GCODE_OFFSET command (a previous offset is resetted before!).

Interference

Temperature or humindity changes are not a big deal since the switch is notaffected much by them and all values are probed in a small time period and onlythe releations to each other are used. The nozzle height in step 2 can bedetermined some time later and even many celsius higher in the printer'schamber, compared to the homing in step 1. That is why the nozzle is probedagain and can vary a little to the first homing position.

Example Output

The output of the calibration with all determined positions looks like this(the offset is the one which is applied as GCode offset):

Z-CALIBRATION: ENDSTOP=-0.300 NOZZLE=-0.300 SWITCH=6.208 PROBE=7.013 --> OFFSET=-0.170

The endstop value is the homed Z position which is always zero or the configure"stepper_z:position_endstop" setting - and in this case, it's even the same asthe probed nozzle hight.

To activate the extension, a [z_calibration] section is needed in the printerconfiguration. The configuration properties are describedhere in details.

Switch Offset

The "z_calibration:switch_offset" is the already mentioned offset from theswitch body (which is the probed position) to the actual trigger point aboveit. A starting point for this value can be taken from the datasheet like fromthe Omron switch (D2F-5: 0.5mm and SSG-5H: 0.7mm). It's good to start with alittle less depending on the squishiness you prefer for the first layer (it'sabout 0.45 for the D2F-5). So, with a smaller offset value, the nozzle is moreaway from the bed! The value cannot be negative.

For example, the datasheet of the D2F-5:

Automatic Z-Offset Calibration - Danger Klipper documentation (6)

And the calculation of the offset base:

offset base = OP (Operation Position) - switch body height 0.5 mm = 5.5 mm - 5 mm

Attaching and Detaching the Probe

The attaching and detaching of the mag-probe can be done by creating a macrofor the CALIBRATE_Z command and surround it by the appropriate commands:

[gcode_macro CALIBRATE_Z]description: Automatically calibrates the nozzles offset to the print surface and dock/undock MagProberename_existing: CALIBRATE_Z_BASEgcode: ATTACH_PROBE # replace with the name of your specific attach macro CALIBRATE_Z_BASE DETACH_PROBE # replace with the name of your specific detach macro

It is also possible to use the start_gcode and end_gcode properties tocall the attach and detach commands instead:

[z_calibration]...start_gcode: ATTACH_PROBE # replace with the name of your specific attach macroend_gcode: DETACH_PROBE # replace with the name of your specific detach macro

If there are any space restrictions and it is not possible to probe the nozzleon the endstop with the probe attached, the before_switch_gcode property canbe used to attach the probe instead of the start_gcode. Then, the probe isnot attached until the probe is probed on the endstop:

[z_calibration]...before_switch_gcode: ATTACH_PROBE # replace with the name of your specific attach macroend_gcode: DETACH_PROBE # replace with the name of your specific detach macro

Bed Mesh

If a bed mesh is used, the coordinates for probing on the print bed must beexactly the relative reference index point of the mesh since this is the pointzero of the mesh! But, it is possible to omit these properties completely andthe relative reference index point of the mesh will be taken automatically (forthis, the "bed_mesh:relative_reference_index" setting is required and there isno support for round bed/mesh so far)!

Do not bother too much about absolute values of the calculated offsets. Thesecan vary a lot. Only the real position from the nozzle to the bed counts. Totest this, the result of the calibration can be queried by GET_POSITIONfirst:

> CALIBRATE_Z> Z-CALIBRATION: ENDSTOP=-0.300 NOZZLE=-0.267 SWITCH=2.370 PROBE=3.093 --> OFFSET=-0.010000> GET_POSITION> mcu: stepper_x:17085 stepper_y:15625 stepper_z:-51454 stepper_z1:-51454 stepper_z2:-51454 stepper_z3:-51454> stepper: stepper_x:552.500000 stepper_y:-47.500000 stepper_z:10.022500 stepper_z1:10.022500 stepper_z2:10.022500 stepper_z3:10.022500> kinematic: X:252.500000 Y:300.000000 Z:10.022500> toolhead: X:252.500000 Y:300.000000 Z:10.021472 E:0.000000> gcode: X:252.500000 Y:300.000000 Z:9.990000 E:0.000000> gcode base: X:0.000000 Y:0.000000 Z:-0.010000 E:0.000000> gcode homing: X:0.000000 Y:0.000000 Z:-0.010000

Here, the Z position in "gcode base" reflects the calibrated Z offset.

Then, the offset can be tested by moving the nozzle slowly down to zero bymoving it in multiple steps. It's good to do this by using GCodes, sincethe offset is applied as GCode-Offset. For example like this:

> G90> G0 Z5> G0 Z3> G0 Z1> G0 Z0.5> G0 Z0.3> G0 Z0.1

Check the distance to the print surface after every step. If there is a smalldiscrepancy (which should be smaller than the offset base from the switch'sdatasheet), then adapt the "z_calibration:switch_offset" by that value.Decreasing the "switch_offset" will move the nozzle more away from the bed.

And finally, if you have double checked, that the calibrated offset is correct,you can go for fine tuning the "z_calibration:switch_offset" by actuallyprinting first layer tests. This needs to be done only once!

Command CALIBRATE_Z

The calibration is started by using the CALIBRATE_Z command. There are nomore parameters. A clean nozzle is needed for running this command.

It does not matter when this calibration is called (and at what temperatures).But, it is importaint to call it just before starting a print when the printeris hot. So, it is good to add the CALIBRATE_Z command to the PRINT_STARTmacro (which is called from the slicers start gCode). The sequence of thismacro can look like this:

  1. Home all axes
  2. Heat up the bed and nozzle (and chamber)
  3. Get probe, make any bed leveling if needed (like QGL, Z-Tilt), park probe
  4. Purge and clean the nozzle
  5. Get probe, CALIBRATE_Z, park probe
  6. (Adjust Z offset if needed)
  7. Print intro line if used
  8. Start printing...

:exclamation: And remove any old Z offset adjustments here(like SET_GCODE_OFFSET)

For textured print surfaces, it might be necessary to go closer to the bed.To adjust the offset from the slicers start GCode, the following command can beadded to the PRINT_START macro after calling the Z calibration:

 # Adjust the G-Code Z offset if needed SET_GCODE_OFFSET Z_ADJUST={params.Z_ADJUST|default(0.0)|float} MOVE=1

Then, a Z_ADJUST=0.0 can be added to the PRINT_START command in the Slicer.This does not reset the offset to this value but adjusts it by the givenamount!

NOTE: Do not home Z again after running the Z calibration or it needs tobe executed again!

Command PROBE_Z_ACCURACY

There is also a PROBE_Z_ACCURACY command to test the accuracy of the Zendstop (like the PROBE_ACCURACY command of the probe):

PROBE_Z_ACCURACY [PROBE_SPEED=<mm/s>] [LIFT_SPEED=<mm/s>] [SAMPLES=<count>] [SAMPLE_RETRACT_DIST=<mm>]

It calculates the maximum, minimum, average, median and standard deviation ofmultiple probe samles on the endstop by taking the configured nozzle positionon the endstop. The optional parameters default to their equivalent setting inthe z_calibration config section.

Ooze Mitigation

Ooze with any nozzle probe endstop can cause inaccuracies, as the filament will continue to leak ordeform over the space of multiple probes. It is highly recommended to take some measures to preventooze buildup before the nozzle probe portion of this plugin.

A slow long retraction, of as much as 15mm at print end, can reduce the potential for ooze. If you dothis, consider adding a comparable extrude as the last command in your print start sequence to bringthe plastic back to the tip. (Retracts longer than 5mm have been linked to clogs in many hotends,especially the Rapido. This may be best considered a last resort, depending on exact hardware andfilament.)

Heating the nozzle about a minute before scrubbing - using a purge bucket - will allow all theremaining plastic time to drain from the nozzle and be cleaned away by a simple wipe. If using apurge and scrubbing bucket, do not purge filament at this stage.

An endstop switch that requires a stronger activation force, such as sexbolt with a spring, orunklicky z, can help squash any remaining ooze and improve consistency.

Probing can be done with a hotend temperature below the full temperature for the print. If you printat 250, you can preheat the nozzle to 180, and run this script before finishing the heat up to fulltemperature. This may have varying effects depending on temperatures used.

Also consider picking up your probe prior to your nozzle wipe, to allow this script to probe thenozzle immediately after cleaning it.

Automatic Z-Offset Calibration - Danger Klipper documentation (2024)

FAQs

How to adjust z offset with Klipper? ›

In principle, the Z offset calibration is a two-step process:
  1. Probe as normal and move the nozzle above the probing point.
  2. Manually lower the nozzle down to the build plate until we feel some friction with the gauge or the piece of paper.
Apr 5, 2023

How to properly calibrate z offset? ›

One way for users to calibrate the Z-offset is to observe the outcome of the first printed layer, then manually set the height differences values(as shown in Figure 2). If the nozzle is too high, then the value will be too small. If the nozzle is too low, then the value should be reduced.

Where is Klipper Z offset stored? ›

New values like the Z-offset are stored by Klipper in the DO NOT EDIT section.

What is auto z offset? ›

Z-offset is just what it sounds like. It's a vertical offset (positive or negative) between the nozzle and the bed. The auto-bed leveling function will make use of a z-offset after taking measurements, but it can be useful for various things unrelated to bed leveling.

How do I know if my Z offset is correct? ›

To check if you have correctly set your Z-offset, you can 3D print a square that is 0.22mm high. Your goal is to have the top surface flat. If you see ridges or valleys on the 3D print, you should adjust the Z-offset until you find a smooth surface.

What does increasing the Z offset do? ›

While bed leveling addresses the overall alignment of the bed, Z offset allows for finer adjustments in the vertical direction, ensuring the correct starting height for the print. Together, these measures contribute to a well-calibrated 3D printing setup, resulting in accurate and reliable prints.

Should my z-offset be 0? ›

The Z-offset is typically a negative number, with zero being identified as the top of the heat bed washers. A larger negative Z-axis value brings the hot end nozzle closer to the print surface. A smaller negative Z-axis value will move the nozzle further away from the print surface.

What is the G code for Z offset? ›

To adjust the Z offset using G-code, first home the printer using the command G28 Z0 . Next, G92 Z0. 1 can be used to set a manual Z offset for printing. The G92 command assigns the provided coordinates to the printhead's current physical location.

What is the best hardware for Klipper? ›

This method prevents the need for the micro-controller to process the GCode and allows it to focus on just moving the steppers so to speak. In order to use Klipper you will need a Raspberry Pi, a BigTreeTech CB1, or a specialized pad that can run Klipper.

What code does Klipper use? ›

Klipper uses "extended" G-Code commands for general configuration and status.

How do you calibrate Z offset on Sonic pad? ›

To set the Z offset, set a sheet of paper on the print bed, and use the onscreen controls to carefully move the nozzle down in the Z axis until it is just touching the paper. When you can slide the paper and feel slight resistance from the nozzle, you have reached the correct Z offset.

Why is my filament not sticking to the bed? ›

If the bed is too cold, the filament won't adhere properly. On the other hand, if the cooling fans are too aggressive, they can cause the filament to cool too quickly, leading to poor adhesion. Solution: Adjust the bed temperature based on the filament you're using.

How does Z probe offset work? ›

The z_offset is the distance between the nozzle and bed when the probe triggers. The Klipper PROBE_CALIBRATE tool can be used to obtain this value - it will run an automatic probe to measure the probe's Z trigger position and then start a manual probe to obtain the nozzle Z height.

What is auto bed leveling? ›

This intelligent system automatically adjusts the bed level, ensuring optimal distance across the entire printing surface. It's designed especially for newcomers to 3D printing, eliminating the tedious and error-prone manual bed leveling process.

What is the test Z command in Klipper? ›

TESTZ Z=<value> : This command moves the nozzle up or down by the amount specified in "value". For example, TESTZ Z=-. 1 would move the nozzle down .

How to set z offset on sonic pad? ›

To set the Z offset, set a sheet of paper on the print bed, and use the onscreen controls to carefully move the nozzle down in the Z axis until it is just touching the paper. When you can slide the paper and feel slight resistance from the nozzle, you have reached the correct Z offset.

What is the command for Z offset? ›

To adjust the Z offset using G-code, first home the printer using the command G28 Z0 . Next, G92 Z0. 1 can be used to set a manual Z offset for printing. The G92 command assigns the provided coordinates to the printhead's current physical location.

References

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Mrs. Angelic Larkin

Last Updated:

Views: 5319

Rating: 4.7 / 5 (47 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Mrs. Angelic Larkin

Birthday: 1992-06-28

Address: Apt. 413 8275 Mueller Overpass, South Magnolia, IA 99527-6023

Phone: +6824704719725

Job: District Real-Estate Facilitator

Hobby: Letterboxing, Vacation, Poi, Homebrewing, Mountain biking, Slacklining, Cabaret

Introduction: My name is Mrs. Angelic Larkin, I am a cute, charming, funny, determined, inexpensive, joyous, cheerful person who loves writing and wants to share my knowledge and understanding with you.