当前位置:文档之家› labview的步进电机控制加工机床

labview的步进电机控制加工机床

Session G-19 STEPPER MOTOR CONTROL USING LABVIEW TM IN A COMPUTER NUMERICALLY CONTROLLED DESKTOP MILL

Usha L Manepalli, Dr. M. Elsayed

Department of Mechanical Engineering

University of Louisiana at Lafayette

Lafayette, LA, USA

https://www.doczj.com/doc/f516126219.html,ha@https://www.doczj.com/doc/f516126219.html,

melsayed@https://www.doczj.com/doc/f516126219.html,

Dr. Cherif Aissi

Department of Industrial Technology

University of Louisiana at Lafayette

Lafayette, LA, USA

aissi@https://www.doczj.com/doc/f516126219.html,

Abstract

The advantage of stepper motor motion control system in a computer numerically controlled (CNC) desktop mill is the high holding torque at low speeds. The aim of this paper is to utilize stepper motors, build their control circuit and write a LabVIEW TM program that reads and implements a CNC code, in the form of a text file, for engraving operations on a desktop mill. The program also controls the basic functions of the desktop CNC mill, such as turning the spindle on and off and controlling travel limits of the worktable. The basic CNC code included linear and circular interpolations, which provide the foundation necessary for the implementation of any future design expansion of the program.

LabVIEW TM is a graphical programming language produced by National Instruments of Austin, TX, USA.

1.Background

In 1995, Eric Stutes et al.1 successfully designed and manufactured a fully operational desktop CNC milling machine under the guidance of Dr. M. Elsayed. In this CNC project, DC brush servo motors were used as a conventional motor technology to produce rotary motion in response to an applied voltage. So basically, a close-loop feedback system was used to drive the ballscrew slides for X and Y axis movements using several subroutines and the software library provided by Technology 80 for a Model 5650 controller card1.

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e, McNeese State University

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e , McNeese State University

In this work, the servo motors used in the CNC miniature mill are replaced by stepper motors mainly due to their high holding torque at low speeds, their excellent precise positioning mechanism, their simple open-loop feedback system applications and their lower cost.

The work is covered mainly in two steps:

1. Test setup I: Build a stepper motor driver interface and control a small 2-phase, bipolar stepper motor using LabVIEW through digital output of a DAQ (Data Acquisition) card for full, half and micro-stepping in both clockwise and counter-clockwise directions.

Figure 1-A Small Stepper Motor Purchased from Danaher Motion 2

2. Test setup II: To apply the knowledge of LabVIEW and stepping sequence in operating the X and Y axes motion of CNC miniature mill for the engraving operation using ballscrew slides and appropriate stepper motors.

Figure 2-Motor and Lead screw Arrangement 3

2. Objectives

The main objectives of this research are:

1. To replace the existing servo motors with stepper motors control system for the desktop CNC milling machine.

2. To develop a driver and an interface circuit between the CNC machine and a PC.

3. To develop a LabVIEW program that can generate machine command from basic CNC-code.

3. Scope of the Research

? The controller will be built using LabVIEW TM , a graphical programming language produced by National Instruments of Austin, TX, USA.

? The LabVIEW Program is built based on the basic G-codes, which are G0, G1, G2 and G3. ? The new controller will be applied to an existing milling machine, which is the CNC milling machine by replacing the existing servo-motor controller with the new controller.

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e , McNeese State University

32 16 8 4 2 1

? An interfacing circuit board will be built based on the stepper motor in order to interface between the controllers (PC) and the CNC milling machine. ? Actual machining will be done by executing a subroutine for,

a) Linear interpolations (G0, G1) b) Circular interpolations (G2, G3)

c) Engraving operations (A-Z and 0-9) which utilize (a) and (b)

4. Test Setup-I

Stepping Sequence for Full/ Half/ Micro-Steps mode:

For a four-coil motor, a four-bit code sequence is needed to energize the appropriate poles at any one time. The sequence needed to make the rotor turn can be done in either “full step” or “half step” increments. The difference between these two modes is that the application of some of the codes is omitted. This can be seen in the Tables 1 and 2. Both the speed and direction may be changed at any instant by applying the appropriate codes at the stepper motor’s signal line.

Full-step mode:

The phase switching for the small bipolar stepper motor (Test Setup-I) with full-step, i.e., 7.50 step angle is shown in Table 1. This gives a full step rotation in both clockwise and counter clockwise directions.

Step angle, θs (degrees/ step) = 3600/ R s (steps/ rev) [4] Where ‘R s ’ is Stepping rate For Full Step, θs = 7.50

So, R s = 3600÷ 7.50 = 48 steps/ rev

Table 1-Full-Step Sequence for a Stepper Motor with 7.50 Step Angle

where:

7B, 9B & 7A, 9A are I1B, I0B & I1A, I0A respectively (control current levels) 8B & 8A are Phase B & Phase A respectively (control direction)

A and

B are two I

C chips (NJM3770AD3) used in stepper driver circuit in Test Setup-I.

Half-step mode:

Similarly, the stepping sequence for half and micro-step is given in Table 2 and Table 3 respectively.

For Half Step, θs = 3.750 (half of full step angle ) So, R s = 3600÷ 3.750 = 96 steps/ rev

C W d i r e c t i o n

Step 7B 9B 8B 8A 7A 9A Nos θs (deg) C C W d i r e c t i o n

1 0 0 1 1 1 1 15 0

2 1 1 0 1 0 0 52 7.5

3 0 0 0 0 1 1 3 15

4 1 1 1 0 0 0 56 22.

5 1 0 0 1 1 1 1 15 30

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e , McNeese State University

Table 2-Half-Step Sequence for a Stepper Motor with 3.750 Step Angle

where:

7B, 9B & 7A, 9A are I1B, I0B & I1A, I0A respectively (control current levels) 8B & 8A are Phase B & Phase A respectively (control direction)

LabVIEW and Data Acquisition

LabVIEW is a program development application developed by National Instruments. It uses a graphical programming language to create programs in block diagram form. It is called a virtual instrument (VI) because its appearance and operation can replicate an actual instrument. A VI consists of a front panel and a block diagram .

The front panel is an interactive user interface that simulates a panel of physical instruments like knobs, push buttons, other controls and indicators. Whereas, the block diagram acts as back end, where the actual programming is written using different functions and codes 5.

Figure 3-Front Panel of Stepper Motor (Half/Full-Step).vi

C W d i r e c t i o n

Step 7B 9B 8B 8A 7A 9A Nos θs (deg) C C W d i r e c t i o n

1 0 0 1 1 1 1 150

2 0 0 1 1 0 0 12 3.75

3 1 1 0 1 0 0 527.5

4 0 0 0 1 0 0 411.2

5 5 0 0 0 0 1 1 315

6 0 0 0 0 0 0 018.75

7 1 1 1 0 0 0 5622.5

8 0 0 1 0 0 0 826.25 1 0 0 1 1 1 1 1530 32 16 8 4 2 1

Figure 4-Block Diagram of Stepper Motor (Half/Full-Step).vi

Fig. 3 and Fig. 4 show the front panel and block diagram of full-step mode with step angle 7.5 deg.

Micro-step mode:

For Micro-Step,θs = 0.750 (1/10th of full step angle)

So, R s = 3600÷ 0.750 = 480 steps/ rev

Compared to full and half-steps, where the stepper motor tends to be slightly jerky in its operation as the motor moves step by step, in micro-step it runs at a smoother rate.

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e, McNeese State University

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e , McNeese State University

Table 3-Micro-Step Sequence for a Stepper Motor with 0.750 Step Angle

where:

7B, 9B & 7A, 9A are I1B, I0B & I1A, I0A respectively (control current levels) 8B & 8A are Phase B & Phase A respectively (control direction)

Working Principle of Test Setup-I

The Test setup-I as shown in Fig. 5 includes a stepper motor, driver interface, DAQ board (device 3), 5V DC Power supply and a PC with LabVIEW software installed.

Depending upon the size of the stepper motor, its windings require a substantial drive current. In this case, it ranges between 100mA- 700mA. This drive current is essential for our specified motor to run. Stepper motor driver with two of NJM3770AD36 IC chips, shown in Fig. 6,

provides the current switching to each of the four lead wires (1-Black, 2-Yellow, 3-Grey, 4-Red) or the two windings.

C W d i r e c t i o n

Step 7B 9B 8B 8A 7A 9A Nos θs (deg) C C W d i r e c t i o n

1 0 0 1 1 1 1 150

2 0 0 1 1 1 0 140.75

3 0 0 1 1 0 1 13 2.25

4 0 0 1 1 0 0 12 3.7

5 5 0 1 1 1 0 0 28 5.25

6 1 0 1 1 0 0 44 6.75

7 1 1 0 1 0 0 527.5

8 1 0 0 1 0 0 368.25

9 0 1 0 1 0 0 209.75 10 0 0 0 1 0 0 411.25 11 0 0 0 1 0 1 512.75 12 0 0 0 1 1 0 614.25 13 0 0 0 0 1 1 315 14 0 0 0 0 1 0 215.75 15 0 0 0 0 0 1 117.25 16 0 0 0 0 0 0 018.75 17 0 1 0 0 0 0 1620.25 18 1 0 0 0 0 0 3221.75 19 1 1 1 0 0 0 5622.5 20 1 0 1 0 0 0 4023.25 21 0 1 1 0 0 0 2424.75 22 0 0 1 0 0 0 826.25 23 0 0 1 0 0 1 927.75 24 0 0 1 0 1 0 1029.25 1 0 0 1 1 1 1 1530

32 16 8 4 2 1

Figure 5-Schematic representation of Test Setup-I7

The input step signals generated from digital I/O (P0.0 to P0.5) transfer to stepper driver pins 7B, 9B, 8B, 8A, 7A, 9A respectively. These input signals or the pulses from the switches or the ports energize the phase windings consecutively, causing the stepper motor to run.

Motor leads to

pins 1 & 15

Pins 7, 9 are I1,

I0 respectively

and Pin 8 is

Phase.

Figure 6-Pin Configurations of NJM3770AD3 Chip6

Fig. 6 shows the pin configurations of NJM3770AD3 and the inputs (7, 8 and 9) and outputs (1 and 15) of IC chip are used in for the signals to flow through the driver circuit from DAQ board to the stepper motor leads.

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e, McNeese State University

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e , McNeese State University

Table 4-Pin

Description of NJM3770AD3 Chip

6

Figure 7-Stepper Motor Driver Interface

6

Fig. 7 is the schematic of the NJM3770A IC chip and its pin configuration is shown in Table 4.

DIP Symbol Description

1 M B Motor output B, Motor current flows from M A to M B when phase is high.

2

T

Clocking oscillator. Timing pin connect a 56K ? resistor and a 820pF in parallel between T and Ground.

3,14 V MM Motor supply voltage, 10 to 40 V. Pins 3 and 14 should be wired together.

4,5

GND

Ground and negative supply. Note these pins are used for heat sinking. 12,13

6 V CC Logic voltage supply normally +5V.

7 I 1 Logic input. It controls, together with the I 0 input, the current level in the output stage

The controllable levels are fixed to 100, 60, 20, and 0 %. 8

Phase

Controls the direction of the motor current of M A and M B outputs.

9 I 0 Logic input. It controls, together with the I 1 input, the current level in the output stage

The controllable levels are fixed to 100, 60, 20, and 0 %.

10

C

Comparator input. This input senses the instantaneous voltage across the sensing resistor, filtered through a R C Network. 11 V R Reference voltage. Controls the threshold voltage of the comparator and hence the output current. Input resistance: typically 6.8K ?± 20%

15 M A Motor output A, Motor current flows from M A to M B when phase is high.

16

E

Common emitter. Connect the sense resistor between this pin and ground.

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e , McNeese State University

Figure 8-Typical stepper motor driver application with NJM3770A 6

where:

7B, 9B & 7A, 9A are I1B, I0B & I1A, I0A respectively (control current levels) 8B & 8A are Phase B & Phase A respectively (control direction)

A and

B are two I

C chips (NJM3770AD3) used in stepper driver circuit in Test Setup-I.

Figure 9-Digital Control of Stepper Motor Experiment I

Stepper Motor

5V DC

NI DAQ USB Board Digital I/O

Stepper Driver Control Circuit

PC

Grey

Yellow

Red

8A A

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e , McNeese State University

Fig. 9 shows a photo of the Test Setup-I, where a PC with LabVIEW program gives the stepping input signals to stepper driver through a digital NI-DAQ USB board. The output signals from the stepper driver control circuit, which is described in Fig. 8, are used for rotary motion of the stepper motor through the motor leads.

5. Test Setup-II

Stepper Control Circuit in Test Setup-II

Figure 10-Typical Wiring Diagram [8]

In Fig. 10, the microstepping drive receives digital input signals from DAQ-board and the output signals are sent to stepper motor through an extension cable. A 35V DC power supply is given to the drive.

Figure 11-Schematic Diagram of Voltage Follower in *NI Multisim

A special case of the non-inverting amplifier is that of the Voltage Follower. The voltage

follower has the output signal connected to the inverting input terminal of the op amp as shown in Fig. 11. The analysis of this device shows that V out = V in . Also the output is in phase with the input. The common use for a voltage follower is to create a buffer in a digital circuit 9. It acts as isolation between the input (DAQ board) and the output (Microstepping Drive).

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e , McNeese State University

*National Instruments Multisim is an easy-to-use schematic capture and simulation software.

Figure 12-Stepper Motor Controller Circuit with Voltage Follower in Test Setup-II

Fig. 12 shows that the voltage follower circuit acting as an isolator between the circuits, i.e., stepper driver circuit (X and Y drive) along with relay circuit (spindle drive), and the NI- DAQ digital I/O USB boards.

The DC power supply for the Voltage follower, i.e., Vcc ≈10V. In the test setup-II for CNC desktop mill, a total of 10 voltage followers are used. So, instead three LM 324 ICs (Integrated Chips) are utilized for this.

Working Principle of Stepper Motor in Axis Drive:

The movement along the different axis is required either to move the cutting tool to the work table to the desired positions. In order to accomplish accurate control of position and velocity, stepper motors are used for axis drive. In the test setup-II, X and Y axes of the work table are controlled by stepper motors and Z-axis or the cutting tool (spindle) is controlled by pneumatic actuator, which is activated by a relay circuit 10.

Controlling Resonance in the Mechanism:

If a rigidly mounted stepping motor is rigidly coupled to a frictionless load and then stepped at a frequency near the resonant frequency, energy will be pumped into the resonant system, and the result of this is that the motor will literally lose control. There are two basic ways to deal with this problem:

Voltage Follower Circuit

120V AC Power Supply Stepper Drivers

NI- DAQ Digital I/O

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e , McNeese State University

1. Use of elastomeric motor mounts or elastomeric couplings (Appendix A shows the drawings

of the motor mounts and couplings) between motor and load can drain energy out of the resonant system, preventing energy from accumulating to the extent that it allows the motor rotor to escape from control.

2. Viscous damping can be used. Here, the damping will not only draw energy out of the resonant modes of the system, but it will also subtract from the total torque available at

higher speeds. The end bearing for the lead screw offers an opportunity for viscous damping, as do the ways on which the load slides. Even the friction found in sealed ballbearings or Teflon on steel ways can provide enough damping to prevent resonance problems 11.

Spindle Drive

The spindle drive is controlled by a pneumatic/ air cylinder activated by solenoid air valve (Fig. 14) using two solid state I/O relays and DAQ board (device 2). The device shown in the Fig. 13 is the solenoid air valve used for spindle UP/ DOWN actions. A close circuit supplies 5V DC to the relay and thereby spindle is either extended or retracted from the work piece. Another device is the spindle motor, which is again controlled by a third relay and same DAQ board for spindle ON/ OFF positions. Fig. 15 shows the photo of all the connections for spindle drive.

Figure 13-Wiring Diagram of Solid State Digital I/O Relay

These Solid state I/O switching modules deliver an electrically clean, photo-isolated, noise-free "output" interface from logic level control systems (NI-DAQ board) to external loads such as motors, valves, solenoids, etc.

Figure 14-Working of Solenoid Air Valve 12

Air Cylinder Solenoid

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e , McNeese State University

An air compressor (Fig. 15) is used to supply a pressurized air of about 75-85 PSI or 6 bar to the pressure center of the solenoid air valve. When the solenoid is activated and displaces downward, then the pressurized air is sent to the air cylinder. Here when pressure P1> P2, the piston in the air cylinder is forced down, moving the spindle downward. Similarly, when P2>P1, the piston is forced up, moving the load (spindle) upward.

Figure 15-Experimental Test Setup-II

Figure 16-CNC Desktop Mill

Fig. 16 shows a closer view of the CNC desktop mill, where a spindle is operated by a solenoid air valve. A ball end mill is used as a cutting tool. Clamping is used to fix the work piece to the work table. Two stepper motors are used to control the X and Y slides movement. Limit switches are used at each end of the X and Y axes.

Clamping Solenoid Air Valve

Spindle

Work Table Work Piece Slides

Stepper Motor

Ball End Mill Limit Switches for Y-axis

PC with

LabVIEW Program Air Compressor NI-DAQ

USB Relay Circuit

Stepper

Driver

Desktop Mill

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e , McNeese State University

Limit Switches in Motion Control

A limit switch is a device that produces a signal used to stop the motor. Limit switches are usually used to indicate an end of travel, or to prevent a motor from travelling too far in one direction or crossing the work space limits. In this experiment, the stepper motors cannot move any more than a specified distance (5.5in. each direction) without doing damage to the motor or the surroundings. When a limit switch (Fig. 17) is activated in the direction of travel, a controller needs to stop motion in that direction as soon as possible. To accomplish this, ReadDigPort_2.vi as shown in Appendix C is used in a while loop in the main program to stop immediately at the press of the roller. This acts like an emergency stop and the whole program and machine comes to a stand still. To get any movement, the limit must be disabled.

Figure 17-Limit Switch and its connections for longitudinal slide of the desktop mill

When the XY table has moved to the farthest position it can move to, the motor must stop trying to push it any further. If there were no limit switches on the XY table, the motor would reach the end of travel, but still continue to turn, causing damage to either the motor or the XY table 13. 6. Results and Discussions

This section includes the description of LabVIEW programming (Fig. 19-36) to read CNC-code text file and to be able to complete the engraving operation 14 on desktop CNC miniature mill. The program is written to execute sub-routine of any 3 letters (A-Z) or 3 numbers (0-9).The CNC code for letters A to Z and numbers 0 to 9 are explained in Appendix B.

A flow chart is illustrated in Fig. 18 for the LabVIEW program used to read a CNC-code text file. The Main VI (Subroutine_Main.vi) is having a SubVI called Sub Code VI which contains all the different CNC codes (G0, G1, G2, G3, Home, M5 and L9201) used in the program. A SubVI for each of the CNC code is written.

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e , McNeese State University

Figure 18-Flow Chart for the LabVIEW Program to read a CNC-Code text file

Main VI Program:

Figure 19-Front Panel of Subroutine_Main.vi

Figure 20-Block Diagram of Subroutine_Main.vi

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e , McNeese State University

Sub Code VI Program:

Figure 21-Front panel of Sub_Code.vi

Fig. 21 shows front panel of the Sub Code VI. Here a menu ring that has different CNC-codes and another ring that contains the characters, i.e., letters (A-Z) and numbers (0-9) are used.

Linear Interpolation Sub VI: G0, G1

Figure 22-Front Panel of Feed Rate All_with Limit Switch.vi

Figure 23-Block Diagram of Feed Rate All_with Limit Switch.vi

Ring Properties

Table 5-Test Menu Ring Properties

The Table 5 shows the different cases used in Linear Interpolation SubVI.

Figure 24-Front Panel of SubVI Feed Rate _with Limit Switch.vi

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e, McNeese State University

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e , McNeese State University

Figure 25-Block Diagram of SubVI Feed Rate_with Limit Switch.vi

Circular Interpolation SubVI: G2, CW

Figure 26-Front Panel of CW Circular Interpolation (G2) SubVI.vi

Figure 27-Block Diagram of CW Circular Interpolation (G2) SubVI.vi

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e , McNeese State University

Circular Interpolation SubVI: G3, CCW

Figure 28-Front Panel of CCW Circular Interpolation (G3) SubVI.vi

Figure 29-Block Diagram of CCW Circular Interpolation (G3) SubVI.vi

Proceedings of the 2010 ASEE Gulf-Southwest Annual Conferenc e , McNeese State University

Figure 30-Front Panel of CW/CCW Circular Interpolation SubVI.vi

Figure 31-Block Diagram of CW/CCW Circular Interpolation SubVI.vi

相关主题
文本预览
相关文档 最新文档