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

    Closed Loop Control of Stepper Motors with Rotary Encoder

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    9
    32
    7.1k
    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.
    • johnundefined
      john @john
      last edited by

      @sean Based on this diagram from the driver data sheet:

      0_1542871220264_56a7630c-cc5e-42bd-bc85-542ee1319ce1-image.png

      I updated my M569 command to:

      M569 P5 S1 R1 T2.5:2.5:5:0

      On the external driver I have the Motor DIR set to CW, and the S1 parameter in M569 set to "Forward" because that seems to make sense.

      R1 set to Enable High, because enabling the driver from the chart looks like a high command.

      And the Step Pulse timing seems to correspond to:

      Taa:bb:cc:dd (firmware 1.21 and later)
      aa: Minimum driver step pulse width, t3
      bb: step pulse interval, t4
      cc: direction setup time, t2
      ddL direction hold time, 0

      This is still causing my motor to vibrate after 1 or 2 X+1 commands.

      johnundefined 1 Reply Last reply Reply Quote 0
      • johnundefined
        john
        last edited by

        @joergs5 Thanks for the response. I adjusted my R parameter in M569 to R1, active high, and the motors seem to stay cool.

        1 Reply Last reply Reply Quote 0
        • johnundefined
          john @john
          last edited by

          @sean I followed the steps on this post, to see if the voltage coming from the expansion breakout was too low for my ext. driver. I didn't suspect so, and it didn't change the behavior of the motor.

          JoergS5undefined 1 Reply Last reply Reply Quote 0
          • JoergS5undefined
            JoergS5 @john
            last edited by JoergS5

            @sean Maybe you should split your analysis first to know which component is not working correctly, so using this controller with another stepper and then testing the stepper with a different controller.

            The controller has ALM connections. I remember a discussion about this setting here:
            https://forum.duet3d.com/topic/3519/yet-another-external-driver-question/2
            (different controller, but maybe comparable meaning).

            johnundefined 1 Reply Last reply Reply Quote 0
            • johnundefined
              john @JoergS5
              last edited by

              @joergs5 That approach makes sense - my hang up is that i don't know if the settings on the Duet are matching the dip switch settings on the external driver. Questions like fwd v. CW, or Pulse edge rising v. falling, etc.However, I will mix & match drivers w/ motors to see if the issues are consistent.

              I don't believe ALM has any bearing on the issues I'm facing. The ext. driver has a flashing LED that tells me when there is an issue, so the ALM connections are just to notify you elsewhere, such as activating a trigger on the Duet as @dc42 points out in the post you linked.

              JoergS5undefined 1 Reply Last reply Reply Quote 0
              • JoergS5undefined
                JoergS5 @john
                last edited by JoergS5

                @sean Some more ideas: if your tests give no result, you could provide information how your wiring is: which pins you connected, which PSU and connected where (controller for stepper needs 24-48 V e.g.), especially where you connect the + signals. Your T parameters are at the edge of the minimium values, I would try longer times.

                (In case you don't know) CW means clockwise, CCW counterclockwise, so I would set this switch to PUL/DIR.

                I would not set/use ENA, because it is enabled if unconnected.

                johnundefined 1 Reply Last reply Reply Quote 0
                • johnundefined
                  john @JoergS5
                  last edited by

                  @joergs5 , the external driver has a dip switch for

                  "SW5, Motor DIR: off=CCW or on=CW"
                  "SW7, Pulse Mode: off=PUL/DIR or on=CW/CCW."

                  I currently have it set to PUL/DR and CW to align with the Duet firmware "Forward." (This makes more sense to me than CW aligning with Backward).

                  JoergS5undefined 1 Reply Last reply Reply Quote 0
                  • JoergS5undefined
                    JoergS5 @john
                    last edited by JoergS5

                    @sean If you have an oscilloscope, looking at the signals would be another idea. I bought one myself (Hantek 6022) to look at controller signals. Not a quick solution, but maybe you experiment as often as me so that it pays off...

                    There is a youtube about CL57T, maybe you get some hints:
                    https://www.youtube.com/watch?v=S8c6c4CYZUU

                    1 Reply Last reply Reply Quote 0
                    • johnundefined
                      john
                      last edited by

                      Update: I believe the issue was the external driver had a default amp setting of 8A, and the stepper motors I was using were only 2.0 A. When I finally was able to get into the external driver firmware (pro tip: order the RS232 compatible cable AND a serial-to-USB from amazon or something), I could toggle the amperage setting from 8A to 2A and create or turn off the vibrating motor issue I was experiencing.

                      With the omc-stepperonline driver and stepper motors, the pulse timing in M569 is set to 7.5. Anything less and the stepping from the motor sounded like grinding. 7.5 sounds pretty smooth.

                      1 Reply Last reply Reply Quote 0
                      • Da Sid Monundefined
                        Da Sid Mon
                        last edited by

                        I tried using the Closed Loop Stepper Drive/motor combo from Stepperonline. Motors ran OK but from my experience these drives are not truly closed loop. There is no makeup for error and I've switched to a REAL solution. They're Great but NOT cheap (Quality usually isn't)... https://www.teknic.com/products/clearpath-brushless-dc-servo-motors/clearpath-sd/

                        johnundefined 1 Reply Last reply Reply Quote 0
                        • johnundefined
                          john @Da Sid Mon
                          last edited by

                          @da-sid-mon What do you mean "no makeup for error?" I am not saying they are perfect, but the driver-motor combo that I indicated above does attempt to correct the lost steps. The bigger problem that I don't see either of the solutions (mine or your linked servos) is that debris / mechanical fault causing lost steps won't be remedied by closed loop. The only thing that these solutions do in my mind is indicate steps were lost BEFORE you find out after the thing runs into a wall.

                          I'm genuinely curious about your implementation. These systems are new to me.

                          1 Reply Last reply Reply Quote 0
                          • Danalundefined
                            Danal
                            last edited by Danal

                            Hmmm... I'm a little reluctant to be "that guy", but at the same time, there does seem to be some discussion of "makeup lost steps" and "find an error before the machine hits something". May I point out that no amount of sensing from the motor shaft will detect a loose belt, or a loose pulley. These two causes are BY FAR the most common reasons for the "controlled point" not being physically where the firmware commanded. A sensor on the motor shaft literally cannot "see" either of these.

                            I'll be the first to say that a sensor on the motor shaft CAN, maybe, sense a "Jam", a failure to actually move when commanded, aka a "missed step", either because something got in the belt/screw or because the "control point" hit something or similar. At least some of the time a sensor will detect these.

                            So can TMCxxxx stall detect. Particularly, detecting the case of "things are so far off the machine just hit a travel limit" is extremely reliable.

                            So... I'm back to my original question: Encoders on steppers seems to be expense and complexity that accomplishes very little or nothing, vs. current state-of-the art drivers and steppers.

                            Of course, this is a free opinion and worth every penny. 🙂

                            Delta / Kossel printer fanatic

                            1 Reply Last reply Reply Quote 0
                            • 3dmntbighkerundefined
                              3dmntbighker
                              last edited by

                              I posted this here just recently.

                              http://misfittech.net/nema-17-smart-stepper/

                              Scratch built CoreXY with Maestro
                              Heavily modified Ender 3 with Maestro
                              MPCNC work in progress with Duet WiFi

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