Duet support for Digital Servos?
-
Forgot to upload the config first time. I'm shutting off all the heaters on the Duex just to be safe:
0_1548440073786_config.gTested 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.
-
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 usecTo 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.
-
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?
-
@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.
-
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.
-
@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.
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:
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.
-
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
} -
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.