Given an x-coordinate (from the touch screen) for the air hose’s new x-position, the motor control is responsible for providing the stepper motor driver chip (the MC3479 from Motorola) with the correct signals to rotate the stepper motor so that the air hose is lined up with this new x-position. There is also a corresponding y-coordinate motor control module which differs from the x-motor control only in that the scaling used in the two modules is different (scaling being how many pixels on our VGA monitor correspond to one half-step of our stepper motor).
The motor control module controls a stepper motor
by giving signals to a stepper motor driver chip. This chip, in turn,
drives the stepper motors. To drive the stepper motors, half an amp
is needed, but the XS40 board does not provide enough current, and hence
the use of the stepper motor driver chips, which do provide enough current
for the stepper motors. The stepper motor driver chips drive the
stepper motors at twelve volts.
The motor control provides the stepper motor driver chip with a CLK
signal and also with a clockwise/counter-clockwise (CW/CCW) control signal.
For each positive edge the stepper motor driver chip sees at its CLK input,
it tells the motor to move one half step according to the CW/CCW control
signal. A half-step clockwise corresponds to moving the air hose
either left or down, depending on the motor, and a half-step counter-clockwise
corresponds to moving the air hose either right or up, depending on the
motor. To allow for a smooth acceleration of our stepper motors,
the CLK signal to the stepper motor driver chips have a frequency of 600
Hz.
The motor control module keeps track of its current x-position. The current x-position is where the air hose is currently pointing along the x-axis. If the input x-coordinate from the touch screen is less than the current stepper x-coordinate, then the stepper motor control has the motor turn counter-clockwise (left). Conversely, if the input x-coordinate is greater than the current stepper x-coordinate, then the stepper motor control has the motor turn clockwise (right). This ratio of coordinates (which are really just pixel positions on the VGA monitor) to motor half-steps is not 1:1. With a little experimentation, we found that 12 pixels along the x-axis corresponds to one half step while 11 pixels along the y-coordinate corresponds to one half step.
In addition to control signals for the stepper motor
driver chip, the motor control portion of our project also outputs the
current position of the stepper motors. This is necessary because
the VGA camera project needs to know the position of the stepper motors
in order to accurately display the crosshairs indicating a user’s touch
location and the current position of the stepper motors.