










Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Project; Class: Senior Design Project Lab; Subject: Electrical and Computer Engr; University: University of Illinois - Urbana-Champaign; Term: Spring 1999;
Typology: Study Guides, Projects, Research
1 / 18
This page cannot be seen from the preview
Don't miss anything!











By Jose Rene Flores and Jaime Zavala ECE 345 TA: Lee Rumsey Project # 04 May 1999
This paper reports on the design of a device to rotate a mirror assembly through various angles. A small stepper motor rotates the mirror. The objective of this project was to design the necessary circuitry and software to drive the small stepper motor via a laptop computer's parallel port interface. There are three key components to the project design: (1) mechanical drive, (2) hardware to software interface, (3) computer software to drive the stepper motor via a laptop computer. The three components were successfully integrated to rotate of the stepper motor through forty-five degree increments. II
This project’s overall goal was to rotate a mirror located inside of a spacecraft. The mirror is used as a focusing device for a set of sensors taking atmospheric measurements. The project is not concerned with the design of the sensors, but with the design and implementation of the mechanical device to turn the mirror, the needed drive circuitry and the controlling software. The resulting project design goals are: Speed – The stepper motor must turn at a reasonably fast rate. Due to the speed of the spacecraft, the mirror has to quickly focus the sensors in different directions. Torque – The stepper motor’s holding torque must be enough to sustain the weight of the motor assembly. Direction – The user must be able to rotate the mirror in two directions (mirror rotation occurs in one dimension). The only mechanical component used was a small stepper motor. The shaft of the stepper motor will be connected to the mount of the mirror for rotation. Using a computer interface, positioning commands were fed to the stepper motor via a printer cable to the driver hardware. The hardware amplified the signals and relayed them to the stepper motor. Figure 1below clearly shows the design flow. Fig. 1 Block diagram of Stepper motor-parallel port interface. (JRF) V Computer (^) Drive circuits Stepper Motor Mirro r
with six poles serves as the rotor, three are north polarized and three are south polarized. The specific motor used for this project has an angle resolution of 1.8 degrees per step. Higher resolutions require more poles, 1.8 degrees require 100 poles. Current flows from the center tap of winding 1 to terminal (a) causes the top stator pole to be a north pole and the bottom stator pole to be a south pole. Power is then alternated to winding 2 and causes the rotor to turn. Only one half of each winding is energized at a time. Stepper motors also have the advantage of producing high torque at low speeds. Direct current motors do not produce high torque at low speeds, without the aid of gearing mechanisms. Stepper motors also have holding torque which allows a stepper motor to hold its position firmly when not turning. This is useful for the intended application where the motor will be starting and stopping, while the force of the mirror’s momentum acting against the motor remains present. This eliminates the need for a mechanical brake mechanism. These same principals drive the specific motor used for this project, the Astrosyn mini-angle stepper. The Astrosyn is a 5V, 1A per phase, 1.8 degree per step motor. 2.2 Driver circuit The motor used for this project requires at least 1 ampere per phase, but the computer’s parallel port can only deliver a few milliamperes of current. Since the computer delivers the motor’s required 5 volts per phase ,a simple application of Ohm’s law says that a 5 resistor will pull the necessary current. However, most resistors are not capable of pulling current past a few milliamperes. In addition, resistors cannot handle the fast current switching required by the stepping sequence. The inductive loads of the coils tend to make the current reverse direction because of the rapid on and off switching. VII
Using a Darlington transistor array such as the ULN2003 chip can easily solve these problems. These arrays are composed of cascaded NPN transistors with suppression diodes attached to prevent current reversal. Another advantage of the Darlington transistor is its ability to amplify the computer’s output current from a few milliamperes into a 500mA input to the stepper motor. Two transistor elements of each pin are needed in parallel to supply the necessary 1A to the stepper motor. Figure 3 below shows the arrangement of NPN transistors and the pin assignments on the chip. Fig. 3 ULN2003 Darlington transistor array representative schematic and pin connections Figure 4 on the next page shows the parallel connection of the chips’ internal transistors. Pins 1-3 and 4-6 were used as inputs from the computer’s parallel port. These pins received the on and off sequence discussed in section 2.1. Pins 14 -16 and 11-13serve as the output of the chips. Current leaving each of the pins was measured to be 344 milliamperes. Only two pins are needed to supply the necessary500mA, but 3 pins were utilized as a backup feature. As can be seen from the schematic, each set of outputs is used to feed into one of the stepper motor’ coils, 1a, 1b, 2a, and 2b. (JZ) VIII
We took some data to verify that the output from the Darlington chips was consistent. Table 1 in the following page shows the results. The input to the Darlington chips had a current values of approximately 0.0015mA. The current values coming out of each of the output pins were approximately 0.67A! This is a pretty impressive amplification. When you add up these current values the result is 2.01A, more than necessary to run the motor. However, the actual current measured from the parallel arrangement was approximately 1.16A. This makes sense because the motor only pulls the current it needs from the parallel arrangement. To show that the data sequence was actually being sent correctly, we generated a plot of Table 1. This plot can be found in appendix 1. (JRF)
The project worked as expected and most of the design goals were achieved except for the frequency of rotation. The stepping frequency was 1 step per second. This is unacceptable for the intended design purpose. The stepping frequency is controlled by the computer software. Originally, the software did not include any provisions for frequency control. The computer’s pulse frequency was too fast for the stepper motor coils to energize and react. The result was no movement of the motor. The solution used was the utilization of the ‘sleep’ command within the C coding. The sleep command specifies the time delay to execute certain functions. The fastest frequency attained via the sleep command was one step per second. A faster rate of turn could have been achieved had there been more time. There were other programming solutions that could have been pursued, but abandoned because of time constraints. Another design goal not met was the construction of the mirror itself. Again, time did not permit the design of a mirror assembly. The project reached a good degree of functionality. The main design goal, that of getting the motor to turn via a computer program, was successfully achieved. The main area for improvement is the frequency of rotation. This team has gained a tremendous amount of knowledge through the researching and designing of the stepper motor-parallel port interface. The project was very interesting because of the opportunity to learn about areas unfamiliar to both project members. XIII
[1] Gadre, Dhananjay V.,”Programming the Parallel Port. Interfacing the PC for Data Acquisition and Control” Lawrence, KS: Miller Freeman Inc. [2] D. Jones, “Control of Stepping Motors, a tutorial,” October 1998, http://www.cs.uiowa.edu/~jones/step XIV
if (direc == 1) { degrees += 90; clockwise(12); outportb(0x378, 0x8); outportb(0x378, 0x2); printf("It's at %d degrees.\n", degrees); } else { degrees -= 90; counterclockwise(12); outportb(0x378,0x1); sleep(1); outportb(0x378,0x4); printf("It's at %d degrees.\n", degrees); } break; case 'C': case 'c': ask(&direc); if (direc == 1) { degrees += 135; clockwise(18); outportb(0x378,0x8); sleep(1); outportb(0x378,0x2); sleep(1); outportb(0x378,0x4); printf("It's at %d degrees.\n", degrees); } else { degrees -= 135; counterclockwise(18); outportb(0x378,0x1); sleep(1); outportb(0x378,0x4); sleep(1); outportb(0x378,0x2); sleep(1); printf("It's at %d degrees.\n", degrees); } break; case 'D': case 'd': ask(&direc); if (direc == 1) {degrees += 180; clockwise(25); printf("It's at %d degrees.\n", degrees); } XVI
else { degrees -= 180; counterclockwise(25); printf("It's at %d degrees.\n", degrees); } break; case 'u': case 'U': outportb(0x378,0x0); printf("\nThe motor is unlocked\n"); break; case 'q': case 'Q': printf("\nAdios Shania!"); break; default: printf("Invalid angle, enter another\n"); break; } } while (angle !='Q' && angle !='q'); return 0; } /------------------------------------------------------------/ /this function rotates the motor clockwise. / void clockwise(int times) { int i; for(i=1; i<=times; i++) { outportb(0x378,0x8); sleep(1); outportb(0x378,0x2); sleep(1); outportb(0x378,0x4); sleep(1); outportb(0x378,0x1); sleep(1); } } /-----------------------------------------------------/ /* This function rotates the motor counterclockwise. */ void counterclockwise(int times) { int i; for(i=1; i<=times; i++) { outportb(0x378,0x1); sleep(1); XVII