Printer Model: Sapphire Pro / Panda Cube
MCU / Printerboard: Skr 1.4 and Arduino Nano klippy(3).log (1.3 MB)
klippy.log
Fill out above information andin all cases attach yourklippy.logfile (use zip to compress it, if too big). Pasting yourprinter.cfgis not needed Be sure to check our “Knowledge Base” Category first. Most relevant items, e.g. error messages, are covered there
Describe your issue:
I want to use a 3D-Beacon probe in the future. Because I want everything as automated and reliable as possible, I want my printer to measure the exact z-offset before every print.
Here for I’m using the hotend as a switch. I want it to move down until it hits a bare aluminium plate on the front of the bed. When the nozzle hits the metal plate, a circuit gets closed and triggers for example a gcode_button. Then the beacon measures its distance to the metal plate and compares it to the nozzle, which is currently at zero. This difference is the new exact z-offset, which will be used for the current print. This whole process should be somewhat similiar to how z_tilt_adjust works. I have already tried a lot of different versions of this project, but I don’t get it to fully work. I have lots of trouble coding in Jinja2. I need the part where it moves down as long as the switch is open, then stops and holds the current position as long as the beacon makes its reading. Then this value needs to be stored until the next restart.
For this process all the axis have to be homed (so the printhead can move to its needed position) and the z-tilt has to be adjusted. So the beacon probe has to be used before it could make its exact z-offset reading. So I actually have to use two different z-offsets. One permanently stored for when I need to home the axis and z-tilt adjust for the first time after a restart and one which replaces this z-offset with the much more accurate read one.
[gcode_macro TEST_OFFSET_READING]
description: Reads z-offsets and probe offset, compares and sets new z-offset
gcode:
G1 F2000 X0 Y0 # first move to 0,0 to ensure afterwards only y-axis moves
G1 F2000 X0 Y-130 # move to aluminium plate
G1 F5000 X-50 Y-130 # wipe nozzle
G1 F5000 X0 Y-130
G91 # Set to relative positioning
{% for 0 in trigger_state %} # as long as trigger_state is 0 execute movement
G1 F200 X0 Y0 Z-0.1 # slowly lower z-axis
M400 # wait until movement is finished
{% endfor %}
G90 # Set to absolute positioning
M400 # wait until movement is finished
I have a custom heated bed that runs on mains voltage. But I want to mount the alumium plate electricaly isolated from the rest, because the 5V on the plate wouldn’t work with the grounded bed.
I think aluminium is the wrong material to go with that probe.
That thing is an “Eddy-current sensor” Eddy-current sensor - Wikipedia
A big disadvantage (in my eyes) is the need of an USB cable. Since the probe is attached to the extruder, you 'll have another heavy and inflexible cable going to your host.
In fact, only conductive surfaces like aluminum or steel will work with such a sensor. For example, a bubble/missing spot in the PEI sheet will go unnoticed.
@Toni
Interesting idea. I’m not sure if your concept can be realized with macros. My gut feeling is no, but there are far more knowledgeable macro wizards than me.
It is never wrong to learn how to write macros for Klipper.
I’m following this probe but the price is still high and shipping to Germany as well.
There are IDM knock-offs in AliExpress and even one with a smaller head and outsourced electronics and no restricted area.
No problem. I mean your right, the probe doesn’t really matter. At the moment I’m running a 3D-Touch and the shown concept would pretty much work the same.
Do you mean the issue with the recalling of a changed variable state?
This is the full version:
[gcode_macro global]
variable_trigger_state: 0
gcode:
M115 ; must provide something
[gcode_macro TEST_OFFSET_READING]
description: Reads z-offsets and probe offset, compares and sets new z-offset
gcode:
G1 F2000 X0 Y0 # first move to 0,0 to ensure only y-axis moves
G1 F2000 X0 Y-130 # move to aluminium plate
G1 F5000 X-50 Y-130 # wipe nozzle
G1 F5000 X0 Y-130
G91 # Set to relative positioning
{% for 0 in trigger_state %} # as long as trigger_state is 0 execute movement
G1 F200 X0 Y0 Z-0.1 # slowly lower z-axis
M400 # wait until movement is finished
{% endfor %}
G90 # Set to absolute positioning
M400 # wait until movement is finished
[gcode_button my_gcode_button]
pin: arduino:PB3
; The pin on which the button is connected. This parameter must be
; provided.
press_gcode:
SET_GCODE_VARIABLE MACRO=global VARIABLE=trigger_state VALUE={1}
; A list of G-Code commands to execute when the button is pressed.
; G-Code templates are supported. This parameter must be provided.
release_gcode:
SET_GCODE_VARIABLE MACRO=global VARIABLE=trigger_state VALUE={0}
; A list of G-Code commands to execute when the button is released.
; G-Code templates are supported. The default is to not run any
; commands on a button release.
I’m honestly suprised how hard it is to code smth like this. I only have expierence when it comes to programming Arduinos and there it would actually seem like such an easy task
I didn’t have much time today, but this setup works for the first part of lowering the z-axis until the switch triggers and then the axis stops moving. Let’s see where this solutions is going in the future. If you have any advice, feel free to tell me.
[gcode_macro TEST_OFFSET_READING]
description: Reads z-offsets and probe offset, compares and sets new z-offset
gcode:
G1 F2000 X0 Y0 # first move to 0,0 to ensure only y-axis moves
G1 F2000 X0 Y-130 # move to aluminium plate
G1 F3000 X-50 Y-130 # wipe nozzle
G1 F3000 X0 Y-130
UPDATE_DELAYED_GCODE ID=TEST_LOOP DURATION=1 # start the loop for lowering the z-axis
[delayed_gcode TEST_LOOP]
gcode:
G91 # Set to relative positioning
G1 F100 Z-0.05 # lower the z-axis
UPDATE_DELAYED_GCODE ID=TEST_LOOP DURATION=0.5 # restart loop in 0.5 seconds
[gcode_button my_gcode_button]
pin: arduino:PB3
; The pin on which the button is connected. This parameter must be
; provided.
press_gcode:
UPDATE_DELAYED_GCODE ID=TEST_LOOP DURATION=0 # stop the loop when nozzle touches aluminium plate