Servo PWM behavior



  • When switching Duet from power OFF to ON pin3 sends a brief pulse s to displace the servo by a significant increment. This happens to give my particular strategy fits. Is there any way to subvert this?

    Secondly problem is when I want to displace the servo to a new position I send , for example :
    M280 P3 S1400 I1 ;PULSE WIDTH MICROSECONDS
    G4 S1 ;DWELL BEFORE DISABLE
    M280 P3 S-1 ;TURN OFF P3 (SERVO)
    which works fine and turns off the servo to avoid overheating. There is no external force attempting to move the servo when off. Unfortunately, I think, but am not absolutely certain, that occasionally (?) an uncommanded servo signal occurs in the gcode execution stream. I can't think how to determine when/if this occurs.


  • administrators

    I assume you are driving the servo directly from the expansion connector of the Duet. Here are some suggestions to fix the power on problem:

    1. Connect a pulldown resistor of between 1K and 10K between the servo output and ground. This should hold the pin low during power up.

    2. If you are activating the servo within config,g, try adding a G4 delay command before you enable the pin for servo use. This will make the pin stay high for much longer, and with luck the servo will ignore it.

    3. Try a different pin on the expansion connector. Some of the PWM-capable pins use a timer-counter, and others use a PWM channel. They may behave differently at start-up.

    Modern servos do not normally overheat unless you drive them beyond their physical endstops. So avoid sending commands which move the servo beyond its natural range. Some servos have slightly smaller ranges than published.

    HTH David



  • @balrags said in Servo PWM behavior:

    ...that occasionally (?) an uncommanded servo signal occurs in the gcode execution stream. I can't think how to determine when/if this occurs.

    In decreasing order of what they'd tell you:

    • Oscilloscope on the output pin.

    • "Servo tester" that reads pulse width (much cheaper than o-scope!) in parallel.

    • Cheap analog servo in parallel.


Log in to reply