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

    sensorless homing random wrong direction

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    4
    31
    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.
    • moth4017undefined
      moth4017
      last edited by

      Duet Web Control 3.4.1-rc1,Board: Duet 3 Mini 5+ (Mini5plus)
      Firmware: RepRapFirmware for Duet 3 Mini 5+ 3.4.1rc1 (2022-05-03)
      Duet WiFi Server Version: 1.25

      ; General preferences
      G90                                            	; send absolute coordinates...
      M83                                            	; ...but relative extruder moves
      M550 P"Valkyrie 3030 V002"                     	; set printer name
      M669 K1     									; core xy
      
      ; Network
      M552 S1                                        	; enable network
      M586 P0 S1                                     	; enable HTTP
      M586 P1 S0                                     	; disable FTP
      M586 P2 S0                                     	; disable Telnet
      
      ; Drives
      M569 P0.0 S1	D2 								; physical drive 0 goes forwards   
      M569 P0.1 S1    D2                        		; physical drive 1 goes forwards
      M569 P0.2 S1                                 	; physical drive 2 goes forwards ( blown needs replacing)
      M569 P0.3 S0                                	; physical drive 3 extruder
      M569 P0.4 S1  	D2                        	 	; physical drive 4 goes forwards D3=stealthchop
      M569 P0.5 S0  	D2 								; physical drive 5 goes backwards
      M569 P0.6 S1  	D2								; physical drive 6 goes forwards 
      
      M584 X1 Y0 E3 Z0.4:0.5:0.6               		; set drive mapping FL,FR,RC
      M350 X16 Y16 I1                       			; configure microstepping with interpolation
      M350 Z16 E16 I1  								; configure microstepping with interpolation
      M92 X80.00 Y80.00  Z320.00  E562.00           	; set steps per m
      M566 X700.00 Y700.00 Z100.00 E100.00 P1        	; set maximum instantaneous speed changes (mm/min) jerk
      M203 X24000.00 Y24000.00 Z4000.00 E400.00   	; set maximum speeds (mm/min)
      M201 X700.00 Y700.00 Z300.00 E250.00       	; set accelerations (mm/s^2)
      M906 X1000 Y1000 Z500 E800 I10                	; set motor currents (mA) and motor idle factor in per cent
      M84 S20                                        	; Set idle timeout
      
      ; Axis Limits
      M208 X-20 Y-11 Z0 S1                            ; set axis minima "Travel Area"
      M208 X300 Y300 Z405 S0                         	; set axis maxima "Travel area"
      
      ; Endstops
      M574 X1 S4   									; configure sensorless endstop, 1 = low end, 2 = high end. S4 multipule motors
      M574 Y2 S4 										; configure switch-type (e.g. microswitch) endstop for low end on Y via pin io1.in
      M574 Z2 S4                              		; configure sensorless endstop for high end on Z, 1 = low end, 2 = high end. S4 multipule motors
      M671 X-20:300:150 Y0:0:280 S25 					; leadscrews at front left,front right, rear Center s= max correction factor  must be in same order as M584
      
      
      
      M558 P8 C"!io3.in" H10 F1000 T12000 R0 A4 S0.03   ; set Z probe type to unmodulated and the dive height + speeds
      G31 P500 Z0.3									; set Z probe trigger value, offset and trigger height bigger the posative number the closer to the bed
      G31 P500 X27 Y-11              					; set x,y trigger value, offset and trigger height
      M557 X10:290 Y10:290 S90                     	; define mesh grid
      
      ; Heaters
      ;Bed
      M308 S0 P"temp0" Y"thermistor" T100000 B3950 A"Bed T °C" 		; configure sensor 0 as thermistor on pin bedtemp
      M950 H0 C"out0" T0 Q10                      					; create bed heater output on bedheat and map it to sensor 0
      M307 H0 R0.838 K0.331:0.000 D3.08 E1.35 S0.90 B0				; PDI info for 8mm aluminium bed 700w Heater NTC 100K 3950
      M140 H0                                       					; map heated bed to heater 0
      M143 H0 S120                                   					; set temperature limit for heater 0 to 120C
      ;extruder
      M308 S1 P"temp1" Y"pt1000" A"Extruder T °C"						; configure sensor 1 as thermistor on pin e0temp (104gt2)
      M950 H1 C"out1" T1                           					; create nozzle heater output on e0heat and map it to sensor 1
      M307 H1 R3.558 K0.357:0.000 D9.14 E1.35 S1.00 B0 V23.8			; disable bang-bang mode for heater  and set PWM limit
      M143 H1 S280                                   					; set temperature limit for heater 1 to 280C
      ;Chamber      
      M308 S2 P"temp2" Y"thermistor" T100000 B4267 A"Chamber T °C"	; configure sensor 2 as thermistor on pin temp2
      M950 H2 C"out5" T2												; create chamber heater output on 1.out0 and map it to sensor 2
      M307 H2 B0 S1.00												; disable bang-bang mode for the chamber heater and set PWM limit
      M141 H2															; map chamber to heater 2
      M143 H2 S100													; set temperature limit for heater 2 to 280C
      
      M308 S10 Y"mcu-temp" A"MCU"                           ; defines sensor 10 as MCU temperature sensor
      M308 S11 Y"drivers" A"Duet stepper drivers"           ; defines sensor 11 as stepper driver temperature sensor
      
      
      
      ; Fans
      M950 F0 C"out4" Q250								; create fan 0 on pin fan0 and set its frequency
      M106 P0 S0 H-1	C"Part Fan"							; set fan 0 value. Thermostatic control is turned off
      M950 F1 C"out3" Q250								; create fan 1 on pin fan1 and set its frequency
      M106 P1 S1 H1 T45	C"Extruder Fan"					; set fan 1 value. Thermostatic control is turned on
      
      ; Tools
      M563 P0 D0 H1 F0									; 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
      T0
      
      ; Custom settings are not defined
      M98 P"/macros/home_max_Z"
      
      ;External Buttons
      M950 J1 C"!io2.in"			;config input pin	switch NO  connected to io2 and Gnd 
      M581 P1 T0 C0				;T0 = emergency stop on trigger; T1 = pause print; T{N} = runs the macro "sys/trigger{N}.g", rising edge S1 falling edge S0
      ;M581 P1 T4 c0				;run a macro trigger4.g
      M582 T0 					; Check External Trigger
      
      ; homex.g
      echo "start"
      M569 P0.0										; Check status in console
      M569 P0.1										; Check status in console
      G91                                             ; relative positioning
      M569 P0.0 S1 D3 V10                             ; set to stelth chop
      M569 P0.1 S1 D3 V10								; set to stelth chop
      M915 P0.0:0.1 S1 F0 R1 H200                    	; Configure Z-Axis Stall Detection
      M906 X600 Y600									; Lower motor current
      M574 X1 Y2 S4									; Configure Z-Axis stall detection homing
      echo "after stall detection setup"
      M569 P0.0										; Check status in console
      M569 P0.1										; Check status in console
      G1 H1 X-0.2 F3000                               ; move a  little  for cal of sensorless homing / not stalled
      G1 H1 Y-0.2 F3000    							; move a  little  for cal of sensorless homing / not stalled
      M400											; make sure everything has stopped before we make changes
      echo "after stall detection Calibrate"
      M569 P0.0										; Check status in console
      M569 P0.1										; Check status in console
      G1 H1 X-350                                     ; Home Z-Axis actuators independently
      echo "check stall"
      M569 P0.0										; Check status in console
      M569 P0.1										; Check status in console
      G90 											; absolute positioning
      G1 X150 F6000									; move to center of bed
      
      ;revert back 
      M906 X1000  Y1000                               ; Reset motor current
      M569 P0.0 S1 D2                                 ; reset motors back to spread cycle,
      M569 P0.1 S1 D2									; reset motors back to spread cycle,
      echo "after revert back"
      M569 P0.0										; Check status in console
      M569 P0.1										; Check status in console
      

      so i have this issue where the X or Y axis will randomly go in the wrong direction when homing

      so i have tried to capture the info on each drive after there has been a change made see config.g, the results below the only difference i can see when i have the error is that drive 1 pwmScaleAuto 0, when it should be pwmScaleAuto 1

      G28 X
      start
      Drive 0 runs forwards, active low enable, timing fast, mode spreadCycle, ccr 0x00053, toff 3, tblank 0, hstart/hend/hdec 5/0/0, pos 968
      Drive 1 runs forwards, active low enable, timing fast, mode spreadCycle, ccr 0x00053, toff 3, tblank 0, hstart/hend/hdec 5/0/0, pos 648
      after stall detection setup
      Drive 0 runs forwards, active low enable, timing fast, mode stealthChop, ccr 0x00053, toff 3, tblank 0, tpwmthrs 10 (937.5 mm/sec), pwmScaleSum 2, pwmScaleAuto 0, pwmOfsAuto 66, pwmGradAuto 19, pos 968
      Drive 1 runs forwards, active low enable, timing fast, mode stealthChop, ccr 0x00053, toff 3, tblank 0, tpwmthrs 10 (937.5 mm/sec), pwmScaleSum 2, pwmScaleAuto 0, pwmOfsAuto 76, pwmGradAuto 17, pos 648
      
      after stall detection Calibrate
      Drive 0 runs forwards, active low enable, timing fast, mode stealthChop, ccr 0x00053, toff 3, tblank 0, tpwmthrs 10 (937.5 mm/sec), pwmScaleSum 18, pwmScaleAuto 0, pwmOfsAuto 75, pwmGradAuto 19, pos 968
      Drive 1 runs forwards, active low enable, timing fast, mode stealthChop, ccr 0x00053, toff 3, tblank 0, tpwmthrs 10 (937.5 mm/sec), pwmScaleSum 19, pwmScaleAuto 1, pwmOfsAuto 73, pwmGradAuto 17, pos 136
      
      check stall
      Drive 0 runs forwards, active low enable, timing fast, mode stealthChop, ccr 0x00053, toff 3, tblank 0, tpwmthrs 10 (937.5 mm/sec), pwmScaleSum 39, pwmScaleAuto 0, pwmOfsAuto 65, pwmGradAuto 17, pos 200
      Drive 1 runs forwards, active low enable, timing fast, mode stealthChop, ccr 0x00053, toff 3, tblank 0, tpwmthrs 10 (937.5 mm/sec), pwmScaleSum 39, pwmScaleAuto 0, pwmOfsAuto 74, pwmGradAuto 16, pos 392
      

      <

      droftartsundefined dc42undefined 3 Replies Last reply Reply Quote 0
      • droftartsundefined
        droftarts administrators @moth4017
        last edited by

        @moth4017 said in sensorless homing random wrong direction:

        Are the motors moving the wrong way because it is wrongly detecting a stall and then moving 150mm (line 25 in your homex.g), or is it actually homing -350mm in the wrong direction (line 20)?

        I don't think you are running the tuning move correctly. See: https://docs.duet3d.com/en/User_manual/Connecting_hardware/Motors_tuning#stealthchop-tuning (though this does need a little updating).

        You must execute the proper tuning sequence after switching to stealthChop. This means: apply motor current, pause for more than 130ms, then execute a move at reasonable speed.

        Rather than this (line 14-16 in homex.g):

        G1 H1 X-0.2 F3000 ; move a  little  for cal of sensorless homing / not stalled
        G1 H1 Y-0.2 F3000 ; move a  little  for cal of sensorless homing / not stalled
        M400              ; make sure everything has stopped before we make changes
        

        M400 just waits for the current move to finish, so may not give a long enough pause. Use

        M17 X Y Z ; enable XYZ motors
        G4 P150 ; wait 150ms
        

        After this tuning needs a reasonable length move at reasonable speed to tune, ie a homing move. A 0.2mm move may not be long enough to tune stall detection.

        Ian

        Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

        moth4017undefined 1 Reply Last reply Reply Quote 0
        • moth4017undefined
          moth4017 @droftarts
          last edited by moth4017

          @droftarts

          X or Y axis will move the correct way when they do the stall detection calibration ,
          but then randomly move in the opposite direction to home.

          <

          droftartsundefined 1 Reply Last reply Reply Quote 0
          • droftartsundefined
            droftarts administrators @moth4017
            last edited by

            @moth4017 said in sensorless homing random wrong direction:

            X or Y axis will move the correct way when they do the stall detection calibration ,
            but then randomly move in the opposite direction to home.

            It's unlikely to move 'randomly', unless there is an issue with wiring. In your homex.g, X and Y move -0.2mm, then homes X-350, then moves X+150. If the stall is detected without moving (the second X-350 move), it should move 150 in the other direction. Or does it try to move 350mm in the 'wrong' direction? Are subsequent moves in the 'wrong' direction?

            Ian

            Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

            moth4017undefined 1 Reply Last reply Reply Quote 0
            • moth4017undefined
              moth4017 @droftarts
              last edited by

              @droftarts
              wiring ok , if i used the machine movement controls 100% perfect
              6d6bc7f9-f8e8-4753-95bd-147dfad918cc-image.png

              just done a test it moves 150 in the wrong direction so it looks like its not doing the -350.

              manual moves going in the correct way.

              <

              droftartsundefined 1 Reply Last reply Reply Quote 0
              • droftartsundefined
                droftarts administrators @moth4017
                last edited by

                @moth4017 Okay, that means it is too sensitive to stalls. Either the tuning move is not working (did you do the change I suggested earlier?) or you need to revisit the sensitivity values.

                Ian

                Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                moth4017undefined 1 Reply Last reply Reply Quote 0
                • moth4017undefined
                  moth4017
                  last edited by

                  also added the wait time now as suggested in the article and the move for calibration to 1.2mm but still the same issue

                  <

                  droftartsundefined 1 Reply Last reply Reply Quote 0
                  • moth4017undefined
                    moth4017 @droftarts
                    last edited by

                    @droftarts

                    tried the following
                    S1 H200 works for end stops , does random wrong direction
                    S10 H200 works for end stops , does random wrong direction
                    S15 H200 works for end stops , does random wrong direction
                    S1 H400 crashies for end stops ,
                    S1 H300 crashies for end stops ,
                    S1 H250 crashies for end stops ,

                    <

                    1 Reply Last reply Reply Quote 0
                    • moth4017undefined
                      moth4017
                      last edited by

                      @dc42
                      Hi , ive just done this in a 100% repeatable

                      press "emergency stop:
                      home X , homes in wrong direction

                      press "emergency stop:
                      home X , homes in correct direction

                      press "emergency stop:
                      home X , homes in wrong direction

                      press "emergency stop:
                      home X , homes in correct direction

                      etc etc

                      <

                      1 Reply Last reply Reply Quote 0
                      • droftartsundefined
                        droftarts administrators @moth4017
                        last edited by

                        @moth4017 Don't bother with a short tuning move. To tune stealthChop (which is what is being tuned, not stallGuard), you enable the motor, wait >130ms, then move a reasonable distance at a reasonable speed, ie the homing move. See the 2209 datasheet, page 35 (6.1 automatic tuning) https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC2209_Datasheet_V105.pdf

                        You are using 'S4' in your endstop configuration. This is for 'Multiple motor'. Change M574 X1 S4 and M574 Y1 S4 to use S3 instead. Not sure of the effect of this if you are only using one motor. Using stall detection on Z is much more difficult, because of the torque on leadscrews.

                        You are also dropping your motor current using M906 rather than M913. Not sure of the effect of that, either.

                        Finally, are you using 1.8 degree or 0.9 degree motors? This affects the H parameter in M915.

                        If the stealthChop tuning works correctly, all you should need to do is find a good value for M913.

                        Ian

                        Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                        moth4017undefined 1 Reply Last reply Reply Quote 0
                        • moth4017undefined
                          moth4017 @droftarts
                          last edited by

                          @droftarts
                          my Z homing working perfectly 3 motors on gear boxes belt driven.

                          Core XY configuration 1.8Deg Motors all round
                          the X and Y are the only ones playing up. i think i have been told to use S4 as its multiple motors driven at the same time, is this not correct?

                          <

                          droftartsundefined 1 Reply Last reply Reply Quote 0
                          • droftartsundefined
                            droftarts administrators @moth4017
                            last edited by

                            @moth4017 No, S4 is for multiple motors on the SAME axis, ie like your Z axis. Use S3 for X and Y. See https://docs.duet3d.com/User_manual/Reference/Gcodes/M574

                            Endstop type S4 means use motor stall detection (like S3) but if there are multiple motors, stop each one individually as it stalls. S3 means use motor stall detection but stop all relevant motors when the first one stalls.

                            If you're using 1.8 motors, H200 is correct.

                            Also see https://docs.duet3d.com/User_manual/Connecting_hardware/Sensors_stall_detection

                            Ian

                            Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                            moth4017undefined 2 Replies Last reply Reply Quote 0
                            • moth4017undefined
                              moth4017 @droftarts
                              last edited by

                              @droftarts

                              im not sure why the emergency stop button is causing this , ive just tried it again and its very repeatable

                              press "emergency stop:
                              home X , homes in wrong direction

                              press "emergency stop:
                              home X , homes in correct direction

                              press "emergency stop:
                              home X , homes in wrong direction

                              press "emergency stop:
                              home X , homes in correct direction

                              <

                              1 Reply Last reply Reply Quote 0
                              • moth4017undefined
                                moth4017 @droftarts
                                last edited by

                                @droftarts

                                S3 same results

                                <

                                droftartsundefined 1 Reply Last reply Reply Quote 0
                                • droftartsundefined
                                  droftarts administrators @moth4017
                                  last edited by

                                  @moth4017 Not sure why emergency stop would cause that behaviour. One for @dc42 to look at?

                                  Have you tried increasing the motor current 5%? Use M913 rather than M906.

                                  Ian

                                  Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                                  moth4017undefined 1 Reply Last reply Reply Quote 0
                                  • moth4017undefined
                                    moth4017 @droftarts
                                    last edited by

                                    @droftarts @dc42
                                    hi thanks for all the help , ive tried changing motor currents and many things over the past few weeks, i was waiting for the latest update to see if that had fixed it , but still in the same boat .. so i think this is a @dc42 one .

                                    <

                                    1 Reply Last reply Reply Quote 0
                                    • droftartsundefined
                                      droftarts administrators @moth4017
                                      last edited by

                                      @moth4017 said in sensorless homing random wrong direction:

                                      M915 P0.0:0.1 S1 F0 R1 H200
                                      

                                      Looking back at your first post, you have the S parameter set to S1, which would typically make it more sensitive to stalls. You may want to try making it less sensitive, ie increase S. Try S3. You will need to balance this against motor current.

                                      Ian

                                      Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                                      moth4017undefined 1 Reply Last reply Reply Quote 0
                                      • moth4017undefined
                                        moth4017 @droftarts
                                        last edited by

                                        @droftarts
                                        i have tried changing current with the"S" value , i can give that another go tomorrow , but the "emergency stop" button thing is bugging me 🙂 why should that be so consist ant.

                                        so in my stop.g macro i have
                                        G28 X Y /macros/sensorless_Z

                                        ;sensorless_z
                                        M915 P0.4:0.5:0.6 S3 F0 R0 ; Configure Z-Axis Stall Detection
                                        M906 Z300 ; Lower motor current
                                        M574 Z2 S4 ; Configure Z-Axis stall detection homing
                                        M400

                                        <

                                        droftartsundefined 1 Reply Last reply Reply Quote 0
                                        • droftartsundefined
                                          droftarts administrators @moth4017
                                          last edited by

                                          @moth4017 said in sensorless homing random wrong direction:

                                          G28 X Y /macros/sensorless_Z
                                          

                                          That isn't a valid command, and the macro won't be running. If you want to run that macro after homing X and Y, you need M98 P"/macros/sensorless_Z"

                                          Ian

                                          Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                                          moth4017undefined 1 Reply Last reply Reply Quote 0
                                          • moth4017undefined
                                            moth4017 @droftarts
                                            last edited by moth4017

                                            @droftarts
                                            i agree it looks invalid, but it runs.. changed it anyway

                                            Still made no difference
                                            im still getting the
                                            press "emergency stop:
                                            home X , homes in wrong direction

                                            press "emergency stop:
                                            home X , homes in correct direction

                                            press "emergency stop:
                                            etc etc

                                            <

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