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

    Multiple Leadscrew Z Axis Alignment and Microstepping

    Scheduled Pinned Locked Moved
    General Discussion
    4
    6
    1.2k
    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.
    • DigitalVisionundefined
      DigitalVision
      last edited by DigitalVision

      I recently reconfigured one of my printers (a CoreXY) with 3 Z axes driven by 3 steppers. 2 are driven by the Z axis driver, and one by the E1 driver.

      To keep the three leadscrews in alignment my homing strategy is to bring the bed down and stall the steppers against mechanical hard stops at the bottom – then back up again against a mechanical microswitch for Z=0.

      While this actually seems to work somewhat reasonably well in practice, I don't believe it will yield a well defined relative position. When the steppers stall they will skip an entire full step, but we don't know the final microstep offset they are going to be at at the end of the move, and since the mechanical positions aren't perfectly identical they will skip out of phase of each other.

      If we had a way to move an axis to its next full step in either direction, we could ensure that the microstep phase offset was identical each time greatly increasing the chance that the three steppers end up in the same relative state against the hard stop. This could either be solved with some custom move command, or by reconfiguring the steppers to use full stepping temporarily.

      The first option also depends on the E1 and Z drivers to always stay synchronized on the same microstep offset. Assuming multiple leadscrew bed leveling and stall detection isn't enabled is this guaranteed to always be the case?

      For the second option, I tried to change microstepping on the fly: after stalling the steppers against the hard stops switch to single stepping, move them up a mm and stall them against the hard stops again – but this seems to cause very bad things to happen. The steppers behave very weirdly and complain loudly with high pitched and/or hissing sounds without moving – for a few seconds – and then suddenly all they start behaving correctly. But at this point they have lost position registration. It feels like a software bug, like a position counter overflow or similar, and I assume this is not currently supported. I tried a bunch of things, like turning the motors off, M0, etc, but got the same result. It would be nice if this was supported. (I'm at 2.02RC1) This is the gcode that failed:

          M564 H0           ; allow movement of axes that haven't been homed
      
          G1 Z205 F1800 S0  ; crash into mechanical stops
          G1 Z-1 F1800 S0   ; move 1 mm back up again
          M350 Z1           ; set Z axis to single stepping
          G1 Z2 F200 S0     ; stall with single stepping
      
          ; home against microswitch
          G1 Z-205 S1 F1800 ; coarse
          G1 Z1       F1800 ; backup
          G1 Z-1.5 S1 F200  ; refine
      
          G92 Z0            ; set Z position to axis minimum (you may want to adjust this)
      
          M350 Z64          ; restore Z axis to 64x µ-stepping
          M564 H1           ; prevent movement of axes that haven't been homed
      

      Another potential use case for temporarily full stepping could be to get more repeatable microswitch homing positions. In the past I found mechanical microswitches to vary their trigger positions by up to ±50 µm, and a firmware hack to probe an enstop multiple times and use the median position as offset significantly improved homing accuracy. Effectively rounding the trigger position to the nearest full step would improve consistency.

      A third option would be to turn the stepper motor off temporarily, i.e. M18 Z when the steppers are pushing against the hard stop. Will this reset the steppers to a fullstep position?

      1 Reply Last reply Reply Quote 0
      • Phaedruxundefined
        Phaedrux Moderator
        last edited by

        For your single microstepping moves, that are failing, try reducing the speed and acceleration drastically. speed and accel 10mm/min

        You could try using stallguard to home each motor one at a time. It's going to depend a lot on the steps per mm of your z axis, and a number of other things. That's kind of what you're already talking about, but you're doing it all at once. This is complicated by the fact you're using 3 motors with 2 drivers. Not sure how well that would play out.

        It's been discussed recently about turning off the steppers to get them to snap to a fulls tep, but the problem is they can snap in either direction, so can't be guaranteed to be synced.

        Z-Bot CoreXY Build | Thingiverse Profile

        1 Reply Last reply Reply Quote 0
        • gtj0undefined
          gtj0
          last edited by

          I tried a Z setup like yours early on before buying the Duex5. Then I bought the Duex5. 🙂 You could get away with a Duex2 and I highly recommend it.

          With 2 leadscrews controlled by the same driver you can never automate this. As @Phaedrux said,
          when the motors power off, there's no guarantee which direction they'll go to get to the next full step and even 1 full stop off will give you fits. Also, when the motors turn off, the weight of the bed might actually turn the screws and and turn them in different amounts.

          Using full stepping might be a problem for the same reason. When the driver switches from microstepping to full stepping I'm not sure there's a guarantee that it will be an instant operation even from the driver's perspective. If it isn't then then again, the rotor could snap either way during the transition. You may have to look through the TMC2660 driver docs to get a better idea of what happens in that case.

          Is there a reason you can't use a bed probe? If you can, here's what you can do, assuming you have the 3 motors driven independently ...

          Assuming your Z motors are assigned drives 2, 4, 5 (M584 Z2:4:5) ...
          Create a macro that's named "home_to_bottom" or something. In it, assign the 3 screws independently to the Z, U and V logical drives using M584 Z2,-1,-1 U4 V5 (read the docs), then assign each one of your lower switches (assuming you have 3) to each of the axes with M574, then move to the bottom with G1 Z500 U500 V500 S1. Each screw should stop when it's endstop is hit. Substitute 500 with a sane number for your printer. Then reset the driver assignments with M584 U-1 V-1 Z2:4:5. Now your homez.g macro file can call this macro first to send the bed to the known bottom endstops, then do what it needs to home to 0 just with the Z logical drive. Then run Auto Bed Compensation.

          1 Reply Last reply Reply Quote 2
          • dc42undefined
            dc42 administrators
            last edited by

            You can't get better resolution than 1 full step using independent drivers for each Z motor and stall detection endstops, because of the way that stall detection works; or 4 full steps using a hard stall and no stall detection, because the motor current directions in the windings repeat at intervals of 4 full steps.

            Duet WiFi hardware designer and firmware engineer
            Please do not ask me for Duet support via PM or email, use the forum
            http://www.escher3d.com, https://miscsolutions.wordpress.com

            1 Reply Last reply Reply Quote 0
            • DigitalVisionundefined
              DigitalVision
              last edited by

              Thanks everyone. I was able to solve the issue with switching to single stepping. The problem was a) a few missing M400 in the script and b) I had to update steps per mm (M92) after changing microstepping.

              The reason I didn't do the microstepping change was that my config.d sets M92 before M350 and M350 rescales the steps/mm setting as per the M350 entry in the wiki. This however doesn't seem to work correctly when changing microstepping on the fly (at least from something other than 1/16). This seems like a bug.

              @dc42 said in Multiple Leadscrew Z Axis Alignment and Microstepping:

              You can't get better resolution than 1 full step using independent drivers for each Z motor and stall detection endstops, because of the way that stall detection works; or 4 full steps using a hard stall and no stall detection, because the motor current directions in the windings repeat at intervals of 4 full steps.

              Thanks. The idea was that I don't need higher resolution – all I'm after is repeatability – but I now realize that the idea of changing to full stepping is broken. For this idea to work one would need a way to put both steppers into the same modulo-4 full step position. As it works now – at the end of a full step stall, the steppers can still be in one unknown out of four possible different positions, and the two steppers connected to the same driver can be misaligned by up to up to 3 steps relative to each other.

              Single step stall detection won't work with two steppers connected to the same driver as far as I can tell.

              It seems like my best option without changing the hardware is probably to move the bed down to the hard stops. Power off the Duet to de-energize the motors and leave the bed with a natural gravity force keeping it in a consistent state. Maybe turn the leadscrews manually to achieve a consistent torque. Then boot the Duet up again which should put everything back in a consistent modulo-4 stepper position and likely (how?) snap into a consistent relative position. A slight improvement might be that after a fresh boot where I know that the steppers are in a known state, I can move the steppers down against the hard stops to stall an amount that corresponds to an even multiplier of a full 4 steps. In my case that would be 0.100 mm. At this point – with some luck – the system should probably be in a mechanically consistent state – until the z motors are turned off at least.

              Is this really the best one can do with 2 steppers powered by one driver?

              @gtj0 said in Multiple Leadscrew Z Axis Alignment and Microstepping:

              You could get away with a Duex2 and I highly recommend it.

              That seems to be the only really good option. If stall detection can be tuned to reliably detect single step it should be possible to then get everything aligned properly without microswitches using the full stepping mode. Otherwise I'd add a z min microswitch for each axis and home the bed like a delta printer.

              @gtj0 said in Multiple Leadscrew Z Axis Alignment and Microstepping:

              Is there a reason you can't use a bed probe?

              I'd prefer to not add that complexity. If the bed is sufficiently flat it should be possible to achieve mechanical repeatability.

              Phaedruxundefined 1 Reply Last reply Reply Quote 0
              • Phaedruxundefined
                Phaedrux Moderator @DigitalVision
                last edited by

                @digitalvision

                I'd prefer to not add that complexity

                6 of one and a half dozen of the other at this point?

                Z-Bot CoreXY Build | Thingiverse Profile

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