I am using servo motor for some positioning. Let's said I want the servo motor rotate to a specific angle like 23 degree, is it possible to achieve using Raspberry PI? Did I need some sort of encoder to do alignment?
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question does not appear to be specific to the Raspberry Pi within the scope defined in the help center." – joan, Ghanima
Servo motors are controlled by pulse width modulation (PWM). Specifically, the angular position of the servo is determined by a specific pulse width. The angular position will be approximate and may even differ from servo to servo. The angular position may also be affected by torque.
Given this behavior, feedback is generally required for exact positioning (e.g., 23 degrees) of servo motors. Such feedback is quite often provided by a rotary encoder. You will need software to control the servo and have it go to a specific position as indicated by the rotary encoder. And yes, that is as complicated as it sounds.
An alternate solution is to use a stepper motor. Stepper motors are designed for digital positioning and can be used with or without rotary encoders depending on your precision needs, but you may need a sensor to establish home position. You may want to consider microstepping for highest positional accuracy.