Week #1 Laboratory Session

advertisement
ME-191
Computer Applications in Mechanical Engineering II
Lab 3. Stepper Motor Calibration and Control
Lab Objectives:




Use MATLAB and LabJack to acquire digital inputs from limit switches
Use MATLAB and LabJack to control a stepper motor
Use MATLAB to analyze acquired data
Use a control system to vary an output based upon input data
Lab Equipment Required



Laptop with MATLAB/LabJack software installed
Labjack DAQ and DB25 cable for interfacing with two-dimensional (X-Y) tables
X-Y table and power supply
Background
Recall from previous experiments with analog DC motors that when an analog signal is applied
to the motor circuit the motor rotates at a certain speed. Application of a higher voltage results in
a faster speed. Stepper motors employ an entirely different concept. Used mainly for positioning
applications, stepper motors ‘step’ through shaft rotation positions incrementally. The control
signal most often used in stepper motor control is the so-called pulse train as seen in Figure 1.
Each time the signal goes from low to high and back to low, the motor indexes by one radial
increment. In Figure 1, there are four low-high-low transitions shown which would result in four
incremental movements of the motor shaft. Some motors increment one degree for every pulse
(360 pulses per revolution), while others are designed for different increment sizes. In addition,
some motors allow using a ‘half-step’ mode. In normal mode a motor may increment in onedegree steps, but in half-step mode, each pulse would result in one-half-degree rotation.
Figure 1. A pulse train.
The on-off pulse train might be generated in many different ways. Considering the
hardware/software available in this course, MATLAB could be used to turn a channel on, then
off using the EDigitalOut command:
EDigitalOut(x,x,x,x, 1);
EDigitalOut(x,x,x,x, 0);
where 1 is the ‘high’ state and 0 is ‘low’.
Notice that to change the speed of rotation of the motor, the time between pulses could be
increased or decreased. In the case of the hardware/software interfaces in this course, the speed
limitation is related to the communication speed between MATLAB and LabJack. It is possible
to slow the system down (with a pause command perhaps), but it is important to note that
ME-191
Computer Applications in Mechanical Engineering II
communication speed limitations between the computer and the I/O board do indeed impose a
motor rotation speed limit.
Equipment Set Up
MSOE’s so-called X-Y tables are already wired to interface with the LabJack DAQ units.
However, please pay attention to where the inputs and outputs are connected while writing
programs. Be especially careful to distinguish between digital input and digital output signal
types. It is possible to damage the equipment if these are reversed (i.e. writing an output to a
closed switch input).
The X-Y table axes and limit switch locations are shown in Figure 2.
Limit Switch A
Y- axis (D10)
Y Axis
Limit Switch B
Y- axis (D11)
Motor
Motor
X Axis
Limit Switch B
X- axis (D9)
Limit Switch A
X- axis (D8)
Direction LOW = Towards A
Direction HIGH = Towards B (both axes)
Figure 2. Schematic diagram of a two-axis (X-Y) table.
It may be convenient, for programming purposes, to remember that A refers to “Away” from the
motor, and B refers to “Back” toward the motor.
Table 1 contains the wiring assignments for the LabJack I/O connections. Note that these cannot
be changed since they are hard-wired from the circuit board to the motors and from the X-Y
tables to the LabJack connector.
ME-191
Computer Applications in Mechanical Engineering II
Table 1. LabJack and X-Y table interconnections.
DB25 Pins
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Labjack IO
D0
D1
D2
D3
D4
D5
D6
D7
NC
+5V
+5V
+5V
+5V
Ground
Ground
Ground
Ground
D8
D9
D10
D11
D12
D13
D14
D15
XY Table Connections
X-axis Step (each pulse)
X-axis Direction
X-axis Motor 1/2 step
X-axis Motor phase
Y-axis Step (each pulse)
Y-axis Direction
Y-axis Motor 1/2 step
Y-axis Motor phase
Color
Yellow
White
Red
Blue
Orange
Tan
Pink
Violet
X-axis limit switch A +5
X-axis limit switch B +5
Y-axis limit switch A +5
Y-axis limit switch B +5
Driver board ground
Green
Green
Green
Green
Black
Green
X-axis limit switch A (+5 when limit is reached)
X-axis limit switch B (+5 when limit is reached)
Y-axis limit switch A (+5 when limit is reached)
Y-axis limit switch B (+5 when limit is reached)
X-enable (default-low is enabled)
Y-enable (default-low is enabled)
Yellow
Black
Orange
Red
Grey
Brown
When developing programs for this lab, you will primarily use the X-axis step and direction
commands for each motor (D0 and D1), and the corresponding limit switch outputs (D8 and D9).
(And similarly for the Y-axis.)
Each time that a pulse (a HIGH signal followed by a LOW) is sent to D0, the motor rotates one
step (according to the motor plate, one step is 0.9 degrees). Setting D1 HIGH or LOW controls
the direction of the motor rotation. If D1 is LOW, the default, the bearing block moves towards
end A, i.e., away from the motor.
Several other connections may be of interest in future labs and during the final two weeks of the
course when designing your own system. D2 and D6, when turned on (HIGH) will cause the
respective stepper motors to run in a half-step mode. A full step is 0.9 degrees, therefore the halfstep mode will produce only 0.45 degrees per step. This increases the X and Y resolution as each
pulse only travels one-half of the default distance. Notice that the number of steps per second
(commanded from the computer) does not change and thus it takes twice as long to move the
same distance.
You can also remotely disable each motor by setting the outputs D12 and/or D13 to HIGH.
ME-191
Computer Applications in Mechanical Engineering II
Programming the X-Y Tables
Connect the hardware as in Figure 2. Open the LabJack LJLogger application and verify that
everything is connected and working properly. In particular, and with the main power
supply off, move the bearing slides to the various endpoints. When each respective limit
switch is contacted, the LJLogger screen should illuminate the respective input button.
Verify all four limit switches are operational.
Finally, set D0, D1, D4, and D5 directions to Write and turn on the main power supply; now
when you toggle the various outputs between LOW and HIGH you should be able single step
each motor in both directions.
When the motors are not moving, turn the main power supply back to OFF position
because leaving it switched on while not in use generates significant heat in the four power
resistors located under the main driver circuit board.
1. Write an m-file program to move the X axis 100 steps in the A direction, followed by
moving it back towards end B 100 steps. Think about different ways that this can be
accomplished using loops. Before you start running this program move the bearing
slide on the X-axis far enough away from end A so that the limit-switch is not
contacted.
2. Combine the limit switch feedback with the ability to move the X-axis motor. Write
an m-file to perform the following steps:
a. Move the X-axis carrier towards end A until the limit switch is actuated, thus
ending the motor movement (think: while-loops).
b. Create a steps variable and move the X-axis carrier towards B until the next
limit switch is set. Continually increment steps until finished so that when B is
contacted you have counted the number of steps that it took to travel from
limit switch A to limit switch B on the X-axis. Display on the screen the
number of steps.
c. Finally, move the X-axis carrier to its center position (steps/2), and end the
program. Utilize a FOR-loop instead of a WHILE-loop and comment on
differences observed in parts a. and b.
3. Repeat part 2, steps a, b, and c, for the Y-axis. Consider using existing code, copying
it into a new program, changing several I/O variables, and repeating the procedure.
ME-191
Computer Applications in Mechanical Engineering II
Required Deliverables
1. Lab Report: Combine this lab with experiments from Lab 4 (next week) and provide a
one page (approximately) summary of what you designed and programmed for this
experiment. Fill out the Verification of Table Dimensions and include in the report. A
group report is optional. Attach m-files for all three parts to the one page summary. Use
comments liberally within each m-file to describe the function of primary statements.
Due one week from completion of Lab 4.
2. Homework: Due at first meeting of week 5.
 Find and record i.) Maximum torque, ii.) Maximum operating voltage, iii.) Maximum
current, and iv.) Step size, for at least two different stepper motor manufacturers. Find
one smaller and one larger than the motors in the existing set-up. Record
manufacturer (website?), model number, and price.
 What is a synchronous AC motor and how is its speed controlled?
ME-191
Computer Applications in Mechanical Engineering II
Verification of Table Dimensions
Table Data: 10 teeth/pulley and 32 teeth/foot in the belt
or
Pulley pitch diameter = 1.194 inches
Motor Data: 0.9 Degrees of rotation per step
X-axis Calculations
Measured length of mechanical travel between X-axis stop-switches = _____________ inches
Number of steps counted over the total travel = _____________
Distance per step = _____________ inches
Total angle of rotation (assuming 0.9° per step) = _________ degrees
Total angle of rotation (assuming 0.9° per step) = _________ radians
Total angle of rotation (calculate using pulley information) = ____________ radians
Distance per step (calculate using pulley and motor information) = ________ inches
Y-axis Calculations
Measured length of mechanical travel between Y-axis stop-switches = _____________ inches
Number of steps counted over the total travel = _____________
Distance per step = _____________ inches
Total angle of rotation (assuming 0.9° per step) = _________ degrees
Total angle of rotation (assuming 0.9° per step) = _________ radians
Total angle of rotation (calculate using pulley information) = ____________ radians
Distance per step (calculate using pulley and motor information) = ________ inches
(In your report, remember to show your work, include units, and label all variables.)
ME-191
Computer Applications in Mechanical Engineering II
Appendix
Specifications
Frame
Size
[inch]
2.22
Maximum
Holding
Torque
[oz-in]
127
Rotor
Inertia
Basic
Step Inductance
Angle
[ohms/phase]
[°]
[mH/phase]
1.8
0.9
3.2
Rated
Voltage Resistance
Current
[oz-in2] [A/phase]
1.64
2
[V]
3.6
Corresponding
Package Model
CSK266M[]T
ME-191
Computer Applications in Mechanical Engineering II
Permissible Overhung Load
Distance from Shaft End
0 inch 0.2 inch 0.39 inch 0.59 inch 0.79 inch
[lb.]
12.1
15
20
29
* The permissible thrust load [lb. (N)] shall be no greater than the motor mass
ME-191
Computer Applications in Mechanical Engineering II
Download