How can I make a servo return to its true center position?
Asked by
MellowKite47
I'm building a school project with a penguin whose head should shake side to side when an answer is incorrect. I'm using what appears to be an SG-5010 servo with Arduino-style C++ code. The movement works, but the head doesn't finish centered on its axis. My sequence writes angles such as 92, 180, 0, and finally 90 before using SERVO_STOP. Is 90 supposed to be the center position, and how should I calibrate the servo so the penguin's head ends up straight?
Answers
Cheap servos can have some offset or drift, so donโt assume 90 is perfect. Also make sure the servo horn is mounted as close to centered as possible when the servo is commanded to its midpoint. Since this is a positional servo, SERVO_STOP usually isnโt needed after the movement; simply leave it at the calibrated center angle. Avoid repeatedly commanding the extreme values if the mechanism hits a physical stop.
Reply to this answer
For a positional servo, write(angle) tells it which angle to move to, not just how far to turn. Ninety degrees is normally the midpoint, but the mechanical center of the penguinโs head may not line up exactly with the servoโs electrical center. Try values such as 88, 90, 92, and so on until you find the angle that points the head straight, then use that value for the final position.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions