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

    Trouble with micro servos.

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    4
    8
    277
    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.
    • Ernst Blofeldundefined
      Ernst Blofeld
      last edited by

      I'm trying to run a micro servo from a PWM connection on my Duex 5, but I don't seem to be able to get it to move at all with what I think are the correct settings. I can get some movement if I change the PWM frequency to much higher than it should be, but it never moves to where I think it should.

      The servo is an MG90S. I have tried swapping it (I bought a pack of 3), but no change. It is connected to PWM_5 on my Duex.

      I'm running:

      • Duet 2 WiFi with Duex 5
      • RRF 3.3

      I have separate 5V power connected to the Duex's 5V Aux In and the jumper changed to select this.

      According to the internet, the servo expects a 50Hz PWN frequency, and a 1ms pulse should put it to the minimum position, a 1.5 ms pulse should put it to the middle and a 2ms pulse should put it to the maximum position.

      I think I should configure the servo with:

      M950 S0 C"!duex.pwm5" Q50
      

      and then set its position with, ie:

      M280 P0 S1000
      M280 P0 S1500
      M280 P0 S2000
      

      for the positions mentioned above.

      This does nothing, except turn on the LED next to the heater 7 output (I have nothing connected to any of the duex heaters).

      If I instead do:

      M950 S0 C"!duex.pwm5" Q500
      

      then the position commands do cause movement, just very small amounts, definitely not going to the correct positions.

      Different values of Q give different results, 250 gives some big movements, but I'm fairly sure I shouldn't be changing that number at all.

      Please help me, I have no idea what I'm doing.

      o_lampeundefined dc42undefined 2 Replies Last reply Reply Quote 0
      • o_lampeundefined
        o_lampe @Ernst Blofeld
        last edited by

        @ernst-blofeld
        AFAIK, for servos you don't set any Q-value.
        Make sure you have sufficient current to move the servo (external 5V perhaps)

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

          @ernst-blofeld use:

          M950 S0 C"duex.pwm5"

          Don't invert the pin, and there is no need to specify the frequency.

          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

          Ernst Blofeldundefined 1 Reply Last reply Reply Quote 0
          • Ernst Blofeldundefined
            Ernst Blofeld @dc42
            last edited by

            @dc42 said in Trouble with micro servos.:

            @ernst-blofeld use:

            M950 S0 C"duex.pwm5"

            Don't invert the pin, and there is no need to specify the frequency.

            Thanks Dave, my servo is now moving, but only 90 degrees between min and max, where I expected 180 degrees. Any ideas on that?

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

              @ernst-blofeld what commands are you sending to move it to the ends of its range?

              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

              Ernst Blofeldundefined 1 Reply Last reply Reply Quote 0
              • Ernst Blofeldundefined
                Ernst Blofeld @dc42
                last edited by Ernst Blofeld

                @dc42 said in Trouble with micro servos.:

                @ernst-blofeld what commands are you sending to move it to the ends of its range?

                M280 P0 S1000
                to send to minimum

                and

                M280 P0 S2000
                to send to maximum

                Experimentally, I can get 180 degrees by using S600 for min and S2400 for max. I don't know what that means. Values below 600 seem to cause it to spin round to the other extreme and values over 2400 seem to be ignored.

                fcwiltundefined 1 Reply Last reply Reply Quote 0
                • fcwiltundefined
                  fcwilt @Ernst Blofeld
                  last edited by

                  @ernst-blofeld

                  The docs for M280:

                  M280

                  From the docs for M280:

                  S values below 544 are treated as angles, and 544 or greater as the pulse width in microseconds.

                  Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                  Ernst Blofeldundefined 1 Reply Last reply Reply Quote 1
                  • Ernst Blofeldundefined
                    Ernst Blofeld @fcwilt
                    last edited by

                    @fcwilt said in Trouble with micro servos.:

                    @ernst-blofeld

                    The docs for M280:

                    M280

                    From the docs for M280:

                    S values below 544 are treated as angles, and 544 or greater as the pulse width in microseconds.

                    Yes! I'd become fixated on using the pulse width. S0 through S180 seem to work as expected.

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