Motor stall detection as Z probe



  • I've successfully tuned my motor stall detection to work reliably on the z axis. The precision and repeatability is more than enough. Is it possible to configure motor stall detection as Z probe?


  • administrators

    The resolution of stall detection is +/- 1 full step at best. If you had a high steps/mm then you might get sufficient resolution, for example 2000 steps/mm @ x16 microstepping would give you (16/2000)mm = 8um resolution. But then at a high steps/mm the force with which the motor drives the nozzle into the bed would be high even with reduced motor current. So I doubt that it is possible. But I haven't tried it.



  • Each full step of the motor translate to 0.05mm z movement in my case. I've lowered the z acceleration to 100 and used the most sensitive stall detection threshold value and lowest motor current possible. The nozzle does not leave any mark on my PEI sheet. and it only left a small mark on the surface of an ABS print, so I'm not too concerned by the force.
    I'd love to be able to config it as a Z probe. Since even though my ir sensor is extreamly precise under the same condition, the trigger distance varies for different bed material(I'm using buildtak flexplate), for different temperatures, and even for different spot on the PEI sheet I coated with ABS juice using a brush. The difference could be as high as 0.3mm in some cases.


  • administrators

    Are you saying that you have motor stall working as a Z endstop, assuming of course that you position the nozzle over the bed when homing Z? If so then I'll look at adding a another Z probe type that monitors the Z motor stall. You would still need to reduce the motor current during probing and restore it again afterwards, but I guess that could be done in the deploy and retract files.



  • Yes that's correct. I'm using motor stall as Z endstop.
    https://youtu.be/asz7eWImvFY


  • administrators

    Ok, I'll add this in 2.0alpha as an experimental feature. It will be Z probe type 10.



  • Does stall detection works when using two motors connected to one driver? Z probing with stall detection is just a brilliant idea!


  • administrators

    It probably won't work as well that way because the drop in back emf of the motor that stalls will be attenuated by the other one. But worth trying. If your E1 driver is free then you can connect the second motor to that instead. Stall detection monitors all drivers for an axis.



  • This is interesting. I have very high steps on my Z axis. 3200, giving 0.005mm for a single step. That's better than the repeatability I'm getting from the BLTouch.

    @Shen Would you mind sharing how you have it configured?



  • [[language]]
    M913  Z30:30 ; Reduce current
    M201 Z100; Reduce acceleration
    M915 P1:2 S1 F0; Set stall detection threshold (you don't need this if you have it in config.g file)
    
    G91
    G1 S1 Z-210 F600 ; probe
    G90
    
    M201 Z1250 ; Restore acceleration
    M913 Z50:50; Restore current
    
    G92 Z0
    G1 Z0.4 F3600; Stall triggers at -0.4mm, raise nozzle by 0,4mm.
    G92 Z0
    
    ```Here is my code for z probe. The exact configuration would probably be different between each setup. You'll need to look for a setup that trigger the stall detection with the lowest impact force between the bed and the nozzle. Here is how I figured out mine:
    First you need to lower your Z acceleration so stall detection won't trigger due to the force of z acceleration.
    Then you need to figure out the lowest current that stall detection works reliably(M913). I found my motor moves reliably at 20% current, but stall detection works reliably at 30% current.
    Then find the lowest stall detection thresh hold(M915). Mine is 1\. To avoid damage your printer always start with low values that would trigger the stall detection immediately, and increase the value until you can move the z axis.
    You might also want to find the lowest speed as well to further reduce the impact force, but I just used F600.
    Change any of the current, stall detection thresh hold and speed will probably effect the other 2\. You need to find a combination that works reliably and has the lowest impact force. To determine the impact force, I put a piece of print between the nozzle and the bed, and check the mark left by the nozzle after impact.
    I don't have a spring under my bed, this might now work for you if you have a soft sprint under the bed.


  • @phaedrux said in Motor stall detection as Z probe:

    This is interesting. I have very high steps on my Z axis. 3200, giving 0.005mm for a single step. That's better than the repeatability I'm getting from the BLTouch.

    @Shen Would you mind sharing how you have it configured?

    This is what I wondered about. It's not, according to what I read about it here when the stall detect and sensorless homing was first included microsteps, it's full motor steps.

    This is why I am wondering how this can work well. My delta (0.9deg steppers and 16t pulleys) is 200 (micro)steps/mm, but this is at 1/16th so its 12.5 full steps/mm which is 80 microns per step! That's quite a big chunk given we are getting (upto) 5 micron accuracy using the Orion Z-probe.

    However I might try it.



  • I'm going to try on my 1.5m delta as well, I will probably probe each print since so far most of my prints take forever anyway so why not.


  • administrators

    I have implemented this as Z probe type 10 in the latest build of firmware 2.0alpha. I've a few more things to test and at least one thing to fix before I do another 2.0alpha release.



  • This would probably not work very well on deltas. If you use 5mm pitch screw with 0.9 degree stepper on Z axis, each full step is only 0.0125mm.


  • administrators

    @shen said in Motor stall detection as Z probe:

    This would probably not work very well on deltas. If you use 5mm pitch screw with 0.9 degree stepper on Z axis, each full step is only 0.0125mm.

    That's right, it will only work when the Z steps/mm is high enough so that one full step provides sufficient resolution, but low enough that the motor stall can be detected before too much force is applied between the nozzle and the bed.



  • Oops must have followed a link and forgot, was referring to endstop not probe. Have smart Effector for probing.



  • It works fine for endstops, but because it is not very accurate, and I can confirm this having an endstop-less delta running, you need to auto-calibrate after each homing or you will not have an accurate enough calibration to print. Not a particularly big problem, but it highlights that it won't work for most deltas as a z-probe. My cylinder delta is 400steps/mm as it is leadscrew driven on XYZ but this is still only a 40-microns-accuracy z probe which is a good factor of 4-8 out on a smart effector or piezo probe.



  • @djdemond said in Motor stall detection as Z probe:

    It works fine for endstops, but because it is not very accurate, and I can confirm this having an endstop-less delta running, you need to auto-calibrate after each homing or you will not have an accurate enough calibration to print. Not a particularly big problem, but it highlights that it won't work for most deltas as a z-probe. My cylinder delta is 400steps/mm as it is leadscrew driven on XYZ but this is still only a 40-microns-accuracy z probe which is a good factor of 4-8 out on a smart effector or piezo probe.

    Yeah I'm excited to try out the smart effector, my arms finally arriving today. 500mm from Haydn. Do you have your calibrate script for endstop less? I definitely don't mind probing each print.


  • administrators

    @mysta said in Motor stall detection as Z probe:

    Yeah I'm excited to try out the smart effector, my arms finally arriving today. 500mm from Haydn. Do you have your calibrate script for endstop less? I definitely don't mind probing each print.

    For a script to home a delta without endstops, see the example macro file towards the end of https://duet3d.dozuki.com/Wiki/Stall_detection_and_sensorless_homing#Section_Configuring_sensorless_homing. This file is for testing homing without endstops. For actual use as a homing file you could simplify it. For example, you don't need the M574 commands to change the endstop type because you can just set stall detect endstops in config.g if that's the only type of endstop you ever use.



  • Thanks, I'll start from there. I left the endstops on my frame just in case but I'm really interested in using some of the new functionality of the 2660


 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.