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

    3 Z axis and homing

    Scheduled Pinned Locked Moved
    General Discussion
    2
    19
    1.0k
    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.
    • kb58undefined
      kb58
      last edited by kb58

      ; Configuration file for Duet 3 (firmware version 3)
      ; executed by the firmware on start-up
      ;
      
      
      
      ================ General preferences ============
      
      G90                                                	; send absolute coordinates...
      
      M83                                                	; ...but relative extruder moves
      
      M550 P"Bobo"   	                                	; set printer name
      M669 K1                                            	; select CoreXY mode
      
      ;
      
      
      ================ Network ========================
      
      ;M552 P0.0.0.0 S1                                   	; enable network and acquire dynamic address via DHCP
      
      M552 P192.168.2.2 S1					; set hard address to P192.168.2.1 and enable ethernet port
      M553 P255.255.255.0					; assign subnet address
      M586 P0 S1                                         	; enable HTTP
      
      M586 P1 S0                                         	; disable FTP
      
      M586 P2 S0                                         	; disable Telnet
      
      ;
      
      
      ============== Set motor direction ==============
      
      M569 P1 S0                                       	; physical drive 1 - X
      
      M569 P2 S0                                       	; physical drive 2 - Y
      
      M569 P3 S1                                       	; physical drive 3 - Z1 left
      
      M569 P4 S1                                       	; physical drive 4 - Z2 rear
      
      M569 P5 S1                                       	; physical drive 5 - Z3 right
      
      M569 P0 S0                            			; physical drive 0 - extruder;
      
      
      
      ============== Set drive mapping ================
      
      M584 X1 Y2 Z3:4:5 E0 					; Drive 1 - X
      							; Drive 2 - Y
      							; Drive 3 - Z1, left
      							; Drive 4 - Z2, rear
      							; Drive 5 - Z3, right
      							; Drive 0 - Extruder;
      
      ================ Drives settings ================
      
      M350 X16 Y16 Z16 E16 I1                            	; configure microstepping with interpolation
      
      M92 X200.00 Y200.00 Z640.00 E917.444               	; set steps per mm
      M566 X700.00 Y700.00 Z24.00 E2000.00               	; set maximum instantaneous speed changes (mm/min)
      
      ;M203 X35000.00 Y35000.00 Z1200.00 E5000.00         	; set maximum speeds (mm/min)
      
      M203 X10000.00 Y10000.00 Z1200.00 E5000.00         	; set maximum speeds (mm/min)
      M201 X6000.00 Y6000.00 Z400.00 E2500.00            	; set accelerations (mm/s^2)
      
      M906 X1600 Y1600 Z1600:1600:1600 E500 I30              	; set motor currents (mA) and motor idle factor in per cent
      
      M84 S60                                            	; Set idle timeout
      
      ;
      
      
      =========== Independent Z leveling ==============
      
      M671 X-215:0:215 Y-120:210:-120 S5 			; Define Z leadscrew positions relative to origin: front left, center rear, front right;
      
      
      ================ Axis Limits ====================
      
      M208 X-165 Y-165 Z-350 S1                              	; set axis minima
      
      M208 X165 Y165 Z0 S0                             	; set axis maxima
      
      ;
      
      
      ================ Endstops =======================
      
      M574 X1 S1 P"io1.in"                               	; configure active-high endstop for low end on X
      M574 Y1 S1 P"io2.in"                               	; configure active-high endstop for low end on Y
      M574 Z1 S1 P"io3.in+io4.in+io5.in" 			; Z axis with 3 motors, individual min endstops, active high
      M574 E0 S1 P"io6.in"                                 	; configure extruder Z-probe endstop for low end on Z
      
       - io0 reserved for PanelDue;
      
      
      ================ Z-Probe ========================
      
      M558 P5 C"^!io7.in" A2 H5 F120 T15000              	; set Z probe type to unmodulated and the dive height + speeds 
      G31 P50 X34.3 Y5 Z1.035		                   	; set Z probe trigger value, offset and trigger height Z1.023
      
      M556 S50 X0 Y0 Z0                                  	; set orthogonal axis compensation parameters
      
      M557 X30:270 Y30:270 P4                            	; define mesh grid
      
      ;
      
      
      ================ Heaters ==============================================
      M308 S0 P"temp0" Y"thermistor" A"Bed" T100000 B3950 	; configure sensor 0 as thermistor on pin temp0
      
      M950 H0 Q10 C"out1" T0                                  ; create bed heater output on out0 and map it to sensor 0 (if NOT SSR, delete Q10)
      
      M307 H0 R0.928 C350.9 D6.77 S1.00 V24.0                 ; disable bang-bang mode for the bed heater and set PWM limit
      
      M140 H0                                            	; map heated bed to heater 0
      
      M143 H0 S100                                     	; set temperature limit for heater 0 to 100C
      
      
      M308 S1 P"temp1" Y"thermistor" A"Hotend" T107537 B4725 C7.06e-8
      							; configure sensor 1 as thermistor on pin temp1
      
      M950 H1 C"out2" T1                                	; create nozzle heater output on out1 and map it to sensor 1
      
      M307 H1 R1.953 C374.1 D8.85 S1.00 V24.0       		; disable bang-bang mode for heater and set PWM limit
      M143 H1 S280                                       	; set temperature limit for heater 1 to 280C
      
      ; 
      
      
      ================ Fans & Lights ==================
      
      M950 F0 C"out7" Q500 				        ; create fan 0 on pin out7 and set its frequency
      
      M106 P0 S0 H1 T35                                  	; set fan 0 value. Thermostatic control is turned on
      
      M950 F1 C"out8" Q500                               	; create fan 1 on pin out8 and set its frequency
      
      M106 P1 S0 H-1 C"Layers Fan"                       	; set fan 1 value. Thermostatic control is turned off 
      
      M950 F2 C"out9" Q500                               	; create fan 2 on pin out9 and set its frequency (lights)
      
      M106 P2 S0.2 H-1 C"Lights"                         	; set fan 2 value. Thermostatic control is turned off (lights)
      
      ;
      
      
      ================ Tools ==========================
      
      M563 P0 D0 H1 F0:1                                 	; define tool 0
      
      G10 P0 X0 Y0 Z0                                    	; set tool 0 axis offsets
      
      G10 P0 R0 S0                                       	; set initial tool 0 active and standby temperatures to 0C
      
      ;
      
      
      ================ Miscellaneous ==================
      
      M575 P1 S1 B57600                                  	; enable support for PanelDue
      
      M911 S10 R11 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000" 	; set voltage thresholds and actions to run on power loss
      
      
      
      ; homez.g
      ; called to home the Z axis
      ;
      
      
      
      G91               		; relative positioning
      
      G1 H2 Z5 F10000     	 	; lift Z relative to current position
      
      G1 H1 Z355 F1800 		; move Z down until the endstop is triggered
      G90                		; absolute positioning
      
      G1 X-34.3 Y5 F10000 	 	; go to location that places the Z sensor in the center of the bed
      G30                 	 	; home Z by probing the bed
      
      
      G91              		; relative positioning
      
      G1 Z5 F100       		; lift Z relative to current position
      
      G90              		; absolute positioning
      
      
      

      Scratch-built 350mmx350mm coreXY, linear rails, ballscrews, 3 Z axis, Duet3 6HC, v3.3, Tool Board v1.1, BondTech LGX + Mosquito hot end

      1 Reply Last reply Reply Quote 0
      • kb58undefined
        kb58
        last edited by

        ; bed.g
        ; called to perform automatic bed compensation via G32
        ;
        
        
        
        M561				; clear any bed transform
        
        G28 				; home all
        
        G30 P0 X-165 Y-165 Z-99999 	; probe near left front leadscrew
        
        G30 P1 X-34 Y160 Z-99999 	; probe near rear center leadscrew
        
        G30 P2 X130 Y-170 Z-99999 S3	; probe near left front leadscrew
        , then perform a 3-point calibration
        G29  				; probe the bed and enable compensation
        
        M291 P"Leveling finished" R"Probing..." S1 T2
        
        
        

        Scratch-built 350mmx350mm coreXY, linear rails, ballscrews, 3 Z axis, Duet3 6HC, v3.3, Tool Board v1.1, BondTech LGX + Mosquito hot end

        1 Reply Last reply Reply Quote 0
        • kb58undefined
          kb58
          last edited by

          ; homex.g
          ; called to home the X axis
          ;
          
          
          G91                ; relative positioning
          
          G1 H2 Z5 F10000    ; lift Z relative to current position
          
          G1 H1 X-375 F10000 ; move quickly to X axis endstop and stop there (first pass)
          
          G1 X5 F10000       ; go back a few mm
          
          G1 H1 X-375 F360   ; move slowly to X axis endstop once more (second pass)
          
          G1 H2 Z-5 F1000    ; lower Z again
          
          G90                ; absolute positioning
          

          Scratch-built 350mmx350mm coreXY, linear rails, ballscrews, 3 Z axis, Duet3 6HC, v3.3, Tool Board v1.1, BondTech LGX + Mosquito hot end

          1 Reply Last reply Reply Quote 0
          • kb58undefined
            kb58
            last edited by

            ; homey.g
            ; called to home the Y axis
            ;
            
            G91               	; relative positioning
            
            G1 H2 Z5 F10000    	; lift Z relative to current position
            
            G1 H1 Y-375 F10000  	; move quickly to Y axis endstop and stop there (first 
            
            pass)
            
            G1 Y5 F10000      	; go back a few mm
            
            G1 H1 Y-10 F360   	; move slowly to Y axis endstop once more (second pass)
            
            G1 H2 Z-5 F1000   	; lower Z again
            
            G90               	; absolute positioning
            

            Scratch-built 350mmx350mm coreXY, linear rails, ballscrews, 3 Z axis, Duet3 6HC, v3.3, Tool Board v1.1, BondTech LGX + Mosquito hot end

            1 Reply Last reply Reply Quote 0
            • kb58undefined
              kb58
              last edited by

              ; homeall.g
              
              ; called to home all axes
              ;
              
              G91                     ; relative positioning
              
              G1 H2 Z5 F10000         ; lift Z relative to current position
              
              G1 H1 X-355 Y-355 F3000 ; move quickly to X or Y endstop and stop (first pass)
              
              G1 H1 X-355             ; coarse home X
              
              G1 H1 Y-355             ; coarse home Y
              
              G1 X5 Y5 F600	  	; go back a few mm
              
              G1 H1 X-10	        ; move slowly to X axis endstop once more (second pass)
              
              G1 H1 Y-10  	        ; then move slowly to Y axis endstop
              
              
              G1 H1 Z-355 F360        ; move Z down, stopping at the endstop
              G90                     ; absolute positioning
              G92 Z0                  ; set Z position to axis minimum (may need to adjust)
              
              ; Uncomment the following lines to lift Z after probing
              G91                    ; relative positioning
              G1 Z5 F100             ; lift Z relative to current position
              G90                    ; absolute positioning
              
              

              Scratch-built 350mmx350mm coreXY, linear rails, ballscrews, 3 Z axis, Duet3 6HC, v3.3, Tool Board v1.1, BondTech LGX + Mosquito hot end

              1 Reply Last reply Reply Quote 0
              • kb58undefined
                kb58
                last edited by

                Endstop switches are at the physical top end of the Z stepper travel, meaning near the nozzle.

                Scratch-built 350mmx350mm coreXY, linear rails, ballscrews, 3 Z axis, Duet3 6HC, v3.3, Tool Board v1.1, BondTech LGX + Mosquito hot end

                1 Reply Last reply Reply Quote 0
                • kb58undefined
                  kb58
                  last edited by kb58

                  Some of my confusion is coming from what "high end" and "low end" mean for stop switches on the Z axis. If zero is at the nozzle, does putting the switch there make it the high end because it's physically high, or is it considered the low end because of the numerical value of zero at that location?

                  Scratch-built 350mmx350mm coreXY, linear rails, ballscrews, 3 Z axis, Duet3 6HC, v3.3, Tool Board v1.1, BondTech LGX + Mosquito hot end

                  fcwiltundefined 3 Replies Last reply Reply Quote 0
                  • fcwiltundefined
                    fcwilt @kb58
                    last edited by

                    @kb58 said in 3 Z axis and homing:

                    Some of my confusion is coming from what "high end" and "low end" mean for stop switches on the Z axis. If zero is at the nozzle, does putting the switch there make it the high end because it's physically high, or is it considered the low end because of the numerical value of zero at that location?

                    Yes the terms "high end" and "low end" can be confusing.

                    In this case low means near the axis min and high means near the axis max.

                    Perhaps they use those terms because endstop sensors are not required to be exactly at axis min or max.

                    As mentioned when a G1 H1 move triggers the endstop sensor the axis position is set to axis min or axis max. I believe the endstop sensor setting of low or high controls this.

                    Frederick

                    Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

                    1 Reply Last reply Reply Quote 0
                    • fcwiltundefined
                      fcwilt @kb58
                      last edited by

                      @kb58

                      In my option when you have multiple Z endstop sensors, as you do, it makes more sense to home using G1 H1 moves rather than the Z probe.

                      The homing "levels' the bed to the degree the Z endstop sensors trigger at the correct point to achieve a level bed. The firmware moves each Z axis until the associated endstop sensor triggers. When all Z endstop sensors have been triggered the homing is finished.

                      Then you can use G32 and the bed.g file to use the Z probe to "fine tune" the bed leveling.

                      This is the way my triple Z printer works.

                      Here is a quick and dirty video showing the "rough leveling" achieved during homing with the multiple endstop sensors and then the "fine leveling" achieved use the Z probe.

                      I have intentionally put the bed seriously out of level to more clearly show the "leveling" action of the multiple endstop sensors.

                      triple Z homing video

                      Frederick

                      Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

                      1 Reply Last reply Reply Quote 0
                      • fcwiltundefined
                        fcwilt @kb58
                        last edited by

                        @kb58

                        Here is the basic Z homing code from that printer:

                        G1 Z-399 F1200 H1 ; move up until endstop switch is activated
                        G1 Z20   F1200    ; move down a bit
                        G1 Z-25  F600  H1 ; move up until endstop switch is activated
                        
                        

                        which is then followed by a G32 to run bed.g to auto-level the bed using the Z probe.

                        Here is the essential code from bed.g:

                        M671 X-180:0:180 Y-65:130:-65 S3 ; positions of lead screws
                        
                        ; --- level bed ---
                        
                        while true
                          ; run leveling pass
                        
                          ; --- probe near lead screws ---
                        
                          G30 P0 X-145 Y-65 Z-99999
                          G30 P1 X0    Y100 Z-99999
                          G30 P2 X145  Y-65 Z-99999 S3
                        
                          ; check results - exit loop if results are good
                        
                          if move.calibration.initial.deviation < 0.02
                            break
                        
                          ; check pass limit - abort if pass limit reached
                        
                          if iterations = 5
                            M291 P"Bed Leveling Aborted" R"Pass Limit Reached"
                            abort "Bed Leveling Aborted - Pass Limit Reached"
                        
                        ; --- finish up ---
                        
                        G1 Xaaa Ybbb ; move Z probe to center of bed - aaa and bbb would be determined for your printer
                        
                        G30          ; set Z=0 datum 
                        
                        

                        Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

                        1 Reply Last reply Reply Quote 0
                        • kb58undefined
                          kb58
                          last edited by

                          I'll look into using G1 H1. Keep in mind that I gathered the information on creating these files from multiple sources. Some of it hasn't been tested yet and is no doubt completely wrong, but for the purposes of this thread, I'll stick to just Z homing.

                          What you're describing is my end goal, to have the three steppers home to the switches, then do a three point probe to do fine leveling. As mentioned, I very likely have lines of code that are either wrong or have no business being there, but I'm slowly coming up on the learning curve for all of this.

                          Scratch-built 350mmx350mm coreXY, linear rails, ballscrews, 3 Z axis, Duet3 6HC, v3.3, Tool Board v1.1, BondTech LGX + Mosquito hot end

                          fcwiltundefined 1 Reply Last reply Reply Quote 1
                          • fcwiltundefined
                            fcwilt @kb58
                            last edited by

                            @kb58

                            Some folks don't use Z endstop sensors and rely on the Z probe.

                            I always install Z endstop sensors.

                            As you can see from the video, multiple endstop sensors can cope with a bed way out of level - a Z probe can have serious problems trying to do that.

                            You did watch the video, didn't you?

                            I use the Z probe for:

                            • auto-leveling the bed
                            • creating the height map needed for mesh bed compensation
                            • setting the Z=0 datum which I always do with the probe at the center of the bed

                            Note that setting the Z=0 datum:

                            • needs to always be done at the same XY location
                            • needs to be done after auto-bed leveling
                            • needs to be done before creating/loading the height map

                            Frederick

                            Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

                            1 Reply Last reply Reply Quote 0
                            • kb58undefined
                              kb58
                              last edited by

                              Thanks, and yes I watched your video... actually saw it several days ago while looking on YT for just this setup. As mentioned, as it is right now, all three Z steppers are driving to the endswitches, so now it's a matter of following that by probing for fine leveling. The Pinda probe isn't yet connected or calibrated, so there's still a long way to go.

                              Scratch-built 350mmx350mm coreXY, linear rails, ballscrews, 3 Z axis, Duet3 6HC, v3.3, Tool Board v1.1, BondTech LGX + Mosquito hot end

                              fcwiltundefined 1 Reply Last reply Reply Quote 0
                              • fcwiltundefined
                                fcwilt @kb58
                                last edited by

                                @kb58 Glad to hear you are making progress.

                                Let me know if you need more input.

                                Frederick

                                Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

                                kb58undefined 1 Reply Last reply Reply Quote 0
                                • kb58undefined
                                  kb58 @fcwilt
                                  last edited by

                                  @fcwilt Oh I will! I grew up using assembly language on 1802 and 6800 microprocessors, and it's pretty amazing what's out there now. As I head toward retirement, it's nice to get back into coding and hardware.

                                  Scratch-built 350mmx350mm coreXY, linear rails, ballscrews, 3 Z axis, Duet3 6HC, v3.3, Tool Board v1.1, BondTech LGX + Mosquito hot end

                                  fcwiltundefined 1 Reply Last reply Reply Quote 0
                                  • fcwiltundefined
                                    fcwilt @kb58
                                    last edited by

                                    @kb58 said in 3 Z axis and homing:

                                    @fcwilt Oh I will! I grew up using assembly language on 1802 and 6800 microprocessors, and it's pretty amazing what's out there now. As I head toward retirement, it's nice to get back into coding and hardware.

                                    I never worked with those - started on the 8080 and then the Z80 and then the 8085.

                                    I tried a few others but the 8085 did everything I needed.

                                    The first eprom chips I used were only 256 bytes and I didn't have the "luxury" of an assembler.

                                    Just coded in hex (knew the commands by heart) which was punched to tape, loaded on another machine and then burnt to the eprom.

                                    Didn't care for the 8086 design and by the time the "sensible" designs came out I was no longer doing hardware.

                                    Those early days were fun.

                                    Frederick

                                    Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

                                    kb58undefined 1 Reply Last reply Reply Quote 0
                                    • kb58undefined
                                      kb58 @fcwilt
                                      last edited by

                                      @fcwilt yup, bytes, all entered by hand, no assembler. I tried working with some of the Intel processors but just connected better with Motorola processors, 6800, 6802, 6809, and the 68HC11. That was, oh, 50 years ago... good times.

                                      Scratch-built 350mmx350mm coreXY, linear rails, ballscrews, 3 Z axis, Duet3 6HC, v3.3, Tool Board v1.1, BondTech LGX + Mosquito hot end

                                      1 Reply Last reply Reply Quote 1
                                      • First post
                                        Last post
                                      Unless otherwise noted, all forum content is licensed under CC-BY-SA