Top Banner
1 Interfacing of Stepper Motor with Microcontroller 8051 Prepared By: Uday Korat (100280111022) Himanshi Gajjar(100280111032)
14

Report Interfacing of Stepper Motor With Microcontroller 8051

Apr 18, 2015

Download

Documents

Uday Korat

this project report is useful for stepper motor interfacing with 8051 mic..nd this report war prepared by me nd himanshi gajjar(ec-ldce)
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Report Interfacing of Stepper Motor With Microcontroller 8051

1

Interfacing of

Stepper Motor with

Microcontroller

8051

Prepared By: Uday Korat (100280111022) Himanshi Gajjar(100280111032)

Page 2: Report Interfacing of Stepper Motor With Microcontroller 8051

2

CERTIFICATE

This is to certify

that__________________________ Studying in 5th

semester, B.E. (Electronics and Communications) has

successfully completed his project on

MICROCONTROLLER AND INTERFACING

within four walls of L.D. College Of Engineering,

Ahmedabad -15 for the term ending in November. 2012

Date of Submission: _________

Staff in-Charge Head of Department

Mr.Pankaj Prajapati Prof. K.R.Parmar

L.D. College of Engineering

Gujarat Technological University, Ahmedabad-380015.

Page 3: Report Interfacing of Stepper Motor With Microcontroller 8051

3

• Table Of Content:

1. Introduction 2. Component List 3. Stepper Motor 4. 8051 Microcontroller 5. L293D (Quadruple Half H-Bridge IC) 6. Circuit Diagram 7. Flowchart 8. C Program

Page 4: Report Interfacing of Stepper Motor With Microcontroller 8051

4

• Component List

8051 Controller

8051 Development board

L293D(Motor Driver)

Stepper Motor(Bipolar)

SPST switch

Connectors

Page 5: Report Interfacing of Stepper Motor With Microcontroller 8051

5

Stepper Motor A stepper motor is a widely used device that translates electric pulse into mechanical movement. Stepper motor is one of the commonly used motors for precise angular movement. The advantage of using a stepper motor is that the angular position of the motor shaft can be controlled without any feedback mechanism. Stepper motors are widely used in industrial and commercial applications. They are also commonly used as in drive systems of autonomous robots.

A stepper motor is an electric motor that can perform a 360-degree rotation divided into a number of steps. The number of steps differs for various stepper motors. The micro stepping concept can be used in a stepper motor to increase the number of steps and to provide smooth rotation by eliminating jerky behavior between each step. Two full-bridge motor drivers can be connected to a stepper motor to perform micro steps.

Concepts Related to Stepper Motor Step Angle

The Step angle is the minimum degree of rotation associated with a single step.

Steps per Second & rpm Relation

Steps per Second = rpm * Steps per revolution

60

Page 6: Report Interfacing of Stepper Motor With Microcontroller 8051

6

Motor Speed

The speed of motor is measured in steps per second(Steps/s) is a function of Switching Rate.

Types Of Stepper Motor

Stepper Motor is mainly classified into 2 types:

1. Unipolar Stepper Motor 2. Bipolar Stepper Motor

Page 7: Report Interfacing of Stepper Motor With Microcontroller 8051

7

1. Unipolar Stepper Motor

Unipolar stepper motors are characterised by their center-

tapped windings.

2. Bipolar Stepper motor

The Bipolar Stepper motor has 2 coils. The coils are identical and are not electrically connected. You can identify the separate coils by touching the terminal wires together-- If the terminals of a coil are connected, the shaft becomes harder to turn.

Page 8: Report Interfacing of Stepper Motor With Microcontroller 8051

8

Step Sequence for Bipolar stepper motor 1. 4-Step Wave Drive Sequence

Step 1a 1b 2a 2b

0 1 0 0 0

1 0 1 0 0

2 0 0 1 0

3 0 0 0 1

2. 8-Step (Half Step) Sequence

Step 1a 1b 2a 2b 0 1 0 0 0 1 1 1 0 0

2 0 1 0 0

3 0 1 1 0

4 0 0 1 0

5 0 0 1 1

6 0 0 0 1

7 1 0 0 1

Page 9: Report Interfacing of Stepper Motor With Microcontroller 8051

9

• 8051 Microcontroller

o Features

8 bit ALU. 16 bit PC and DPTR. 8 bit stack pointer and 8 bit PSW. 4K internal ROM 128 bytes of Internal RAM. 32 bits arranged as four,8 bit ports P0-P3. Two 16 bit timer/counters, T0 & T1. Full duplex serial Port. Control Registers TCON,TMOD,SCON,PCON,IP,IE etc

(SFR’s). Two External and three internal interrupt sources. 0-12 MHz clock. 40 pin DIP package. Powerful Instruction set.

Pin Diagram

Page 10: Report Interfacing of Stepper Motor With Microcontroller 8051

10

L293D(Motor Driver IC)

When an enable input is high, the associated drivers

are enabled and their outputs are active and in phase with their inputs.

When the enable input is low, those drivers are disabled and their outputs are off and in the high-impedance state.

With the proper data inputs, each pair of drivers forms a full-H (or bridge) reversible drive suitable for solenoid or motor applications.

L293D are quadruple high-current half-H drivers.

Output Clamp Diodes for Inductive Transient Suppression

The L293D is designed to provide bidirectional drive currents of up to

600-mA at voltages from 4.5 V to 36 V. All inputs are TTL compatible. Drivers are enabled in pairs, with

drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN.

Page 11: Report Interfacing of Stepper Motor With Microcontroller 8051

11

Circuit Diagram

• Hardware Description

Port1 of microcontroller is configured as output port.

4 pins of port1 in connected with 4 input of the L293D.

2 enable of the L293D is connected with the 5 Volts.

Vss of L293D is connected with 12Volts supply.

Vcc of L293D is connected with 5Volts supply.

Stepper Motor is connected with L293D.

Vss is used as Motor Power Supply.

Page 12: Report Interfacing of Stepper Motor With Microcontroller 8051

12

For changing direction of rotation, a SPST switch is used,

which is connected between port 2.0 and Ground.

Port2 of Microcontroller is configured as Input Port.

Switch is connected with pin 0 of the port2, As we know

ports of Microcontroller are Bit-Addressable. So direction

of rotation is depends upon the status of pin 0 of port2.

When switch is connected with ground, pin 2.0 will get “0”

as Input, So Motor will rotate in Clockwise Direction.

When switch is not connected with ground, pin 2.0 will get

“1” as input, as pin 2.0 is configured as input port by giving

“1” to the pin. So motor will rotate in Anticlockwise

Direction.

Flowchart

Page 13: Report Interfacing of Stepper Motor With Microcontroller 8051

13

C Program

/************ BIPOLAR STEPPER (BOTH DIRECTION) *****************/ /************AUTHOR: HIMANSHI & KORAT*****************/ /************PORTC AS OUTPUT AND CONNECTED WITH L293D*********/ /************SPST SWITCH CONNECTED WITH PORTB.0 FOR DIRECTION CHANGE*********/

#include<avr/io.h> #include<util/delay.h> void motor_stop(void); void motor_clockwise(void); void motor_anticlockwise(void); #define SET(x,b) x|=(1<<b) #define CLR(x,b) x=x&(~(1<<b)) #define CHK(x,b) (x&(1<<b)) #define x CHK(PINB,0) #define a 0x08 #define b 0x02 #define c 0x04 #define d 0x01 void main(void) {

DDRC=0XFF; CLR(DDRB,0); SET(PORTB,0); //motor_stop(); while(1) {

if(!x) {

motor_stop(); while(!x) {

motor_clockwise(); }

} else {

motor_stop();

Page 14: Report Interfacing of Stepper Motor With Microcontroller 8051

14

while(x) {

motor_anticlockwise(); }

} }

} void motor_stop(void) {

PORTC=0X00; _delay_ms(100);

} void motor_clockwise(void) {

PORTC=a; _delay_ms(10); PORTC=b; _delay_ms(10); PORTC=c; _delay_ms(10); PORTC=d; _delay_ms(10);

} void motor-anticlockwise(void) {

PORTC=a; _delay_ms(10); PORTC=d; _delay_ms(10); PORTC=c; _delay_ms(10); PORTC=b; _delay_ms(10);

}