A Presentation On Relay, Optoisolator and Stepper Motor Interfacing
Download
Report
Transcript A Presentation On Relay, Optoisolator and Stepper Motor Interfacing
A
PRESENTATION
ON
RELAY, OPTOISOLATOR AND STEPPER MOTOR
INTERFACING WITH AVR
Prepared By:Katariya Prakash[130070110027]
Kathiriya Shalin[130070110028]
Maulik Vasaiya[130070110036]
Kishan Mer[130070110037]
Submitted To:-
B. V. M. Engineering College
Interfacing Relays with AVR
What is Relay?
A relay is an electromagnetic switch operated by a relatively
small electric current that can turn on or off a much larger electric
current.
The heart of a relay is an electromagnet (a coil of wire that
becomes a temporary magnetwhen electricity flows through it).
How does it Work?
When current flows through the coil, a magnetic field is
created around the coil(the coil is energized), which causes the
armature to be attracted to the coil. The armature’s contact
acts like a switch and closes or opens the circuit.
When the coil is not energized, a spring pulls the
armature to its normal state.
The contacts can be normally open(NO) or normally
closed(NC).
In "normally open" (NO) relay: the contacts in the second
circuit are not connected by default, and switch on only when
a current flows through the magnet.
In "normally closed" (NC; the contacts are connected so a
current flows through them by default) and switch off only
when the magnet is activated, pulling or pushing the contacts
apart.
Driving a Relay
Digital systems and microcontroller pins lack sufficient current to
drive the relay. While the relay’s coil needs around 10mA to be
energized, the microcontroller’s pin can provide a maximum of 12mA current.
For this reason, we place a driver, such as the ULN2803, or a power
transistor between the microcontroller and the relay as shown in
figure-1.
Assembly program for relay
Interfacing
LDI R16,0X5F
OUT SPH,R16
LDI R16,LOW
OUT SPL,R16
SBI DDRB,0
BEGIN:
SBI PORTB,0
RCALL DELAY_1s
CBI PORTB,0
RCALL DELAY_1s
RJMP BEGIN
DELAY_1s:
……………
RET
Interfacing Optoisolator with AVR
What is Opto-isolator?
An optoisolator (also known as optical coupler, optocoupler
and opto-isolator) is a semiconductor device that uses a short
optical transmission path to transfer an electrical signal between
circuits or elements of a circuit, while keeping them electrically
isolated from each other.
The solid state relay has an opto-isolator at its input.
Controlling a Lamp via an Opto-isolator:-
Interfacing Stepper Motor with
AVR
A stepper motor is a device that translates the electrical
pulses to mechanical movement. It is used in applications like
robotics, printers, disk drives for position control.
Stepper motors have a permanent magnet rotor surrounded
by a stator.
Generally the stepper motors have four stator windings that
are paired with a common center tap as shown in figure:
The current flowing in the stator is responsible for direction of
rotation. As the direction of current is changed, the polarity is
also changed causing the reverse motion of the stepper motor.
The stepper motor has 6 leads, 4 leads representing four
stator winding and 2 leads for 2 common for the center
tapped leads.
There are many sequences for rotation. Each sequence has a
different degree of precision.
The below table showing the 2 phase 4 step stepping
sequence.
Step
Winding
A1
Winding
A2
Winding
A3
Winding
A4
1
1
0
0
1
2
1
1
0
0
3
0
1
1
0
4
0
0
1
1
Counter
Clockwise
Clockwise
Although we can start with any sequence, we must continue in
proper order. E.g. if we start with step 2 then the sequence of
steps is 3,4,1 etc.
Step Angle:Step angle is defined as the minimum degree of rotation
associated with a single step.
Stepper motor step angles:
Step angle
Steps per
revolution
0.72
500
1.8
200
2.0
180
2.5
144
5.0
72
7.5
48
15
24
The total number of steps required to rotate one complete
rotation of 360 is called as steps per revolution.
Types of Stepper motor
Depending on the number of connections to the motor there are
three types of stepper motor. They are:
1)
Universal stepper motor
2)
Unipolar stepper motor
3)
Bipolar motor
A universal stepper motor has 8 connections, a
unipolar stepper motor has 6 connections and
bipolar stepper motor has 4 connections.
The bipolar motor can be configured for
bipolar mode only.
The unipolar motor can be configured as
unipolar or bipolar mode.
And universal stepper motor can be used in
any of the three modes.
AVR Interfacing to Stepper Motor
The four leads of the stator winding are controlled by port D
bits PD0-PD3. The AVR doesn’t have sufficient current to drive
the stepper motor windings. Hence, a driver like ULN2003 is
required to energize the stator.
Assembly program for stepper motor Interfacing
Label
Instruction
LDI R16,$5F
Pointer higher byte
LDI R16,$08
Initialize stack
OUT SPL,R16
Pointer low byte
LDI R16,$FF
Port D is
LDI R16,$66
OUT PORTD,R16
Load step sequence
PORTD=R16
Shift right
BRCC L1
If carry≠1 skip next
RCALL DELAY
RJMP L2
DELAY:
Output port
LSR R16
ORI R20,$08
L1:
Initialize stack
OUT SPH,R16
OUT DDRD,R16
L2:
Comments
……RET