QET Motor Trainer

13
1 Quanser Engineering Trainer DC Motor Control User Guide Quanser Consulting Inc.

Transcript of QET Motor Trainer

Page 1: QET Motor Trainer

1

Quanser Engineering TrainerDC Motor Control

User GuideQuanser Consulting Inc.

Page 2: QET Motor Trainer

2

Quanser Engineering TrainerDC Motor Control

1 Introduction

The DC MOTOR CONTROL TRAINER (DCMCT) is a versatile unit designed to teachthe fundamentals of motor servo control in a variety of ways. The system can readily beconfigured to control motor position, speed and current using the followingimplementations:

1.1 PID Tuning Fundamentals course can be given using the DCMCT inconjunction with a QIC Processor Core and the DCMCT qKInterfaces. TheqKInterfaces offer easy setup experiments in System Identification, PositionControl and Speed Control. A course is available allowing to teach these withminimal setup time.

1.2 Analog feedback control using the Quanser Analog Plant Simulator or anyother analog computer including OP-AMP circuits implemented on breadboards.A breadboard is available on the system for students to implement their ownanalog 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 useSimulink to generate code and run it in realtime on a PC. The system is fullycompatible with any of the Quanser Hardware in the Loop (HIL) boards as wellas National Instruments E-series boards and the dSpace DS1104 board. Thesystem is fully controllable using Quanser’s WinCon or SLX RT as well asRTWT, XPC target, LabVIEW and Control Desk.

1.4 PIC Microcontroller control. The Quanser QIC Processor Core can readily beplugged into the DCMCT unit. The user can then program the PIC to control themotor 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 whenthe system is purchased with a QIC.

1.6 Haptic Virtual Ball and Beam. This is java component that simulates a ball andbeam experiment dynamics on a PC. It also provides the user with a realtimegraphic simulation such that the user can command the beam angle via theDCMCT and program “feel” in the knob to sense the ball rolling. This system caneasily demonstrate the positive effect haptics has on operation in virtual orremote environments.

Page 3: QET Motor Trainer

3

Figure 1

2 Control options

The photograph in Figure 1 shows the general layout of the system and the various

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 boardor 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 PlantSimulator can be used to implement analog controllers. In this case the encodercannot be used.

2.3 Breadboard implementation. You may implement a controller of your owndesign on the supplied breadboard

2.4 Embedded controller. A socket is supplied which allows you to insert a QIC

Page 4: QET Motor Trainer

4

Figure 2 Block diagram of DCMCT

embedded controller. The signal connections are automatically made when theQIC is installed. Quanser supplies qKInterfaces to communicate with the QIC inrealtime for tuning and data collection.

3 System components

A block diagram of the system is shown in Figure 2. The individual components aredescribed below.

3.1 High quality DC (Maxon brand) motor - This is a Graphite Brush DC motor with alow 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. Theinput to the amplifier can be configured to be either the voltage at the RCA jacklabeled Command or the output of the built in D/A. The built-in D/A can only beused if a QIC board is connected to the system and the appropriate jumperinstalled (J6).

Page 5: QET Motor Trainer

5

3.3 QIC compatible socket - A QIC processor core board can be plugged into thissocket to enable one to perform closed loop control using the QICmicrocontroller.

3.4 Analog current measurement - a series load resistor is connected to the outputof the amplifier. The signal is amplified internally to result in a sensitivity of 1.8Volt/Amp. This signal is available at the RCA jack labeled Current. It is also levelshifted and scaled and made available at the QIC header so it can be used by aQIC based controller. This measurement can be used to either monitor thecurrent 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 opticalencoder is mounted to the rear of the motor. The optical encoder signal an beused at the DIN plug by a HIL board. The encoder signals are also fed to anencoder counter IC that interfaces with the QIC in order to perform encoderfeedback control using the QIC.

3.6 Analog speed measurement - An analog signal proportional to speed is availableat the RCA jack labeled Tach. It has the range of ± 5 Volts. The signal is alsoscaled and level shifted to the range of 0-5 volts and made available to the QICheader so that it can be used by a QIC based controller.

3.7 Analog position measurement using a potentiometer - a potentiometer can becoupled via toothed belt to the motor shaft in order to implement analog positionfeedback control. The potentiometer signal is available at the RCA jack labeledPot and can be used by an analog computer or a data acquisition board on aPC. This analog signal is in the range of ± 5 V. The signal is also level shiftedand scaled to 0-5 volts and made available to the QIC header so that it can beused by a QIC based controller. The potentiometer belt should be removed inorder to eliminate the effects of extra friction when running speed control andencoder position feedback experiments as well as to extend the life of thepotentiometer. It is especially recommended that the potentiometer belt beremoved while running speed control experiments. Although the potentiometer israted for 10 million revolutions its life will quickly diminish when running at 2000RPM for long durations. Running the potentiometer at 2000 RPM for examplewould reduce its life expectancy to 83 days! Potentiometers are typically used inposition control systems and as such are not expected to continuously turn athigh 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 powersupplies can be used for external circuitry.

3.9 Wall transformer- A wall transformer is supplied to deliver the required ACvoltage to the board.

Page 6: QET Motor Trainer

6

3.10 12 bit D/A is available and can be used only if the QIC board is installed. This willallow feedback controllers implemented on the QIC to drive the D/A instead ofthe external Command input. The jumper JP6 must be set to use the D/A outputto drive the amplifier and the output must be enabled using RB4. The output ofthe 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 isinstalled, the encoder measurements can be read by the QIC.

3.12 Secondary encoder input. An additional external encoder can be attached to thesystem such that it can be read by the QIC. This can be used for thedevelopment of other experiments by the user.

3.13 External analog input to QIC. The analog input applied to the RCA jack labeledCommand is level shifted and scaled such that a signal in the range of ± 5 Vapplied to it is made available as a signal in the range of 0-5 volts at the QICinput AN4. This is useful if you want to apply external command signals to a QICbased controller.

Page 7: QET Motor Trainer

7

Figure 3 External connections to the DCMCT

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

Input

RCA1 Command signal topower amplifier

± 5 VDC

Serial

DB9 Serial to QIC RS232

Power

6mm jack AC power to board 15 VAC

Page 8: QET Motor Trainer

8

5 System ParametersValue Units Symbol

Motor

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

Linear Amplifier

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

Current sense

Current sensitivity (+/- 10%) 0.556 Amp/Volt Gcurr

Encoder

Lines per revolution 1024 Lines

Resolution- Quadrature 0.0879 Deg / count GEnc

Type TTL

Signals A, B, Index

Potentiometer

Resistance 10 kS

Bias voltage ± 4.7 V

Electrical range 350 Degrees

Sensitivity 39 Deg / V Gpot

Tachometer (Analog output - digitally derived from Encoder)

Sensitivity 1.5 V / 1000 RPM Gtach

Page 9: QET Motor Trainer

9

Figure 4 Location of J6 for control fromvoltage at Command RCA jack

6 Interfacing to a Quanser HIL board

The system is fully compatible with allQuanser HIL terminal boards and as such canbe used to perform control experiments on aPC. The realtime controller is typicallydesigned in Simulink and running realtimeusing WinCon. Typically connect as follows:

é é é Location of J6

HIL Terminal board DCMCT Signal range Signal

Inputs Outputs

Analog input 0 » Pot ± 5 V Potentiometer

Analog input 1 » Tach ± 5 V Tachometer

Analog input 2 » Current ± 5 V Current

Encoder 0 » Encoder TTL Encoder

Output Input

Analog output 0 º Command ± 5 V Amplifier command

Page 10: QET Motor Trainer

10

Figure 5 Location of J6 for control fromonboard D/A controlled by QIC

7 Interfacing to the QIC Processor Core

When a QIC core is inserted into the QICSocket on the DCMCT, you can use the QICto measure all the sensors and to control theamplifier. In this case the jumper J6 should beconfigured such that the D/A output on theboard drives the linear amplifier.

é é é Location of J6

With the QIC Core inserted, the following connections are attained:

QIC Core DCMCT

Function Pin Name Signal range Signal

Inputs 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 analoginput

Encoder ENC ENC » A, B, Index Encoder

Pushbutton RB0 INT » TTL, Pulledhigh

PB

Outputs Inputs

D/A output enable RB4 RB4 º TTL, PulledHigh

Enable DA OUT

Analog out D/A Vout º ±5 V AmplifierCommand

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 thesensors, the QIC can be made to drive two LED’s and read the state of a momentaryaction pushbutton switch. These are useful when performing certain types ofexperiments supplied with the DCMCT qKInterfaces.

Note that RB4 is used to enable the output of the D/A to drive the amplifier. RB4 must

Page 11: QET Motor Trainer

11

be pulled low by the QIC to enable the D/A output. You still need to physically movejumper 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 afactor of 2 when measured by the QIC A/D’s as opposed to the RCA jacks. The reasonis that the RCA outputs are in the +/- 5 V range while the A/D inputs to the QIC are inthe 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 arethe 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 onboarddevices you need to enable. The table below shows the way to select the device youwant.

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.

Page 12: QET Motor Trainer

12

7.1.3 Using the D/A Chip

The QCM is equipped with a 12 bit Digital to analog converter that interfaces to the QICcore via an 8 bit bus. The bus is attached to PORT D on the QIC. Reading and writingto 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 thenwrite to it the desired values.

The device has two registers which must be written to in order to obtain the desiredoutput. These are controlled via pins C4 & C5 on the QIC. In order to write a 12 bitvalue 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 bitswhich can be divided as follows:

d11 d10 d9 d8 d7 d6 d5 d4 d3 d2 d1 d0

High 4 bit nibble 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 donevia 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 lowEnable the chip using RB2 and RB1Wite the low byte to port DAssert A0 & A1 lowPulse the write linewrite the high byte to port DAssert A0 & A1 high

Page 13: QET Motor Trainer

13

Pulse the write line

Once the above operation is performed, the output of the D/A will be updated to reflecthe 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 discattached to the shaft whose position you want to measure. The disc is etched with linesradially such that when a line lines goes past the sensors pulses are generated at theoutputs of the two sensors. The signals from sensors are typically called the A & Bpulses. These pluses are out of phase resulting in 4 state transitions in the pulses perline. 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 1000line encoder has a resolution of 360/1000 = 0.36 degrees. Counting the number ofpulses results in the measurement of the rotation of the shaft. Counting the number ofstate transitions can increase the resolution four-fold. When a counter is attached to theA&B channels, it can be configured to count in quadrature , ie count every transition inA 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 theencoder are fed to an encoder counter chip which is coupled to the QIC via the parallelport. The encoder chip is the LS7266 and has a variety of registers that are used toprogram it and read the encoder counts from. A variety of functions are supplied in theaccompanying 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 mayimplement analog controllers by wiring the system appropriately.