Quanser Engineering Trainer DC Motor Control
User Guide Quanser Consulting Inc. 1
Quanser Engineering Trainer DC Motor Control 1
Introduction
The DC MOTOR CONTROL TRAINER (DCMCT) is a versatile unit designed to teach the fundamentals of motor servo control in a variety of ways. The system can readily be configured to control motor position, speed and current using the following implementations: 1.1
PID Tuning Fundamentals course can be given using the DCMCT in conjunction with a QIC Processor Core and the DCMCT qKInterfaces. The qKInterfaces offer easy setup experiments in System Identification, Position Control and Speed Control. A course is available allowing to teach these with minimal setup time.
1.2
Analog feedback control using the Quanser Analog Plant Simulator or any other analog computer including OP-AMP circuits implemented on breadboards. A breadboard is available on the system for students to implement their own analog controllers.
1.3
Computer control using a PC with realtime control capabilities and a HIL board. The user can either program the PC to perform the realtime control or use Simulink to generate code and run it in realtime on a PC. The system is fully compatible with any of the Quanser Hardware in the Loop (HIL) boards as well as National Instruments E-series boards and the dSpace DS1104 board. The system is fully controllable using Quanser’s WinCon or SLX RT as well as RTWT, XPC target, LabVIEW and Control Desk.
1.4
PIC Microcontroller control. The Quanser QIC Processor Core can readily be plugged into the DCMCT unit. The user can then program the PIC to control the motor without a PC.
1.5
Haptic knob experiments can be performed such as detents, damping, mass, spring and friction emulation. A sample active knob software is included when the system is purchased with a QIC.
1.6
Haptic Virtual Ball and Beam. This is java component that simulates a ball and beam experiment dynamics on a PC. It also provides the user with a realtime graphic simulation such that the user can command the beam angle via the DCMCT and program “feel” in the knob to sense the ball rolling. This system can easily demonstrate the positive effect haptics has on operation in virtual or remote environments. 2
2
Control options
The photograph in Figure 1 shows the general layout of the system and the various
Figure 1
methods one could control the motor with. These are briefly described below. 2.1
PC or DSP control. You may control the system using a data acquisition board or a DSP. You wire the signals to the RCA and DIN connectors on the board.
2.2
Analog computer control. An analog computer such as the Analg Plant Simulator can be used to implement analog controllers. In this case the encoder cannot be used.
2.3
Breadboard implementation. You may implement a controller of your own design on the supplied breadboard
2.4
Embedded controller . A socket is supplied which allows you to insert a QIC 3
embedded controller. The signal connections are automatically made when the QIC is installed. Quanser supplies qKInterfaces to communicate with the QIC in realtime for tuning and data collection. 3
System components
A block diagram of the system is shown in Figure 2. The individual components are described below.
Figure 2 Block diagram of DCMCT
3.1
High quality DC (Maxon brand) motor - This is a Graphite Brush DC motor with a low inertia rotor. It has zero cogging and very low unloaded running friction.
3.2
Linear power amplifier - A linear power amplifier is used to drive the motor. The input to the amplifier can be configured to be either the voltage at the RCA jack labeled Command or the output of the built in D/A. The built-in D/A can only be used if a QIC board is connected to the system and the appropriate jumper installed (J6).
4
3.3
QIC compatible socket - A QIC processor core board can be plugged into this socket to enable one to perform closed loop control using the QIC microcontroller.
3.4
Analog current measurement - a series load resistor is connected to the output of the amplifier. The signal is amplified internally to result in a sensitivity of 1.8 Volt/Amp. This signal is available at the RCA jack labeled Current. It is also level shifted and scaled and made available at the QIC header so it can be used by a QIC based controller. This measurement can be used to either monitor the current or use it in a feedback loop to control the current in the motor.
3.5
Digital position measurement using a quadrature optical encoder - An optical encoder is mounted to the rear of the motor. The optical encoder signal an be used at the DIN plug by a HIL board. The encoder signals are also fed to an encoder counter IC that interfaces with the QIC in order to perform encoder feedback control using the QIC.
3.6
Analog speed measurement - An analog signal proportional to speed is available at the RCA jack labeled Tach. It has the range of ± 5 Volts. The signal is also scaled and level shifted to the range of 0-5 volts and made available to the QIC header so that it can be used by a QIC based controller.
3.7
Analog position measurement using a potentiometer - a potentiometer can be coupled via toothed belt to the motor shaft in order to implement analog position feedback control. The potentiometer signal is available at the RCA jack labeled Pot and can be used by an analog computer or a data acquisition board on a PC. This analog signal is in the range of ± 5 V. The signal is also level shifted and scaled to 0-5 volts and made available to the QIC header so that it can be used by a QIC based controller. The potentiometer belt should be removed in order to eliminate the effects of extra friction when running speed control and encoder position feedback experiments as well as to extend the life of the potentiometer. It is especially recommended that the potentiometer belt be removed while running speed control experiments. Although the potentiometer is rated for 10 million revolutions its life will quickly diminish when running at 2000 RPM for long durations. Running the potentiometer at 2000 RPM for example would reduce its life expectancy to 83 days! Potentiometers are typically used in position control systems and as such are not expected to continuously turn at high speeds.
3.8
Built in power supply- A Built in power supply converts 15 VAC to ± 20 V DC. The ±20 VDC is regulated as well to supply ±5 VDC and ±12 VDC. These power supplies can be used for external circuitry.
3.9
Wall transformer- A wall transformer is supplied to deliver the required AC voltage to the board. 5
3.10
12 bit D/A is available and can be used only if the QIC board is installed. This will allow feedback controllers implemented on the QIC to drive the D/A instead of the external Command input. The jumper JP6 must be set to use the D/A output to drive the amplifier and the output must be enabled using RB4. The output of the D/A is also made available at the RCA jack labeled D/A.
3.11
24 bit encoder counter is connected to the encoder such that if a QIC board is installed, the encoder measurements can be read by the QIC.
3.12
Secondary encoder input. An additional external encoder can be attached to the system such that it can be read by the QIC. This can be used for the development of other experiments by the user.
3.13
External analog input to QIC. The analog input applied to the RCA jack labeled Command is level shifted and scaled such that a signal in the range of ± 5 V applied to it is made available as a signal in the range of 0-5 volts at the QIC input AN4. This is useful if you want to apply external command signals to a QIC based controller.
6
4
Connections
Wiring to the system is via RCA and DIN jacks. They perform the following connections: Outputs
Device
Range
RCA4
Potentiometer voltage
± 5 VDC
RCA3
Tachometer voltage
± 5 VDC
RCA2
Current measurement
± 5 VDC
RCA5
QIC D/A output
± 5 VDC
5 pin DIN
Encoder output
TTL, A, B
Command signal to power amplifier
± 5 VDC
Serial to QIC
RS232
AC power to board
15 VAC
Input
RCA1 Serial
DB9 Power
6mm jack
Figure 3 External connections to the DCMCT
7
5
System Parameters Value
Units
Symbol
Torque constant
0.052
Nm/Amp
Km
Terminal resistance
10.6
S
Rm
Terminal Inductance
0.82
mHenry
Lm
Rotor Inertia
11.6
gm-cm2
Jm
Max Torque
0.07
Nm
Tmax
Gain
3.0
V/V
Ga
Max output voltage
15
V
Vmax
Max current
1.5
Ampere
Imax
Max output power
22
Watt
Pmax
Max dissipated power (with heat sink) Rload = 4 Ohm
8
Watt
Pdis
0.556
Amp/Volt
Gcurr
Lines per revolution
1024
Lines
Resolution- Quadrature
0.0879
Deg / count
Motor
Linear Amplifier
Current sense Current sensitivity (+/- 10%) Encoder
Type
TTL
Signals
A, B, Index
GEnc
Potentiometer Resistance
10
kS
Bias voltage
± 4.7
V
Electrical range
350
Degrees
Sensitivity
39
Deg / V
Gpot
V / 1000 RPM
Gtach
Tachometer (Analog output - digitally derived from Encoder) Sensitivity
1.5
8
6
Interfacing to a Quanser HIL board
The system is fully compatible with all Quanser HIL terminal boards and as such can be used to perform control experiments on a PC. The realtime controller is typically designed in Simulink and running realtime using WinCon. Typically connect as follows: Ž
Ž
Ž
Location of J6
HIL Terminal board
DCMCT
Inputs
Outputs
Figure 4 Location of J6 for control from voltage at Command RCA jack Signal range
Signal
Analog input
0
»
Pot
±5V
Potentiometer
Analog input
1
»
Tach
±5V
Tachometer
Analog input
2
»
Current
±5V
Current
Encoder
0
»
Encoder
TTL
Encoder
±5V
Amplifier command
Output Analog output
Input 0
º
Command
9
7
Interfacing to the QIC Processor Core
When a QIC core is inserted into the QIC Socket on the DCMCT, you can use the QIC to measure all the sensors and to control the amplifier. In this case the jumper J6 should be configured such that the D/A output on the board drives the linear amplifier. Figure 5 Location of J6 for control from onboard D/A controlled by QIC Ž
Ž
Ž
Location of J6
With the QIC Core inserted, the following connections are attained: QIC Core Function
DCMCT Pin
Name
Signal range
Inputs
Signal
Outputs
Calibration
Analog input
RA0
AN0
»
0-5 V
Potentiometer
78 deg / volt
Analog input
RA1
AN1
»
0-5 V
Tachometer
.75 V/1000 RPM
Analog input
RA2
AN3
»
0-5 V
Current
1.11 Amp / V
Analog input
RA5
AN4
»
0-5 V
External analog input
Encoder
ENC
ENC
»
A, B, Index
Encoder
Pushbutton
RB0
INT
»
TTL, Pulled high
PB
Outputs
Inputs
D/A output enable
RB4
RB4
º
TTL, Pulled High
Enable DA OUT
Analog out
D/A
Vout
º
±5 V
Amplifier Command
LED 3
RC0
RC0
º
0-5 V
LED 1
LED 2
RC1
RC1
º
0-5 V
LED 2
The highlighted cells show that over and above the signals that are derived from the sensors, the QIC can be made to drive two LED’s and read the state of a momentary action pushbutton switch. These are useful when performing certain types of experiments supplied with the DCMCT qKInterfaces. Note that RB4 is used to enable the output of the D/A to drive the amplifier. RB4 must 10
be pulled low by the QIC to enable the D/A output. You still need to physically move jumper J6 to the left to connect the output of the D/A to the amplifier input. The calibration column indicates that the analog sensors sensitivities are reduced by a factor of 2 when measured by the QIC A/D’s as opposed to the RCA jacks. The reason is that the RCA outputs are in the +/- 5 V range while the A/D inputs to the QIC are in the 0-5 V range. 7.1
Accessing onboard devices using the QIC
7.1.1 Chip select lines
The DCMCT has two onboard devices which can be accessed via the QIC. These are the D/A chip. These devices are addressed by the PIC via lines B1 and B2. Lines B1 & B2 are applied to a 2 to 4 demultiplexer that will select which of the two onboard devices you need to enable. The table below shows the way to select the device you want. Chip select line
B2
B1
N/A
0
0
Encoder
0
1
Digital to analog converter
1
0
Not used
1
1
7.1.2 Read / Write lines
The devices can be written to and read from using the PIC via the read write lines. These are defined below: READ
A4
WRITE
B3
Pulsing these lines low will perform the desired operation.
11
7.1.3 Using the D/A Chip
The QCM is equipped with a 12 bit Digital to analog converter that interfaces to the QIC core via an 8 bit bus. The bus is attached to PORT D on the QIC. Reading and writing to this port enables you to use the D/A chip. In order to write to the device, you need to enable it via the Chip Select line and then write to it the desired values. The device has two registers which must be written to in order to obtain the desired output. These are controlled via pins C4 & C5 on the QIC. In order to write a 12 bit value to the D/A, you need to write two 8 bit values in the correct sequence. Consider the 12 bit value that want to write to the D/A. It would consist of twelve bits which can be divided as follows: d11
d10
d9
d8
High 4 bit nibble
d7
d6
d5
d4
d3
d2
d1
d0
Low 8 bit value
Once you have split the data to two 8 bit words: Low_byte
d7
d6
d5
d4
d3
d2
d1
d0
High_byte
0
0
0
0
d11
d10
d9
d8
You then need to select to which register you need to write these values. This is done via lines C4 and C5 on the PIC. The table below shows how to select the register: C4
C5
Data Register
0
0
Low byte
1
1
High byte
In order to program the D/A you need to do the following: Enable the output - Pull RB4 low Enable the chip using RB2 and RB1 Wite the low byte to port D Assert A0 & A1 low Pulse the write line write the high byte to port D Assert A0 & A1 high 12
Pulse the write line Once the above operation is performed, the output of the D/A will be updated to reflec the value that you programmed. The 12 bit integer value is related to the output voltage via: int_value = 2048 + (Vdesired/5.0)*2047; 7.1.4 Using the encoder chip
An encoder is a sensor which is equipped with two optical senors and a rotating disc attached to the shaft whose position you want to measure. The disc is etched with lines radially such that when a line lines goes past the sensors pulses are generated at the outputs of the two sensors. The signals from sensors are typically called the A & B pulses. These pluses are out of phase resulting in 4 state transitions in the pulses per line. When the film is mounted to a rotating shaft the device is called a rotary encoder. The number of lines per revolution determines the resolution of the encoder. A 1000 line encoder has a resolution of 360/1000 = 0.36 degrees. Counting the number of pulses results in the measurement of the rotation of the shaft. Counting the number of state transitions can increase the resolution four-fold. When a counter is attached to the A&B channels, it can be configured to count in quadrature , ie count every transition in A or B from low to high. In this case, a 1000 line encoder can result in a resolution of .36/4 = 0.09 degrees. The motor on the DCMCT is equipped with an encoder. The A& B channels of the encoder are fed to an encoder counter chip which is coupled to the QIC via the parallel port. The encoder chip is the LS7266 and has a variety of registers that are used to program it and read the encoder counts from. A variety of functions are supplied in the accompanying software that will enable you to use the chip. 7.2
Interfacing to the Analog Plant Simulator
The system is fully compatible with the Quanser Analog Plant Simulator. You may implement analog controllers by wiring the system appropriately.
13