Está en la página 1de 51

The 8051 Microcontroller and

Embedded Systems

CHAPTER 16
Motor Control: Relay,
PWM, DC and Stepper
Motors

1
RELAYS AND OPTOISOLATORS

A relay is an electrically controllable switch


widely used in industrial controls,
automobiles, and appliances
It allows the isolation of two separate
sections of a system with two different
voltage sources
For example, a +5V system can be isolated
from a 120V system by placing a relay
between them
2
RELAYS AND OPTOISOLATORS

One such relay is called an electromechanical


(or electromagnetic) relay
The EMRs have three components: the coil,
spring, and contacts
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

3
Electromechanical Relay Symbols

4
Criteria for Choosing a Relay
The contacts can be normally open (NO) or normally
closed (NC).
There can one or more contacts. For example, we
can have SPST (single pole,single throw), SPDT
(single pole, double throw), and DPDT (double pole,
double throw) relays
The voltage and current needed to energize the coil
The maximum DC/AC voltage and current that can
be handled by the contacts

5
Driving a relay

Digital systems and microcontroller pins lack


sufficient current to drive the relay
While the relays coil needs around 10 mA to
be energized, the microcontrollers pin can
provide a maximum of 1-2 mA current
For this reason, a driver is placed, such as
the ULN2803, or a power transistor between
the microcontroller and the relay

6
Driving a relay

7
Solid-state relay

In this relay, there is no coil, spring, or


mechanical contact switch
The entire relay is made out of semiconductor
materials
These relays have switching response time
much faster than that of electromechanical
relays
The life cycle for the electromechanical relay
can vary from a few hundred thousands to few
8
million operations
Solid-state relay

Wear and tear on the contact points can


cause the relay to malfunction after a while
Solid-state relays have no such limitations
Extremely low input current and small
packaging make solid-state relays ideal for
microprocessor and logic control switching
They are widely used in controlling pumps,
solenoids, alarms, and other power
applications
9
Solid-state relay

10
Reed switch

When the reed switch is placed in a magnetic


field, the contact is closed
When the magnetic field is removed, the
contact is forced open by its spring
The reed switch is ideal for moist and marine
environments where it can be submerged in
fuel or water
They are also widely used in dirty and dusty
atmospheres since they are tightly sealed
11
Reed switch

12
Optoisolator

Optoisolator (also called optocoupler) are


used to isolate two parts of a system
An optoisolator has an LED (light-emitting
diode) transmitter and a photosensor
receiver, separated from each other by a gap
When current flows through the diode, it
transmits a signal light across the gap and
the receiver produces the same signal with
the same phase but a different current and
13 amplitude
Optoisolator

14
Interfacing an optoisolator

The optoisolator comes in a small IC


package with four or more pins
When placing an optoisolator between two
circuits, we must use two separate voltage
sources, one for each side
Unlike relays, no drivers need to be placed
between the microcontroller/digital output
and the optoisolators

15
Interfacing an optoisolator

16
Introduction to Stepper Motor

Stepper motor is a widely used device that


translates electrical pulses into mechanical
movement
Stepper motor is used in applications such
as
disk drives
dot matrix printer
robotics etc.
Stepper motors commonly have a permanent
magnet rotor (shaft) surrounded by a stator
17
Stepper Motor Diagram
Construction of Stepper Motor
Construction of Stepper Motor
Commonly used stepper motors have four stator
windings that are paired with a center tapped
common. Such motors are called as four-phase
or unipolar stepper motor.
It has a permanent magnet rotor which is
surrounded by a stator.
A practical PM stepper motor will have 1.8
degrees step angle and 50 tooth on its rotor.
There are 8 main poles on the stator, each
having 5 tooth in the pole face
Construction of Stepper Motor

21
Unipolar Stepper motors
Stepper Motor Selection

Permanent Magnet / Variable Reluctance


Unipolar vs. Bipolar
Number of Stacks
Number of Phases
Degrees Per Step
Microstepping
Pull-In/Pull-Out Torque
Detent Torque
Stepper Motor Selection
Most common stepper motors have 4 stator
windings that are paired with a center-tapped
common as shown in the fig
This type of stepper motor is commonly referred to
as a four phase or unipolar stepper motor
The center tap allows a change of current direction
in each of two coils when a winding is grounded,
there by resulting in a polarity change of the stator
Working of Stepper Motor

The stator is a magnet over which the


electric coil is wound
One end of the coil is connected commonly
either to ground or +5V
The other end is provided with a fixed
sequence such that the motor rotates in a
particular direction
Stepper motor shaft moves in a fixed
repeatable increment, which allows one to
move it to a precise position
Working of Stepper Motor

Direction of the rotation is dictated by the


stator poles
Stator poles are determined by the current
sent through the wire coils

30
Step Angle

Step angle is defined as the minimum degree


of rotation with a single step.
No of steps per revolution = 360 / step angle
Steps per second = (rpm x steps per
revolution) / 60
Example: step angle = 2
No of steps per revolution = 180
One Phase on
(Wave drive four step sequence)

(Normal four step sequence)


8051 connection to stepper motor
Program:
Write an ALP to rotate the stepper motor clockwise / anticlockwise continuously with
full step sequence.

MOV A,#66H
BACK: MOV P1,A
RR A
ACALL DELAY
SJMP BACK
DELAY: MOV R1,#100
UP1: MOV R2,#50
UP: DJNZ R2,UP
DJNZ R1,UP1
RET
Note: motor to rotate in anticlockwise use instruction RL A instead of RR A
Program:
: A switch is connected to pin P2.7. Write an ALP to monitor the status of the
SW. If SW = 0, motor moves clockwise and if SW = 1, motor moves
anticlockwise.

ORG 0000H
SETB P2.7
MOV A, #66H
MOV P1,A
TURN: JNB P2.7, CW
RL A
ACALL DELAY
MOV P1,A
SJMP TURN
CW: RR A
ACALL DELAY
MOV P1,A
SJMP TURN
Program:
Write an ALP to rotate a motor 90 clockwise. Step angle of motor is 2.

Step angle = 2
Steps per revolution = 180
For 90 rotation the no of steps is 45

ORG 0000H
MOV A, #66H
MOV R0, #45
BACK: RR A
MOV P1, A
ACALL DELAY
DJNZ R0, BACK
END
Programming stepper motor in c
#include <reg51.h>
void main ()
{ while (1)
{
P1=0x66;
MSDELAY (200);
P1=0x33;
MSDELAY (200);
P1=0x99;
MSDELAY (200);
P1=0xCC;
MSDELAY (200);
}
}
Programming stepper motor in c
#include <REG51xD2.H>
void delay(unsigned int x) /* Delay Routine */
{ for(;x>0;x--);}
main(){
unsigned char Val,i;
while(1) {
Val = 0x88;
for(i=0;i<4;i++) {
P0 = Val;
Val = Val>>1;
delay(575); }}}
DC MOTOR INTERFACING AND
PWM

A direct current (DC) motor is another widely


used device that translates electrical pulses
into mechanical movement
The DC motor has only + and leads
Connecting them to a DC voltage source
moves the motor in one direction
By reversing the polarity, the DC motor will
move in the opposite direction
39
DC MOTOR INTERFACING AND
PWM

Small fans used in many motherboards to


cool the CPU are run by DC motors
While a stepper motor moves in steps of 1 to
15 degrees, the DC motor moves
continuously
The DC motor has two rpms: no-load and
loaded
The manufacturers data sheet gives the no-
load rpm
40
41
Unidirection Control

TheDC motor has rotation for clockwise


(CW) and counterclockwise (CCW) rotations

42
Bidirectional control
All the
switches
are
open,
which
does not
allow the
motor to
turn.

43
Bidirectional control
When
switches 1
and 4 are
closed,
current is
allowed to
pass
through
the motor.

44
Bidirectional control

45
Bidirectional control
An invalid
configuration
Current
flows directly
to ground,
creating a
short circuit

46
Bidirectional control
H-Bridge control can be created using relays,
transistors, or a single IC solution such as the L293
When using relays and transistors, it must be
ensured that invalid configurations do not occur

47
Pulse width modulation (PWM)

The speed of the motor depends on three


factors:
(a) load
(b) voltage
(c) current
For a given fixed load we can maintain a
steady speed by using a method called pulse
width modulation (PWM)

48
Pulse width modulation (PWM)

By changing (modulating) the width of the


pulse applied to the DC motor we can
increase or decrease the amount of power
provided to the motor, thereby increasing or
decreasing the motor speed
PWM is so widely used in DC motor control
that some microcontrollers come with the
PWM circuitry embedded in the chip

49
Pulse width modulation (PWM)

Although the voltage has a fixed amplitude, it


has a variable duty cycle
That means the wider the pulse, the higher
the speed

50
DC Motor Connection using a
Darlington Transistor

51

También podría gustarte