Position of a servo

Hello,
Last week I asked about knowing the position of a stepper: http://arduino.cc/forum/index.php/topic,85616.0.html . Now I'm interested in servos.

I have a servo motor driving a shaft with a coupling (unknown for the moment, but doesn't matter). The shaft turn of about 90°, but not exactly.

I'd like to register the max and min position of the shaft, by moving it by hands.

Is there a way to know them with the servo or will I have to had an encoder or any position sensor?
What happens on the command pin of the servo (not the 5V, not the ground one), if I supply my motor with current, and turn the shaft?

Have a nice day

I'd like to register the max and min position of the shaft, by moving it by hands.

Same answer as with the stepper motor. No, you can't do that.

Well maybe it's a little work to do but follow this thread at another site.

http://forums.parallax.com/showthread.php?84991-Propeller-Application-Proportional-feedback-from-a-Standard-Hobby-Servo-(Upda&p=582447

justone:
Well maybe it's a little work to do but follow this thread at another site.

http://forums.parallax.com/showthread.php?84991-Propeller-Application-Proportional-feedback-from-a-Standard-Hobby-Servo-(Upda&p=582447

That's a heckuva interesting thread - if such a thing really works (and skimming the thread seems to indicate "yes"), it opens up a lot of exciting possibilities with cheaper hobby servos (if the position values can be read fast enough).

Great link - thanks for posting it!

:slight_smile:

the AX-12 servos (and similar) from the BIOLOID roboitis kits will give position feedback but they are not hobby servos and they are not cheap! if you opened up a standard hobby servo you could probably read the potentiometer and use that for position.

With some hacking the voltage from the wiper of the servo pot can be read for position feedback. Note that you can potentially damage a servo by turning the servo horn by hand.

http://www.lynxmotion.net/viewtopic.php?f=2&t=2748
http://www.lynxmotion.net/viewtopic.php?f=31&t=3182

You guys (tt_tony, zoomkat) really need to read that Parallax forum thread, if you haven't done so already - that's a really swift way to get the position of the servo (by carefully controlling the current and voltage to just barely turning the servo on, then "scanning" the servo while monitoring the current) without needing to hack the potentiometer or anything; other than it being slower to utilize (and requiring a tad more circuitry and coding) - it seems almost perfect! :slight_smile:

I just don't see a practical application for this current monitor to determine position. How is it better then reading a standard pot's position? Certainly it is different, cleaver, etc, but I still don't see an application where a simpler and cheaper method would work better. I must be missing something?

retrolefty:
I just don't see a practical application for this current monitor to determine position. How is it better then reading a standard pot's position? Certainly it is different, cleaver, etc, but I still don't see an application where a simpler and cheaper method would work better. I must be missing something?

I'd say it has two benefits:

  1. No need to hack the servo - in theory, it should work with most standard hobby servos (aside from continuous rotation "servos" of course without needing to open the servo up and solder wires onto the potentiometer (and with micro-servos, this might be very difficult to do). Not to mention possibly voiding a warantee on an expensive servo. Plus, if you had a servo set up for this, and it was working well, then the servo failed - you could just grab another and plug it in, without needing to hack it first.

  2. It's accuracy might be better - since you don't have to deal with potential contact "noise" issues from the wiper (likely a minor thing, though); plus since you aren't loading down the servo's position sensing feedback circuit, you won't run into any issues there.

I'm sure it has some drawbacks - the main one being the extra external circuitry required, plus I would bet that not all servos would work the same (maybe the so-called "digital" servos are less tolerant?). There also might be issues with selecting the proper amount of "just enough" current for different servos. I still think it's a pretty neat hack, all the same.

:slight_smile:

One might also use a zxct1009 like in the open servo project to measure the current being used by the servo. probably depends on what the objecive of the exercise is.

http://www.openservo.com/Schematic3

http://www.openservo.com/Datasheets?action=AttachFile&do=get&target=zxct1009.pdf

cr0sh:

retrolefty:
I just don't see a practical application for this current monitor to determine position. How is it better then reading a standard pot's position? Certainly it is different, cleaver, etc, but I still don't see an application where a simpler and cheaper method would work better. I must be missing something?

I'd say it has two benefits:

  1. No need to hack the servo - in theory, it should work with most standard hobby servos (aside from continuous rotation "servos" of course without needing to open the servo up and solder wires onto the potentiometer (and with micro-servos, this might be very difficult to do). Not to mention possibly voiding a warantee on an expensive servo. Plus, if you had a servo set up for this, and it was working well, then the servo failed - you could just grab another and plug it in, without needing to hack it first.

I didn't mean to a servo's internal pot, just an external normal standard pot if I wanted to measure a rotational angle position. A servo has maybe 180 degree travel, a pot has 270 degrees or so. What does using a servo to read a mechanical angle position have over using a standard linear pot? Actually a optical quadrature encoder is my favorite device for measuring angle rotation.

  1. It's accuracy might be better - since you don't have to deal with potential contact "noise" issues from the wiper (likely a minor thing, though); plus since you aren't loading down the servo's position sensing feedback circuit, you won't run into any issues there.

Well I suspect that using either a standard pot, or this method using analog readback of the current via a analog input pin will have simiar accuracy and resolution as the A/D converter would be the limiting factor. I suspect the simple standard pot would be much simpler to read and equal or better in accuracy.

I'm sure it has some drawbacks - the main one being the extra external circuitry required, plus I would bet that not all servos would work the same (maybe the so-called "digital" servos are less tolerant?). There also might be issues with selecting the proper amount of "just enough" current for different servos. I still think it's a pretty neat hack, all the same.

Yea, it's a cleaver hack, I haven't read the code. I just don't know what problem this solution is trying to solve. Cleaver, yes, useful, I don't think so. :wink:
:slight_smile:

I didn't mean to a servo's internal pot, just an external normal standard pot if I wanted to measure a rotational angle position. A servo has maybe 180 degree travel, a pot has 270 degrees or so. What does using a servo to read a mechanical angle position have over using a standard linear pot? Actually a optical quadrature encoder is my favorite device for measuring angle rotation.

I almost agree with you BUT, external pot means that I'll have to mechanicaly link the servo to the pot. And I don't want to do that. I don't want to do anything that involves my shaky hands. :smiley:

Note: I bought a servo GWS 136L STD: 80N.cm 0.33/60°
Very powerful for my application. In fact,.. too powerfull
I now understand:

Note that you can potentially damage a servo by turning the servo horn by hand

it was so hard (too hard) to turn with my hands.
I think that at last I will do my own servo motor with my own pot, motor,..
That way I'll have all my desire except good looking.

Thanks

retrolefty:
I didn't mean to a servo's internal pot, just an external normal standard pot if I wanted to measure a rotational angle position. A servo has maybe 180 degree travel, a pot has 270 degrees or so. What does using a servo to read a mechanical angle position have over using a standard linear pot? Actually a optical quadrature encoder is my favorite device for measuring angle rotation.

Yes, using an external pot would probably be better, but if you're wanting a compact device (or lower weight), that may not be an option; using a "true digital" servo with a serial bus would be the best option, but those are rather expensive. This hack solves for both of those situations, without needing to open up the servo to access the internal pot (which is the "standard" hack).

As far as a quadrature encoder is concerned - I'm not sure how you get an angel out of a quadrature encoder (direction and pulses, yes - but an angle?).

retrolefty:
Well I suspect that using either a standard pot, or this method using analog readback of the current via a analog input pin will have simiar accuracy and resolution as the A/D converter would be the limiting factor. I suspect the simple standard pot would be much simpler to read and equal or better in accuracy.

If you can go with an external pot, probably; but this hack is nice in that it allows you to reduce the number wires from the servo (though I think more ports are involved on the microcontroller side - not sure?), and no need to alter the servo to get it to work. As far as accuracy is concerned, you may be correct (especially if using a precision potentiometer); the real question is what the difference in accuracy would be between this method, and splicing into the internal potentiometer of the servo...

retrolefty:
Yea, it's a cleaver hack, I haven't read the code. I just don't know what problem this solution is trying to solve. Cleaver, yes, useful, I don't think so.

No hacking of the servo required (for internal pot connections), fewer wires from the servo, a compact (and lightweight) setup (closer to a hacked pot servo). Imagine trying to build a bipedal robot using 18 standard servos (because you can't afford the fancy serial bus servos); you need and want servo position information (for posing the robot for "moves", for instance). You could a) Use a bunch of mechanical linkages and external pots, increasing the weight and mechanical complexity, decreasing the run time, and have a bunch of wires from the extra pots running everywhere, b) Hack each servo (18) and hope none of the them break (because you'll have to hack the new one); you'll still have a bunch of extra wires to take care of, or c) Use this method, which eliminates the extra wires, and doesn't add any extra weight or mechanical complexity.

It's only real drawbacks are speed of measuring (which the author already noted could be improved) and the extra circuitry needed for the measurement system. Depending on the needs of your system, the benefits can clearly outweigh the drawbacks. True it can only measure in the range of the servo, and it might not be as accurate; if those are necessary design needs, then use what's appropriate. I do think, though, that this current measurement technique is an interesting one that should be kept in the back of everyone's mind, as it may be the proper solution for a future problem (but certainly not every problem).

:slight_smile:

As far as a quadrature encoder is concerned - I'm not sure how you get an angel out of a quadrature encoder (direction and pulses, yes - but an angle?).

An encoder does so many fixed pulses per revoltion. Just count steps and divide by that factor and you get angle (degrees) moved. If then one has a starting reference either external to the encoder, or use an encoder that includes an index pulse output signal, once per revolution, one can also keep track of absolute angle position, not just degrees traved.

Back to this servo 'trick'. It seem to me if you wire it up as shown you can't then also use it as a output servo where the micro can command it to move. So it just becomes an angle sensor, so what is it's advantage over the other methods used to sense angular motion? Again I may be missing something by not being able to see it used in other real world applications. The video I watch just showed him turning the 'sensor' servo manually and his code would cause another normal servo to track along with the sensor servo. That in itself would be much simpler and cheaper just using a standard linear pot wired to a analog input pin?

Lefty

There are actually 2 pages to that thread. Lawson (I think that was the name) came up with a simpler circuit and did some testing on being able to read the servo when holding a load and when the servo was moving. A little work is needed to go thru the thread.

I've been dismembering some servos the last few months and converting them into continuous ones. I like the Hitec cheapy (311) . It and most of the other lower cost hitecs have a sensor pot that is easy to hack. Removing the plastic stop inside it makes it continuous but there is only about 200 deg of
a readable info but allows a way to find home on it. I put 4 holes in the first driven gear and have a QRD1113(4) ROS to sense the rotation. I'm in the process of making a tiny24 to do the work of interfacing and driving the existing hardware with some nice features.

The ability to obtain the position of a servo depends on the brand of servo that you are using. When I need feed back from a servo mechanism, I use Dynamixel servos and I get them from Trossen Robotics.

Here is a URL to look at:

These servos are fully programmable and you can daisy chain them together so you only have to use three wires to control multiple units.

Robot shop http://www.robotshop.com has the necessary USB adapter to communicate directly with a chain of servos.

Hope this information is useful.

charlesb:
The ability to obtain the position of a servo depends on the brand of servo that you are using. When I need feed back from a servo mechanism, I use Dynamixel servos and I get them from Trossen Robotics.

Here is a URL to look at:
http://www.trossenrobotics.com/c/robotis-dynamixel-robot-servos.aspx?gclid=CJv0-LyYy60CFcfe4AodsE1QiA

These servos are fully programmable and you can daisy chain them together so you only have to use three wires to control multiple units.

Robot shop http://www.robotshop.com has the necessary USB adapter to communicate directly with a chain of servos.

Hope this information is useful.

Useful if you don't mind spending $40.00+ USD per servo; I suppose if you absolutely need these kinds of servos, you pay what you have to. Even so, for an 18 servo biped, that would run you almost $800.00 in servos alone (I was recently thinking about how cheap you could make a 20+ servo biped using standard servos, provided you could get the feedback signal from the servos). Having a way to simply and easily (without modifications or other hacks) get the position of a standard R/C servo would go a long way to making small bipeds much more affordable. So far it seems like the only way is to hack the servo (and connect to the pot), or do the current monitoring method (a much better method, but still not ideal).

Having a way to simply and easily (without modifications or other hacks) get the position of a standard R/C servo would go a long way to making small bipeds much more affordable.

Making small bipeds is relatively cheap, if you can get someone of the opposite sex to help you. Caring for them is another matter.

Having a way to simply and easily (without modifications or other hacks) get the position of a standard R/C servo would go a long way to making small bipeds much more affordable. So far it seems like the only way is to hack the servo (and connect to the pot), or do the current monitoring method (a much better method, but still not ideal).

Why exactly is the feedback required or needed for 'biped' control? Lets take a typical R/C servo application, rubber control on a model airplane. The command send to the servo via a continous PPM pulse width stream commands the servo to go to a specific angle and stop. When one sets up the initial servo/rubber linkage it is adjusted so that 0% command is equal to say +45 degree deflection and 100% command stick goes to -45 degree deflection, and 50% command is rubber neutral position. The servo itself is a self contained PID closed loop controller where the command sent to the servo is the desired setpoint. As long as one sets up the initial travel calibration for each biped moving servo controlled element, why go to the trouble and expense to build another redundant 'closed loop control' around the servo's control loop?

Lefty

The issue of knowing the position of a servo is somewhat sloved by moving the servo over its desired movement range in small position incerments. the servo is usually expected to be in the location where it was sent. If the servo is not there, then there are probably non recoverable mechanical issues involved. The usual setup is move the servo until an event occurrs at which time the servo is stopped and the last position sent to the servo is used as its current position. Below is a simple terrain adaption test for a servo.