# Interfacing of Stepper-Motor

Updated on 2017/08/28 18:32

## Syllabus

Interfacing of 8051 Micro-controller with: Stepper motor

## Introduction to Stepper-Motor

### Principle of Working

A stepper motor is an electromechanical device which converts electrical pulses into discrete mechanical movements. The shaft or spindle of a stepper motor rotates indiscrete step increments when electrical command pulses are applied to it in the proper sequence. The motors rotation has several direct relationships to these applied input pulses. The sequence of the applied pulses is directly related to the direction of motor shafts rotation. The speed of the motor shafts rotation is directly related to the frequency of the input pulses and the length of rotation is directly related to the number of input pulses applied.

Stepper motor can be operated in two types of sequences:

1. Half step: In this sequence single coil is energized and then both coils are energized at the same time and motor shaft rotates. Refer figure 1 shown above.
Step Angle = 45 degree
No of steps = 8
2. Full step: In this sequence single coil is energized or both coils are energized at the same time and motor shaft rotates. Refer figure 1 shown above.
Step Angle = 90 degree
No of steps = 4

#### Half step Sequence

 Half Step Sequence Step A B A' B' Hex Value 0 1 0 0 0 08H 1 1 1 0 0 0CH 2 0 1 0 0 04H 3 0 1 1 0 06H 4 0 0 1 0 02H 5 0 0 1 1 03H 6 0 0 0 1 01H 7 1 0 0 1 09H

#### Full Step Sequence

 Full step sequence Step A B A' B' Hex value 0 1 0 0 0 08H 1 0 1 0 0 04H 2 0 0 1 0 02H 3 0 0 0 1 01H
 Full step sequence Step A B C D Hex codes 0 1 1 0 0 0CH 1 0 1 1 0 06H 2 0 0 1 1 03H 3 1 0 0 1 09H

### When to use a stepper motor

• A stepper motor can be a good choice whenever controlled movement is required.
• They can be used to get advantage in applications where you need to control rotation angle, speed, position and synchronism.
• Because of inherent advantages listed previously, stepper motor have their place in many different applications.

## Interfacing

### Assembly Language Program for Interfacing

Program: Write an ALP to rotate stepper motor 90 degree in the clockwise direction which is interfaced to 8051 microcontroller.

ORG 00H
Main:Mov A,#OCH
Acall Delay
Mov A,#06H
Acall Delay
Mov A,#03H
Acall Delay
Mov A,#09H
Acall Delay
SJMP Main
Delay:Mov R7,#4
up2:Mov R6,#0FFH
up1:Mov R5,#0FFH
Here:DJNZ R5,Here
DJNZ R6,up1
DJNZ R7,up2
ret
end

Note:-In order to rotate stepper motor in anticlockwise direction just reverse the sequence of excitation of windings (from bottom to top) refer table above

Program: Write an ALP to rotate stepper motor 45 degree in the clockwise direction which is interfaced to 8051 microcontroller.

ORG 00H
Main:Mov A,#O8H
Acall Delay
Mov A,#OCH
Acall Delay
Mov A,#O4H
Acall Delay
Mov A,#06H
Acall Delay
Mov A,#O2H
Acall Delay
Mov A,#03H
Acall Delay
Mov A,#O1H
Acall Delay
Mov A,#09H
Acall Delay
SJMP Main
Delay:Mov R7,#4
up2:Mov R6,#0FFH
up1:Mov R5,#0FFH
Here:DJNZ R5,Here
DJNZ R6,up1
DJNZ R7,up2
ret
end

## References

• Interfacing image by Jayesh Gopal, WikiNote Volunteer, Pune
• Created and edited by Prof.S.M.Wagh, SKNCOE, Pune
• WikiNote Foundation
Tags:
Created by Sujit Wagh on 2017/08/03 16:40

Happy WikiNoting!