Connecting and Operating a Servo Motor

  • Hi Duet Users,

    I want to connect and operate a servo motor (MG945 Digital Servo, operating voltage: 4.8-7.2V) with my Duet Wifi; however it doesn't work...

    A servo motor should be implemented to grip (and then lift via z-stage) a dish; hence the application requires gripping (for example: 120 to 60 degrees) for 10 sec and then an opening motion (60 to 120 degrees).

    Duet Wifi + Duex5 (12V, 29A), 7 stepper motors with 7 limit switches, 4 fans, 2 bed heater, 1 servo motor

    The servor motor has three wires/pinouts (PWM, VCC, GND). According to the documentation "Using servos and controlling unused IO pins", I can use heater pins to connect the servo motor. Since the heater connection has two pins, I was wondering how to connect the servo motor to the DuetWifi. Do you have any example for the wiring of a servo motor? Is the motor connected to ext 5V (with +5V and GND) and the PWM to the heater pin?

    Using the heater pins, I disabled the heater via M307 H# A-1 C-1 D-1 in the config file. Currently, I am a bit confused if E0 is H0? Moreover, do I have to use the M42 command when using M280 servo control command? It would be great to see an example protocol for operating a servo motor.

    Thanks a lot for your feedback and support!


  • I myself use a servo for my filament mux. Here is my config (I use a Duet fan output, with fan power supply set to 5V; my real fans are all on the Duex5):

    M106 P0 I-1               ; disable Fan 0 (used as servo output)
    M280 P20 S2400 I1         ; select mux 1

    For electrical connection, you need to power up your servo from a dedicated power supply (so you can adjust the voltage, and have enough current): wire the + of this supply to the + of your servo, and connect all - together (main Duet supply, servo power supply and servo itself). Then, wire the fan pwm output to the servo pwm input.

    The servo power supply can be a buck converter connected to the Duet power supply. Don't use duet 5V, you may fry it, because a servo can drain a lot of current.

  • administrators

    The DueX5 has 5 three-pin connectors for 5V servos, one for each heater channel. Pick one of those for which you are not using the corresponding heater.

  • I missed that! Thanks!

Log in to reply