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

    Control of stepper motor

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    2
    3
    139
    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.
    • JeanCundefined
      JeanC
      last edited by

      Hello, I use a stepper to rotate a turntable and I would like to control his rotation with degrees. Currently, I have only found a value in X to enter to make a 360° rotation (G1 X33 F1000). But this is not at all optimal, do you know a command or a way to perfectly control the rotation of the stepper motor shaft in degrees?

      ;config.g
      ;drives
      M569 P0 S1 R0                               ; set direction of movement and polarity
      M584 X0                                     ; set drive mapping
      M350 X16                                    ; set microstepping mode for x axis
      M92 X80                                     ; set steps per mm
      M566 X900                                   ; set maximum instantaneous speed changes (mm/min)
      M203 X1000                                  ; set maximum speeds (mm/min)
      M201 X500                                   ; set accelerations (mm/s^2)
      M906 X800 I10                               ; set motor currents (mA) and motor idle factor in per cent
      M84 S5                                      ; set idle timeout
      M564 H0                                     ; allow movement of axes that have not been homed
      M400
      M18                     				    ; disable the motor
      
      ;macro
      G91 				        ; set to relative positioning
      M564 H0                     ; allow movement of axes that have not been homed
      
      ;motor settings
      M569 P0 S1 R0               ; set direction of movement and polarity
      M350 X16                    ; set microstepping mode for x axis
      M92 X200                    ; set steps per mm for x axis
      
      G1 X33 F1000                ; move on x axis
      
      M400                        ; wait for the movements to end
      M18                         ; disable the motor
      
      G90                         ; set to absolute positioning
      

      I'm using a Duet 3 6XD 3.4.6 with a NEMA 17 0.5Nm 1.7A with a step of 1.8° (M1173041). I also have to use an external driver for the motor (TB6600).

      dc42undefined 1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators @JeanC
        last edited by

        @JeanC currently you have configured 80 microsteps per degree in your M92 command, and commanding X to move by amount 33 turns it 360 degrees. This implies that your actual mictosteps per degree is 80 * 33/360 = 7.3333. If you use that value in M92 instead of 80, then the X parameter in your G1 command should correspond to the position in degrees.

        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

        JeanCundefined 1 Reply Last reply Reply Quote 0
        • JeanCundefined
          JeanC @dc42
          last edited by

          @dc42 Thank for replying.
          But I was wondering what parameters I have to put in the motor settings to have a perfect rotation of 360°. Because the 33 is a value that I approximated using my eyes but it's not a perfect rotation. Or is there a command to control a stepper motor only in degrees of rotation and not in a linear axis ?
          Otherwise, thank you very much for your response!

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