How can I make a servo return to its true center position?

0
3
Asked By MellowKite47 On

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?

2 Answers

Answered By CedarFox8 On

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.

Answered By NimbleQuartz21 On

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.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.