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

    Hobby Servo Wiring

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    5
    14
    814
    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.
    • superpotatoundefined
      superpotato
      last edited by

      Hi all,

      I needed some help in confirming if my wiring is correct as I have never wired a hobby servo to duet before. So for my project I need to activate 2 servos and I was thinking of wiring them up like this?

      I do not require any of the fans so I am looking into getting power from there by setting the fan jumper to 5V and controlling the servo similar to BLtouch using the heater4 and heater5.

      Capture.PNG

      Can someone confirm if this will work?.

      And in the config.g file I will make the following changes to get them to work:

      M950 P0 C"exp.heater3" Q500  ; allocate GPIO port 0 to heater3 on expansion connector, 500Hz
      M42 P0 S0.5  ; set 50% PWM on GPIO port 0
      
      M950 P1 C"exp.heater4" Q500  ; allocate GPIO port 1 to heater4 on expansion connector, 500Hz
      M42 P1 S0.5  ; set 50% PWM on GPIO port 1
      

      And from what I understand I can control the postion of the 2 servos with the following command in the Gcode:

      M280 P0 S##
      M280 P1 S##

      This is something new for me but have tried to research as much as I can. I would appreciate any help if someone can confirm my wiring and the changes I need to make to the software.

      Thank You

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

        @superpotato With this wiring you have to be carefull because the servo can drawback relatively high voltage to your Duet.
        Do you have the possibility for an external 5V supply?

        I have my servo wired like this:
        Duet_Mankati_Schema.pdf

        About the code, i have to look later. I'm not at the machine...

        Mankati FSXT+, DeltaTowerV2, E3D MS/TC

        superpotatoundefined Fred-Yundefined JoergS5undefined 3 Replies Last reply Reply Quote 1
        • superpotatoundefined
          superpotato @cosmowave
          last edited by

          @cosmowave

          Thanks for the reply

          At the moment with the setup I do not have any 5V supply. I was hoping to power it directly through the Duet as I had a look at this section: https://duet3d.dozuki.com/Wiki/Using_servos_and_controlling_unused_IO_pins and the 9G servos I am using seem to be okay for it.

          Also had a look at your servo wiring, so it seems that the wiring to control the servo is okay and the same with mine but mainly its a matter of figuring out if the 5V supply will work and if the code is correct now.

          Think I will just try it out tonight 🤞

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

            @superpotato When i'm at home, i can share my code for controlling the servo...

            Mankati FSXT+, DeltaTowerV2, E3D MS/TC

            superpotatoundefined c310undefined 2 Replies Last reply Reply Quote 0
            • superpotatoundefined
              superpotato @cosmowave
              last edited by

              @cosmowave

              Perfect, thanks for the help 🙂

              1 Reply Last reply Reply Quote 1
              • c310undefined
                c310 @cosmowave
                last edited by

                @cosmowave can you share brush pictures too?
                thanks!

                cosmowaveundefined 2 Replies Last reply Reply Quote 0
                • cosmowaveundefined
                  cosmowave @c310
                  last edited by

                  @c310 Yes of course.
                  Today evening....

                  Mankati FSXT+, DeltaTowerV2, E3D MS/TC

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

                    @c310 Here are some pictures of my brush for nozzle cleaning.
                    P1080930.JPG

                    The brush is made from the head of this "brush".
                    P1080931.JPG

                    The system works pretty well. But it's not really necessary! 😄
                    I have made this just for fun, and i had a servo laying around...
                    Here is a video.
                    https://www.youtube.com/watch?v=9iB9oI-SMB0

                    The config.g part for the servo is:

                    ; 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 deploying 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 60mm 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 retracting the brush:

                    ; this macro retract the cleaner brush
                    ;
                    M280 P1 S0							; set servo position to 0°
                    M291 P"brush retracted" R"RetractBrush" S1			; message
                    

                    Mankati FSXT+, DeltaTowerV2, E3D MS/TC

                    superpotatoundefined 1 Reply Last reply Reply Quote 0
                    • Fred-Yundefined
                      Fred-Y @cosmowave
                      last edited by

                      @cosmowave Using an external power supply is a very good advice!

                      I think I burned a PanelDue because of a servo directly powered by the Duet 2.

                      superpotatoundefined 1 Reply Last reply Reply Quote 0
                      • superpotatoundefined
                        superpotato @cosmowave
                        last edited by

                        @cosmowave

                        Ah great, thanks for posting this :). I didn't get the time yesterday but will try it out over the weekened.

                        1 Reply Last reply Reply Quote 0
                        • superpotatoundefined
                          superpotato @Fred-Y
                          last edited by

                          @fred-y 😓 Thanks for letting me know, might be best if I source the power supply just to be safe, really don't want to destroy the board

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

                            @cosmowave said in Hobby Servo Wiring:

                            I have my servo wired like this:
                            Duet_Mankati_Schema.pdf

                            Hello, thank you for sharing your schema, which helps me also. But I have a question, which is probably because of my limited electronic knowledge: isn't it necessary to connect ground of the 5V servo PSU with the Duet PSU, so the Duet knows the signal level?

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

                              @joergs5 Yes, you're right. The GND has to be connected, This is not shown on my scheme, because this scheme was only a quick "remender" for my old brain! 😊

                              Mankati FSXT+, DeltaTowerV2, E3D MS/TC

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

                                @cosmowave ok, thanks for clearifying. I'm doing my best to get better with electronics, but sometimes I have my problems (eg to connect ground high with low voltage - this feels very wrong and dangerous...). I plan to use servos as brakes for hinges, the servo acting as compliant switch.

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