How exactly do (hobby) servo motors work?

Hi - can anybody explain how hobby servo motors work? I'm guessing it's something like this: during the high phase of the PWM pulse some sort of capacitor or something is charged, and then the voltage across that cap is compared to the voltage across the center terminal of the pot. Then the control circuitry sends out a current proportional to the difference between those two voltages until the next PWM pulse is received.

Or something like that.

Anybody know?

The reason I ask is simple: I am trying to measure the current going through my servo motors (Hitec HS-81MGs) as a very basic force feedback system. What I'm not sure about is when I should be measuring current across them. Right now I just have an RC filter across them that is averaging the signal somewhat - but it is not a perfect solution. Any suggestions as to when I should measure current to get the optimal force feedback, with respect to either the start or the end of the PWM pulse?

Thanks!

-Mike

Reply to
Mike
Loading thread data ...

That's how they worked maybe 25 years ago, but today, they're much more elaborate. Many have a microprocessor inside.

That servo has a motor PWM frequency of 1830 Hz. That's the rate you'll see if you connect an oscilloscope to the motor. It's completely independent of the control pulse timing.

If you want feedback, the Hitec HSR-8498HB servo has it, but it's more expensive and the protocol for getting feedback while the servo is working is undocumented. The "HiTEC Multi-protocol Interface" is only documented for the dumb bidirectional pulse width interface, but there may be a real digital protocol for talking to the thing, since Hitec claims force feedback capability. Nobody ssems to have figured out how to do it, though.

Then there's the AX-12 servo:

formatting link
This finally gets it right - all the servos are on a single 1mb/s digital data bus and you can get back info on current, position, velocity, and temperature. About US$70 each.

John Nagle

Reply to
John Nagle

Ah - I guess they're a bit smarter than I thought. Any idea what kind of control loop they're running?

How do you know this? Is there a chart somewhere, or are you just familiar with that specific part? Also, this seems wayyy faster than I had expected - I mean there's a very audible noise coming from the servo motors when torqued (and sometimes even visible vibration), so there must be something else going on there as well.

Looks like an interesting part - but it really is too big for what I'm trying to do, unfortunately.

Again - a very interesting part, but just too big for my needs.

So have you ever looked at the current going into a servo motor to see if there is any sort of signals in it at around 50Hz? Or is it all much higher frequency stuff?

Thanks!

-Mike

Reply to
Mike

You're shopping in the wrong places. :) CrustCrawler has them for $45, and I'm pretty sure I saw them for the same price someplace else, though I can't find that now.

But I agree, this is one of the first servos I've seen that isn't as dumb as a rock, and at a really good price for the torque, too. Add in the smart feature set and it's pretty much a shoo-in except in cases where unavoidable constraints force the use of some other brand.

Best,

- Joe

Reply to
Joe Strout

There is a small squirrel in the motor that lives in a cylindrical cage. Changing the width of the pulses causes a cluster of nuts suspended above the cage to shift left or right. The squirrel naturally chases the nuts, and thus the motor changes direction as the nuts move. This is something of a highly scientific overview, but basically this is how it works.

Seriously, I don't think it really matters how the servo works internally for you to measure current demand as a way of detecting force feedback. There are a couple of commercial systems that use this for better-than-crude measurement. One is the quite inexpensive servo controller from NetMedia. Maybe get one and see how it works. While the digital servos discussed by others in this thread offer more accurate results, unless you need the other features a digital servos provide you're just wasting your money. If nothing else you could crack the case of a standard $12 servo and tap off the motor leads inside.

FWIW, the typical analog servo has never had the "sample-and-hold" feature you describe. That's a function of digital servos, but in most analog servos current is not held between pulses. After the pulse is received, it powers the motor for a short interval, and if no other pulse is received, the motor stops.

-- Gordon

Reply to
Gordon McComb

The trouble with measuring current externally to the servo is that you don't get the sign of the error. You can tell how much current the servo is drawing, but not which way it's trying to drive the motor.

John Nagle

Reply to
John Nagle

Don't see how this is relevent for "a very basic force feedback system." Do you?

-- Gordon

Reply to
Gordon McComb

If you're trying to achieve a specific force, you need to know which direction of motion increases the force and which decreases it, so you can servo on force. For a gripper, it's usually fairly obvious, but for a leg against an obstacle, it's not.

John Nagle Animats

Reply to
John Nagle

Again I think this is irrelevent for a "very basic force feedback system." Besides, if you are able to move the armature in either direction you can empirically determine which direction is meeting the resistance. Who says you have to keep blindlly applying the same pulses to the servo? You can change them 50 times a second, and some clever programming coupled with simple current measurement can readily determine direction of force.

-- Gordon

Reply to
Gordon McComb

All:

My experience with measuring the current draw from hobby servos is that that the current draw is very non-linear. When a servo is not able to get to the desired location (e.g. hitting a mechanical stop) it will draw a lot of curren as the servo motor stalls trying to to get to the desired location. Otherwise, the current is quite small and hardly noticable. Measuring the current draw of a hobby servo is not going to yield a very satisfactory force feedback result.

My $.02,

-Wayne

Reply to
Wayne C. Gramlich

Opposite experience. I've had very good successful on several projects measuring the current of low-end hobby servos (HS-311s, etc.) to get a gross idea of force. Enough that I know when the pads of a walking robot are touching the ground and the legs are lifting the weight of the robot. Obviously you're not going to get much current if the servo is at

62 degrees and you want to move to 64 degrees, but for 10 bucks what do you expect?

-- Gordon

Reply to
Gordon McComb

Gordon:

I guess we don't agree on the definition of "force feedback". For me, it means you are actually measuring the force. My experience is that I can get one bit of feedback from a cheap hobby servo (low current = at position and not moving, high current = off position and exerting substantial force.) I've never been able to get anything in between. Have you been able to get more than 1 bit? If so, can you share the schematic?

-Wayne

Reply to
Wayne C. Gramlich

See my earlier post re: NetMedia's servo board. It has a current sense on it that provides a fairly decent (didn't say always accurate) loading reading. Try here for details:

formatting link
I used several of these boards for a couple of consulting-type projects and got fairly good results for my applications. Terrific for forty bucks, plus the cost of ordinary servos.

By definition, a servo holding position with zero or low load will not exhibit much current at all. You'd expect that. It'll only display current when moving or trying to move against some load or resistance, and when the output is at about 5-10 percent (give or take) away from the intended position. So the thing to do is try to move it, maybe in incremental steps. The servo will naturally decrease its current the closer it gets to its intended position, and this variance depends on the servo.

I'm not sure why you get only 1-bit resolution, and all I can suggest is to try different servos. My favorites for playing are ones like the Hitec HS-422, a good middle of the road model. Just to make sure I wasn't dreaming about all this, I just took my test 422, connected an amp meter inline of the red power lead, and plugged the servo into my Hitech HFP-10 programmer. (The programmer is simply a handy means of generating 900-1110 us pulses to any servo, including analog ones. You can use your favorite microcontroller, servo tester, or whatever.)

I dialed the programmer to 1500 us, locked down the servo shaft, then started to turn the dial. The current increase was so linear you could set you watch by it.

-- Gordon

Reply to
Gordon McComb

Yes, the current vs. position error behavior will be drastically different for different servos. Ones with a big dead band will tend to exhibit "1 bit behavior". Ones with gear trains that don't back-drive well will probably not exhibit good force feedback behavior.

That tells you there's good mechanical backdrive ability, a linear P term, and no I term.

There are interesting things to do if you can get enough info to do force feedback reasonably well. You can make a servomotor help you as you manually move it. You can simulate springs. You can do compliance in software. You can tell if you have foot/ground contact, and how solid it is. You can implement control schemes which are based primarily on force and velocity rather than position.

John Nagle

Reply to
John Nagle

The low-end Hitec 311's, 422, etc. all have about an 5-8us deadband, which is pretty common among analog servos. Any larger than that and the servo is not too useful. I've never seen a standard servo with more than a 10us or so deadband. (Retract servos may have a deadband >20us, but these are not suitable for the task anyway as they are not proportional.)

Never encountered a standard servo that could not be back-driven, even the 400 oz-in large scale servos I use for some projects.

-- Gordon

Reply to
Gordon McComb

But how easily do they back-drive?

Measure the minimum force that will back-drive the servo. That gives you a lower limit on the force that can be sensed. If your multi-legged robot's legs won't back-drive under the weight of the robot, force feedback to control contact isn't going to work.

Ball bearings are a good thing.

John Nagle

Reply to
John Nagle

For the test I posted no backdriving was involved. A static shaft against a load is a common application for force feedback. It is not a given that the force or weight to equal or exceed the backdrive torque to get a useful reading. All you need is a resistance to the drive of the motor -- which can come from a leg touching the ground and lifting the robot -- and you have an increase in current consumption. Therefore you have something to read as force feedback.

I suppose if the robot is light enough, and the gear raio of the servo is high enough, that there will be very little current demand either way, including lifting the robot and making it walk. I think this is an obvious misapplication of the concept, though, plus somewhat unlikely. Most of the time we're hitting against the upper torque limits of these servos for this type of application.

-- Gordon

Reply to
Gordon McComb

Gordon:

I'm not much into servos, so I don't have a lot of them lying around. I definitely got the 1-bit behavior out of my Futaba S3003's. My experience with force feedback was sufficiently negative, that I stopped putting current sense resistors into my servo controllers. For example, my old servo controller has them:

and my newer one does not:

Given your experience, I will be rethinking that decision. I'll probably want to build a test rig and actually measure force vs. current for a number of differnt servos before I do so, however. Yet another thing to put on my "to do" list.

Later,

-Wayne

Reply to
Wayne C. Gramlich

Hi Wayne - I just had a quick gander at your schematic - and I saw something that I find very interesting. You're using a CAN transceiver, but that PIC doesn't have CAN. Are you bit banging CAN? If not, what exactly are you doing?

Thanks,

-Mike

Reply to
Mike

Mike:

For RoboBricks2 modules, we are running asynchronous serial protocol (1 start bit, 9-data bits, and 1 stop bit) at 500kbps using the CAN bus physical layer. We are *not* running any of the normal CAN bus protocol stack, just 1's and 0's on the bus. The purpose for doing this is because we want the high noise immunity provided by differential signalling with the simplicity of using the common UART's in embedded system microcontrollers.

The choice of CAN bus physical layer vs. RS-485 or RS-422 is because CAN bus is multi-drop (like RS-485) *and* we do not have to fiddle with a transceiver direction line. All RS-485 transceivers have a direction control line and it is kind of a pain in the rear to get the microcontroller to deassert that line after it is done transmitting. (For the PIC, you have to go into a tight loop checking the transmit buffer empty flag.) Other that that important little detail, CAN and RS-485 are pretty interchangeable.

For more information about RoboBricks2, the project home page is:

If you want to talk further about RoboBricks2, it would probably better to start a new thread as opposed to hijacking this thread. I will be delighted to answer any questions you have about my pet project. ;-)

-Wayne

Reply to
Wayne C. Gramlich

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.