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

    How to setup and configure a servo

    Scheduled Pinned Locked Moved
    General Discussion
    5
    14
    581
    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.
    • dmc456undefined
      dmc456
      last edited by

      I'm new to Duet and looking what should be some basic assistance.

      I need to configure a "RC servo" to run on my expansion board as shown below. By printer is configured with the below firmware and hardware. Can someone help with the edit of my config.g file to assign the PWM1 port shown below, and then the basic gcode command to move the servo from 1000 to 2000 which is the range in micro-seconds to drive the servo.

      166d05fa-e90d-4a48-9c21-156f6aafec7a-image.png

      Here is the PWM1 ports I would like to connect my servo.

      1b3c0c0b-a499-4c7f-a2a7-376faaa2608b-image.png

      Here is my Config.g file (I think this is where I'm supposed to assign the port)
      config.g

      Rushmere3Dundefined 1 Reply Last reply Reply Quote 0
      • Rushmere3Dundefined
        Rushmere3D @dmc456
        last edited by

        @dmc456 https://docs.duet3d.com/en/User_manual/Connecting_hardware/Motors_servos

        Have a read here ^

        Follow my adventures in 3D Printing, laser cutting and electronics. https://linktr.ee/Rushmere3D

        dmc456undefined 1 Reply Last reply Reply Quote 0
        • dmc456undefined
          dmc456 @Rushmere3D
          last edited by dmc456

          @rushmere3d

          I have read that multiple times. I would only be guessing at a code to try.

          I assume I assign the port in my config.g file.

          What is the 1 line I need to add to my config.g to assign this port as a SERVO? I say something about heaters and configuring which I don't think I have, at least not on the expansion board or this group of ports.

          And thanks for your help so far.

          alankilianundefined 1 Reply Last reply Reply Quote 0
          • dmc456undefined
            dmc456
            last edited by

            Looks like I use the 42 command in my config.g to assign. Im using RR2.x firmware

            And then M280 in my gcode to position the servo when printing.

            1 Reply Last reply Reply Quote 0
            • alankilianundefined
              alankilian @dmc456
              last edited by alankilian

              @dmc456

              I don't have a Duex, but I'll take a shot:

              According to THIS image, you are going to use PWM1 which is pin E2_PWM

              I tried the obvious pin names of E2_PWM and PWM1 which were both wrong, so I googled for duex5 pin names and after looking at some dead-end pages, I found THIS page which lists the pin names in RRF3.

              So I see this is the way to configure your pin:

              M950 S1 C"duex.pwm1"
              

              And, going to THIS page, this is the way to control the servo:

              M280 P1 S80
              

              I don't have one of these boards and I don't know which version of firmware you are running, so some of this might not work, but the links should allow you to make some more progress.

              SeemeCNC Rostock Max V3 converted to V3.2 with a Duet2 Ethernet Firmware 3.2 and SE300

              1 Reply Last reply Reply Quote 0
              • dmc456undefined
                dmc456
                last edited by dmc456

                I am running RR2.....does the following make sense?

                Add to the config.g file to configure the port for PWM1 running RR2.

                M42 P3 S1500;
                P3 is the pin for RR3, but I couldn't find any RR2 pin numbers, S1500 move the servo to the center.

                For my gcode commands:
                M280 P3 S1000 to move to one extreme
                M280 P3 S1500 to move the middle
                M280 P3 S2000 to move to the other extreme

                Looking for someone who understands this before I try it.

                I have also seen where the pin # might be 8
                Scroll down to PWM1 pins for heaters
                https://docs.duet3d.com/Duet3D_hardware/Duet_2_family/Duet_2_WiFi_Ethernet_Hardware_Overview

                droftartsundefined 1 Reply Last reply Reply Quote 0
                • droftartsundefined
                  droftarts administrators @dmc456
                  last edited by droftarts

                  @dmc456 pin names (RRF3) and numbers (RRF2) are here:
                  https://docs.duet3d.com/Duet3D_hardware/Duet_2_family/DueX2_and_DueX5#inputoutput
                  Pwm outputs are shared with heaters, and pwm1 is heater 3 so you can’t connect a heater there if using the PWM pin. PIN number is 3. Add M307 H3 A-1 C-1 D-1 before M280 to free it up.

                  Edit: no need to use M42, just use M280. You may need to invert output with I0.

                  Ian

                  Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                  dmc456undefined 1 Reply Last reply Reply Quote 0
                  • dmc456undefined
                    dmc456 @droftarts
                    last edited by

                    @droftarts thanks for the help!

                    droftartsundefined 1 Reply Last reply Reply Quote 0
                    • droftartsundefined
                      droftarts administrators @dmc456
                      last edited by

                      @dmc456 see my edit, only use M280!

                      Ian

                      Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                      dmc456undefined 1 Reply Last reply Reply Quote 0
                      • dmc456undefined
                        dmc456 @droftarts
                        last edited by

                        @droftarts

                        Please confirm

                        The M307 and M42 go in the config.g file to assign the pin?

                        The M42 is the gcode command used to move the servo which I can use in my slicer software.

                        droftartsundefined 1 Reply Last reply Reply Quote 0
                        • droftartsundefined
                          droftarts administrators @dmc456
                          last edited by

                          @dmc456 M307 to free up the pin in config.g. You don’t need M42 or M280 in config.g in RRF2, unless you want the servo powered up when the machine starts.

                          M42 accepts S parameter values 0 to 255. See You will have to experiment carefully what values work for your servo, if you can’t output M280 commands from the slicer, or use a post processing script to replace M42 with M280.

                          Ian

                          Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                          dmc456undefined 1 Reply Last reply Reply Quote 0
                          • dmc456undefined
                            dmc456 @droftarts
                            last edited by

                            @droftarts

                            Thanks

                            I will experiment

                            1 Reply Last reply Reply Quote 0
                            • dmc456undefined
                              dmc456
                              last edited by

                              I'm measuring 3.3 V at P3. How do I change it to 5V.

                              DIY-O-Sphereundefined 1 Reply Last reply Reply Quote 0
                              • DIY-O-Sphereundefined
                                DIY-O-Sphere @dmc456
                                last edited by

                                @dmc456
                                https://forum.duet3d.com/topic/13016/rrf3-and-servo/9?_=1646952076729

                                (UTC+1)

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