EC312 ... Spring 2015

advertisement
EC312
CAN Lab #3 Motor Control Setup & Calibration
Spring 2015
Maxon 2140-937 24V 6 Watt DC Motor W/ Spur Gearhead 6:1 & Optical Encoder (600 counts / rev.)
System Functional Block Diagram
CANopen
Magic Node
Graphical User Interface
Bench
Power
Supply
CAN
Messages
CANopen Motor Lab Configuration
Shaft
Rotation
Power
CANopen
MicroMod
Ain4
into
MicroMode
PWM
Fo0
out
MicroMod
L298 Driver
Board
Motor
Modulated
Power
Analog Voltage Proportional to Motor Speed
Encoder
Position Pulse
Train
LM2907
Frequency to
Voltage
Converter
References:
1. CANopen MircoMod quick guide.pdf
2. http://intranet.usna.edu/WSELabs/PARTS/MOT/MOTORS/DC_MOTORS/maxon_motor_2140_937.pdf
Part A Connect Motor Control Components
1. Verify the Maxon motor light blue encoder cable to the LM2907 frequency input to analog voltage
output converter board cabling being careful to
Color
LM2907 MicroMod
Description
verify that the “No Connection” (NC) pin has
White
VO
Ain4
Analog Speed
no wire attached.
Red
+5V
Vcc
5V Power
2. Verify that the LM2907 analog output is
Black
GND
GND
Ground
connected to the MicroMod as specified to the
Color
L298
MicroMod
Description
right:
Grey
GND
GND
Ground
3. Verify the 5 conductor rainbow ribbon cable
Purple
Vcc
Vcc
5V Power
connection to the L298 Motor Driver Board
Blue
IN1
GND
Direction
input as specified by the table to the right. Then
Green
IN2
Fo0
PWM Signal
verify the individual wire connections to the
Yellow
ME1
Vcc
Master Enable
MicroMod PWM output, 5V power and ground
as specified to the right.
4. Verify that the L298 Motor Driver Board outputs M1A and M1B are connected to the two motor
wires. Note that the polarity establishes motor rotation direction and, in this lab, does not matter.
5. Power up the DC bench power supply and verify that the voltage is to 18V. Make sure you are careful
with the banana clips which supply the power to the motor leads, they are unshielded and have a
potential of 18V DC voltage down at the workspace, do touch them or allow them to touch each other
and create a short.
6. Connect your oscilloscope to the MicroMod Fo0 PWM output then power up the scope. Also
connect the scope probe to a suitable micromod ground. Make sure to select DC coupling on the
scope.
E. Zivi April 22, 2015
1
Part B Maxon Motor Calibration Using CANopen
7. Copy the Lab 3 folder from the location your instructor suggests or your Google share drive for your
section.
8. Verify that the MicroMod is connected directly to the PCAN-USB adapter with a single terminated CAN
cable and verify that the PCAN-USB adapter is plugged into one of your computer’s USB ports.
9. Startup CANopen Magic by double clicking on MotorSpdCAN.cox.
10. Note the changes to the CANopen Magic graphical user interface:
The Process Data visual display has been redesigned for open loop and PI closed loop motor
testing and control. (We’ll use the PI control related portions of the display in the final lab.)
A more complete set of messages to send PWM duty cycle CAN Messages commands to the
MicroMod have added to the CAN Messages window:
• 0% (F1), 10% (F2), 25% (F3), 50% (F4), 75% (F5), 90% (F6), 100% (F7).
• Note: if the function keys don’t activate the commands, click on the associated Tx button.
There are now three Trace windows, each with different filters. Verify that the correct filters are
applied to each window – make any changes necessary.
• Trace 1 is the same as the first two labs: this window shows all CAN messages
• While having the Trace 1 tab selected, click on the filters icon
and configure the trace filter as in the picture below
• Trace 2 has the filter shown at the right which only displays CAN Process Data Object (PDO)
messages
• While having the Trace 2 tab selected, click on the filters icon
and configure the trace filter as in the picture below
• Trace 3 has a filter which only displays Node 2 (MicroMod) TPDO 3 messages which contain
data from the second bank of MicroMod analog inputs: Ain4 to Ain7.
• While having the Trace 3 tab selected, click on the filters icon
and configure the trace filter as in the picture below
E. Zivi April 22, 2015
2
11. Power up the MicroMod and bring it to operational status by clicking on Tx buttons for CAN
Messages 0 and 1 in the CANopen Magic CAN Messages window.
12. Set the PWM duty cycle to 25% by clicking on the TX button and verify that the motor is running.
13. Use the CANopen Magic pre-defined CAN Messages to vary the MicroMod PWM duty cycle
between 10% and 100% entering your measurements and comparing your displayed motor speed to
the following table. While doing so, notice the changes on the oscilloscope.
Duty Cycle
Nominal
Speed
Your Speed
(rad. / sec.)
10% (F2)
25% (F3)
50% (F4)
75% (F5)
90% (F6)
100% (F7)
30
92
194.
282.
352.
380.
Question 1: Compare your motor speed results with the nominal values given above:
E. Zivi April 22, 2015
3
Part C Maxon Motor Step Response Using CANopen
14. We will use CANopen Magic to collect Maxon Motor step response data and then import the data
into MATLAB to extract the step response data and determine a 1st order transfer function model of
the motor. (We need this transfer function to design a PI controller.)
15. We’ll collect the motor transient response data using the Trace 3 window which will only display
Node 2 (MicroMod) TPDO 3 messages. The first word of this TPDO contains the MicroMod Ain4
input which is connected to the motor tachometer output.
16. Ensure that the Trace 3 is:
Stopped
Time is set to Relative ms
Scrolling is set to Sequence
17. Send the MicroMod the 10% Duty Cycle command and confirm that the motor is running.
18. Read over, then perform the following steps playing close attention to the timing of the sequence of
steps to collect motor transient data:
a. Verify that the motor is turning slowly driven by a 10% PWM duty cycle command
b. Click the dark red button in the upper left corner of the Trace 3 window to begin
recording MicroMod TPDO 3 motor tachometer data
c. Quickly ( < 1 second), click on the Tx button on 90% duty cycle entry in the CAN Messages
window or you can try to press the F6 function key.
d. Wait about half a second for your motor to reach steady state speed, then click the Trace 3
e.
stop button.
Click on the Tx button on 0% duty cycle entry in the CAN Messages window to turn off the motor.
19. Click on the Trace 3 “Export the trace recording to a file” button and save the Trace 3 data to a
file in your working directory (same directory where the MATLAB file was saved.)
20. Start MATLAB and use the MM_import_TPDO3.m script to read and interpret the trace data
(enter .csv file at the prompt).
21. Verify that MM_import_TPDO3.m completed without error and generates a step response plot. With
a little effort, your step response plot could be used to determine the motor first order transfer
function as shown below:
E. Zivi April 22, 2015
4
22. Adjust the time axis limits to clearly display the transient response and to show the steady state speed.
One way to accomplish this is to use the following MATLAB command:
>> ax = axis; % ax will have 4 elements: containing the x- and y- axis limits
>> ax(1) = <new x-axis lower limit>;
>> ax(2) = <new x-axis upper limit>;
>> axis(ax); % change figure x-axis limits
23. Print your step response plot and include it in your lab report.
Question 2: Is your motor step response consistent with the figure presented in this lab
handout? Check for time constant ( record time at 63.2% of max amplitude value).
Question 3: How was CAN network communication used to facilitate this lab? Explain using the
block diagram details, try to include data pins used and how they would be communicated.
Question 4: What CANopen commands and what CANopen data was transferred during the lab
experiments? Explain using Message IDs along with the commands- make sure you take a look
at the hex data portion of the trace commands to help you correlate what you see in the graphic
display.
Question 5: What aspect of CANopen ensured that turning on the power supply before powering
up the CANopen network as safe [Review the CANopen startup sequence]?
Answers to questions and calibration results
Total score
E. Zivi April 22, 2015
100
100
5
Download