Servo resolution

Hi All

I’m after controlling a servo at an accuracy of .1 degree.

I’m used to using stepper motors but want to see if a servo can produce the same.

I’m looking at this servo to try first : DS3218 PRO
Operating travel: 180° (PWM 500-2500μs)

So this give a pwm range of 2000μs… So 180° / 2000μs = 0.09°

Can I use servo.writeMicroseconds() with increments of 1?

I only need a 90° range so can I start at :

servo.writeMicroseconds(500);
Then move to:
servo.writeMicroseconds(1500);

Then tune if needed to:
servo.writeMicroseconds(1501);

Is this all possible with the Arduino servo library?

Also what is deadband with servos?
This servo has Dead brand: 3μs
Is this similar to back lash?

Cheers for the help

I think you're being optimistic.

Don't forget that most hobby servos are still man-in-the-loop devices, so repeatability may well not be very good.

0.1 degrees means trying to fit sixty increments into the space between the minute markings on a clock face.

I have a +/- tolerance of 0.1° so have a window of .3°

The main question is can servos be controlled in the way I have asked?

I have have found more expensive hobby servos with higher resolution and lower dead band.

The Servo library will certainly allow you to send commands to the servo using writeMicroseconds() in the way you describe.

You're then at the mercy of how the servo responds to those commands. But since servo Deadband effectively means the minimum signal change that is guaranteed to produce any change in output controlling that particular hobby servo with single microsecond changes is a bit optimistic. And that's a fairly good servo for it's class, deadband is often 5-10us.

If you really need a repeatable accuracy of +/- 0.1 degrees then no hobby servo will do it, you're going to need a serious (expensive) industrial servo and they normally use different control mechanisms anyway.

Steve

Hitec D954SW has a dead band of 1μs and a potential accuracy .09°.

May give that a go.

It is repeatability I am after, like I said I have a window of 0.3° so hopefully may be able to hit that.

Cheers for the help.

You need anti-backlash geartrain for that sort of repeatability, and no deadband.

This seems like an application for a servomotor with a precision encoder, not an RC servo(mechanism).

If you set a servo limit, using the Arduino servo library, of say 90 degrees, you still get a range of 2000uS to divide by 90 instead of 180. You go from 5.54uS per degree to 11.11uS per degree; It is really 5.55uS but I like the bit of safety.

If a ESP32 is used the PWM is adjusted by clock ticks. Though you do not get to use the Arduino servo library of limits, there is the added resolution of 1uS of PWM =~3 clock ticks. Then it become a matter of the thing the servo can do.

Markt:

I have only used stepper motors in the past, I have gear box's for these. The only reason I do not want to use them is that I need to calibrate them to a home position. With the tolerance stated its one other thing that needs to happen.

I thought a hobby servo would be good because it knows it's own position.

I have seen servo motors with built in encoders, do they know their own position from go, or do they need to be initially calibrated to a home position?

Idahowalker: If you set a servo limit, using the Arduino servo library, of say 90 degrees, you still get a range of 2000uS to divide by 90 instead of 180.

Interesting. How do you do that using the Servo library? Or do you mean modifying the library code?

Steve

The limiting factor will be , as said, backlash plus the angular resolution of the feedback pot in the servo. Why do you need such accuracy ?

slipstick: Interesting. How do you do that using the Servo library? Or do you mean modifying the library code?

Steve

Servo.attach > https://www.arduino.cc/en/Reference/ServoAttach. Using the min/max values in uS.

Idahowalker: Servo.attach > https://www.arduino.cc/en/Reference/ServoAttach. Using the min/max values in uS.

No sorry, that makes no difference at all if you are already using writeMicroseconds(). That still takes exactly the values you give it and the interpretation is down to the servo.

The attach() limits are applied if you use write(angle) and if you want precision you'd never use that. Internally it just does some calculations and then calls writeMicroseconds() itself.

The conversion of pulse length to degrees of movement is a characteristic of the specific servo. It's not something we can have any control over at the Arduino end.

Steve

slipstick: No sorry, that makes no difference at all if you are already using writeMicroseconds(). That still takes exactly the values you give it and the interpretation is down to the servo.

Steve

Sorry, my experience has been that if, when I used limiting min max values, I get a greater range of values per degree, when I used the servo library, and yes there is a limitation of the servo to do as requested.

As with the ESP32 PWM API, I can send torque values to the servo that are in clock ticks that equal to 3 clock ticks per uS. The servo may not be able to respond to a 3 clock tick per uS PWM but, the granularity of control still exists and my servos on the X/Y platform are more responsive to tilt angles.

Idahowalker: Sorry, my experience has been that if, when I used limiting min max values, I get a greater range of values per degree, when I used the servo library, and yes there is a limitation of the servo to do as requested.

As with the ESP32 PWM API, I can send torque values to the servo that are in clock ticks that equal to 3 clock ticks per uS. The servo may not be able to respond to a 3 clock tick per uS PWM but, the granularity of control still exists and my servos on the X/Y platform are more responsive to tilt angles.

Must be a different servo library then, perhaps the ESP32 has its own. But the standard servo library doesn't use the PWM API so it's not related in any way to that.

Confusing. Ah well, I guess people will have to carry on trying to work it out for themselves.

Steve

https://makezine.com/2014/04/23/arduinos-servo-library-angles-microseconds-and-optional-command-parameters/

Is what gave me my initial understanding that lowering the limits with min/max would give, in software and PWM output of the Arduino Servo library, greater granularity per degree of servo torque.

There is a ESP32 servo library that mimics the Arduino Servo library. It's limitations is the ESP32 servo library allows the ESP32 PWM API to set the hardware timer. If 'your' code uses one of the hardware timers, then ones program may be interfered with. By using the ESP32 PWM API, directly, one can assign which servos are attached to which hardware timers, one gains an increase in program speed, and there is a natural increase in servo torque granularity.