Request: Check for lost steps

  • Hello all! 🙂
    I have a small wish for future versions of the Duet WiFi firmware: Checking for lost steps.
    Let me explain: When I rebuilt and tuned in my Z-axis I sometimes heard the sound of what might be a skipped step of the Z-axis stepper but there was no way to check if the sound came from something mechanical or if it really was a missed step.
    An easy solution would be to implement a function where you rehome an axis (or all) and it tells you how much of a difference there is between the real and the assumed position.
    Please tell me your opinion about this! 🙂

  • Take a look at - maybe this is what you are looking for.

  • Of course I know of stall detection but what I was requesting is a way of detecting lost steps after they were lost and also how many steps were lost.
    Let's say you have something in your print that looks like a small layer shift. You could never really know if it was a lost step or something mechanical like a loose screw somewhere unless you check everything.
    With the feature I'm trying to describe you could in this case just run it and it'll give you the difference between the assumed (and displayed position) and the 'real' position after a rehome.

    I hope I didn't explain it more complicated than it needed to be 😅
    If yes, feel free to ask more questions.

  • I think your request is quite clear. There is no known way to accomplish this without placing encoders on the motors and going what is known as "closed loop". Very complex and expensive.

  • Obviously it isn't clear... 😅
    The feature isn't something that helps during a print, just during setup and troubleshooting.

    I'll try to make up an example:
    Let's say you command your z-axis to move 10 mm. You look at your printer and you'll see the motors running and the bed moving.
    But unless you put a dial indicator or calipers against the bed you'll never know how much it actually moved.
    If your steps/mm are calibrated right then one could assume that your axis moved the right distance and most of the times that is true.
    But let's say you're tuning in your accelerations or maximum speeds (or maybe even the anti-backlash but on your leadscrew which could produce too much friction if too tight): Unless the motor loses a lot of steps and makes horrible noises of you see the print bed stuttering there is no way of knowing if your motors can handle this speed.

    So what you would do now (with my proposed feature):

    1. Press the button "check for lost steps" (or however it will be called)
    2. the axis (in this case the z-axis) will go to its homing switch
    3. If the motor didn't lose any steps the distance to the homing switch is exactly the distance that you can read in your UI (-> the real position and the assumed position did match).
      But if any steps were lost the firmware would read the endstop as triggered before or after the distance that was displayed. The difference in mm times the steps/mm will give you a value for how many steps weren't performed.

    I hope this makes it clear since I don't know how to make it clearer 😅

  • You have this now.

    • Mark position precisely.
    • G91 (relative motion).
    • G0 X100 (or any other single axis, or multi axis, move that you are trying to setup/debug)
    • G0 X-100
    • Did it return to precisely marked position?

    Why not have this as a firmware feature? Because "mark position precisely" is almost always more precise/repeatable than the accuracy/repeatability of most limit switches.

  • administrators

    There is a way to do this on a Cartesian or CoreXY machine, but not automatically at present. The procedure is:

    • Home the axis to an endstop switch. It will set the axis position to the M208 limit for that axis, assuming you don't use a G92 command to add an offset.
    • Do whatever movement you want (perhaps a complete print)
    • Repeat the homing move(s), but instead of using a G1 S1 move, use S3 instead of S1. Instead of setting the axis position to match the M208 limit, it will do the reverse, i.e. change the M208 limit to match the calculated axis position
    • Send M208 to report the new axis limit, and compare it with the original one.

  • Sorry for the long delay, my bachelor's thesis kept me quite busy the last month so I somehow forgot about this post...

    Anyway, I tried what you suggested and it works! 🙂
    I created a small macro to execute those commands so I can compare the actual position at the endstops with the position its supposed be (at the endstops).

  • I'd recommend homing the system then running the test 10 times or so to enable you to get an idea of the repeatability of your homing switch/sensing before blaming error on missed steps.

    May also be worth checking the difference when the sysyem is hot vs cold.

    Edit: Strictly speaking 3 tests would be enough for an average but 30 is the amount recomended if you want to acurately gauge the deviation.

  • You are absolutely right about the repeatability of the homing switches. It also dawned on me that errors in the range of a few hundredths or maybe tenths of a millimeter might come from the homing switches but my guess is that lost steps in the XY direction are more likely in the range of a few mm.
    At least that's what I think since I never experienced a very small amount of lost steps. The motor either completely stalls or everything works fine.

  • administrators

    If the motor stalls, you will lose a multiple of 4 full steps. On a typical Cartesian printer, that's 0.8mm in X or Y. Your homing switches are probably much more reproducible than that.

  • That makes sense and eases my mind! Thank you very much for your help! 🙂

Log in to reply