Control

Servo Motor




- Operating Voltage: 4.8V (~5V)

- Rotation Range: 0°-180°

- Speed: 0.1 sec/60°

- Holding Torque: 1.8 kg-cm

- Weight: 9 grams


Internals



- DC Motor supplies rotational movement

- Gear reduction increases torque at the cost of speed. Determined by the ratio of the gears. Final gear contains lever that limits movement to half circle

- Feedback potentiometer rotated by gears and determines position of the servo's arm

- Control circuitry receives user control via the signal wire and feedback from the potentiometer. On board H-bridge rotates DC motor clockwise and/or counterclockwise



Controlling a Servo




Despite rotating from analog values 0° to 180°, a servo requires a digital PWM signal. The internal circuitry demands a frequency of 50Hz to operate. This translates to a period of 20ms.

Rotational positions from 0° to 180° correspond to specific pulse times. Maintaining a period of 20ms and varrying the pulse width from [0.5ms, 2.5ms] results in positions from [0°, 180°].

Not all servos are the same! Servos tend to exceed the range [0°, 180°], and require individual tuning. The pulse times must be adjusted to represent accurate positions of the secondary shaft.

Python's modules serve act similar to libraries in C++. The module "RPi.GPIO" allows us to perform various operations on the Pi's GPIO pins. The argument for the PWM function is the duty cycle (highlighted in red) as opposed to the pulse time.



The content inside the move_servo() function can exist on its own. The function was created solely for convenience, as it will be often referenced in upcoming code.

Back to top of page


© Team459 2018