You are on page 1of 6

“Development of a CPLD based novel open

loop stepper motor controller for high
performance using VHDL”
Zoonubiya Ali * and R.V Kshirsagar **
*

Disha Institute of Management and Technology, Electronics & Telecommunication Engg., Raipur (C.G.), INDIA
** Priyadarshini College of Engg. & Architecture, Nagpur (M.S.), INDIA
E-mail: zoonubiyakhan@yahoo.co.in

Abstract— In motion control systems, stepper motors are
widely used and the stepper motor driver is mainly
implemented using a DSP (Digital Signal Processor). As the
IC industry boomed over the recent decade, large amounts
of data process more and more fast in digital system.
Because of this, the SOC (system on chip) and CPLD
(complex programmable logic device) are popular with
designers. However, when mass production is needed,
CPLD (complex programmable logic device) based drivers
are preferred since the CPLD based design is compatible
with conversation to an ASIC (Application Specific
Integrated Circuit). Previous studies proposed CPLD based
drivers but the quality is still limited because of the
difficulty of handling complex computations in the CPLD.
Nowadays, with the improvement of CPLD techniques, it is
possible to perform various computations in the CPLD &
FPGA so it can be used instead of the DSP in motor driver
design. This paper presents an open loop driver of stepper
motor controller based on the CPLD. This driver can
perform stable, precise control and is responsive. The
experimental results verify the performance of the control
algorithm.
Keywords: Stepper motor, CPLD , Open loop mode.

A simplified description of CPLD design flow is as
follows:
1. The design is written in a high-level language, such as
Verilog or VHDL, using a software development tool.
2. The design is simulated for functional correctness.
3. The design is “fit” to a particular CPLD, providing the
physical aspects such as resource utilization and timing
paths.
Figure 1 shows the block diagram for controlling stepper
motor using CPLD. Here sequence of applied pulses is
directly proportional to direction of rotation, frequency of
applied pulses is directly proportional to speed of rotation,
and number of pulses applied is directly proportional to
length of rotation.
START/STOP
CONTROL
SWITCH

CPLD

LATCH

DIRECTION
CONTROL
SWITCH

I. INTRODUCTION
The stepper motor consists of permanent magnet rotor
and wound stator. The coils of wound stator are called
control windings. The rotation of stepper motor is
controlled by switching ON/OFF the current through
control windings. Normally the control windings are
excited through driver transistors. The stepper motor
controller generates a sequences of digital data called
switching sequence at a particular clock rate which can be
used to switch the transistors that are used to drive the
motor. The controller can be made to generate the
switching sequences at variables rate to drive the motor at
variable speed. The direction of rotation of motor can be
reversed by generating the switching sequences in reverse
order. In this work, the control of the rotation and speed
of the stepper motor is done by using CPLD (Complex
programmable logic device) instead of DSP &
Microprocessor[1]. The characteristic of non volatility
makes the CPLD the device of choice in modern digital
designs to perform the function before handing over
control to other devices not having this capability [6].

978-1-4244-7652-7/10/$26.00 ©2010 IEEE

BUFFER

– 307 –

STEPPER
MOTOR
DRIVER
CIRCUIT

STEPPER
MOTOR

CLOCK
GENERATOR

Figure 1. Block Diagram of stepper motor controller

II. WHY STEPPER MOTOR?

A stepper motor can be a good choice whenever
controlled movement is required.

They can be used to advantage in applications
where control on rotation angle, speed, position
and synchronism is required.
Because

A stepper motor is an electromechanical device
which converts electrical pulses into discrete
mechanical movements.

Torque Vs Speed characteristic – 308 – The torque vs speed characteristics are the key to selecting the right motor and drive method for a specific application. • The step rate • The drive current in the windings • The drive design or type Figure 3. Angular Position at Different Holding Torques In a stepper motor a torque is developed when the magnetic fluxes of the rotor and stator are displaced from each other [5]. Typical Plot of the Positional Accuracy of a Stepper Motor D. This type of control eliminates the need for expensive sensing and feedback devices such as optical encoders. F. Figure 2. Rotor Angular Position B. Stepping Modes of stepper motor The following are the most common drive modes. C. Torque Vs. Torque Generation of stepper motor The torque produced by a stepper motor depends on several factors. Open loop control means no feedback information about position is needed. Wave Drive (1 phase on) This error is also noncumulative from step to step. Angle Characteristics of stepper motor The torque vs angle characteristics of a stepper motor are the relationship between the displacement of the rotor and the torque which applied to the rotor shaft when the stepper motor is energized at its rated voltage. Here position is known simply by keeping track of the input step pulses. E.INES 2010 • 14th International Conference on Intelligent Engineering Systems • May 5–7. 2010 Las Palmas of Gran Canaria. Typically stepper motors will have a step angle accuracy of 3 – 5% of one step. Half Step Drive (1 & 2 phases on) Micro stepping (Continuously varying motor currents) Figure 4. Spain – An ideal stepper motor has a sinusoidal torque vs displacement characteristic as shown in figure 2 The shaft or spindle of a stepper motor rotates in discrete step increments when electrical command pulses are applied to it in the proper sequence A. Torque Vs. Open Loop Operation of stepper motor One of the most significant advantages of a stepper motor is its ability to be accurately controlled in an open loop system. . Step Angle Accuracy of stepper motor One reason why the stepper motor has achieved such popularity as a positioning device is its accuracy and repeatability. Full Step Drive (2 phases on) The accuracy of the stepper motor is mainly a function of the mechanical precision of its parts and assembly.

On account of processing speed restrictedly. III. In order to approach the linear acceleration. it has taken some important steps in automation. R. it cannot make a breakthrough in variable speed controller of stepper motor for limited capability of microprocessor[2]. Kang (1994) developed a new method using single microprocessor to control stepper motor at the same time. whereas open loop. etc. large amounts of data process more and more fast in digital system. design of stepper motor controller is a very important issue. robotic arms with low moment of inertia. Because of this. microprocessor can only control by constant speed. This system is implemented on DSP. Figure 5. According to various situations of applications. A typical “speed – torque curve” Although the capability of microprocessor is limited. – 309 – . time should dominate among others. and many others which are required to move controlled objects to accurate positions within nominated time. If angle exceed the range between winding and rotor. For those applications that demand the controlled objects moved with designated time to prearranged positions. and clockwise or counter. Bae and Krishnan (1996) reported that when the open loop driver is implemented with a DSP in the C programming language.The output sequence for driver circuit is as follows. proposed variable speed controller using close-loop control. This encoder can check the angle of motor. X-Y plotters. As the IC industry boomed over the recent decade. NECESSITY OF STEPPER MOTOR CONTROL Stepper motors can be found in printers. the choice of stepper motor controller between the controlling scheme of position or speed must be made in advance. He used an optical encoder coupling with motor. the digital-to-analog converter (DAC) is used to increase resolution [1]. In such cases. Ali . stop. Le (2006). including start. and velocity profile stored in memory [5]. Kshirsagar • Development of a CPLD-based Novel Open Loop Stepper Motor Controller for High Performance Using VHDL These characteristics are dependent upon (change with) the motor. high resolution could not be provide. Kenjo (1994) advanced a theory that derived the formulas of linear acceleration [2].Here in this work as we are forcing motor to rotates in two direction clockwise and counter clock wise mode. an open loop driver is preferred since it needs a simple control algorithm and an encoder is not required[12]. CRUCIAL CONTROL PARAMETERS Position To control the stepper motor. However. excitation mode and type of driver or drive method[4] The advantage of microprocessor is that it is easy for design the control mode of stepper motor by user. WORK DONE IN PAST FOR THE CONTROLLER SIDE OF STEPPER MOTOR Petrov (1988) proposed a system by a microcomputer achieved a variable speed controller. the driver can apply an open loop control algorithm or closed loop algorithm. V. such as those used in autonomous cars. With applications where load torque is stable and operations are at low speed.Z. the coding and debugging is straightforward [3]. it will switch to close-loop. Time Kos (2006) presented an algorithm to realize the linear variable speed controller by adjusting the torque corresponding current [4]. The precision positioning is a top priority than others consideration. disk drives.clockwise indeed. industrial plants. the system on chip (SOC) and DSP are popular with designers. IV. Nevertheless. For performing high precision positioning and smooth rotation operation.

various Ic’s are available which will work as driver circuit between two depending upon specification of motor & designing we can select any one by connecting some buffers and latches to driver IC’s.. 2010 Las Palmas of Gran Canaria. Reset =0 B 1/0 1000 0/6 0/0 0010 1/7 1/1 1001 0010 1000 0110 0/1 0/5 1/6 1/2 0110 Figure 7.The ULN2801A-ULN2805A can be better choice for small voltage motor. Proposed algorithm Flow chart The design and simulation of the stepper motor controller can be performed using Active VHDL[14]. State_motor<Next_State_motor=0 So.INES 2010 • 14th International Conference on Intelligent Engineering Systems • May 5–7. State diagram 1/4 0 A These is the case because in Half step mode motor rotates for all eight step if we take rotation for 45° from step 0 to step 7 (0 1 2 3 4 5 6 7) 2 State_motor<=next_ motor+2 State_motor<=ne xt_motor-2 State_motor<=n ext_motor-1 For full step motor it decremented by 2 State_motor<= next_state_motor-2.after every clock 0 motor is incremented by one for half step mode. OUTPUT SEQUENCE FOR DRIVER CIRCUIT output Step 0 Step 1 Step 2 Step 3 Step 4 Step 5 Start Step 6 Step 7 A 1 0 0 0 0 0 1 1 A_n 0 0 1 1 1 0 0 0 B 1 1 1 0 0 0 0 0 B_N 0 0 0 0 1 1 1 0 Initialization of Clock.If CPLD’s are compared with FPGA[9] then this design can fit into FPGA with some changes[8][11] Here in this work we are Controlling Stepper motor using VHDL and its implementation into CPLD. A_n. Then the system can be implemented in CPLD. 1010 0/7 1001 0001 0100 0/2 1/5 0/4 0100 1/3 0101 0001 0/3 Figure 6. State_motor<= next_state_motor+1 0 CW_CCW =1 & for.The flow chart for controlling stepper motor using VHDL is already been explain.The clock generator is also connected so that continous 5v for CPLD is generated. (0 State_motor<=next_ motor+1 1 0101 – 310 – . Also the timings of various signals can be verified. and Full_Half_step & CW_CCW as input pins And A. B_n as output pins Architecture begin Clock “event” Clock=1 A B 1 Step 0 If Reset=1 For initial condition assumed that motor is in step 0 1 which shows A A_n B B_n=1010 . Reset. B. The state diagram for eight half step mode is as follows Clock = 1. Spain TABLE II.similarly for counter clockwise rotation for Half step mode it is decremented by 1 State_motor<= next_state_motor-1 If Full _Half=1 Whereas for full step mode the rotation takes place for 90° in four step only from step 0 to step 6 4 6). Full step mode it is incremented by two 1 If Full_Half= 1 0 State_motor<= next_state_motor+2 Both is true for clockwise rotation. When CPLD is interface with stepper motor then due to difference in there specification one driver circuit is to be connected between them.

Outputsmaybe paralleled for higher current capability. R. such as adders. theULN2804A has a 10. AND gates. Five versions are available to simplify interfacing to standard logic families : the ULN2801Ais designed for generalpurpose applicationswith a current limit resistor . Functional Block Diagram of Controller Using Driver – 311 – .The setup for which is shown below in fig. and OR gates.In our work we are using ULN2803A.5kW input resistor for -15V CMOS and the ULN2805A is designed to sink a minimum of 350mA for standard and Schottky TTL where higher output current is required. CW_CCW=1 Full_Half_step=1 10 1 +5v Figure 10. Ali . the ULN2802A has a 10. ULN 1 10k +5v • output simulation is shown below: Reset=0. 9 5v Clock Generator 12v C Reset 3 Start 33 35 2 P 2 8 0 3 It is generated after the HDL synthesis phase of the synthesis process. the ULN2803A has a 2. Each darlington features a peak load current rating of 600mA (500mA continuous) and can withstand at least50V in the off state. counter clock wise for full step & for half step is as follows: A 12v C 3 16 D D 15 CW/CCWw 7 • B 37 10k This representation is in terms of generic symbols. PIN CONNECTION of 2803 The ULN2801A-ULN2805A each contain eight darlington transistors with common emitters and integral suppression diodes for inductive loads. The result for rotating stepper motor in clockwise.The RTL view is shown below in fig 10. Figure 8. counters. Kshirsagar • Development of a CPLD-based Novel Open Loop Stepper Motor Controller for High Performance Using VHDL when coding is done in VHDL and xylinx its shcematic and RTL(Resistor transfer logic) is generated. multipliers.5kW inputresistor and zener for 14-25VPMOS. Output Simulation Result Figure 9. 17 5 +5v • 18 L 10k This is a schematic representation of the preoptimized design shown at the Register Transfer Level (RTL).7kW input resistor for 5V TTL and CMOS . RTL View 39 4 +5 v Full/Half 10k 9 9 Figure 11.Z. V.

Sugawara. in Paris. 675 – 684. Marcos A. Bae and Krishnan (1996) H. pp. (2007). International Conference on Control. U. Gayakwad. pp. 8. 14. Carrica. Oct. Jeon. N. “A Study of Current Controllers and Development of a Novel Current Controller for High Performance SRM Drivers. Survey published by University of Toronto 10. 3916 –3921. 2010 Las Palmas of Gran Canaria. 2.1996. SICE-ICASE Internation Joint Conference. pp. 3593 –3598. M. France. Curkovic. Kapun. The University Electro. This paper presents an open loop stepper motor driver using a CPLD. Seoul. IEEE standard VHDL Language reference manual. and K. J.498. vol. 68-75. K. industrial. The Xilinx CoolRunner-II CPLD and alteras MAX II CPLD’s is the perfect device with which to control stepper motors with the added benefit that the CPLD can be reprogrammed to accommodate a different motor if the system specifications change. 1322-1326. 487 . pp. 1. 2007 . Korea. 2007 in COEX. High Performance Algorithm Realization on FPGA for Stepper Motor Controller. W. ISBN 11401840302. medical and scientific applications. González. and J. Strmik. Oct. “A Microcomputer-Based Speed Controller for Lift Drives”.Communications. Jun. and Sergio A. 2nd edition . Mechatronics. 11.(year of publication) Analog & Digital control systems. Daniel Carrica. no. IEEE/ASME Transactions on Mechatronics. IEEE Transactions on Applications. Novel Stepper Motor Controller Based on FPGA Hardware Implementation. 1. Benedetti. Japan. Seoul. Krishnan. 2006. Jezernik. IECON 2006-32nd Annual Conference. (2008). 17-20. Bae and R. Busan. Robert Dueck. Oxford University Press. Vol. Thomnson Delmar Learning. “Efficient Stepper Motor Torque Ripple Minimization Based on FPGA – 312 – 15. D. pp.INES 2010 • 14th International Conference on Intelligent Engineering Systems • May 5–7. Ngoc Quy Le and Jae Wook Jeon. 3. Funes. 3. 24. S. “Development of an FPGA-Based Motion Control ASIC for Robotic Manipulators. A. 8221-8225.” IEEE Proceedings of The Sixth World Congress on Intelligent Control and Automation. Dec. V. 2006. SICE Annual Conference. ”Application of Velocity Profile Generation and Closed-Loop in Step Motor Control System”. VI. 7. Tzung-Cheng Chen and Yung-Chun Su. vol. O. Output Simulation Result Stepper motors are commonly found in consumer. pp. pp. (1996) Architecture of FPGAs and CPLDs: A Tutorial . ISBN 0. Q. the CPLD is used to build a high performance open loop driver without using a DSP or microcontroller. Korea. Oct. 1322-1326 9. Reset=0 . Prentice Hall Publications. 17-20. 8. 1994. González. An Open-loop Stepper Motor Driver Based on FPGA. 12. T. Elsevier.13. Furthermore it is compatible with ASICs and mass production methods for CPLD’s & FPGA [7] Experimental verification of the proposed controller is expected to justify the key theoretical results which will be available in the final version of paper. 2. Cho. J. and M. Korea.CW_CCW=0 Full_Half_step=0 Figure 12. 6. 2008. 5. in Bexco. Brown and Rose. “Stepping Motors And Their Microprocessor Controls Second Edition”.” IEEE Industry Applications Conference. Vol. Automation and Systems. The basics of stepper motor was described. Automation and Systems 2007. Le. 14. Ngoc Quy Le and Jae Wook Jeon An Open-loop Stepper Motor Driver Based on FPGA. 2. vol.(2003). (2004). August 20-22. 2004. No. Spain Hardware Implementation”. “A high speed velocity control algorithm of multiple stepper motors”.033028. Petrov and S. 13. A. IEEE Industrial Electronics. D. 4. 1988. REFERENCES 1. Issue 6. Kenjo and A. CONCLUSION 1. . IEEE STD 1076-2002. International Conference on Control.pp 120-124. Digital design with CPLD Applications & VHDL. Xiaoyin Shao and Dong Sun. Oct. 2006. Kos.