Jack, H., "Teaching Mechanical Students to Build and Analyze Motor Controllers", ASEE National Meeting, Nashville, June, 2003.
All junior Mechanical and Manufacturing engineering students take EGR 345, Dynamic Systems Modelling and Control, at Grand Valley State University. This course looks at modeling systems with mechanical, electrical and other components. This is supported by laboratory work that includes motor modeling and feedback control. There is also a major design project in the course to reinforce theoretical and experimental design. The topics covered in the course are listed below.
Prerequisites for the course include basic circuits, statics, differential equations and digital systems (C programming on 6811 microprocessors). The course is followed by another controls course, EGR 450 - Manufacturing Control Systems, which focuses on discrete state control systems using PLCs. EGR 450 is required for the Manufacturing students, while it is a popular elective for the Mechanical students. EGR 450 is followed by EGR 474 - Integrated Manufacturing Systems, which focuses on high level control using databases and networks to integrate devices such as robots and CNC machines. EGR 474 is a popular elective for Manufacturing students, and an elective for the Electrical students.
Throughout the course students use computers for numerical analysis, data collection and control. The software used includes Mathcad, Labview , Scilab (a free Matlab clone) and C/C++ compilers. Use of these tools is reinforced throughout the semester with laboratory work that uses industrial sensors and actuators to verify theoretical calculations. The laboratory sequence is listed below.
The first motor laboratory examines motor speed control using an inexpensive transistor and pulse width modulation (PWM). The second laboratory experiment focuses on modeling DC brushed motors and deriving basic parameter values. The final experiment uses a proportional feedback controller to control the motor speed. When the laboratory sequence is complete students are able to build and analyze basic feedback controllers.
The controller the students analyze and build is based upon a transistor which switches power to the motor. To allow the effective voltage to be varied, a pulse width modulation method is used, as shown in Figure 1. The power is switched fast enough so that the dynamic effects of the motor filter out the effects of the rapid switching. Typically this can be a frequency as low as 100Hz, although a higher frequency is better, and above 20KHz puts it above the audible range. This method does require some sophistication to generate the PWM signal, but the result is a much simpler and more efficient power amplifier.
The motor control system is connected as shown in Figure 2. The counter output from the computer drives a TIP-120 (Darlington coupled NPN) transistor that switches the voltage from a high current (>1amp) voltage supply. When the counter output is on (+5V) the transistor turns on and allows current to flow. In this configuration the voltage across the transistor is about Vce = 2V (the Vce value is available in the transistor datasheets). This means the maximum voltage delivered to the motor is Vs = Vp - Vce. Multiplying this by the duty cycle gives the effective (RMS) voltage delivered to the motor. The shaft of the motor is coupled to the tachometer. The tachometer can be any permanent magnet DC motor. When the shaft of the motor is turned, it acts as a generator and delivers a voltage that is proportional to angular velocity. The voltage from the tachometer is read as an analog input (Vt) to the computer.
Part of the setup procedure requires that the speed-voltage ratio for the tachometer be established experimentally. This is done by supplying a voltage to the motor, and measuring the motor speed (ω) and tachometer voltage (Vt). We normally measure the angular velocity with a strobe light tachometer. Multiple readings are taken by changing the motor voltage and then repeating the previous readings. Graphing the data should yield a straight line and show a linear relationship. The data can be used to determine the coefficient ‘Kt’ in the equation Vt = Kt(ω).
The computer is interfaced to the process through a National Instruments PCI-1200 DAQ card . It is used to read the analog voltage input from the tachometer and generate the PWM motor output with a counter. The PWM output is characterized with a frequency for the output pulses, and a delay for the on/off transition as shown in equation 1. In this application the frequency remains fixed, but the counter value is changed to vary the duty cycle. When using the counter the upper and lower limits must not be exceeded. At best this will make the system non-linear, at worst it may make the motor output unpredictable.
A Labview program, similar to that shown in Figures 3 and 4 is written by the students to handle inputs and outputs, and do calculations. The front panel is shown in Figure 3. It has a knob so that a desired speed can be set, and a chart that displays the tachometer speed reading as a function of time.
The wiring diagram in Figure 4 shows the basic system setup. Variables have been labeled so that they correspond to the equations in this paper. Outside the while loop there is a calculation that only needs to be done once, and the “PULSE CONFIG” function to setup the counter on the PCI-1200 DAQ board. Inside the while loop are the functions that should be repeated each scan. On the left hand side the analog voltage is read in using the “AI ONE PT” function block. The voltage is converted to a speed and subtracted from the desired voltage. It is then multiplied by the controller gain constant to obtain the desired motor voltage. This is then converted to a counter value that will produce a corresponding PWM output with the “ICTR Control” function block. This program does not include functions to limit the values to the counter. The scan time is notably absent in this program because the proportional control equation is not a function of time.
The equations for the control system are given below. Equation 2 was obtained by manipulating equation 1 to isolate the desired value for the counter as a function of the desired motor voltage. Equation 3 is the proportional feedback controller. Equation 4 is the speed-voltage relationship for the tachometer. Equation 5 is a simplified differential equation for a permanent magnet brushed DC motor, relating the speed of the motor to the supplied voltage. In the equation the ‘K’ and ‘R’ values are fixed, but the ‘J’ value is a function of the inertia in the system. This equation obviously ignores friction and viscosity effects.
The coefficients for the motor equation can be found using the method shown in Figure 5, although other methods are available. In this case the resistance of the motor windings is measured directly. The motor speed constant and the second moment of inertia are determined by applying a voltage step input to the motor and observing the first order response. The steady state speed is used to determine the motor speed constant. The second moment of inertia is determined by finding the time constant of the response and relating it to the coefficient in the first order differential equation for the motor. This method is not perfect, but from a pedagogical perspective it strongly reinforces many important principles of first order differential equations.
Once armed with the constant values for the motor and the tachometer, the system response can be modelled theoretically. The equations for the feedback controller and the motor can be combined and simplified to obtain equation 6.
The laboratories were structured to distribute the laboratory over a three laboratory sequence, as listed below. In the first week students connect a simple motor controller. This establishes a level of comfort with the concepts of pulse width modulation and using transistors for power switching. The second week builds upon the first including the use of motors as tachometers and motor modelling. The third week integrates the components into a feedback control system.
Lab 1 - PWM Control Tutorial - Students are shown how to develop a Labview program to use a DAQ card counter to generate a PWM output from the computer. They then connect this through a transistor to control the speed of a motor.
The results of the experiments are documented in formal laboratory reports. In addition to expected elements, these ultimately include a comparison between theoretical and actual responses of the feedback systems. Through this lab students find the common problem with the proportional controller, particularly the significant steady state error. This supports the lectures by providing a basis for discussion of the Integral and Derivative components of a PID controller.
Upon completion the students are able to construct a fairly complex motor control system that allows them to input parameters and observe the results. These are then compared to the theoretical prediction of performance. There are discrepancies because of standard problems, such as friction and velocity, but the students gain and appreciation of this.
Hugh Jack earned his bachelors degree in electrical engineering, and masters and Ph.D. degrees in mechanical engineering at the University of Western Ontario. He is currently an associate professor at Grand Valley State University and chairs the graduate and manufacturing programs. His research interests include using open source software for industrial control.