Forums

Question re Servos

Started by MaxMaxfield 6 months ago9 replieslatest reply 5 months ago116 views

I'm a bit confused -- I recently started playing with servos. In the book "Motors for Makers" https://www.amazon.com/dp/0134032837 it says that 1.5ms pulses always equate to the servo's midpoint. That some servos use 1.0ms and 2.0ms for hard left and hard right, respectively, but this can vary, with some ranging from 0.7ms to 2.3ms. This book also says that if you go too far you can damage the servo (strip the gears). So far, so good (although it wouldn't kill the servo manufacturers to protect against the user going too far).

In the case of the Tower Pro SG92R Micro Servo from Adafruit https://www.adafruit.com/product/169 they say that "Position '0' (1.5ms pulse) is middle, '90' (~2ms pulse) is all the way to the right, '-90' (~1ms pulse) is all the way to the left." They also say: "Note that the default servo pulse widths (usually 1ms to 2ms) may not give you a full 180 degrees of motion. In that case, check if you can set your servo controller to custom pulse lengths and try 0.75ms to 2.25ms. You can try shorter/longer pulses but be aware that if you go too far you could break your servo!" This is pretty close to what the "Motors for Makers" book says.

But when I go to the Arduino reference guide for the Servo attach() method in their servo library https://www.arduino.cc/reference/en/libraries/serv..., it shows two forms:

servo.attach(pin)
servo.attach(pin, min, max)

It also says "min" (optional): the pulse width, in microseconds, corresponding to the minimum (0 degree) angle on the servo (defaults to 544) and "max" (optional): the pulse width, in microseconds, corresponding to the maximum (180 degree) angle on the servo (defaults to 2400).

(a) Why would the default values be outside the range of most servos, (b) why would Adafruit let you use these after saying not to go outside 750 to 2250 us, and (c) why didn't my servo make horrible graunching noises when I fed it with the servo library's default values?

Any thoughts would be very gratefully received :-)

[ - ]
Reply by WKalmanJune 20, 2022

Basically, there is no real standard and all those timing specs are very casually defined and not enforced at all.

Arduino might be overdoing the timing to make sure that whatever servo you're using goes all the way.  But that might also make it try to hold the motor hard up against the stops - heating the motor, draining your battery, and in extreme cases might damage the gears.

And on the other hand are the servo manufacturers who might be under-driving their servos, not going all the way to the mechanical limit in case some servo library tries to over-drive them!

So I'd say that you should test your servos and see what timings they like.  You want to have your full travel available, but you don't want to hold tight against the stops.  You can slowly increase/decrease your min/max timing until you see that the servo horn doesn't move any further and note that timing (and maybe back it off a bit to be on the safe side) and use those limits in whatever library you're using.



[ - ]
Reply by s-lightJune 21, 2022

on top -
every device can have some variation to the next one -
as the hw has tolerances too....


originally they com from the RC-Toy world - in the beginnings all analog stuff...


i highly recommend to keep the servos not working against the stops. as this very likely damages the motor/driver via overheating - i did not encounter gears crashing yet.
(this year i mentored 8 times *arduino classes* in school - and servos are often (ab)used.)


sunny greetings
stefan

[ - ]
Reply by MaxMaxfieldJune 20, 2022

This is awesome advice -- thanks so much -- Max

[ - ]
Reply by CustomSargeJune 20, 2022

Howdy, 1> major distinction required. You're playing with RC servos. Yes they have their place, but rarely seen in industrial applications (no toys allowed).

2> You want standardization of control?  BUHAHAHA - Chinese made = get real. I suspect best you'll get is each mfg'r has their "standard".

Play with toys? No problem, just accept they're toys. I've used them - well suited as appropriate. Enjoy them as they are, I do.   G.H.  <<<)))


[ - ]
Reply by MaxMaxfieldJune 21, 2022

Sage advice as always :-)

[ - ]
Reply by DilbertoJune 20, 2022

Hi, Max!


Welcome to the Arduino world!      :-)


Dilberto.


[ - ]
Reply by MaxMaxfieldJune 20, 2022

Why, thank you, it's a pleasure to be here (whose turn is it to buy the beers? :-)

[ - ]
Reply by SpiderKennyJuly 13, 2022

If you were to use a servo in the real-world, you'd probably have some kind of feedback.

Either 1.)visual feedback - you watch the thing while you move the servo back and forth, and your thumb, on the controller, is the end-stop, and therefore you never actually go over the limits. Or B.) the devcie has some real feedback, and you tell the controller 'move some direction until some feedback event happens' and the feedback, whatever it is, limits the movements. Either way you don't need to worry about what the actual values are, because you never exceed the limits anyway.

I hope that makes sense.

The arduino library uses excessive limits to make sure that, by default, all servos can move to their full extents. Using what you and I would call 'sensible' limits would mean that by-default some servos won't move to their extents.


[ - ]
Reply by MaxMaxfieldJuly 13, 2022

This all makes a lot of sense -- thanks for sharing :-)