Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Auto Z offset calibration

    Scheduled Pinned Locked Moved
    Using Duet Controllers
    6
    22
    1.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Proschi3Dundefined
      Proschi3D @Proschi3D
      last edited by

      How do I connect a z offset plate to a duet mini as a limit switch

      Love my Duet 3 Mini.
      https://www.instagram.com/proschi3d
      https://youtube.com/@proschi3d
      https://www.proschi3d.de

      Proschi3Dundefined 1 Reply Last reply Reply Quote 0
      • Proschi3Dundefined
        Proschi3D @Proschi3D
        last edited by

        20230406_134910.jpg

        Love my Duet 3 Mini.
        https://www.instagram.com/proschi3d
        https://youtube.com/@proschi3d
        https://www.proschi3d.de

        1 Reply Last reply Reply Quote 0
        • Phaedruxundefined
          Phaedrux Moderator
          last edited by

          If it's a simple microswitch with positive and negative wires you should be able to connect it as such to an endstop input.

          Z-Bot CoreXY Build | Thingiverse Profile

          Proschi3Dundefined 1 Reply Last reply Reply Quote 1
          • Proschi3Dundefined
            Proschi3D @Phaedrux
            last edited by

            @Phaedrux OK thanks. So red at signal input and black gnd?

            Love my Duet 3 Mini.
            https://www.instagram.com/proschi3d
            https://youtube.com/@proschi3d
            https://www.proschi3d.de

            1 Reply Last reply Reply Quote 0
            • Phaedruxundefined
              Phaedrux Moderator
              last edited by

              Typically. And if it's a simple switch it shouldn't really matter.

              Z-Bot CoreXY Build | Thingiverse Profile

              1 Reply Last reply Reply Quote 0
              • Phaedruxundefined
                Phaedrux Moderator
                last edited by

                Do you have any info on it?

                Z-Bot CoreXY Build | Thingiverse Profile

                Proschi3Dundefined 1 Reply Last reply Reply Quote 0
                • Proschi3Dundefined
                  Proschi3D @Phaedrux
                  last edited by

                  @Phaedrux No it came without any information. then just test it thank you

                  Love my Duet 3 Mini.
                  https://www.instagram.com/proschi3d
                  https://youtube.com/@proschi3d
                  https://www.proschi3d.de

                  Proschi3Dundefined 1 Reply Last reply Reply Quote 0
                  • Proschi3Dundefined
                    Proschi3D @Proschi3D
                    last edited by

                    it works fine now.
                    here is the gcode if anyone is interested

                    var errorfix = 0.000  		; constant offset
                    G31 Z0						; set Z-offset to Z=0
                    echo >"0:/sys/config_probe.g" "G31 Z0"
                    
                    M291 S3 R"Heating up nozzle" P"Wait for the nozzle to reach printing temperatures"
                    M568 P0 S210				; set tool 0 (primary hotend) temperature to 210c
                    T0							; select tool 0 (primary hotend)
                    M116 P0 H5					; wait for temperature to reach within 5c of set temperature
                    
                    M300 S666 P666 				; beep
                    M291 S3 R"Automatic Z Offset Calibration" P"Press OK to continue, or CANCEL to abort"
                    M291 S3 R"Homing axes" P"Remove the puck. The printer will home the X, Y, and Z axises without the puck"
                    
                    M98 P"config_probe.g"												; Load BLTouch probe settings
                    M280 P0 S60 I1														; clear any probe errors
                    G29 S2                      										; cancel mesh bed compensation
                    G91                    												; relative positioning
                    M913 X50 															; X axis 50% power
                    G1 H2 Z5 F200          												; lift Z relative to current position
                    G28 X0 U0 Y0  		; Home X,U and Y axis      												; go back a few mm 		
                    M913 X100 															; X axis 100% power
                    G90                    												; absolute positioning
                    G1 X{move.axes[0].min+175} Y{move.axes[1].min+110} F6000 				; move to center
                    G1 F600																; reduce speed
                    G30                    												; home Z by probing the bed
                    
                    G31 Z0						; set Z-offset to Z=0
                    M564 H1 S0             		; Negative movements are allowed
                    G29 S2						; cancel mesh bed compensation
                    G90 						; absolute positioning
                    G1 Z35						; raise Z to 35mm
                    M83							; relative extruder moves
                    G1 E-5 F300 				; retract 5mm of filament
                    G4 P0						; wait for the moves to finish       
                    M291 S3 R"Clean the nozzle" P"The nozzle has been pre-heated. Clean it from any plastic debris"
                    G1 X100 Y200 F6000			; go to X100, Y200
                    G4 P0						; wait for movements to have stopped
                    
                    
                    M300 S666 P666				; beep
                    M291 S3 P"Place the offset tool below the nozzle and press OK to perform the macro, or CANCEL to abort"
                    
                    G4 P200 					; wait 200ms
                    G91							; relative moves
                    G1 H1 Z-19 F50				; move 19mm down, stop when hitting the offset tool (but don't risk crashing the bed)
                    G92 Z0 						; set current position as Z=0
                    G4 P200 					; wait 200ms
                    G1 Z11 F200					; move up 11mm
                    
                    G91							; relative moves
                    G1 X{sensors.probes[0].offsets[0] * -1} Y{sensors.probes[0].offsets[1] * -1} F1500 ; move nozzle so that BLTouch is in it's position 
                    G90							; absolute moves
                    
                    G30 S-3 					; probes Z and adjusts the probe trigger height to match the actual stop height.
                    G4 P200 					; wait 200ms
                    G91							; relative movement
                    M568 P0 S0					; set tool 0 temperatures to 0
                    
                    var Z_auto_offset = {sensors.probes[0].triggerHeight+var.errorfix} ; math to calculate the BLTouch offset
                    
                    	if var.Z_auto_offset < 0.01
                    		M291 S2 R"The nozzle has not touched the puck." P"Please check the guide for troubleshooting"
                    		echo "The nozzle has not touched the puck. Please check the guide for troubleshooting"
                    		echo >"0:/sys/config_probe.g" "G31 Z-3"
                    	elif var.Z_auto_offset >= 0.01 & var.Z_auto_offset < 3.5
                    		echo >"0:/sys/config_probe.g" "G31 Z"^{var.Z_auto_offset}
                    		M291 S2 R"Z-offset has been stored" P"the Z-offset has been stored in the config_probe.g file. Verify the value stored with the value displayed in the console" 
                    		echo "the Z-offset has been stored in the config_probe.g file. The Z-offset is", var.Z_auto_offset, "mm. Remove the offset tool and place it back in the box"
                    	elif var.Z_auto_offset >= 3.5
                    		M291 S2 R"Z-Offset is too high" P"Please verify the probe height using the probe-calibration"
                    		echo "Z-Offset is too high. Please verify the probe height using the probe-calibration"
                    		echo >"0:/sys/config_probe.g" "G31 Z-3"
                    
                    M564 S1 H1      			; Negative movements are forbidden
                    M300 S666 P666 				; beep
                    
                    G91							; relative moves
                    G1 Z5						; lift nozzle up 5mm
                    G90							; absolute moves
                    
                    T-1							; deselect all tools
                    M18							; release steppers
                    

                    Love my Duet 3 Mini.
                    https://www.instagram.com/proschi3d
                    https://youtube.com/@proschi3d
                    https://www.proschi3d.de

                    stuartofmtundefined 1 Reply Last reply Reply Quote 1
                    • stuartofmtundefined
                      stuartofmt @Proschi3D
                      last edited by

                      @Proschi78

                      Very interesting - I will likely try something similar. Do you have a sense at the accuracy / effectiveness?

                      Specifically, it seems that there likely would be some mechanical hysteresis in the switch (i.e. measured zero will be a bit lower than the nominal top of the puck). Then the BLT comes along and triggers, perhaps moving the top of the puck, perhaps not.

                      In other words, it seems there would be some offset between the two trigger points and that could vary from puck-to-puck or in similar solutions that use a microswitch.

                      What I'm thinking is (maybe) set up the nozzle itself as one side of the "switch" (gnd) and using a puck with a fixed plate as the other side(+ve). That would eliminate the variation that could occur due to a microswitch.

                      Of course, it may be prudent to have a little "give" in the puck to guard against over zealous probing by the nozzle but stiff enough to (effectively) not move during the probes.

                      Thoughts?

                      Proschi3Dundefined 1 Reply Last reply Reply Quote 0
                      • Proschi3Dundefined
                        Proschi3D @stuartofmt
                        last edited by

                        @stuartofmt This puck works with gnd and + on the nozzle. Of course there is a small - value, but this is very consistent and can be compensated with var errorfix = 0.000.

                        Love my Duet 3 Mini.
                        https://www.instagram.com/proschi3d
                        https://youtube.com/@proschi3d
                        https://www.proschi3d.de

                        stuartofmtundefined 1 Reply Last reply Reply Quote 0
                        • stuartofmtundefined
                          stuartofmt @Proschi3D
                          last edited by

                          @Proschi78 said in Auto Z offset calibration:

                          @stuartofmt This puck works with gnd and + on the nozzle. Of course there is a small - value, but this is very consistent and can be compensated with var errorfix = 0.000.

                          Many thanks for the input and also the gcodes. I'll print up a puck and give it a whirl. Never did like the sliding paper thing 🙂

                          Proschi3Dundefined 1 Reply Last reply Reply Quote 0
                          • Proschi3Dundefined
                            Proschi3D @stuartofmt
                            last edited by

                            I would like to automatically measure the z offset of the left and right extruder.

                            How can I retrieve the current z height with a meta code and then display it?
                            would like to go to the puk with the left extruder and save the z height as a variable.
                            then go to the puk with the right extruder and subtract the variable from this position and display it

                            Love my Duet 3 Mini.
                            https://www.instagram.com/proschi3d
                            https://youtube.com/@proschi3d
                            https://www.proschi3d.de

                            stuartofmtundefined 1 Reply Last reply Reply Quote 0
                            • stuartofmtundefined
                              stuartofmt @Proschi3D
                              last edited by stuartofmt

                              @Proschi78
                              Use global variables to capture the results ? Then use M291 or M117 to display ?

                              Proschi3Dundefined 1 Reply Last reply Reply Quote 0
                              • Proschi3Dundefined
                                Proschi3D @stuartofmt
                                last edited by

                                @stuartofmt

                                I tried that, but something is still wrong

                                ; Idex Auto Nozzle Offset Tool 1
                                M291 S3 R"Automatic Idex Offset Calibration" P"Press OK to continue, or CANCEL to abort"
                                M291 S3 R"Homing axes" P"Remove the puck. The printer will home the X, Y, and Z axes without the puck"
                                G28
                                T0
                                G90 ; absolute positioning
                                G1 X175 Y110 Z5 F3000
                                M291 S3 R"Heating up nozzle" P"Wait for the nozzle to reach printing temperatures"
                                M568 P0 S200 ;T0 200c
                                M568 P1 S200 ;T1 200c
                                M116 P0 H5 ;Wait for Temp +-5c
                                G1 Z50 F800
                                M291 S3 R"Clean the nozzle" P"The nozzle has been pre-heated. Clean it from any plastic debris"
                                G1 Z25 F800
                                G4 P0
                                M300 S666 P666 ; beep
                                M291 S3 P"Place the offset tool below the nozzle and press OK to perform the macro, or CANCEL to abort"
                                G29 S2
                                G4 P200 ; wait 200ms
                                G1 H1 Z-19 F50 ; move 19mm down, stop when hitting the offset tool (but don't risk crashing the bed)
                                {global.tool0 = move.axes[2].machinePosition} ; Store the current Z position in tool0
                                G1 Z25 F3000
                                G28 X0
                                T1
                                G1 U175 Y110 Z25 F3000
                                G1 H1 Z-20 F50 ; Move Z-axis down 20 mm
                                {global.tool1 = move.axes[2].machinePosition - global.tool0} ; Calculate the difference between current Z position and tool0 and store in tool1
                                {echo "The difference between the two nozzle heights is: " + str(round(global.tool1, 3)) + " mm."} ; Output the difference to the console
                                G4 S15
                                G1 Z25 F500
                                G28 U0
                                

                                Love my Duet 3 Mini.
                                https://www.instagram.com/proschi3d
                                https://youtube.com/@proschi3d
                                https://www.proschi3d.de

                                stuartofmtundefined OwenDundefined 2 Replies Last reply Reply Quote 0
                                • stuartofmtundefined
                                  stuartofmt @Proschi3D
                                  last edited by

                                  @Proschi78

                                  Have you declared the global variables ?

                                  https://forum.duet3d.com/topic/24795/a-couple-of-questions-regarding-global-variables?_=1681490684446

                                  1 Reply Last reply Reply Quote 0
                                  • OwenDundefined
                                    OwenD @Proschi3D
                                    last edited by OwenD

                                    @Proschi78 said in Auto Z offset calibration:

                                    {global.tool0 = move.axes[2].machinePosition}

                                    Should be
                                    set global.tool0 = move.axes[2].machinePosition
                                    however it will always be zero (or whatever your axis minima is set to with M208)
                                    Also no need for curly brackets here.

                                    Likewise the second calculation is going to return zero (axis minima) because you use H1
                                    I feel you should be using H4 on the second test at least and that creating the firt global is largely redundant.

                                    I can't test, but maybe

                                    G1 Z50 F800
                                    M291 S3 R"Clean the nozzle" P"The nozzle has been pre-heated. Clean it from any plastic debris"
                                    G1 Z25 F800
                                    G4 P0
                                    M300 S666 P666 ; beep
                                    M291 S3 P"Place the offset tool below the nozzle and press OK to perform the macro, or CANCEL to abort"
                                    G29 S2
                                    G4 P200 ; wait 200ms
                                    G1 H1 Z-19 F50 ; move 19mm down, stop when hitting the offset tool (but don't risk crashing the bed)
                                    M400
                                    set global.tool0 = move.axes[2].machinePosition ; Store the current Z position in tool0
                                    G1 Z25 F3000
                                    G28 X0
                                    T1
                                    G1 U175 Y110 Z25 F3000
                                    G1 H4 Z-20 F50 ; Move Z-axis down 20 mm
                                    M400
                                    set global.tool1 = move.axes[2].machinePosition - global.tool0 ; Calculate the difference between current Z position and tool0 and store in tool1
                                    echo "The difference between the two nozzle heights is: " ^ global.tool1 ^ " mm." ; Output the difference to the console
                                    G4 S15
                                    G1 Z25 F500
                                    G28 U0
                                    
                                    1 Reply Last reply Reply Quote 1
                                    • First post
                                      Last post
                                    Unless otherwise noted, all forum content is licensed under CC-BY-SA