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

    Need help setting up Servo?

    Scheduled Pinned Locked Moved
    Firmware installation
    5
    7
    603
    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.
    • westechundefined
      westech
      last edited by

      Hello!

      I am trying to set up a small hobby servo SG90 for a pen plotter replacing the Z axis.

      In Marlin it just uses M280 and M282. (one sets the angle for the servo, the other deactivates the servo to save the life of the little motor).

      I need a little help in what to put in the configurations (and which file).

      When I was using Marlin I think I just used the BLtouch pin and settings.

      PS I have now tried Marlin, Klipper and RRF. and RRF is the most intuitive. I love the Upload and print button. Rather than uploading files, finding the file and then setting it to print.

      Thanks

      Max

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

        Perhaps this is what you're looking for?

        https://duet3d.dozuki.com/Wiki/Using_servos_and_controlling_unused_IO_pins

        Z-Bot CoreXY Build | Thingiverse Profile

        1 Reply Last reply Reply Quote 0
        • cosmowaveundefined
          cosmowave @westech
          last edited by cosmowave

          @westech For the servo for my brush i use:

          • in config.g
          ; Cleaning Brush
          M950 S1 C"exp.heater3"	; assign GPIO port 1 to heater3 on expansion connector, servo mode
          M280 P1 S1              ; set (1deg) servo position on GPIO port 1
          
          
          • for moving the brush
          ; this macro deploys the brush for cleaning the nozzle(s)
          ;
          if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed	; are axles homed ?
          	M291 P"axles not homed! perform homing ?" R"DeployBrush" S3	; message when not homed
          	G28								; homing
          if move.axes[2].machinePosition < 26										; z < 26mm ? because brush can crash with bed!
          	M291 P"bed to high for brush! move 26mm down?" R"DeployBrush"	; message
          	G0 Z26															; move z to 26mm
          M280 P1 S90								; set servo position to 90°
          M291 P"brush ready" R"DeployBrush" S1					; message
          

          For moving the servo use the M280 command

          Mankati FSXT+, DeltaTowerV2, E3D MS/TC

          westechundefined 1 Reply Last reply Reply Quote 0
          • westechundefined
            westech @cosmowave
            last edited by

            @cosmowave said in Need help setting up Servo?:

            M950 S1 C"exp.heater3"

            Thank you. I had read the wiki, but was confused by the reference to "exp.heater3", so I'm guessing it just is what the pin is called not to do with a heater which I'd imagine uses a mosfet.

            I'm super new at this. So for writing a macro how would I do this:

            I'd create a file in Marcos folder called

            Pen-down.g

            M280 P1 S0 "set the servo to 0 degrees" PEN DOWN

            Pen-up.g

            M280 P1 S90 "set the servo to 90 degrees" PEN UP

            Do I need to set M950: ""Create heater, fan, spindle or GPIO/servo pin Just once at the start of a print? or must that be set before each M280 command?

            If I will always use that pin for the servo, can it be put in the config.g. It looks like that is how the BLtouch works. Correct.

            Thanks.

            baird1faundefined 1 Reply Last reply Reply Quote 0
            • baird1faundefined
              baird1fa @westech
              last edited by

              @westech you would need the M950 command in your config file or you can add to the macro. But you would need it somewhere that it will be called at least once each time your duet board is powered up or reset. So the config makes the mouse sense.

              westechundefined 1 Reply Last reply Reply Quote 0
              • westechundefined
                westech @baird1fa
                last edited by

                @baird1fa Thanks, That makes sense. As long as I put it in Config, The Macro does not need to invoke M950 again.

                Thanks

                Max

                1 Reply Last reply Reply Quote 0
                • Dariuszundefined
                  Dariusz
                  last edited by

                  i was searching for possibility to deactivate servo, to prevent damage (overheat) it in my case, and finally I have found a solution. You have to set "!" in front of pin name and then again any M280. "!" changes polarity of output and next M280 command results in sending unreliable data to servo so it deactivates.
                  Like in example bellow.

                  Of course then before any M280 command you should put M950.

                  M950 S1 C"pinname"
                  M280 P1 S180
                  M950 S1 C"!pinname"
                  M280 P1 S180

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