Duet support for Digital Servos?



  • Hey Everyone,

    I've been driving servos on my duet for a while now and recently needed more power so I'm trying to get This Digital Servo working. This analog one works just fine in the same setup, but when I plug in the digital it will only move once then buzz.

    Since the digital servo draws higher voltage I am running a voltage regulator off of 24v. This regulated voltage is then hooked into an SSR and driven off the duet. The servo will draw 3A at stall, and these regulators are rated for only 3A, so it might be questionable power wise.

    The Signal pin for the servo connects to PWM1.

    As I mentioned, using this arrangement I don't have any issues driving the analog servo. But when I connect the digital servo in I don't get a response.

    Q:

    1. From what I understand about digital servos is they should be able to receive the same PWM signal? Is there any reason to believe a digital servo won't work?
    2. Could it be that the ground from the voltage regulator is not explicitly grounded to the duet? I presume the grounds on the voltage regulators are the same reference. Edit: I tried joining the grounds, same situation

    I can draw up a diagram of the wiring if that's helpful. I've also attached my config settings

    Here's the code for my driving the servo>
    M280 P3 S0 ; Servo to 0deg
    G4 P300 ; Dwell 300
    M280 P3 S50 ; Servo to 50deg
    G4 P300 ; Dwell 250ms

    The story gets weirder...

    To verify the digital servo works at all I set up a script in arduino to drive the servo. Verified it with an analog and it worked.

    Initially it didn't move the digital servo at all, but once I plugged the 5v output from the arduino into a breadboard, then plugged the digital servo power input to the breadboard as well it started working?! I wouldn't have expected the slight capacitive/resistive change of the bread board to cause any major issues, but after trying to get the servo working without the breadboard there was no success.

    Anyways I'm a bit stumped. I'm going to get some capacitors (the 220uF you'd recommended elsewhere) to put in line on the servo power


  • administrators

    Please provide a wiring diagram.



  • @dc42 0_1548426613261_wiring_digital.png

    Thanks. Right now we're just running the relay plugged into an always on so we don't have to have another variable


  • administrators

    I don't see anything wrong with that wiring, assuming that the servo output on the DueX is OK and you disabled the corresponding heater using M307. Does that output still work if you plug a small servo into it?



  • Forgot to upload the config first time. I'm shutting off all the heaters on the Duex just to be safe:
    0_1548440073786_config.g

    Tested two different analog servos, a little 9g one and the HS-645MG listed in the OP. Both worked without issue.

    Still can't get the digital one to trigger.


  • administrators

    Are you sure that the angles you are sending (0deg and 50deg) are within the range supported by your servo? Have you tried larger values?



  • Good call, Just tried doing 20 degrees to see, no difference. Looking at the servo datasheet I'm seeing

    Operating Travel: 40±5°/ONE SIDE PULSE TRAVELING 400usec
    Direction: CLOCK WISE/PULSE TRAVELING 1500 TO 1900 usec

    To try and eliminate variables I've also been using an Arduino driving a servo from 0-60°, it did seem to be driving the servo 60 degrees. I recreated the wiring diagram using an external variable power supply and confirmed I am able to drive the digital servo successfully using the voltage regulator and a relay. I confirmed this was true with analogs as well.

    Meaning I only had the PWM pin connected to the arduino, and the voltage being driven elsewhere. Grounds were tied together for reference on a breadboard.

    Again, with an arduino the digital servo and analogs commanded the correct move position every time

    However, when I took this identical wiring arrangement, and only changing the PWM pin going into the PWM on the Duex, I am ONLY able to drive analog servos. The digital one continues to not move.

    The only thing I can think of is the PWM frequency between the two devices is different. I'll probably hook it up to an osciloscope to see if I can see the frequency, but at this point I'm pretty compelled of the origin of the issue, and would be willing to go so far as to ship you a digital servo if necessary.


  • administrators

    What voltage does the servo need on its control wire? The servo itself needs 6V minimum power according to Hitech, but I didn't find a specification of the voltage needed on the control wire. If you are running it near its maximum power voltage (7.4V) then it's possible that a 5V signal from the Duet isn't enough, if the digital circuitry inside it is implemented using standard CMOS logic. Try running the servo with 6V or 6.5V power.



  • The arduino is only supplying a measured peak-to-peak 500mV on the control wire when driving the digital servo, the duet is outputting a measured peak-to-peak 1.5V. Both the old analog servo and new digital one operate at 6V on the power, so that's where we're currently set to switch between either option, at least until we get the digital working.

    What frequency is the PWM operated at?


  • administrators

    @mkelly said in Duet support for Digital Servos?:

    The arduino is only supplying a measured peak-to-peak 500mV on the control wire when driving the digital servo, the duet is outputting a measured peak-to-peak 1.5V.

    That's not right at all. The servo shouldn't be drawing anything like that much current from the control wire. You should see 5V or very close to that, if you measure it while the servo has power applied. Either the servo is faulty, or you have wired it incorrectly.

    The servo refresh frequency used by RRF is 50Hz.



  • @dc42

    There's too much noise on the scope to get a good reading, but I was just reporting the measurements from the control signal.

    Again, the digital servo works fine on an Arduino, which also drives the Analog servo of similar form factor.

    The wiring on the duet can drive the analog servo just fine, meaning there's no issues with the wiring from a conductivity standpoint.

    The only variable I can't control right now is how the Duet is outputting the PWM signal to drive a digital servo, and I'm not able to confirm if anyone has been successful in driving a digital servo off of a duet.


  • administrators

    @mkelly said in Duet support for Digital Servos?:

    There's too much noise on the scope to get a good reading, but I was just reporting the measurements from the control signal.

    If there is too much noise to read 5V, you have a big wiring issue.



  • Apologies, sorted out the issues with the measurement, now I'm getting a clean signal from the PWM. Here's a picture from the scope with only 500mV being measured on the square wave at 50Hz. I have isolated the wiring to such a degree that there is no chance of faulty wiring, if it was such a simple troubleshoot this wouldn't have taken so many steps to unravel.

    Scope

    This measurement is identical to the arduino controlled version. Which further increases the confusion why driving the servo off the Duet would have any impact on driving a digital servo.

    Again here's the chart showing the operability of the servo using the exact same wiring:
    0_1548702745052_5cc5cfd9-3b87-413a-8059-04dcdc018b24-image.png

    I also found a servo catalog chart with something interesting. It specifies the Control circuit for the HS-645MG as "ANALOG" but the HS-7954SH specifies a "G2 DIGITAL" Control circuit. It is not clear if this is referring to the internal control circuit (likely) or something relating to the PWM (unlikely), but perhaps that means something to you.

    The other options for the other digital servos in the chart are "G1 Digital", "G2.5 Digital", "HR Digital", "32bit Digital" and "EBL Digital"

    At this point all I'd like to know is if anyone has successfully driven a digital servo off of the Duet? I'm thinking it's necessary to use an external circuit to drive the servo since it's taking so much effort to get the Duet to do it.


  • administrators

    Are you using a x10 probe, and if so, does your scope know that you are? On my scope the probe type is an option on the channel menu. Your 500mV may in fact be 5V.

    What are the pulse width and repetition frequency when you use your working Arduino sketch?



  • You were correct, x1 changed to x10 now I'm measuring 5.3V.

    For the arduino output has a positive width of 1.78ms(~560Hz)(@ the full 5.3v) with a repetition frequency of 50Hz. Total Pulse width is 20ms

    Here's the test code, intended to cycle the servo with a 2s pause:

    #include <Servo.h>

    Servo myservo; // create servo object

    int pos = 0; // variable to store the servo position

    void setup() {
    myservo.attach(8); // attaches the servo on pin 8 to the servo object
    }

    void loop() {

    delay(2000);
    // 120ms to travel 60 degrees
    for (pos = 60; pos <= 120; pos += 5) { // travel 60 degrees
    myservo.write(pos); // tell servo to go to position in variable 'pos'
    delay(10); // waits 10ms for the servo to reach the position
    }


  • administrators

    Have you tried using 1.78ms width pulses from the Duet?



  • I successfully drove a TowerPro MG996R, which is a digital servo. I mean, it has a digital internal closed-loop system, and is controlled the same way as analog ones.

    Your servo, however, is smarter: it can be programmed through the control pin. It should work as any other servos work, by driving a 50Hz signal on the control pin, and it does with Arduino. There is something in the Duet signal messing up the internal electronic of your servo, but I don't see what.


Log in to reply