Microstepping Bipolar Drive of Two-Phase Hybrid Stepping

Application Report SPRAAU7–May 2008 Microstepping Bipolar Drive of Two-Phase Hybrid Stepping Motor on TMS320F2808 DSC Chawakorn Yodsanti and Mongkol K...

7 downloads 467 Views 2MB Size
Application Report SPRAAU7 – May 2008

Microstepping Bipolar Drive of Two-Phase Hybrid Stepping Motor on TMS320F2808 DSC Chawakorn Yodsanti and Mongkol Konghirun ..................... King Mongkut's University of Technology Thonburi ABSTRACT This application report describes the implementation of a micro-stepping algorithm for a two-phase stepper motor using the TMS320F2808 digital signal controller (DSC). The "C" code can easily be utilized with other members of the C2000™ DSC platform of devices. Project collateral and source code discussed in this application report can be downloaded from the following URL: http://www-s.ti.com/sc/techlit/spraau7.zip.

1 2 3 4 5

Contents Introduction .......................................................................................... Microstepping Scheme With Current Controlled ............................................... Experimental Results............................................................................... Conclusion ........................................................................................... References ..........................................................................................

2 2 3 9 9

List of Figures 1 2 3 4 5 6 7 8 9

Dual H-Bridge Circuit Connecting to a Two-Phase Hybrid Stepping Motor ................. Overall System Using DSP ........................................................................ Overall Hardware Setup ........................................................................... Code Composer Studio Screen Capture With Graphs During Run-Time (the captured variables are discrete angle, reference current, feedback current, etc.) ........ Overall Software Flowchart........................................................................ Responses for Precision = 1/8 Step ............................................................. Responses for Precision = 1/16 Step ............................................................ Responses for Precision = 1/100 Step .......................................................... Phase Current and Rotor Position Responses for Different Precisions .....................

2 3 4 4 5 6 7 7 8

List of Tables 1

Code Size, Number of Cycle and MIPS Used for Microstepping Bipolar Drive of Two-Phase Hybrid Stepping Motor ............................................................... 9

C2000, Code Composer Studio are trademarks of Texas Instruments. eZdsp is a trademark of Spectrum Digital Inc. All other trademarks are the property of their respective owners. SPRAAU7 – May 2008 Submit Documentation Feedback

Microstepping Bipolar Drive of Two-Phase Hybrid Stepping Motor on F2808 DSC

1

Introduction

1

www.ti.com

Introduction Hybrid stepping motors are used in a wide variety of position controlled equipments such as plotters, CNCs, printers, robots, etc. However, in high precision applications, the microstepping scheme is necessary for accurate motor rotation. Two main advantages of this scheme have been well reported in literature such as: reduction of resonance behavior [1], [2], [4] and smooth movement with very low ripple torque [3]. In this application report, the microstepping scheme with configurable fractional step is implemented using a fixed-point TMS320F2808 DSC from Texas Instruments, Inc. The discrete angle for discretized sinusoidal voltage commands is generated by the zero hold order (ZOH) module. The motor currents are controlled by using unipolar pulse width modulation (PWM) technique. The dual H-bridge circuit is primarily used to drive a two-phase hybrid stepping motor as shown in Figure 1. Each phase winding is connected to each H-bridge circuit, therefore, four switching devices are independently controlled to generate appropriate voltage for each phase winding. The main advantage of this circuit topology is the independent generation of bipolar voltage between two phases. In low-cost, low-precision applications, the conventional full or half step scheme is selected to implement without the PWM technique. However, high performance systems employ microstepping to achieve accurate motor phase current control. Supply +

S3

S1

A1 S2

S7

S5

A2

B1 S4

S6

B2 S8

Supply -

Figure 1. Dual H-Bridge Circuit Connecting to a Two-Phase Hybrid Stepping Motor

2

Microstepping Scheme With Current Controlled Figure 2 shows the overall system of a microstepping bipolar drive using a TMS320F2808 DSC. The bipolar drive is well known for its advantage of 20%-30% increased torque capability, compared to the unipolar drive [4]. Notice that the reference variables are defined with a superscript * in Figure 2. In the system, the peak of the two-phase motor currents is controlled by a PI controller. The output of this PI is *

the peak command voltage v p . The feedback of the peak current is calculated from the measured phase–a and –b currents by the following:

ip = ia2 + i2b

(1)

The continuous angle (θcon) is discretized to obtain discrete angle (θdisc) by the ZOH block. The number of fractional steps can be adjusted by this block. Then, θdisc is used to compute the discreate sinusoidal command voltages with the peak determined by PI output expressed as follows:

2

v*a = v*p cos qdisc

(2)

v*b

(3)

=

v*p sin qdisc

Microstepping Bipolar Drive of Two-Phase Hybrid Stepping Motor on F2808 DSC

SPRAAU7 – May 2008 Submit Documentation Feedback

Experimental Results

www.ti.com

Once the command voltages (2) and (3) are computed, then the duty cycle of each switching device in the dual H-bridge is determined by using the unipolar PWM technique. Based on this technique, the command voltages are compared with a triangle signal (Vtri) with a fixed switching frequency. The rules of four switching devices for phase-a are determined as follows: when

v a* > v tri, S1on and S2 off Otherwise, S1off and S2 on

when - v a*

> v tri, S3 on and S4 off

Otherwise, S3 off and S4 on

(4)

Similarly, the same rules are applied for other four switching devices (S5-S8) for phase-b winding, using * phase-b command voltage v b . The main advantage of the unipolar PWM technique is the reduction of ripple currents due to output voltages of the double switching frequency.

ePWM1A ePWM1B

θcon θ disc

ZOH

* va

* = v cos q va p disc * vb = vp sin qdisc

* ip +

* vb

2 Phase Unipolar PWM Gen

PI -

ePWM2A ePWM2B ePWM3A ePWM3B

Dual H-Bridge Converter

ePWM4A ePWM4B

vp ip

ia 2 ip = i2 a + ib

ib TMS320F2808 eZ DSP

Figure 2. Overall System Using DSP

3

Experimental Results The overall system shown in Figure 2 is implemented using a fixed-point TMS320F2808 DSC operating at 100 MHz system clock [5]. A photograph of the overall hardware setup is shown in Figure 3. In this system, the switching frequency is set at 10 kHz. This is also the frequency of the interrupt service routine (ISR) where overall algorithms are executed. In addition, two measured currents are sampled at this frequency using the on-chip 12-bit analog-to-digital (ADC) converter of DSC. The DSC is configured to generate the 1-µs of dead time for upper and lower switching devices. The two-phase stepping motor is rated 3A and 1.8° step angle. Code Composer Studio™ V3.1 is used as a DSP development tool and is capable of plotting graphs of any variables in the codes during run-time [6]. Figure 4 shows a screen capture of Code Composer Studio with graphs. Some of the experimental results in this application report are conveniently obtained from the Code Composer Studio graphs. The software flowchart of the overall implementation can be shown in Figure 5.

SPRAAU7 – May 2008 Submit Documentation Feedback

Microstepping Bipolar Drive of Two-Phase Hybrid Stepping Motor on F2808 DSC

3

Experimental Results

www.ti.com

Figure 3. Overall Hardware Setup

Figure 4. Code Composer Studio Screen Capture With Graphs During Run-Time (the captured variables are discrete angle, reference current, feedback current, etc.)

4

Microstepping Bipolar Drive of Two-Phase Hybrid Stepping Motor on F2808 DSC

SPRAAU7 – May 2008 Submit Documentation Feedback

Experimental Results

www.ti.com

c_int0

INT3 Interrupt

Initialize S/W Modules

EPWM1_INT_ISR

Save Contexts and Clear Interrupt Flags

Initialize Time Bases

Enable EPWM1 Time Base CNT_Zero Interrupt and Core Interrupt INT3

Execute the ADC Module (Currents Measurement)

Initialize Other System and Module Parameters

Execute the RAMP_CNTL Module

Backgrount Loop

Execute the ANG_GEN Module INT3

Execute the ZOH Module

Execute the LPF and lpeak Calculations

Execute the PI Module

Execute the Vcontrol Calculations

Execute PWM Unipolar

Restore Contexts

Return

Figure 5. Overall Software Flowchart

SPRAAU7 – May 2008 Submit Documentation Feedback

Microstepping Bipolar Drive of Two-Phase Hybrid Stepping Motor on F2808 DSC

5

Experimental Results

www.ti.com

Figure 6 through Figure 8 show the captured Code Composer Studio graphs of discrete angle, reference current, feedback current, and current error when the step precision is configured by the ZOH block for precision = 1/8, 1/16, and 1/100 step, respectively. As seen from these figures, the current is successfully controlled with a peak of 0.5 per-unit (base current of 2A) regardless of the step precision. The current errors in Figure 6(b), Figure 7(b), and Figure 8(b) are shown to validate the successful implementation of current control. As the fractional step is reduced, the current waveforms become less and less discretized and eventually sinusoidal. When the currents are sinusoidal waveforms, the smooth rotation of the stepping motor is obtained with small ripple torque. This is a necessary requirement in high precision applications.

Figure 6. Responses for Precision = 1/8 Step

6

Microstepping Bipolar Drive of Two-Phase Hybrid Stepping Motor on F2808 DSC

SPRAAU7 – May 2008 Submit Documentation Feedback

Experimental Results

www.ti.com

Figure 7. Responses for Precision = 1/16 Step

Figure 8. Responses for Precision = 1/100 Step

SPRAAU7 – May 2008 Submit Documentation Feedback

Microstepping Bipolar Drive of Two-Phase Hybrid Stepping Motor on F2808 DSC

7

Experimental Results

www.ti.com

In Figure 9, phase-a current and rotor position of the stepping motor are shown for (a) full step, (b) 1/8 step, and ) 1/100 step. The experiments are tested under the same peak current controlled and same stepping rate. As seen in Figure 9, the peak of current is always constant for three different step precisions because of successful current control. However, the movement of the rotor is extremely smooth for precision = 1/100 step, compared to the full step angle (Figure 9(a)) and 1/8 step (Figure 9(b)) precisions.

Figure 9. Phase Current and Rotor Position Responses for Different Precisions

8

Microstepping Bipolar Drive of Two-Phase Hybrid Stepping Motor on F2808 DSC

SPRAAU7 – May 2008 Submit Documentation Feedback

Conclusion

www.ti.com

Using the profiling capabilities of the Code Composer Studio, Table 1 summarizes the code size and number of cycles used for key functional blocks in the system: Table 1. Code Size, Number of Cycle and MIPS Used for Microstepping Bipolar Drive of Two-Phase Hybrid Stepping Motor Code Size (words)

Cycles Used

RAMP_CNTL

80

54

0.54

ANG_GEN

65

95

0.95

ZOH

75

236

2.36

PI

100

146

1.46

PWM

311

115

1.15

Total Functional Blocks

3104

1581

15.81

(1)

4

MIPS Used

(1)

(%)

The MIPS used is calculated based on an ISR frequency of 10 kHz.

Conclusion Microstepping is a drive technique of the stepping motor that allows the smooth movement of the rotor in a fraction of the motor’s full step angle. This application report presents a digital implementation of a microstepping bipolar drive system with current control using a fixed-point TMS320F2808 DSC. The dual H-bridge converter is designed to drive the two-phase stepping motor. The fractional step can be adjusted/configured using the ZOH block. The rotor movement can be controlled at 1/100 step resolution. The demo code is written in "C" and can be downloaded from TI web site at www.ti.com.

5

References 1. N.Q. Le and J.W. Jeon, An Open-Loop Stepper Motor Driver Based on FPGA, IEEE International Conference on Control, Automation and Systems (ICCAS ’07), pp. 1322-1326, 2007. 2. S-M. Yang and E-L Kuo, Damping a Hybrid Stepping Motor With Estimated Position and Velocity, IEEE Transaction on Power Electronics, vol. 18, no. 3, pp. 880-887, May 2003. 3. J.D. Wale and C. Pollock, A Low-Cost Sensorless Technique for Load Torque Estimation in a Hybrid Stepping Motor, IEEE Transaction on Industrial Electronics, vol, 46, no. 4, pp. 833-841, August 1999. 4. T. Kenjo, Stepping Motors and Their Microprocessor Controls, Clarendon Press, Oxford, 1984. 5. eZdsp™ F2808 USB: Technical Reference, Spectrum Digital Inc., Texas, 2005. 6. Code Composer Studio Development Tools v3.3: Getting Started Guide (SPRU509)

SPRAAU7 – May 2008 Submit Documentation Feedback

Microstepping Bipolar Drive of Two-Phase Hybrid Stepping Motor on F2808 DSC

9

IMPORTANT NOTICE Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improvements, and other changes to its products and services at any time and to discontinue any product or service without notice. Customers should obtain the latest relevant information before placing orders and should verify that such information is current and complete. All products are sold subject to TI’s terms and conditions of sale supplied at the time of order acknowledgment. TI warrants performance of its hardware products to the specifications applicable at the time of sale in accordance with TI’s standard warranty. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where mandated by government requirements, testing of all parameters of each product is not necessarily performed. TI assumes no liability for applications assistance or customer product design. Customers are responsible for their products and applications using TI components. To minimize the risks associated with customer products and applications, customers should provide adequate design and operating safeguards. TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right, copyright, mask work right, or other TI intellectual property right relating to any combination, machine, or process in which TI products or services are used. Information published by TI regarding third-party products or services does not constitute a license from TI to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the third party, or a license from TI under the patents or other intellectual property of TI. Reproduction of TI information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproduction of this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable for such altered documentation. Information of third parties may be subject to additional restrictions. Resale of TI products or services with statements different from or beyond the parameters stated by TI for that product or service voids all express and any implied warranties for the associated TI product or service and is an unfair and deceptive business practice. TI is not responsible or liable for any such statements. TI products are not authorized for use in safety-critical applications (such as life support) where a failure of the TI product would reasonably be expected to cause severe personal injury or death, unless officers of the parties have executed an agreement specifically governing such use. Buyers represent that they have all necessary expertise in the safety and regulatory ramifications of their applications, and acknowledge and agree that they are solely responsible for all legal, regulatory and safety-related requirements concerning their products and any use of TI products in such safety-critical applications, notwithstanding any applications-related information or support that may be provided by TI. Further, Buyers must fully indemnify TI and its representatives against any damages arising out of the use of TI products in such safety-critical applications. TI products are neither designed nor intended for use in military/aerospace applications or environments unless the TI products are specifically designated by TI as military-grade or "enhanced plastic." Only products designated by TI as military-grade meet military specifications. Buyers acknowledge and agree that any such use of TI products which TI has not designated as military-grade is solely at the Buyer's risk, and that they are solely responsible for compliance with all legal and regulatory requirements in connection with such use. TI products are neither designed nor intended for use in automotive applications or environments unless the specific TI products are designated by TI as compliant with ISO/TS 16949 requirements. Buyers acknowledge and agree that, if they use any non-designated products in automotive applications, TI will not be responsible for any failure to meet such requirements. Following are URLs where you can obtain information on other Texas Instruments products and application solutions: Products Amplifiers Data Converters DSP Clocks and Timers Interface Logic Power Mgmt Microcontrollers RFID RF/IF and ZigBee® Solutions

amplifier.ti.com dataconverter.ti.com dsp.ti.com www.ti.com/clocks interface.ti.com logic.ti.com power.ti.com microcontroller.ti.com www.ti-rfid.com www.ti.com/lprf

Applications Audio Automotive Broadband Digital Control Medical Military Optical Networking Security Telephony Video & Imaging Wireless

www.ti.com/audio www.ti.com/automotive www.ti.com/broadband www.ti.com/digitalcontrol www.ti.com/medical www.ti.com/military www.ti.com/opticalnetwork www.ti.com/security www.ti.com/telephony www.ti.com/video www.ti.com/wireless

Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright © 2008, Texas Instruments Incorporated