Sensorless detection for Z max

  • Hi,

    Is there a possibility to activate stall detection for Z max? Z min has a "normal" endstop switch.


  • Moderator

    You could create a macro called HomeZmax that configures a Zmax endstop as stall detection, configures the stall detection parameters, configures temporary speed, accel, and jerk settings for the Z axis, reduces motor current, and then does a zmax homing move. All the pieces are there in the documentation to be put together.

    Something like...

    ; HomeZMax.g
    ; Called to home Z to max endstop
    ; Uses the Z axis StallGuard detection as a Z-Probe
    M291 R"Are you sure?" P"Press OK to Home to ZMax. Or Cancel to abort." S3
    M574 Z2 S3			; Set motor stall at the high end for Z Max.
    M915 (whatever driver and stall detetion parameters)
    M201 Z20 ; set whatever z axis acceleration you need for consistent stall detection without triggering false positives
    M913 Z30 ; set lower z motor current
    G91				; Relative positioning
    G1 S1 Z330 F300			; Move bed until endstop triggers
    M291 P"Probing complete. Restoring settings." S3
    M913 Z100   		      				; restore current to 100%
    M201 Z300 						; Restore acceleration
    M915 Z S63 F1 R0					; Set StallGuard sensitivity for normal movement
    M574 Z1 S2						; Use zprobe and home to Z Min.

    But this would need to be customzied for your own setup.

  • Yes, this is possible. I used this for a while on my printer but ended up switching to a limit switch as my printer is fully enclosed and when printing high temp materials the temperature inside the enclosure was affecting the stall guard sensitivity. This resulted in a lot of false triggers when homing to z max. If you want to give it a go I described how below.

    In your config.g
    Configure Z max endstop with stall detection via M574
    Configure stall guard sensitivity etc for the Z motor driver using M915

    Now you can home z with something similar to the following

    M400 ; make sure everything has stopped before we make changes
    G91 ; use relative positioning
    G1 S1 Z9999 F1500 ; home z
    G90 ; back to absolute positioning
    M400 ; make sure everything has stopped before we reset the motor currents

  • The thing is, my Bed is very heavy and when the Motors are disabled, it falls down. So in the end Script i added a g1 z278 and then Shut off to minimize the impact. 280mm is maximum.
    now, i want the printer to drive slowly to z max and when stall is detected, Motors off and M81.

    I'll try to write something and post it here for check.


  • I hope that should do it:

    M574 Z2 S3
    M915 P2 S10 F1 R0
    M913 Z40
    M208 Z300
    G1 S1 Z300 F500
    M81 S1

    Speeds, Motor current and the S Parameter of M915 are not final. I just guess...
    I need that only when prints are finished.


  • It works almost...
    the updated value for Z max works and it drives until it "crashes" softly.
    but the Motors try to go further.

    I tried S values from - 40 to 40.
    Z current from 30 to 50%
    Speed at F500 feels good, tried 700, same behaviour.

    The belt does not "jump" ober the pinion.

    is the S value in the Negative area more sensitive? Or the opposite?

  • Moderator

    You may need to move faster to get a good stall.

  • Hi,

    If you have a Z-min endstop and you have homed the Z axis you know where Z-max is and you only need to issue a move to that value.

    Why is that not acceptable?



  • @phaedrux said in Sensorless detection for Z max:

    You may need to move faster to get a good stall.

    that was it! thank a lot!
    G1 S1 Z300 F3000

    i had to reduce the acceleration as well. But now, it´s perfect.

    Now, i could store it in stop.g or in the endscript from s3d. which would you prefer?

  • is there any other case, than a finished print, that causes to run stop.g?
    I have to add a M0 in the slicer endscript to activate stop.g , correct?

    What, if the endscript contains a M81 S1? Has the M0 to stand before or after the M81? i guess before, but "remebers" the duet the command after processing the stop.g?

  • Moderator

    I prefer to have all my end gcode contained in stop.g and the slicer only has M0. I use multiple slicers regularly so it's easier to just modify one place than each slicer.

    You can put your stall code in stop.g and then at the end have M81 S1

  • Ok Thanks again!

Log in to reply