STEPPER MOTOR DRIVE FOR COMPUTER NUMERICAL CONTROL MACHINES Paulo Augusto Sherring da Rocha Junior, Maria Emilia de Lima Tostes Universidade Federal do Pará – Centro de Excelência em Eficiência Energética da Amazônia – Laboratório de Sistemas Motrizes.
[email protected]
Abstract – This work presents a open loop stepper motor driving, with configurable parameters, such as driving schema and nominal current. The developed system is based on microcontroller, monolithic switches and discrete analog electronics, aiming to reduce the overall cost. The building blocks employed on the system are briefly presented and are divided in: Digital Electronics, Analog Electronics and Power Electronics. Experimental results with the assembled system suggested the well behavior of current regulation for various driving schemas, such as half step and micro step ¼. The performance parameters from the experimental results were found to be reasonable and within expected. The system presented in this paper is part of a CNC routing system. Keywords – Hybrid Stepper Motor, Motor Drive, Computer Numerical Control.
easy to address when using low-end electronics. Problems such as low-speed and high speed performance discrepancies and electro-mechanical resonance usually arises when dealing with higher power systems. The academic community put some effort towards better driving techniques to overcome these issues. On [1] and [2], it is explained a couple of modern and classic control techniques, based on Kalman Filters, Fuzzy control and Proportional-Integral, both being applied in a closed loop approach, based on high end electronics, i.e. FPGA. On [3], an open loop approach is presented, using micro step technique to reduce vibration - and, in consequence, resonance - and to enhance positioning precision. The purpose of this paper is to present a stepper motor drive system, which was applied for positioning control on a Computer Numerical Controlled router machine, which was briefly presented on [4] and [5]. This paper aims to provide basics insight on stepper motor driving technique and present the main elements of the developed system.
I. INTRODUCTION II. STEPPER MOTOR THEORY AND ITS DRIVERS Stepper motors are a particular variation of variable reluctance machines and are designed to achieve higher compatibility and ease of use when interfacing with digital electronics systems. Its mechanical design has a main purpose: achieve a high positioning resolution. Both stator and rotor are built with a castle like structure, with tooth along their circumference and the final resolution of the system is proportional to this number of tooth. General purpose stepper motors are rated with resolutions as low as 0.9 ˚. Precision, high end stepper motors are able to achieve up to 0.05 ˚. Increasing the resolution by means of mechanical design only also increases drastically the final cost of the machine. It is worth noting that stepper motors' weight and power ratio is high, from where arises a maximum achievable power as well. Due to its conception, stepper motors are one of the most employed mechanical drivers for positioning systems in various systems. Its application varies from low power systems, where only a few tenths of watts are necessary, to more power demanding systems, from a few watts to up to hundred of watts are needed. On low power systems, such as hard disk drives, CD, DVD and BD units, and ink-jet printer, these motors perform flawlessly and its application probably will not fade on next decades, because of the ease of development and use. Concerning to more power demanding applications, stepper motors are also employed on productive units, ranging from desktop, low productivity, units to industrial, entry level, units. On these systems, stepper motors have more issues on performing as well, due to issues that are not
Stepper motors are quite different from usual electrical machines. It can be regarded as a brushless DC motor, whose rotor rotates in discrete angular increments when its stators windings are programmatically energized [6]. The rotor has no electrical windings and can have: salient poles, relating to a variable reluctance machine; magnetized poles, relating to a permanent magnet DC motor; or can have both, in which case the motor is regarded as a hybrid stepper motor, being this the most common topology among the machines with higher power ratting. This work aims mostly at hybrid stepper motors and only this design will be regarded from now on. These motors are usually made of two or more stator windings, being more common two, four and five windings design. Each phase can be seen as a variable inductance, (), varying with the mechanical shaft angle, . This relation between and () arises from the very conception of the motor. Figure 1 presents an example of the relation for a motor with the following characteristics: two phase, 90˚ per step, 41 nominal inductance. As can be seen in Figure 1, the inductance of each phase has a periodic peeks in well-defined angular positions. That happens because the tooth of the stator align with tooth of rotor, hence, reducing the air gap and increasing accordingly the inductance.
Figure 1 - Typical inductance profile plotted against , for each phase of a two phase stepper motor. It can be seen on Figure 1 that in no time the inductance falls to zero. Torque generated by such a motor is given by:
() = ∙ 2
that only one of its windings is energized at a time. But, if one drives the motor with smoother signals, a smoother motion is yielded. So, instead of driving a winding at a time to its nominal current, a discretized sine-squared (sin²) wave can be applied in order to achieve smoother motion. Traditional driving schema is known as full step. If one breaks the transitions in 2, it is known as half step. For more fractional driving schema, it is named n-th micro step, were n is the number of subdivisions on the signal. The Tables 1, 2 and 3 illustrates the three driving schemas, respectively. On those Tables, the symbols ½, ¼ and ¾ actually are shorted of
(1)
where is the current on the winding, (θ) is the inductance of the phase and is the angular position of the shaft. Figure 2 presents the torque generated by the previously described stepper motor and such waveform is obtained by taking the derivative of inductance with respect to . It should be noted that magnetic saturation effect was not considered.
, e .
Table 1 – Lookup table used for full step driving schema.
1 1 0 2 0 1 3 0 0 4 0 0
0 0 0 0 1 0 0 1
Table 2 – Lookup table used for half step driving schema.
Figure 2 - Typical torque exerted by a two phase stepper motor. The behavior seen in Figure 2 justifies why stepper motors are inherently used for position control: when a given winding is energized, the rotor aligns with the respective stator energized winding; if some external load torque tries to move the rotor from that position, an opposing torque will act in such a way to move back the rotor to the original rest position; if the load torque is higher than any opposing torque that the motor can generate, the shaft will enter an instability region and will move the rotor to another stable position. From Figures 1 and 2, it can be seen that stepper motors' resolution is related to its mechanical complexity, in a sense that the smaller distance between peeks for an inductance waveform, the higher will be its mechanical resolution. General purpose motors, with cylindrical rotor, the resolution can be as low as 0.9˚. Application specific motors, with disk rotor structure, resolution can be as low as 0.05˚. From that previous analysis, it can be observed that to control the position of a stepper motor, one only have to keep a constant current flowing through a stator winding. However, this position control is limited by three elements: its maximum torque driving capacity, known as holding torque; the number of phases a motor has; and the number of tooth that both stator and rotor have. A. Driving Schemas Besides the mechanical design, the final resolution of a stepper motor is also dependent on how the stepper motor is driven. These machines are digital like actuators, in a sense
1 1 0 0 0 2 ½ ½ 0 0 3 0 1 0 0 4 0 ½ ½ 0 5 0 0 1 0 6 0 0 ½ ½ 7 0 0 0 1 8 ½ 0 0 ½
Table 3 – Lookup table used for micro step 1/4 driving schema.
1 1 0 0 0 9 0 0 2 ¾ ¼ 0 0 10 0 0 3 ½ ½ 0 0 11 0 0 4 ¼ ¾ 0 0 12 0 0 5 0 1 0 0 13 0 0 6 0 ¾ ¼ 0 14 ¼ 0 7 0 ½ ½ 0 15 ½ 0 8 0 ¼ ¾ 0 16 ¾ 0
1 ¾ ½ ¼ 0 0 0 0
0 ¼ ½ ¾ 1 ¾ ½ ¼
Those tables are used as current reference for a controlled current source, which is better explained in the next subtopic. B. Controlled Current Source From Equation (1), the torque exerted by the motor is related by the displacement from the rest position and also to the current flowing on the winding. For a constant holding torque, a controllable constant current source must be implemented. In order to do so, H-Bridge circuit along with comparators and logic circuitry can be used. Such a circuit is depicted on Figure 3.Transistors Q1 through Q4 are power transistors and
Digital control of power transistors. Figure 4 presents some variables and services that run within the microcontroller in order to implement such functionalities. There are four lookup tables, one for each available driving schema and only one can be active at a time. Current reference comes from the active lookup table in a given index, stored at the variable Npos. Passo
Direção
carry the load current. Diodes D1 through D4 are freewheeling diodes. !"#$. is a low resistance resistor in series with load current, generating a small voltage signal, &('), which is filtered with a low pass filter, in order to remove high frequency noise, and compared to a current reference, finally switching on and off Q1 through Q4. The values applied to the inputs In1 and In2 are the values of the current index of the active index table, presented in last subsection. The active index table depends on which driving schema is being used.
Figure 4 – Block diagram of variables and services that run on dsPIC33FJ12GP201.
Figure 3 – Diagram illustrating a controllable current source. III. IMPLEMENTATION OF THE SYSTEM The circuit presented by Figure 3 relies on analog devices, such as comparators, and sources, such as the adjustable current reference. Pure analog circuits usually are harder to implement and are more expensive. The developed system employs digital, analog and power circuits implement the functionalities of the blocks previously described. A. Digital Circuit The digital portion circuit is the core of the developed system and it is based on a microcontroller, produced by Microchip, namely dsPIC33FJ12GP201, which is a general purpose 16-Bits microcontroller, with several built-in peripherals, such as Timers, Analog Digital Converter (ADC), Universal Synchronous/Asynchronous Serial Receiver/Transmitter (USART) and others. The main functionalities executed by the microcontroller are: Selectable drive schemas, being available full step, half step and microstep 1/4 and 1/8; Current reference, controlled according to the active drive scheme; Digital interface for pulse, direction and enable signals; signal comparison;
An Acquisition service runs at 50 KHz. After acquisition cycle, outputs that control the power switches are turned on and off according to the comparison result of the current reference and the read current. A Pulse monitoring service runs whenever the state of the pulse digital signal chances from high to low - the falling edge - and increments or decrements the variable Npos, according to the state of the direction digital input. The variable Npos is bounded according to the size of the active table and wraps around whenever it reaches its upper or lower limits. The real change on the stepper motors' position will take place on the next acquisition cycle, where the switches are to be controlled according to the new index on the active lookup table. B. Power Circuits At the power stage, it was employed and monolithic IC, namely L298, which integrates two H-Bridges and its transistors drives circuits. The H-Bridge is based on Bipolar Junction Transistor (BJT). Its maximum voltage is 40 V and is capable of carrying 2 A by each bridge. External freewheeling, fast recovery diodes were used, to allow current flow on the opposite direction of the BJT’s orientation. The switches are controlled by digital inputs, turning them on and off according to the drive’s logic. In series with the load, more exactly under the low voltage side transistor, a low resistance resistor was placed, generating a voltage signal proportional to the load current. Such voltage is used as input to the analog conditioning circuit.
C. Analog Circuit There are a few operations needed to be carried out on the current-proportional voltage signal before it can be used as input to the ADC. These operations are: scaling and filtering. Signal shifting was not necessary on this case, since the signal of interest is positive only. Filtering is necessary to preserve the spectral content of the interest signal on the sampling process. Scaling is necessary to reduce the error introduced on the discretization process and to allow the signal to swing through the entire range of the ADC. The circuit on Figure 5 presents this functionality. ( ) *( forms a first order, low pass filter, with a cutoff frequency given by:
+,-$!(( =
1 ( . *( . 2. .
(2)
The op-amp /01 the resistive network 1 ) 2 forms a non-inverting amplifier, whose gain is given by:
= 1 + 13
instrumentation – a high performance Hall Effect current clamp –, so the current was measured through !"#$. itself. Due to this fact, all the negative current swing was reflected and observed as a positive swing, i.e. its absolute value was observed.
(3)
Figure 6 – Stepper motor driving system developed. Figure 7 shows the current ripple for one of the phases with a set-point of 2A. The output voltage, given a 2 load current, is 0.94 @, which is close to the mean value shown in Figure 7. The value of 0.950 @A5B was read, that yields a load current of 2.0212 , that in turns corresponds to an absolute error of CDEF = 0,0212 and a percentual error of C% = 1,1 %. The peak-to-peak load current ripple read was H# IJ = 0,097 and, percentually, H# IJ% = 4,888 %.
Figure 5 – Schematics of the current conditioning circuit. The transfer function of the whole circuit is given by: 5!"#$ . ( + ) 1
(4) = . (4) 65!"#$ + ( 7. *( . 4 + 1 Since the conditioned signal is sampled at 50 KHz, 15 Khz band limiting would work just fine to avoid aliasing. Since 15 KHz cutoff frequency is hard to achieve with regular discrete components, the cutoff frequency was approximated to 15.157 KHz. To yield such frequency, along with an overall gain of 0.5 V/A, the employed values were:
( = 7 9Ω *( = 1,5 >
!"#$
= 40 9Ω = 10 9Ω = 0.1 Ω
Figure 7 – Ripple of load current. Next, the results achieved with two driving schemas are shown. Figures 8 and 9 presents the actual current waveform measured and the ideal current waveform, respectively, for a half-step driving schema.
IV. RESULTS The system was built in a printed circuit board and is part of a CNC milling/router system. The built system is illustrated by Figure 6. There were made two tests with the system: current regulation; and the overall current waveform for three of the driving schemas. All measurements were made with an oscilloscope, with the gain of 0.47 V/A. The current signal could not be directly measured, due to lack of correct
Figure 8 – Measured current waveform for half step driving schema.
VI. ACKNOWLEDGEMENT The authors would like to acknowledge: CNPq, for supporting this research; Oyamota do Brasil, for supporting the manufacturing of mechanical system; CEAMAZON, for supporting high-end research and continuously effort on producing human resources. VII. REFERENCES
Figure 9 – Ideal current waveform for half step driving schema. Figures 10 and 11 present the actual current waveform measured and the ideal current waveform, respectively, for a micro step 1/4 driving schema.
Figure 10 – Measured current waveform for micro step ¼ driving schema.
Figure 11 – Ideal current waveform for micro step ¼ driving schema. V. CONCLUSION The stepper motor drive is base of the low cost positioning system. Currently, this topology is being largely employed on low cost CNC systems, whose applications are as varied as possible, being successfully applied to machining, pickand-place, 3D plastic printing and many others. A stepper motor driving system was developed described in this paper. The designed system is based on low cost devices and performed as expected, with its performance parameters within the expected. The experimental results obtained from the developed system are presented. As indicated by the measured current waveform plots, the developed system could regulate the load current according to the selected driving schemas.
[1] N. Dahm, M. Huebner, and J. Becker, "Approach of an FPGA based adaptive stepper motor control system," Reconfigurable Communication-centric Systems-on-Chip (ReCoSoC), 2011 6th International Workshop on, pp. 1-6, Jun. 2011. [2] N. Dahm, M. Huebner, and J. Becker, "FPGA system-on-chip solution for a field oriented hybrid stepper motor control," Systems, Signals and Devices (SSD), 2012 9th International Multi-Conference on, pp. 1-6, Mar. 2012. [3] G. Baluta and M. Coteata, "Precision microstepping system for bipolar stepper motor control," Electrical Machines and Power Electronics, 2007. ACEMP '07. International Aegean Conference on, pp. 291-296, 2007. [4] P. A. S. Rocha Jr., R. Diogne de Silva e Souza, and M. E. de Lima Tostes, "Prototype CNC Machine Design," Journal of Energy and Power Engineering , pp. 1884-1890, Nov. 2012. [5] P. A. S. Rocha Jr., V. S. Kataoka, R. D. S. E. Silva, and M. E. L. Tostes, "Planejamento de Trajetória Aplicado a uma Máquina de Controle Numérico Computadorizado," Anais do XIX Congresso Brasiliero de Automática, 2012, 2012. [6] V. V. Athani, Stepper Motors : Fundamentals, Applications And Design, 1st ed. Daryaganj: New Age International, 1997.