0 degree on servo motor

I bought two Tower Pro micro servos model SG92R ( http://www.towerpro.com.tw/product/sg92r-7/ ) from Adafruit along with their pan-tilt kit.

I run the servo library Sweep example which works.

I am new to servos.
How does it know where the 0 degree position is suppose to be?
Also, one of the servos seems to be able to turn way more than 180 degrees when I rotate it by hand. Is this normal?

How does it know where the 0 degree position is suppose to be?

The servos expect pulses of between 1000 and 2000 microseconds in length. 1000 corresponds to one end of the servo travel and 2000 to the other. 0 degrees to 180 degrees

For convenience it is normal to use the servo.write(degrees); command to control the servos but if you use servo.writeMicroseconds(microseconds); command instead you may get a clearer idea of what is going on.

Note that servos may not be able to move over a range of 180 degrees or may be able to move more even if you write 0 or 180 to them.

I read up on the PWM.

But how does the servo know where the 0 position is suppose to be? It would seem that I would need to manually calibrate it by turning the servo arm all the way in one direction and then all the way in the other. Then put the arm back on in the neutral position. Am I right?

Give it 1500uS wide pulse every 20mS, and that's your middle.

Hobby servos typically use a small internal potentiometer as an absolute shaft encoder, this is what
defines the mid-position.

If you are driving servo by a potentiometer then You can set 0 position on either sides (left or right)....you just need to swap the + - wires of pot with each other....

If you swap those wires it will not work.

I think that there is some confusion here

Hobby servos intended for use on Radio Control systems, generally have an internal potentiometer connected to the output shaft. This provides position feedback to the internal electronics.

If the position of the servo is being controlled by an Arduino program such as the Knob example then an external potentiometer is used to change the pulse widths sent to the servo. If the end connections to this pot are reversed then the control directions will be reversed.

In the past, when RC systems often had no way of reversing the servo motion then it was common to open the servo and reverse the motor and internal pot end connections which would have the effect of reversing the servo output. BTDTGTTS

CrossRoads:
Give it 1500uS wide pulse every 20mS

Which, for OP's edification, happens automatically on servo.attach()as long as the servo's not servo.detach()ed. (edit: or you don't move it with a servo.write().)

Those defaults are set here in servo.h:

#define DEFAULT_PULSE_WIDTH  1500     // default pulse width when servo is attached
#define REFRESH_INTERVAL    20000     // minumim time to refresh servos in microseconds

All very good to know, but I am still unclear about how I know would where the servo motor's 0 degree is.

All very good to know, but I am still unclear about how I know would where the servo motor's 0 degree is.

Write a small program that simply includes the servo library, creates a servo object, attaches it to a pin then writes zero to it. The servo will move to its zero position.

UKHeliBob:
Write a small program that simply includes the servo library, creates a servo object, attaches it to a pin then writes zero to it. The servo will move to its zero position.

Duh! That makes sense. :slight_smile:

Thank you.

Since the two I bought are installed in the pan-tilt assmebly, I will have to buy one or more of the servos to experiment with.

Though the mid position is called 90 (or 1500 microseconds).

There is no guarantee a servo can get as far as 0 or 180 (they typically have a total of 120 to 150
degrees travel).