In this post, we will analyze the simple Arduino circuit below that has a small servo motor SM-S2309S and a few capacitors to smooth variations on the power supply as well as a 5V voltage regulator.
Below some of the characteristics of this SM-S2309S servo motor:
- 3 pins: 1xVin (power supply), 1xGND, 1xSignal (Pulse Width Modulation PWM)
- Gearbox: 1 copper gear at motor output and 4 plastic gears for speed reduction and higher torque
- Vin range: [4.8V .. 6V]
- DC motor high speed and low torque
- Drive controller that uses the "H-bridge" concept in which transistors connected to different pins of the drive KC8801 are opened/closed in order to allow the motor to move in either the forward direction, reverse direction or stop position.
- Potentiometer as position feedback sensor of the application shaft
- Speed and Torque:
- For 4.8V power supply: 0.11 sec/60 degree, 1.1 kg-cm
- For 6.0V power supply: 0.09 sec/60 degree, 1.3 kg-cm
- Rotation angle range (bidirectional): [0° .. 180°] PWM square wave at 50Hz and 20ms period with:
- POS_0: PWM 1ms High level time
- POS_90: PWM 1.5ms High level time
- POS_180: PWM 2ms High level time
Datasheet from a similar Servo controller KC:
The code used in this example is on github and it is divided into 3 main sections:
1. including library <Servo.h> and Servo object instantiation
2. declaration and initialization of global constants and variables
3. setup routine: Definition of pin modes, open Serial communication for debugging/callbacks, servo homing and moving to specific positions such as POS_0, POS_90 and POS_180.
3. loop routine: 2 for loops, one that will make the motor move from POS_0 to POS_180, by setting the angle of the motor at every 15ms, and the other will do the same in the opposite direction, i.e. from POS_180 to POS_0. This is done through the write(motor_angle) method of the Servo object instantiated as motor_1 in this example.
No comments:
Post a Comment