Robot's Servo Drive Motors
Introduction to Servos
The Futaba S3003 servos have been modified to run in continuous mode or free running mode. The servo has three wires,
- red - power 4 to 6 V DC
- black - ground
- white or yellow - signal wire
To drive the motors, a pulse width modulated signal must be sent every 20ms. The width of the pulse will indicate direction and speed:
- pulse width of 0ms, i.e. no pulse -- the motor will stop
- pulse width <1.5ms -- the motor will continuously rotate in one direction (clockwise)
- pulse width = 1.5ms -- the motor is in neutral or dead zone
- pulse width > 1.5ms -- the motor will continuously rotate in the other direction (counter clockwise)
- the drive signal is proportional, so the farther it is from the neutral position, the greater the speed
- NOTE: neutral is approximately at 1.5ms, you must calibrate to get effective speed control
Driving Servo Motors from VHDL
In VHDL, you need a clock based counter to time the 20ms and to provide the basis for the pulse width modulation. The clock speed selected, i.e. 1KHz or 10KHz, will determine the precision of your control ability. The following two sample programs servo_tune.vhd and simple_ctl.vhd should provide you with a starting point. Remember, you have two motors moving in opposite directions to move the robot forward or back. Movement will be in a straight line if the speeds are the same. If the motors move in the same direction, the robot will spin in place assuming the speeds are the same.
Suggestions for Investigation and Calibration of Servo Motors
- Either end of the robot can be the "front", however, the end with
the most space (usually used to mount sensors) is typically considered
the front. Select a "front" for your robot. Name your two motors appropriately,
i.e. left/right, port/starboard, and make sure the entire design team
understands the convention. Use a function generator to investigate
the operation of the servo motors. For each servo, determine the direction
of spin, i.e. which signal, e.g. <1.5ms or > 1.5ms, is required to
move the wheel in a forward or reverse rotation.
- Develop a counter design to find the neutral or dead zone of each
servo motor; do not assume that they are the same. The neutral zone
will be approximately 1.5ms and the motor will stop moving in the neutral
zone. Send a pulse every 20ms; note that the period is always 20ms.
The program should have a starting pulse width, some mechanism for
increasing/decreasing the pulse width, and a mechanism for selecting
the motor to examine. For the pulse width you will need a resolution
of at least 0.01ms to find the dead zone; for example, neutral may
be at 1.53ms not 1.50ms.
- Remember, the closer you are to neutral, the slower the speed of
the motor. The farther you are away from neutral, the faster the speed
of the motor. Design a motor speed controller based on proportional
control with two speeds in both forward and reverse. See if you can
get the robot to move forward in a straight line at both speeds.
- A motor speed controller can be designed by pulsing the the servos on and off. The motors are sent either a full speed forward or a full speed reverse signal. If the motor is then sent no signal, it will stop. Compared to a motor receiving consecutive full speed forward pulses (F-F-F-F...), a motor receiving alternate full speed and stop pulses (F-S-F-S...) will be slower and (F-S-S-F-S-S-F...) will be slower still. Design a motor speed controller based on on/off control. See if you can get the robot to move forward in a straight line at both speeds.