ecd major project report

20
1 | Page Project Report ON PC BASED REMOTE-CONTROLLED STEPPER MOTOR AT Institute Of Technology Nirma University, Ahmedabad By: Kuldip Gor (08BEC030) Pravin Gondaliya (08BEC029) B.Tech in Electronics and communication Engineering Semester-IV Year 2009-10

Upload: kuldip-gor

Post on 21-Apr-2015

77 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Ecd Major Project Report

1 | P a g e

Project Report

ON

PC BASED REMOTE-CONTROLLED STEPPER MOTOR

AT

Institute Of Technology

Nirma University, Ahmedabad

By:Kuldip Gor (08BEC030)

Pravin Gondaliya (08BEC029)

B.Tech in Electronics and communication Engineering Semester-IVYear 2009-10

Guided by:Mr. Kunal Modh

Page 2: Ecd Major Project Report

INDEX:

1. Acknowledgement 3

2. Introduction 4

3. Components 5

4. Circuit Diagram 6

5. Circuit Description 7

6. Components Description 8

1. Stepper motor Description 82. Some basics of parallel port 113. Description of ULN2003 13

7. Device Driver Pragram using C++ 14

8. References 16

2 | P a g e

Page 3: Ecd Major Project Report

ACKNOWLEDGEMENT:

We, Pravin Gondaliya (08BEC029) and Kuldip Gor (08BEC030) students of Electronics and communication Engineering, Institute of Technology, Nirma University, Ahmedabad doing our internal project work of ‘PC based remote controlled stepper motor’ at Nirma University as a perquisite for course of 8th semester.

We would like to thank to our respected faculty Mr. Kunal Modh give us guidance and suggestions regarding to the project. We are also thankful to our H.O.D. Pro.A.S. Ranade for providing the platform and required facilities for our project.

Yours faithfully,Pravin Gondaliya (08BEC029)

Kuldip Gor (08BEC030)

3 | P a g e

Page 4: Ecd Major Project Report

INTRODUCTION:

This circuit works on the principle of infrared rays for remote control. Sitting at your personal computer with the IR transmitter attached to the parallel port of the PC and oriented properly towards the IR receiver, run the program installed on your desktop PC. The Program has a user interface to enter the mode of operation and to specify the control parameters including the angle of rotation of the stepper motor interactively. Enter the choices and press the Enter key. The motor will start running according to your instructions. The control parameters include speed of the function, which enables you to specify the number of steps per second.

4 | P a g e

Page 5: Ecd Major Project Report

COMPONENTS :

ICs:

IC1: NE555 timerIC2: CD4017 decade counterIC3: ULN2003 high voltage , high current darlington arraysT1,T2: BC548 npn transistorsIR LED1: infrared transmitting LEDIRX1: TSOP1738 receiver module

Resistors(all ¼ watt )

R1: 1 kilo ohmR2:470 ohm R3: 10 ohmR4: 680 ohmR5: 10 kilo ohm

Capacitors:

C1: 0.001 uF ceramic diskC2; 0.01 uF ceramic disk

5 | P a g e

Page 6: Ecd Major Project Report

CIRCUIT DIAGRAM:

TRANSMITTER:

RECEIVER:

6 | P a g e

Page 7: Ecd Major Project Report

CIRCUIT DESCRIPTION:IR transmitter:

The output from the PC appears as the series of pulses pin 2 of the 25 pin D type connector of parallel port (address 0378H). These pulses are coupled to the reset pin of timer NE555 configured as an astable multivibrator . The frequency of the multivibrator is set to 38 kHz as determined by timing components R1,R2 and C1. The frequency in Hz is given by the formula, f = 0.69(R1+2R2)xC1

The output pulses from pin2 of connector modulate the 38kHz carrier .The pin3 of IC1 is used to control drive transistor T1, which , in turn , control current through the IR LED during positive incursions of the 38kHz carrier applied to its base.

IR RECEIVER :

This circuit is designed around integrated IR receiver module TSOP1738, which incorporates suitable bandpass filter , demodulator and low power output driver stage . The demodulated pulse output resenting the original output from pin2 of PC’s parallel port , after inversion by amplifier transistor T2 , is used for clocking CD4017 johnson counter during negative pulse incursions at its pin 13 . In this configuration of CD4017 operation , the usual clock pin is tied to Vcc.

The sequential Q0 through Q3 outputs of CD4017 counter are used for driving the stepper motor via high current darlington drivers inside IC ULN2003 , which incorporate free – wheeling diods between common supply pin9 and each of the output pins. This obviates the need to use external free wheeling diodes across the inductive loads of fered by the motor.

Depending upon the stepper motor rating , you can use a separate supply of up to 24V( at pin 9) for driving a current limited to 500mA through each output pin of ULN2003.

As Parallel port is very delicate port attached with mother board, any back current or reverse emf can blow wer entire parallel port along with motherboard off. To prevent this we need to isolate it through optocouplers. Any optocouplers will serve the purpose and safeguard the computer. Here we have used IC 4N35.

DIAGRAM OF IC 4N35:

7 | P a g e

Page 8: Ecd Major Project Report

COMPONENT DISCRIPTION:STEPPER MOTOR DESCRIPTION:

In the above figure the stepper motor has five wires namely Yellow, Brown, Orange, Black and Red. To make the motor rotate in a particular direction (clockwise or anticlockwise), the wires are needed to be connected in a sequence.

For Clockwise rotation the sequence is as follows:Yellow, Brown, Orange, Black. For Anti-Clockwise rotation the sequence is as follows:Black, Orange, Brown, Yellow.

The Red wire in both the cases is kept at a positive voltage.

WORKING OF STEPPER MOTOR:

The stepper motor uses the theory of operation for magnets to make the motor shaft turn a precise distance when a pulse of electricity is provided. As per law of science we know that like poles of a magnet repel and unlike poles attract. Figure 1 shows a typical cross-sectional view of the rotor and stator of a stepper motor. From this diagram we can see that the stator (stationary winding) has four poles, and the rotor has six poles (three complete magnets). The rotor will require 12 pulses of electricity to move the 12 steps to make one complete revolution. Another way to say this is that the rotor will move precisely 30° for each pulse of electricity that the motor receives. The number of degrees the rotor will turn when a pulse of electricity is delivered to the motor can be calculated by dividing the number of degrees in one revolution of the shaft (360°) by the number of poles (north and south) in the rotor. In this stepper motor 360° is divided by 12 to get 30°.

Figure : Diagram that shows the position of the six-pole rotor and four-pole stator of a typical stepper motor

8 | P a g e

Page 9: Ecd Major Project Report

When no power is applied to the motor, the residual magnetism in the rotor magnets will cause the rotor to detent or align one set of its magnetic poles with the magnetic poles of one of the stator magnets. This means that the rotor will have 12 possible detent positions. When the rotor is in a detent position, it will have enough magnetic force to keep the shaft from moving to the next position. This is what makes the rotor feel like it is clicking from one position to the next as we rotate the rotor by hand with no power applied.

When power is applied, it is directed to only one of the stator pairs of windings, which will cause that winding pair to become a magnet. One of the coils for the pair will become the north pole, and the other will become the south pole. When this occurs, the stator coil that is the north pole will attract the closest rotor tooth that has the opposite polarity, and the stator coil that is the south pole will attract the closest rotor tooth that has the opposite polarity. When current is flowing through these poles, the rotor will now have a much stronger attraction to the stator winding, and the increased torque is called holding torque.

By changing the current flow to the next stator winding, the magnetic field will be changed 90°. The rotor will only move 30° before its magnetic fields will again align with the change in the stator field. The magnetic field in the stator is continually changed as the rotor moves through the 12 steps to move a total of 360°. Figure 2 shows the position of the rotor changing as the current supplied to the stator changes.

FIGURE 2 Movement of the stepper motor rotor as current is pulsed to the stator. (a) Current is applied to the top and bottom windings, so the top winding is north, (b) Current is applied to left and right windings, so the left winding is north, (c) Current is applied to the top and bottom windings, so the bottom winding is north, (d) Current is applied to the left and right windings so the right winding is north.In Fig. 2 We can see that when current is applied to the top and bottom stator windings, they will become a magnet with the top part of the winding being the north pole, and the bottom part of the winding being the south pole. We should notice that this will cause the rotor to move a small amount so that one of its south poles is aligned with the north stator pole (at the top), and the opposite end of the rotor pole, which is the north pole, will align with the south pole of the stator (at the bottom). A line is placed on the south-pole piece that is located at the 12 o'clock position in Fig. 2a so that we can follow its movement as

9 | P a g e

Page 10: Ecd Major Project Report

current is moved from one stator winding to the next. In Fig. 2b current has been turned off to the top and bottom windings, and current is now applied to the stator windings shown at the right and left sides of the motor. When this occurs, the stator winding at the 3 o'clock position will have the polarity for the south pole of the stator magnet, and the winding at the 9 o'clock position will have the north-pole polarity. In this condition, the next rotor pole that will be able to align with the stator magnets is the next pole in the clockwise position to the previous pole. This means that the rotor will only need to rotate 30° in the clockwise position for this set of poles to align itself so that it attracts the stator poles.

In Fig. 2c we can see that the top and bottom stator windings are again energized, but this time the top winding is the south pole of the magnetic field and the bottom winding is the north pole. This change in magnetic field will cause the rotor to again move 30° in the clockwise position until its poles will align with the top and bottom stator poles. We should notice that the original rotor pole that was at the 12 o'clock position when the motor first started has now moved three steps in the clockwise position.

In Fig. 2d we can see that the two side stator windings are again energized, but this time the winding at the 3 o'clock position is the north pole. This change in polarity will cause the rotor to move another 30° in the clockwise direction. We should notice that the rotor has moved four steps of 30° each, which means the rotor has moved a total of 120° from its original position. This can be verified by the position of the rotor pole that has the line on it, which is now pointing at the stator winding that is located in the 3 o'clock position

Wiring of stepper motor of different number of wires:

4 wires 5 wires 6 wires 8 wires

10 | P a g e

Page 11: Ecd Major Project Report

SOME BASICS OF A PARALLEL PORTWhat is a port? A port contains a set of signal lines that the CPU sends or receives data with other

components. We use ports to communicate via modem, printer, keyboard, mouse etc. In signaling, open signals are "1" and close signals are "0" so it is like binary system. A parallel port sends 8 bits and receives 5 bits at a time. The serial port RS-232 sends only 1 bit at a time but it is multidirectional so it can send 1 bit and receive 1 bit at a time...

Figure 10. Parallel Port Configuration

Parallel Port - Data Ports: In sending the sequences, you will need the data ports which can be seen in the picture

from D0 to D7 .Parallel Port - Status Ports:These ports are made for reading signals. The range is like in data ports which are S0-

S7. But S0, S1, S2 are invisible in the connector. And S0 is different; this bit is for timeout flag in EPP (Enhanced Parallel Port) compatible ports. The address of this status port is 0x379 . This will always be refer to "DATA+1" and it can send 5 numeric data from the 10 - 11 - 12 - 13 - 15 th pins. So how can we reach the data ports? It is simple: every parallel port has an address. In Windows 2000, you can see yours by Settings > Control Panel > System > Hardware > Device Manager > Ports (COM & LPT) > Printer Port(LPT1) > Properties = in Resources > Resource Setting and you can see your address for your parallel port. For Ex: Generally it is 0378-037F. This is hexadecimal like in math (mod 16). 0x378 belongs to 888 in decimal form. In this way you can look for your com port or game port addresses. Let's enlighten these bits with a printer example:

S0: This bit becomes higher (1) if a timeout operation occurs in EPP mode. S1: Not used (Maybe for decoration :)) S2: Mostly not used but sometime this bit shows the cut condition (PIRQ) of the

port S3: If the printer determines an error it becomes lower (0). Which is called nError

or nFault S4: It is high (1) when the data inputs are active. Which is called Select S5: It is high(1) when there is no paper in printer. Which is called PaperEnd,

PaperEmpty or PError S6: It sends low impact signaling when the printer gets a one byte data. Which is

called nAck or nAcknowledge S7: This is the only reversed pin on the connector (see my table in the article) . If

the printer is busy and it cannot get any additional data this pin becomes lower. Which is called Busy

Parallel Port - Control Ports:This port usually used for outputting but these can be used for inputting. The range is

like in data ports C0-C7 but C4, C5, C6, C7 are invisible in connector. And the address for this is 0x37A

11 | P a g e

Page 12: Ecd Major Project Report

C0: This pin is reversed. It sends a command to read D0-D7 on the port. When the computer starts it is high in the connector. Which is called nStrobe

C1: This pin is reversed. It sends a command to the printer to feed the next line. It is high in the connector after the machine starts. Which is called Auto LF

C2: This pin is for reset the printer and clear the buffer. Which is called nInit, nIni-tialize

C3: This pin is reversed. Sends a high(1) for opening data inputs. It is low after the machine starts. Which is called nSelectIn

C4: Opens the cut operation for the printer. Not visible in the connector... C5: Sets the direction control in multidirectional ports. Not visible in the con-

nector... C6: Not used and also Not visible in the connector... C7: Mostly not used but it is used as a C5 in some ports. Not visible in the con-

nector... Parallel Port -Ground Pins:These are (G0 - G7) the pins from 18 to 25 . These are mostly used for completing the

circuit. Different pins are required when using all the pins including the inputs.After these we will be using data ports in experiment because there are reversed pins in

control and status ports. Here is an explanation for reversed pins: While you are not sending any signals to the data port it is in closed position like "00000000" so the 8 pins have no voltage on it (0 Volt) .If you send decimal "255" (binary "11111111") every pin (D0-D7) has a +5 Volt... On the other hand, if we use control ports, there are reversed pins which are C0, C1 and C3 so while we send nothing to the control port its behaviour is "0100" in binary (decimal "11")...

Signal BIT PIN Direction

-Strobe ¬C0 1 Output

+Data Bit 0 D0 2 Output

+Data Bit 1 D1 3 Output

+Data Bit 2 D2 4 Output

+Data Bit 3 D3 5 Output

+Data Bit 4 D4 6 Output

+Data Bit 5 D5 7 Output

+Data Bit 6 D6 8 Output

+Data Bit 7 D7 9 Output

-Acknowledge S6 10 Input

+Busy ¬S7 11 Input

+Paper End S5 12 Input

+Select In S4 13 Input

-Auto Feed ¬C1 14 Output

-Error S3 15 Input

-Initialize C2 16 Output

-Select ¬C3 17 Output

Ground - 18-25

Ground

12 | P a g e

Page 13: Ecd Major Project Report

DISCRIPTION OF ULN2003:

13 | P a g e

Page 14: Ecd Major Project Report

DEVICE DRIVER PROGRAM USING C++.

#include<iostream.h>#include<conio.h>#include<dos.h>#include<stdlib.h>

void main(){

clrscr();char l;int i,j,k,m;while(l){

clrscr();textcolor(GREEN);cout<<"WEL COME......"<<endl;gotoxy(12,23);outportb(0x0378,0);cout<<"ENTER CHOICE....."<<endl;cout<<"1: SET SPEED \n2: RUN MOTOR \n3: QUIT"<<endl;l=getch();if(l=='3')exit(0);if(l=='1'){

clrscr();gotoxy(12,23);cout<<"ENTER SPEED:";cin>>m;m=1000/m;

}clrscr();gotoxy(12,23);cout<<"ENTER CHOICE:"<<endl;cout<<"1:CONTINUOS RUN\n2:ANGLE SPECIFICATION\n3:QUIT";l=getch();if(l=='1'){

clrscr();gotoxy(12,23);cout<<"PRESS ANY KEY TO START......";getch();textcolor(RED+BLINK);clrscr();gotoxy(12,23);cout<<:"RUNNING........."<<endl<<endl;cout<<"PRESS ANY KEY TO STOP.....";while(!kbhit())

14 | P a g e

Page 15: Ecd Major Project Report

{outportb(0x0378,1);delay(100);outportb(0x0378,0);delay(m);

}getch();continue;

}else if(l=='2'){

clrscr();gotoxy(12,23);cout<<"ENTER THE ANGLE BY WHICH TO BE ROTATED : ";cin>>k;k=k/1.8+1;clrscr();gotoxy(12,23);cout<<"RUNNING....";for(i=0;i<k;i++){

outportb(0x0378,1);delay(100);outportb(0x0378,0);delay(m);

}clrscr();gotoxy(12,23);cout<<"COMPLETE....";getch();continue;

}else{

outportb(0x0378,0);exit(0);

}

}}

15 | P a g e

Page 16: Ecd Major Project Report

REFERENCES:

EFY magazine.http://collections.sharewith.us

16 | P a g e