Hobby Servo Wiring
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.
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.
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
@superpotato When i'm at home, i can share my code for controlling the servo...
Perfect, thanks for the help
c310 last edited by
@cosmowave can you share brush pictures too?
@c310 Yes of course.
@c310 Here are some pictures of my brush for nozzle cleaning.
The brush is made from the head of this "brush".
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.
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.homed || !move.axes.homed || !move.axes.homed ; are axles homed ? M291 P"axles not homed! perform homing ?" R"DeployBrush" S3 ; message when not homed G28 ; homing if move.axes.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
Fred-Y 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.
Ah great, thanks for posting this :). I didn't get the time yesterday but will try it out over the weekened.
@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
JoergS5 last edited by
I have my servo wired like this:
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?
@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!
JoergS5 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.