Software > Software

How to stop a continuous rotation servo?

<< < (3/5) > >>

johnwarfin:
there is no such thing as starving servos. 50hz (20ms) is a myth. for example its impossible for an avr/arduino type chip to supply 20ms frame rate with any useful degree of pulse resolution using oc pwm. so 4ms is in fact the typical frame rate to get 64 or 128 steps and the servos work fine with that short a refresh. maximum fame rate can also be much longer than 20ms. 0.1hz (10 seconds) for example because it tends to hold the position dictated by the last pulse.

as far as torque an unpowered servo has plenty. iits almost impossible to rotate the arms on a high torque/low rate servo without damaging it. stalled or jarred control surfaces are the #1 reason for stripped gears. not wear or other mysterious forces. a robot will stop instantly when power or pulses are removed and its wheels will appear to be locked. solid.

researching servo ic data sheets or just playing with them on the bench for a few minutes under the conditions described will reveal the truth. imo removing pulses is not only the best but actually the only way to stop a robot completely.

jwatte:

--- Quote ---its impossible for an avr/arduino type chip to supply 20ms frame rate with any useful degree of pulse resolution
--- End quote ---

Interval between pulses has little to nothing to do with actual pulse width and precision.

If you use a single 16-bit timer to do both the interval (dead time) AND the pulse width, then yeah, you'd have that problem. So, don't do that!

I control 8 servos with better-than-microsecond resolution and a choice of pulse rate from 10 ms to 100 ms. The trick is in how you generate the PWM across the output port, and disabling interrupts while the pulses are going out in parallel (and thus turning off interrupts for up to 2 milliseconds at a time.) The 16-bit timer is used as a clock source only during this time; pins are written high/low using PORT output writes.

I recall hobby transmitters using 30 ms intervals back in the days, so I don't know where 20 ms come from. My guess is that any duty cycle up way past 50 ms would work before servos start losing sync. However, at some point, a hobby servo will stop applying torque if you stop feeding it pulses.


--- Quote ---as far as torque an unpowered servo has plenty
--- End quote ---

Friction != torque


--- Quote ---removing pulses is not only the best but actually the only way to stop a robot completely
--- End quote ---

Here we agree!

johnwarfin:
unfortunately because of througput and isr latency issues im forced to use timer oc exclusively in my applications. 0% cpu involvement. too much going on to waste interrupts on servos/motors.  even the 8 bit do a great job on my tiny24, mega8, mega328, and mega1284 projects. i am a great fan of servos for motors as lowest cost and easiest way to implement robot locomotion.

friction/torque, whatever you choose to call it that puppy aint gonna roll downhill. or budge at all for that matter.

Duane Degn:

--- Quote from: johnwarfin on April 30, 2013, 02:28:09 PM ---there is no such thing as starving servos. 50hz (20ms) is a myth.
--- End quote ---

What? Analog servo only receive power during a pulse. If pulses are spaced out too much the servo will loose it holding power.


--- Quote from: johnwarfin on April 30, 2013, 02:28:09 PM ---a robot will stop instantly when power or pulses are removed and its wheels will appear to be locked. solid.
--- End quote ---

Again, what? My hexapod slumps to the ground without power (or pulses). My CR servos (10kg*cm) turn relatively easily without power. Given, it's not likely to roll down a gentle slope but I sure wouldn't describe it as "locked. solid". I've heard of unpowered servos being used as a type of dampened bearing since it resists but doesn't completely stop movement.

I don't know how well Arduinos do with multiple servos but a Propeller (my favorite uC) can drive 32 with 1us resolution using one of its eight "cogs" (aka processor). Here's a video I did showing off the Propeller.

QuickStartControlling32Servos120129.AVI

jwatte:

--- Quote ---What? Analog servo only receive power during a pulse. If pulses are spaced out too much the servo will loose it holding power.
--- End quote ---

That's not how it works, actually...

The canonical analog servo circuit I'm familiar with charges a capacitor with the input pulse. The longer the pulse, the higher the charge on the capacitor. The capacitor slowly discharges through a resistor.

Separately, the voltage out of that capacitor is compared to the voltage divider made up by the position sensing potentiometer. This could use a comparator circuit, or an opamp. When the comparision is too high one way, the motor is made to spin the appropriate counteracting direction. In old-school, fully analog servos, that might conceivably be as simple as the opamp output driving the bases of two power transistors (one NPN and one PNP) to drive the motor one way or the other.

If you remove the pulses, the capacitor will slowly discharge, and the servo will turn towards zero.

When I was a kid, and radio controlled airplanes and cars were pretty new (we're talking '70s here,) I vaguely recall friends having servos that lost trim as the battery lost voltage. That's a direct effect of the charge/discharge capacitor implementation of the pulse demodulation circuit! (Myself, I couldn't afford one of those toys at the time; this was *way* before cheap microcontrollers and Chinese manufacturers.)

Now, once integrated circuits entered the picture, the analog design in this system had to be emulated for compatibility. So, even with modern, digital, servo driving circuits, there is some time, after which, the motor drive will be turned off if no additional pulse has been received. These modern chips will not generally emulate the behavior of slowly turning to 0 when the pulse is removed, though, and I think this is for the better!

So, the sentence above is not correct. The width of the pulse decides the goal position that the control logic will seek. The presence of the pulse starts a timer, and the motor/logic in the servo will keep trying to achieve the last-set goal position, until that timer expires. Thus, saying that "analog servo only receive power during a pulse" is not particularly accurate IMO. A servo will energize its motor when it receives a pulse, and for some amount of time after the last pulse was received. That time is not standardized, and may be in the 50 ms to 1000 ms range perhaps. Thus, if a servo has a 50 ms timeout, and you send it pulses every 52 milliseconds, the servo will actually repeatedly turn on/off, which will reduce the output torque, and will probably cause stuttering when trying to hold a position against a counterforce.

Now, the sentence *could* be accurate in a certain circumstance. A possible implementation of a servo using PWM involves using a voice coil, a retracting spring, and a mechanical damper. The voice coil would only be powered when the pulse was high, and the spring/damper/coil system would approximate a particular average position over time. That servo would be pretty crude, and would "hum" at the speed of your pulses. I haven't actually seen any servo built that way, but the world is a large place, so maybe it exists :-)


--- Quote ---a robot will stop instantly when power or pulses are removed and its wheels will appear to be locked
--- End quote ---

Here I agree with Duane: That's simply not the case. A gear motor that has no power applied will not exert any torque, one way or the other. However, the friction involved in spinning the gears, especially for high-gear-ratio (== high torque) servos, can be significant. For some hobby servos, you'll actually break the output gear before you manage to move the inert motor through the gear box. Personally, I find that to be a poor choice of design parameters for the system. However, you will only see "wheels locked" as an apparent effect of the passive mechanical losses in the gearbox; a servo motor without power does not actively exert torque one way or another. A high-quality gear box with low losses will let you turn the powered-off servo pretty easily.

I don't understand why there are so many half-truths and weird understandings of how servo motors and their control pulses work. The systems are very simple, and reasonably well documented. Anyone who has a basic understanding of electronics and mechanics can find out the truth pretty easily.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version