Académique Documents
Professionnel Documents
Culture Documents
-1-
Fig. 2 Photos of armature (rotator), brushes and stator with permanent magnet.
-2-
DC Brushed PM (Permanent Magnetic) Motor Characteristics Torque-speed curve - stall (or starting) torque, Ts : the maximum torque that the motor can produce at zero speed. - no-load speed, max : the maximum speed that the motor can attain when there is no load. PM motor is ideal in control application because of the linearity of its torque-speed relation as shown in Fig. 3.
Ts
max
Fig. 3 DC PM motor schematic and torque-speed curve. Motor Dynamics
La ia V(t) + _
Ra
+ Vb _
-3-
Consider the schematic diagrams of Fig. 4 and Fig. 5 where J m : motor inertia V : armature voltage Vb : back emf (electromotive force) Bm : damping coefficient La : armature inductance m : rotor position Ra : armature resistance m : generated torque ia : armature current l : load torque : magnetic flux due to stator n : gear ratio. The differential equation for the armature current in Fig. 4 is then
La dia + Raia = V Vb (Electrical Eq.). dt
d 2 m d 1 + Bm m = m l (Mechanical Eq.). Jm 2 dt dt n Also, if the stator produces a radial magnetic flux, , and the current in the rotor (also called the armature) is ia , then there will be a torque on the rotor causing it to rotate. The magnitude of this torque is (refer to Lorentzs Force Law, F = ia )
m = K1 ia = KT ia (Torque Eq.)
where KT is the torque constant [N-m/amp]. Whenever a conductor moves in a magnetic field, a voltage, Vb , is generated across its terminals that is proportional to the velocity of the conductor in the field. This voltage, called the back emf, will tend to oppose the current flow in the conductor by
Vb = K 2 m = K E m (Back emf Eq.)
where K E is the back emf constant [V-sec/rad]. Substituting the torque and back emf equations into the electrical and mechanical equations gives the following dynamic equations for the electrical and mechanical systems in the Laplace domain by
1 ( La s + Ra ) I a ( s) = V (s) K E m ( s) and ( J m s + Bm ) m ( s ) = KT I a ( s ) l ( s ) . n Assuming l (s) = 0 and combining the above two equations yields the following transfer function of V (s) to m (s) as
-4-
m ( s)
V (s) -
KT (Transfer Function). ( La s + Ra )( J m s + Bm ) + K E K T
From the above transfer function, we can draw the block diagram of a DC motor shown in Fig. 6.
(e.g., ON and OFF). This frequency is usually in excess of 1kHz. The high value is held during a variable pulse width t during the fixed period T where T = 1 / f . The resulting waveform has a duty cycle, defined as the ratio between the ON time and the period of the waveform, usually specified as a percentage:
duty cycle =
t 100 % . T
In PWM control, the voltage with fixed period and magnitude and variable duty cycle is switching rapidly across the armature, however, since the current is affected by the motor inductance and resistance, the resulting current through the motor has a small fluctuation around an average value as shown in Fig. 7. As the duty cycle gets larger, the average current gets larger and the motor speed increases.
-5-
H-Bridge Drive for a DC Motor In order to control the position of a DC motor, we must be able to change the current
direction to the motor. This can be accomplished by using four power transistors arranged in an H configuration around the DC motor as shown in Fig. 8. If transistors Q1 and Q3 are turned on, and Q2 and Q4 are off, current will flow through the motor in the direction shown and the motor will rotate in one direction. If Q2 and Q4 are on, and Q1 and Q3 are off, the motor will rotate in the other direction.
One of the simple solutions to implement the H-bridge is to use a LMD18200 (3A, 55V Hbridge) by National Semiconductor as shown in Fig. 9 (we will use this chip in the project II).
-6-
Rotary Potentiometer Variable resistance device that can be used to measure angular position.
It consists of a wiper that makes contact with a resistive element, and as this point of contact moves, the resistance between the wiper and end leads of the device changes in proportion to the angular displacement as shown in Fig. 10. Typically, through applying a voltage, the change in resistance can be used to create an output voltage that is directly proportional to the input displacement.
sensor (tachometer constant: volt/rpm) can be used to measure the angular velocity of a motor by means of voltage.
Incremental Encoder It consists of two tracks and two sensors whose outputs are called channels, A and B as
As shown in Fig. 12, the A and B channels are used to determine the direction of rotation by assessing which channel leads the other. The signals form the two channels are a 1/4 cycle (90 degrees) out of phase with each other and are known as quadrature signals. A third output channel, called INDEX, yields one pulse per revolution, which can be used to define a home or zero position.
Fig. 12 Incremental encoder disk track patterns. Through an appropriate decoder circuit, the quadrature signal can be decoded to yield up and down counts in 1x, 2x and 4x resolutions as shown in Fig. 13. For example, if we have a rotary encoder with 500 line/rev, the resolution with the 4x counter is 2000 pulse/rev.
-8-
potentiometer, rotating hand and angle meter, Copley PWM servo amplifier (50V & 5A), 24V switching power supply (10A), wooden base). Oscilloscope (HP 54600B) Digital Multi Meter (HP 34401A) Function Generator (HP 33120A) Digital Power Supply. Test Leads and Connection Wires.
ANGLE METER
DC MOTOR
P E N D U L U M
P O T
V+ V-
G AC AC
J1
J2
-9-
Confirm that the green light of the servo amplifier is ON (if the green light is OFF or the other red lights are ON, report to the TA). Verify the operation of the servo amplifier and DC motor by applying a voltage (smaller
+ than 3 V) to the Vref pin, using the power supply (amplifier and motor tests).
By rotating the shaft of motor with different speeds, measure the voltage from the VT+ pin of the tachometer, using the oscilloscope (tachometer test). By rotating the shaft of motor, verify the operation and electrical angle of the potentiometer at the VW pin, using the oscilloscope (rotary potentiometer test).
NOTE: all grounded elements ( Vref , VT , and the reference and potentiometer ground
terminals) should be tied to the measurement equipment grounds, and report to the TA if you find a problem in operation.
Tests of a DC Motor and Sensors 1. Open loop test of a DC motor
Function
Generator
Fig. 2 Connection diagram for measuring the open loop response of a DC motor.
(Note: all grounded elements should be tied to the measurement equipment grounds.)
(1) Power off the motor apparatus. (2) Connect the outputs of the motor test bed to the oscilloscope channels as shown in Fig. 2. Operate the output of the function generator to be shown below.
2V
duty = 50%
0V
10sec
(3) Adjust the Ch 1 screen of the oscilloscope to be fitted (for example, operate Volts/Div, Time/Div, position and probe scale knobs), and set the trigger source to Ch1. - 10 -
(4) Power on the motor test bed. (5) Adjust the Ch 2 screen of the oscilloscope to be fitted as shown below.
Ch1
Ch2
tS
(6) Record the required time for the motor to reach its final angular velocity (tachometer voltage) from Ch 2. It may be helpful to use the STOP button in the STORAGE keys to hold the screen. (7) Change the upper voltage of the function generator from 1 to 3V, and report the settling time at a few different voltages. (You can change the period time if it is necessary.) (8) When you finish the recording, turn off the function generator to stop the motor. 2. Measurement of tachometer constant DC Motor Test bed
+ Vref
Power Supply
VW VT+
Fig. 3 Connection diagram for measuring the open loop response of a DC motor. (1) Connect the outputs of the motor apparatus to the oscilloscope channels as shown in Fig.
+ 3, and apply 1 V to the Vref .
(2) Adjust the screens of the oscilloscope Ch1 and 2 to be fitted. (3) The outputs of the potentiometer (Ch1) will be saw-toothed waves from 0 to 5V, and the period is equal to the time for the motor to rotate one turn. Calculate the motor speed in RPM (revolute per minute), and read the voltage from the tachometer.
Ch2 Ch1
(4) Repeat the above steps at several different input voltages, and calculate the tachometer constant (volt/rpm). - 11 -
Power Supply
Motor( + )
Motor()
Fig. 4 Connection diagram for testing the PWM amplifier. (1) Connect the outputs from the PWM amplifier to the oscilloscope channels as shown in
+ Fig. 4, and apply a voltage to the Vref . (Be careful not to have a short circuit.)
(2) Adjust the screens of the oscilloscope Ch1 and 2 to be fitted. (3) Record the duty ratio of PWM signals as varying the input voltages from 4 to 4V. (4) Report the results and the gain of the amplifier (duty ratio/volt).
Analysis and Results: Plot voltages of function generator input and tachometer vs. time. Determine the mechanical
time constant and settling time at different input voltages. (Mechanical time constant: if a motor is given a step voltage, the time required for a motor to reach 63.2 % of its final speed is the mechanical time constant, provided the electrical time constant of the armature does not affect the measurement.) Plot voltage of tachometer vs. angular velocity in rpm, roughly. Calculate the averaged tachometer constant (volt/rpm). Explain why the back emf generates. Plot duty ratio of PWM output signal vs. input voltage, roughly. Calculate the averaged gain of the motor amplifier (duty ratio/volt). Discuss the advantages and disadvantages of PWM method.
- 12 -
potentiometer, rotating hand and angle meter, Copley PWM servo amplifier (50V & 5A), 24V switching power supply (10A), wooden base). PCI-1200 card for 1 Ch. D/A & 2 Ch. A/D. DAQ Signal Accessory. NB1 Ribbon Cable, 2 m. Test Leads and Connection Wires.
Objectives: - To check the functions of PCI-1200 and to operate the board by LabVIEW. Hardware of PCI-1200
8 single-ended, 4 differential channels 100 kS/s sampling rate 12-bit resolution 2 channels, 12-bit resolution 24 (5 V/TTL) lines in 8-bit ports Three, 16-bit resolution - 13 -
Analog Output CH0 Polarity Analog Output CH1 Polarity Analog Input Polarity Analog Input Mode
Bipolar5 V (reset condition) Unipolar0 to 10 V Bipolar5 V (reset condition) Unipolar0 to 10 V Bipolar5 V (reset condition) Unipolar0 to 10 V Referenced single-ended (RSE) (reset condition) Nonreferenced single-ended (NRSE) Differential (DIFF)
(a) Differential (DIFF) (b)Referenced single-ended (RSE) Fig. 2 Analog Input connections
DAQ Signal Accessory
- 15 -
0 1* 2 3 4 5 6 7
IC temperature sensor Quick connect terminal Quick connect terminal Tied to analog ground Thermocouple jack IC temperature sensor Microphone jack Available for custom wiring
(2) Function Generator The function generator produces a 2 V pp (peak-to-peak voltage) sine wave and a transistor to transistor logic (TTL) square wave. Use the function generator Frequency Range selector switch to select a frequency range. The choices are 100 Hz to 10 kHz, 1 to 100 kHz, or 13 kHz to 1 MHz. Use the Frequency Range knob to further adjust the frequency. (3) Counter/Timer
- 16 -
CCW A: B: Low
CW A: B: High (Counter 2)
B: A: High (Counter 1) B: A: Low Condition of 8253/8254 counters: high-level gating (mode 0), a counter can count the input pulse only when the gate is high (see National Instruments Application Note 084 - Using Quadrature Encoders with E Series DAQ boards).
Basics of LabVIEW Refer to Student edition LabVIEW for more detailed information. Here, very basic things
are explained.
Fig. 1 A front panel and the associated block diagram. If the VI has Compilation errors
G
Fig. 3 Tools, controls and functions palettes. What are Virtual Instruments? LabVIEW programs are called virtual instruments (VIs) because they have the look and feel of physical systems or instruments. What is a Sub VI? A Sub VI is a stand-alone VI that is called by other VIs. It is similar to a sub function in C language. There are many well-established Sub VI, and you can directly use Sub VIs to construct your own applications (or VIs). Data types Icons Data Type Signed 16-bit integer Single-precision floating-point number Double-precision floating-point number
- 18 -
String Boolean
Wire types
MAX (Measurement Automation Explore) You can operate and configure the PCI-1200 directly by MAX. Go to cursor to PCI-1200
(Device 1) and select Test Panel as shown in the left figure. From Test panel, you can control PCI-1200 as shown in the right figure below.
Tests of PCI-1200 functions by LabVIEW In this test, we use DAQ Signal Accessory to check the functions of PCI-1200 DAQ card.
Connect NB1 Ribbon Cable from PCI-1200 card to the connector Lab/12000 Series Device (No. 18 in Fig. 3) of Signal Accessory. Confirm that the power LED (No. 3 in Fig. 3) is ON.
(1) Analog Input Using Easy Analog Input VIs - In this test, we will measure the voltage output of function generator in the Signal Accessory through AD Ch 1. - Connect the square wave output (No. 14) of function generator to AI Ch 1 (No. 15) by a wire. - Run LabVIEW and open a new VI. Then, two windows appear on the screen. One is front panel and the other is block diagram. Choose the block diagram window. - There are four classes in Analog Input VIs. In the first step, we use Easy AI VIs.
- 20 -
Select AI Acquire Waveform.vi (Function palette Data Acquisition Analog Input), and place the VI into the Block diagram window. This Sub VI has 6 input parameters and 2 output parameters, however, we dont have to specify high and low limits since the limits are already configured to 5V and +5V by MAX.
Press the right mouse button on the VI to open the pop-up window. Go to Create and select Control for device, channel, no. of samples, and sample rate. Choose Indicator for waveform. You can arrange the blocks by changing the hand cursor ( ) to the arrow ( ) in the tool palette. The block diagram and front panel windows will look like
Change waveform to Waveform Graph by pressing the right mouse button and selecting Replace, Graph and Waveform Graph. Enter the right device (PCI-1200 configured to 1) and channel numbers (If you want to use the second AI channel, enter 1 because of the number starting from 0), and run the program. The final front panel window will look like
- 21 -
(2) Analog Input Using Analog Input Utility VIs - We cannot measure the voltage continuously by using AI Acquire Waveform.vi, because the number of samples is limited. In this program, AI Read One Scan.vi (Function palette Data Acquisition Analog Input Analog Input Utility) and While Loop are used to measure a voltage continuously. First, place While Loop (Function palette Structures) on the block diagram window, and AI Read One Scan.vi in the while loop. Note that roughly, there are two types of outputs, binary and scaled arrays. The former outputs in binary way, and the latter outputs in real value, i.e., voltage. Change the output type by pressing the right mouse button on the VI and choosing Select Type and Scaled Array.
In a similar way to the previous program, make control inputs and output indicators. The while loop continuously iterates until the condition is true. To terminate the while loop Boolean control switch is used. Furthermore, to measure the voltage at a fixed rate, Wait Until Next ms Multiple.vi (Function palette Time & Dialog) is used, which waits until the value of the millisecond timer becomes the specified millisecond. For example, if you set the value of timer to 1, the while loop will repeat every one millisecond. The resulting block diagram and front panel are as follows:
- 22 -
(3) Counter - Connect wires as shown in Fig. 4, and download Quad encoder with PCI-1200 (8253).vi from the class homepage. Run the VI, rotate the knob and see the result.
In this program, counter 1 is used to count the CW rotation pulses, and counter 2 to count the CCW rotation pulses. The difference between the counts is the total rotational distance.
Analysis and Results: Make the two analog input LabVIEW programs by your selves in a group, and turn in the
files to the TA by mail. Practice more DAQ VIs in the remaining time. There are a lot of examples for DAQ. For example, go to Program Files/National Instrument/ LabVIEW 6/examples/daq and in the pulldown menu of LabVIEW, Tools Data Acquisition DAQ Solution Wizard. The other way is to search National Instruments Website, www.ni.com. You can find many useful examples. In my opinion, the best way is to read the reference book, Student Edition LabVIEW 6i. Specially, read Ch1- LabVIEW Basics, Ch5-Structure (For, While, Case Loops), Ch6-Arrays and Clusters (Array part), Ch8-Data Acquisition (AI & AO). The chapters 1, 5 and 8 are very important to perform this project. Finally, some useful PDF files for LabVIEW are linked in the class homepage.
- 23 -
potentiometer, rotating hand and angle meter, Copley PWM servo amplifier (50V & 5A), 24V switching power supply (10A), wooden base). PCI-1200 card for 1 Ch. D/A & 2 Ch. A/D. DAQ Signal Accessory. NB1 Ribbon Cable, 2 m. Breadboard. Resistor: 2-2 K. Potentiometer: 1-10 K single turn. Capacitor: 2-104 (0.1 F). Test Leads and Connection Wires.
To control the angle of DC motor every 30 degrees by using PCI-1200 and LabVIEW.
Background of PID controllers
u (t ) = P(t ) + D(t ) + I (t ) t de(t ) = K p e(t ) + K D + K I e( )d dt where e(t ) d (t ) (t ) , and d (t ) and (t ) denote the desired and actual positions. Digital PID Controller
u (k ) = P(k ) + D (k ) + I (k ) = K p e(k ) + K D
k e(k ) e(k 1) + K I he(i) h i =0
- 24 -
100
100
80
80
[deg]
[deg]
60
60
40
40
20
20
0 0 5 10 15 20 25 [msec] 30 35 40 45 50
10
15
20
25 [msec]
30
35
40
45
50
(a) K P = 5, K D = 0, K I = 0
Position Regulation 120 120
(b) K P = 30, K D = 0, K I = 0
Position Regulation
100
100
80
80
[deg]
60
[deg] 0 5 10 15 20 25 [msec] 30 35 40 45 50
60
40
40
20
20
0 0 5 10 15 20 25 [msec] 30 35 40 45 50
(c) K P = 30, K D = 1, K I = 0
(d) K P = 30, K D = 1, K I = 10
Physical meanings of PID terms The motor is held at the desired position by applying a restoring force to the motor that is
proportional to the position error, plus the integral of the error, plus the derivative of the error. (1) The proportional term provides a restoring force proportional to the position error, just as does a spring obeying Hooke's law. (compare between (a) and (b) in Fig.1.) (2) The derivative term provides a force proportional to the rate of change of position error. It acts just like viscous damping in a damped spring and mass system (like a shock absorber in an automobile). (compare between (b) and (c) in Fig.1.) (3) The integration term provides a restoring force that grows with time, and thus ensures that the static position error is zero. If there is a constant torque loading, the motor will still be able to achieve zero position error. (compare between (c) and (d) in Fig.1.)
- 25 -
Making PD Controller by LabVIEW Fig. 2 shows the block diagram of PD-controller for a DC motor apparatus. Instead of
differentiating the value of position sensor, the controller uses tachometer to get velocity information. The resulting command input Vin to the motor can be calculated as
& & & Vin = K P ( d ) + K D ( d ) = K P ( d ) K D
where d and &d = 0 denote the desired angular position and velocity, and and & are the actual sensed angular position and velocity, and K P and K D are the position and velocity gains.
+
d
&d = 0
KP
+
+ +
Vin
Amp
Motor
Tacho
&
Pot
KD
In this program, some more Sub VIs are added, for example, Case Structure to select types of desired input, AO Write One Update to generate the control output, Build Array and Index Array and some numeric VIs as shown in Fig. 3. Since the one-turn potentiometers output is form 0V to 5V, the gain 5/360 [V/deg] is used to enter the position in degrees instead of voltage. Also, to compensate the offset, the offset control is added as shown in Fig. 4.
way to reduce electrical noses is to use a passive low-pass filter made up of one resistor and one capacitor. The low-pass filter (see Example 4.1 in Ch. 4) acts cutting off the high frequency signals at the cut-off frequency, f c = C = 0.1F , then f c 800Hz . - 27 -
We use the DAQ Signal Accessory to interface the DC motor apparatus with PCI-1200 board as shown in Fig. 5.
DC Motor
Vw
Breadboard
2K 0.1F(104)
(Voltage divider) 2K
VT
+
AI Ch 2 0.1F(104)
10K
GND Vref
+
GND AO Ch 1
hour hand from 11 oclock to 1 oclock by one hour in the direction of counter clockwise. Then, rotate the hand form 1 to 11 by two hours in that of clockwise. Based on the given VI, make a VI to perform the tasks automatically (The position control performance will be checked in the next lab hour).
0V
Up to 5V around 12 o'clock
12 11 10 30 1 2
8 7 6 5
- 28 -
Submit the final report of the Project I by the review, which contains General description of the project. Explanation of the control program (VI) you made. Report the final values of the P- and D-gains and discuss the functions of the position and velocity controllers. Explain the calibration procedure and result of the angle vs. voltage.
- 29 -