Let's Make Robots!

Sensing servo feedback

Hi,

I'm new to this forum, robotics, electronics and microcontrollers, however I have been programming a long time and I'm currently studying computer science.

I recently bought an Arduino board with the purpose of making robots for experimenting with my special interest: AI.

I wish to build a walking robot and experiment with varios ways of giving it a nervous system. So I will need to find a way to get feedback directly from the servos, thereby being able to read the amount of stress (load) they experience at a given time.

So far I thought of 3 ways to do this:

1) The simplest way is connecting the servo output (=the servos ground wire) to an analog in port on the Arduino. My classmate who's into electronics said this was possible if I attached a small resisitor to the Arduino ground. The thing is he said that the Arduino would have a large resistor build in (so to speak) on the analog in. So if I just connected the servo output to the analog in without the resistor I would get no reading cause the electricity would flow into the Arduino ground where there is no resistance. Makes sense. He also calculated that I need a 6 ohm resistor based on the peak current draw of the servos I intend to use (HXT900 = 750mA). I'll try this out soon.

2) I could also use a current sensor (thermistor I believe they're called) to do the same thing, connecting it either to the servos 5V input or the output (not sure how?), and again reading the value from an analog in port. I'll also try this solution.

3) This is the really cool but difficult solution. A servo has build in a potentiometer. There are ways to modify servos so that you can read the position from this potentiomenter. Then one can actually move the servos position MANUALLY and later read it's position. And it can also provide a way of reading the stress of the servo.

Here is a manual on this conversion:

forums.trossenrobotics.com/tutorials/how-to-diy-128/get-position-feedback-from-a-standard-hobby-servo-3279/



So basically I need all the advice/input I can get. Does this sound plausible? Is there a 4th or 5th solution I haven't considered? Anyone has tried something similar? Any ideas would be appreciated...


Aniss1001 :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Just one last question..for now anyway :)

Is the servo trying to restall back because your microcontroller is constantly telling it to do so, or simply because of the last command received?

 

Thanks

The OpenServo modification he made might rely on last position sent, but regular servos will only seek a position that is being updated every 20 ms or so. Stopping update pulses will cause the servo to go slack, not seek a position.

That's what I thought...

And as promised I'm out of questions....for the time being :)

 

Aniss1001.. over and out

Very cool video and great explanation. Are these the HXT-12 servos?
Those are MG995 with my version of openservo. More information at http://letsmakerobots.com/node/2423

Good catch on the PWM/PPM.  I edited my comment so it doesn't throw anyone off.  Even in the second option (sending speed instead of position) it will still be servo signals (PPM) signals coming out of the PIC because that is all the servo circuitry understands.  As it says in that artical, you don't want to send PWM signals to a servo.

For a "noob", you seem to be catching on quickly!  Keep it up!

Servos are controlled by PWM, not PPM.

Pulse Position Modulation, as Wikipedia states, has information encoded in a time shifted pulse from a known timebase.

Pulse Width modulation encodes information in the width of the pulse. Servos read a pulse width from 1 to 2 milliseconds to determine where the output should be positioned. The pulse may be generated from an RC receiver that picks up a PPM radio signal from the transmitter, but it still generates a PWM signal to drive the servo.

Perhaps we should just call it servos signals like FingerTech suggests:)
Ok? Now I'm just confused! So the page I linked to was wrong? Like I said it's written by the guy who wrote the latest servo library, which the entire Arduino community is now using to control their servos, so I kinda accepted him as an authority on the matter. But then again you also sound like you know what you're talking about and what you're saying corresponds with my original idea of how it worked...So...I truly don't know what to believe anymore?!

Have you read the page I linked to? Where am I/he going wrong?

Correct me if/when I'm wrong: A servo basically is a DC motor, some gears, a potmeter and a motor controller (usually a small PCB with a chip). Could it be that the following is the case: the motor controller receives a PPM signal (from Arduino or other) and then generates a PWM signal to turn the DC moter to the desired position? That would explain why there seems to be such a mixup about the whole ordeal...

Anyway thanks for your input. I definately need to be completely sharp on this. When I get the time I'll try studying the code of the Arduino servo library (it's open source so...)

PPM: Pulse position modulation has a fixed length high pulse that arrives at different times, referenced to a fixed frequency. How far ahead or behind the fixed time is what is important.

PPM

But ignore that because that's not how servos work!

PWM:Pulse Width Modulation has a fixed frequency and variable period.  The length of the pulse is what's important.

PWM

Servo PWM: Just PWM, with a fixed frequency of ~20ms.  A period of 1.5ms tells the servo circuitry "center".  Period of 0.5ms or 2.5ms sends the servo fully CW or CCW.

Servo PWM

There, hope that made up for any confusion I might have caused!