Copyright q;:) IFAC System Structure and Control, Bucharest, Romania, 1997
CONSIDERA nONS CONCERNING THE SPEED CONTROL OF ELECTRICAL DRIVE SYSTEMS WITH STEPPER MOTORS
Gheorghe Biilufii,
~tefan
Resmerifii
Gheorghe Btilu{O, "Gh. Asachi " Technical University oflasi, Faculty of Electrical Engineering, Electric Drives and Power Electronics Department, Str. Horia, No. 7-9, 6600, Iasi, Romania, te!. 0321112770, E-mail:
[email protected] $tefan Resmeri{O, "Gh. Asachi " Technical University oflasi, Faculty of Automatic Control and Computer Engineering, Department ofAutomatic Control and Industrial lnformatics, Str. Horia , No . 7-9, 6600, lasi, Romania, tel.0321I 16502, E-mail:
[email protected]
Abstract: This paper presents a method for Stepper Motor (SM) speed control by means of a minor loop. The compatibility of the SM with the digital electronics allowed a PC to be used for implementing the control algorithm, the SM control being achieved by two hardware interface levels. The SM command is realized with two specialized circuits: L297 (SM controller) and L298N (driver). The control signals for this level are generated through a parallel port 18255 and a programmable timer 18253 . Some other circuits complete the microprocessor interface. The software has the following tasks: speed measurement and control algorithm achievement of a PI type. To tune this controller the system characteristics are measured, when the system is unstable, having a relay instead of the PI part. There are treated aspects on choosing the sample period, the position transducer, and the type of speed measurement. Copyright q;:) 1998 IFAC Keywords: Control applications, Control closed-loop, Stepping motors, Numerical algorithms, Computer controlled systems.
I. INTRODUCTION The stepper motors ' electrical pulses into recommends them as between electronics and motors are suitable for systems.
of the electrical scheme and to the improvement of the drive system 's performances. However, there are some disadvantages concerning the open-loop control which have to be taken into consideration: - great sensitivity at load variations; - low maximum speed; - switching resonance.
feature of converting the discrete rotor movements ideal connection elements mechanics; thus, the stepper digitally controlled motion
One of the reasons that stepper motors (SM) are widely used is the possibility of safe operation in an open-loop command scheme; the absence of the position transducer and of the closed-loop control make the positioning with SM the cheapest one.
A closed-loop control of SM-based drive systems eliminates these problems, but the use of position transducers rises the cost price of the plant. A supplementary ' advantage of using incremental position transducers is the possibility of speed control. Concerning this matter, a speed control system is presented using a numerical algorithm.
The appearance of the integrated circuits specialized in SM' s command has also led to the simplification
455
could be done.
The minor loop command of an SM facilitates the achievement of speed control by processing the delay between the feedback pulse (received from the transducer) and the command pulse sent to the motor.
The execution element is the timer no. 2 from the circuit 18253, which gives the clock signal for the SM's command scheme. This timer is set to "programmable one-shot" working mode.
The paper presents a speed control method which uses a numerical PI controller. The control scheme contains a hardware level (IBM-PC plus the interface to the SM) and a software level that is a program written in BorlandC language.
The system hierarchy contains two hardware interface levels between the microprocessor and the stepper motor: - microprocessor to SM command scheme interface is made on a prototype board that is plugged into one of the PC motherboard ' s slots. The interface contains the elements needed to generate the command signals for the SM: a parallel port 18255, a programmable timer 18253, the sense discriminator and the adaptation circuit (Baluta and Caciuleanu, 1992). On the same board there are some other components used in the SM' s control ( e.g. AID and D/A converters) (Baluta et al. 1996). - the SM command scheme, which has the classical structure, achieved with the specialized integrated circuits L297 and L298N (SGS Thompson). These
2. SYSTEM DESCRIPTION Figure 1 presents the general configuration of the system. The motor has two phases, 7.5 degrees/step and is driven by two specialized integrated circuits L297 (controller) and L298N (driver) . The motor's shaft is connected with an incremental optical encoder that gives 250 pulses/rev. (this means 1000 pulses/rev. at
PULSE GENERATOR (11253 - tNZ)
16
CONTROL
SYSITM
USING mM-PC
111253 (clll,c#l)
16
Fig. l . The control system the output of the sense discriminator). The pulses generated by the transducer are input signals for the measurement block, where they are counted by one channel of the circuit 18253 . The timer' s content is then read and interpreted by the control program.
form a complete and minimal drive system for stepper motors, receiving the TTL compatible working signals from computer (sense, clock, phase drive sequence). An important feature is the switchmode control of the current in the motor windings, which allows high speed and safe work (Baluta et. aI. , 1995b).
The adaptation circuit adjusts the number of pulses/rev. offered by the encoder to the number of motor' s steps, giving two output signals: 48 pulses/rev. (meaning one pulse for every motor step) and 1008 pulses/rev. (meaning 21 pulses for the motor step). In this last case, 8 pulses/rev. are artificially injected.
One can observe that there are two closed-loops: the minor loop and the speed control one. The minor loop contains the encoder, the sense discriminator, the adaptation circuit and the channel no. 2 of the circuit 18253 . The speed control loop can be easily seen because it has a classical structure.
The initialization and starting block generates the command signals for the measurement block and the L297 circuit through a parallel port interface 18255.
3. SPEED CONTROL BY PROCESSING THE FEEDBACK PULSES
The digital controller processes the speed error and elaborates the command signal for the execution element. The computing block determines the reference value so that the comparison with the measured value
It is known that, using the motor in a minor loop, the delay between the feedback pulse and the command one determines the motor speed (Kuo and
456
The domain of the sample period is in our case 10 to 50 ms. One can choose a value in this domain without significant changes of the system's performances.
Kelemen, 1981). In our case, the pulses obtained at the 48 pulses/rev. output of the adaptation circuit are sent to the enable input GATE2 of the timer no. 2, which is programmed as a hardware triggered "programmable one-shot"; its CLOCK input is connected to an 1 MHz frequency signal. Thus, one pulse received from the transducer triggers the circuit, its output generating a pulse towards SM after a delay measured in whole number of microseconds; this number represents the command " u" and is programmed by the controller at each sample time (fig. 2).
For speed regulation, it was used a PI controller achieved without any difficulty in a discrete form; this controller gives good results and determines good performances of the control system. In continuous input-output form, function of a PI controller is
the transfer
.PHASE C
START pulse
PHASE C PHASE D SUPPUED SUPPUED
= CT1+1 pS
Fig.2. The switching angle modification The motor speed measurement is done by counting the pulses received from the encoder in a sample time. For this, the other two channels of 18253 (one for each rotation sense) are used . The data acquisition is achieved using the computer real time interrupt handler. The sampling frequency can be established by programming the PC's timer that generates this interrupt.
GR(s)=K R .(1+_1_)= U(s) s~
(1)
&(s)
where U(s) is the command and lO:(s) is the speed error. After converting the model into a discrete one (using the "zero order holder" method) the recursive command formula is obtained:
u( k) = u( k - 1) + K R
The sample time was chosen with respect to the following remarks: - electrical drives are usually fast processes, so that a short sample time must be taken into consideration; - the lowest limit of the sample time is given according to the followings: • during the sample period it has to be done all the operations needed by a good operation of the control algorithm : speed measurement, error calculation, command elaboration and transmission; • the way that speed is measured imposes the lowest limit of the sample time; with a weak resolution transducer and a low reference speed, if the sample period was too low there would be high errors in the measurement block. Using of a high resolution encoder (which is more expensive) eliminates this problem. - the highest limit is given by the transition time between two steady states that depends mainly on the load, but is no lower than hundreds of milliseconds. - another reason is given by the PC's real time interrupt rate; the computer's timer can generate this hardware interrupt up to a period of 55 milliseconds; a sample time longer than this brings about an inefficient use of this interrupt.
. & (k)
+ K R'
T -T S
~
J.
& (k
- 1)
(2)
where Ts is the sample time, TI is the integration time and KR is the proportionality factor. The KR and TI values were found by using a tuning method based on the information provided by the output oscillations at the system 's instability limit (Lazar 1995). For this, the PI controller was replaced with a relay as shown in fig. 3
y
Fig.3. The instable system The command can be written as:
4d 1 1 u(t) = -(cosav --cos3aV +-cos 5aV-.. ·) 7r
3
5
(3)
457
Using (6), it results that ~ = 25.46 . From (7), it is obtained KR = 10 .18 and TJ = 0.12 sec. The final values, after heuristicaI changes are: KR = 7 and TJ = 0.08 sec.
The error amplitude is denoted by a li ; supposing that the plant has a low-pass transfer characteristic, the error amplitude can be written as:
4d
\1
a = -IGp(jcvo~ E
(4)
1[
Let kc denote the equivalent amplification factor of the relay; then
1
k
=----..,.
(5)
IGp(jcvo)1
c
Using the PI controller, the system's behavior at step variation of reference and disturbance is shown in fig . 5. The evolution of the output (motor speed) and of the command (time delay) are also presented. Although the output variation is aperiodicaI, the response time can be lower by decreasing Tj, but the price is the overshoots appearance.
Considering (4), it is obtained
4d
k =cJUl
(6)
c
If To denotes the oscillation period, by measuring a c and To , KR and TJ values can be obtained using the Ziegler-Nichols relations: KR 0.4· kc and 0 0.8· To (7) Providing the PI controller with these parameters the performances obtained were satisfactory. Afterwards the parameters were experimentally modified around the initial values in order to improve system's behavior.
=
A supplementary torque at the motor's shaft determines the command variation in order to maintain the speed at the imposed value. A digital low-pass filter can be added to the measurement block for noise reduction but it needs more computer time; the noise has also no significant influence upon the system 's performances.
=
During the supplementary load, the noise is higher because of the time variance of the added resistant torque.
As experimental results, the error oscillations in the tuning procedure are shown in fig. 4. Imposing d = 800, it follows that a c = 40 , To = 0.15 sec.
60 40 v;
l::
\
~ 20
\
In ~
.Q. (1)
"0
~ ~
0
a.. E CO
I....
g
\
\
-20
w
-40
-60
o
0.5
1
1.5
Time [s] Fig.4. Speed error with a relay as controller
458
2
2.5
SPED> (rev.lmin.J
379.8
316.15 253.2
:
PosmON-4518 (stepsJ
········· ···· · · ·· ·······~··· · · · ··· ··· · ·· ·· ·· ··· ··1···
·························f··· ................... ·
SmSE- COUNTERCLOCWISE STEP ANGLE-7.!o
................. ....
j......................... j........................:........................ .
+................. .. . j...... j.
fIj·IMJ~~~:m"I1MMl!H ·...YWV\MIVV\IVV~'VU
.
189.9
························t···· ............ ..... ..~ ........................
126.6
························r·······················j····· ................... :......................... :........ ················1·························
63.3
... ..... ............ .. . ..
0.0
0
!. . . . ... .... . . . .r-...
<4.133
8.267
··············· ·······:························1······.................. .
·············· ·····1·· ·······················:········ ..... ..... ...... : ... ........ . .. .. ........ .
TIME (s )12.100
16.533
20.667
21.800
TIMEDEJ..AY [msJ
5.131.--------....,....-----:::~-----...;,..:'---.!--'--.,---------.--------,
<4.59<4 ... . .. . ......... . ..... .. ~ .••........ ............ : .... . .... ............ . .. ~ ................ ... . .... : . . .... . ... . .. ... . .... ... : ... .................... . : : : : :
: : : : : ··· ... . .. · . .. .. ·................ 2.920 · .. ······· ······· .... ····f···· ·.. ···· .. ····· .. ···1···· .... ················· .. ···i·· ·· .. · . . 2.082 .........................; ..... . ........ ... ..... ,·... .. ..... ... ... .. ..... . , ...... .... .......... ... :........ . ..... ........... ,...... . . ...... ......... .. . .. ... .... . · . , 3.757 . .................. . . ... . .... ......... ..... ..... : .... ... .......... . .... . , ............. ......... .. ; ...... . .... .. .......... , ............ ... . ........ . ~
·· · ······· · ·· ···~· ·
········ ········ · ·~ · ···· ·
1.2<45 .. .... .. . .......... . .....~ . . . .. ... ..... ....... .. : ................... ..... ~ .......... ....... .... .. . : ... . . ... ...... ..... .. ... : . .. . ........... .. ...... . : : : : .
·
..
.· ·
.
0.108 !:-0- - - - - , - " = - - - - " . . . ; " . ;:;----.,..,,-7;: . ",------;-:;-~---___:::_::-';,;:;---...".,.~ <4. 133 8.207 TIME (S)12.'I00 21.800
FigS The output and command values at reference step and disturbance step 4. CONCLUSIONS
the timers no. 0 and no. I of the circuit 18253 to count the 1 MHz frequency pulses between two consecutive feedback encoder pulses. The advantage is a much better measurement precision and a wider measurable speed domain irrespective of the transducer resolution. There is also a disadvantage: the lack of synchronization between the speed measurement and the sample time of the controller.
The minimization of positioning time is an important goal of electrical drives; in the stepper motors ' case, this purpose can be fulfilled by imposing a linear or exponential speed profile. Thus, the speed control of SM becomes necessary and it can be easily done in open-loop command by the clock pulses frequency (Baluta et. aI., 1995a). However, there are some problems in choosing the acceleration and deceleration slopes, which depend on the electro-mechanical characteristics of the motor-load system. Adding the above mentioned disadvantages of the open-loop command, in some cases this control system fails .
5. REFERENCES Biilut<1 Gh., C. Ciiciuleanu (1992). Computer based testing of stepper motors, Bulletin of J.P. Iasi, tom XXXVlfl (XLII), fasc. 1-4.. Biilutii Gh., St. Resmeritii, V. Apopei (1995a). Contributions concerning the computer based control of the stepping motor systems, Proceedings of the First International Symposium on Advanced Electromechanical Motion Control Systems - ELECTROMOTJON '95, ISBN 973-96983-2-8, pp. 124-129, ClujNapoca. Biilutii Gh., St. Resmerita, C. Penelea (1995b). Stepper motor control with specialized integrated circuits, Proceedings of the 5th Symposium on Automatic Control and Computer Science SACCS '95, Vol.l, pp. 358-363, Ia~i. BaIut<1 Gh., St. Resmerit<1, M. Albu, R Bojoi (1996). Contribution on the Numerical Measurement of the Characteristic Quantities of Electric Driving Systems, Proceedings of the 5 th International Conference on Optimization of Electric and
The alternative is the closed-loop control of position and speed. The speed control is facilitated by the use of stepper motor in minor loop, which determines an auto-acceleration and a safe operation of the motor. The control flexibility is assured by the use of discrete algorithms (as computer programs) and programmable command devices. The algorithm here presented can be completed by other elements. For example, a derivative component can be added together with a proper filter. Bringing new control components means that one must think about calculus optimization and choosing the right sample time. Another improvement that can be easily done is regarding the measurement part, which mainly influence the control performances. The motor speed can be measured by programming
459
electronic Electronic Equipments - OPTIM '96, Vol. V, ISBN 973-97549-7-X, pp. 1609-1618, Brasov. Kuo B., A. Kelemen (1981), Sisteme de comandii ~i reglare incrementa/a a pozi!iei, Ed. Tehnica, Bucuresti . Lazar C. (1995), Ingineria reg/iirii automate, Printed course, Vol 2, "Gh. Asachi" Technical University of Iasi .
460