You are on page 1of 77

Unit v

SYSTEM DESIGN USING


MICROPROCESSOR & MICROCONTROLLER

CASE STUDIES - SYLLABUS


1.
2.
3.
4.
5.

WASHING MACHINE CONTROL


STEPPER MOTOR CONTROL USING RELAY
DC MOTO CONTROL USING PWM
RTC INTERFACING USING I 2 C
TRAFFIC LIGHT CONTROL

ARULANANTH.T.S

12/1/16

Washing
machine

ARULANANTH.T.S

12/1/16

Control flow

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

Washing machine control

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

CIRCUIT DIAGRAM

ARULANANTH.T.S

12/1/16

8051 port settings

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

Stepper Motor Interfacing

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 (also called the shaft) surrounded
by a stator

Stepper Motor
Diagram

ARULANANTH.T.S

12/1/16

Construction of Stepper Motor

ARULANANTH.T.S

12/1/16

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
ARULANANTH.T.S

12/1/16

Unipolar Stepper motors

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

Most common stepper motors have 4 stator


windings that are paired with a center-tapped.

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

ARULANANTH.T.S

12/1/16

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. Direction of
the rotation is dictated by the stator poles.
Stator poles are determined by the current
sent through the wire coils.

ARULANANTH.T.S

12/1/16

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

ARULANANTH.T.S

12/1/16

One Phase on
(Wave drive four step sequence)

(Normal four step sequence)

ARULANANTH.T.S

12/1/16

8051 connection to stepper


motor

ARULANANTH.T.S

12/1/16

RELAY

A relay is an electrically operated switch. Relays


are used where it is necessary to control a circuit
by a low-power signal (with complete electrical
isolation between control and controlled circuits),
or where several circuits must be controlled by
one signal.
A relay opens and closes under control of another
electrical circuit. It is therefore connected to
output pins of the microcontroller and used to
turn on/off high-power devices such as motors,
transformers, heaters, bulbs, antenna systems
etc Relay is connected to port 1.0
ARULANANTH.T.S

12/1/16

RELAY
INTERFACI
NG WITH
8051

ARULANANTH.T.S

OPTO ISOLATOR WITH 8051

12/1/16

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

ARULANANTH.T.S

12/1/16

: 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

ARULANANTH.T.S

12/1/16

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

ARULANANTH.T.S

12/1/16

DC MOTOR

ARULANANTH.T.S

12/1/16

DC motor

The DC motor is widely used device that


translates electrical pulses into mechanical
movement.
Motor has 2 leads +ve and ve , connecting
them to a DC voltage supply moves the motor in
one direction. On reversing the polarity rotates
the motor in the reverse direction.
Basic difference between Stepper and DC motor
is stepper motor moves in steps while DC motor
moves continuously.
Another difference is with stepper motor the
number of steps can be counted while it is not
possible in DC motor.
Maximum speed of a DC motor is indicated in
rpm. The rpm is either with noARULANANTH.T.S
load it is12/1/16
few

DC MOTOR WORKING

ARULANANTH.T.S

12/1/16

H BRIDGE DC MOTOR

ARULANANTH.T.S

12/1/16

H BRIDGE

ARULANANTH.T.S

12/1/16

H BRIDGE

ARULANANTH.T.S

12/1/16

H BRIDGE switch status


MOTOR
OPERATIO
N

SW1

SW2

SW3

SW4

OFF

OPEN

OPEN

OPEN

OPEN

CLOCKWISE

CLOSED

OPEN

CLOSED

OPEN

ANTICLOCK
WISE

OPEN

CLOSED

OPEN

CLOSED

INVALID

CLOSED

CLOSED

CLOSED

CLOSED

ARULANANTH.T.S

12/1/16

Interfacing 8051 with PWM GENERATOR

Pulse-width modulation (PWM), or pulse-duration


modulation (PDM), is a modulation technique that
conforms the width of the pulse,the pulse duration, based
on modulator signal information. Although this modulation
technique can be used to encode information for
transmission, its main use is to allow the control of the
power supplied to electrical devices, especially to inertial
loads such as motors.

The term duty cycle describes the proportion of 'on' time to


the regular interval or 'period' of time; a low duty cycle
corresponds to low power, because the power is off for
most of the time. Duty cycle is expressed in percent, 100%
being fully on.

ARULANANTH.T.S

12/1/16

Pulse Width Modulation


(PWM):
The speed of the motor depends on 3 parameters:
load, voltage and current. For a given load,
we can maintain a steady speed by using PWM. By
changing the width of the pulse applied to DC
motor, power provided can either be increased or
decreased.
Though voltage has fixed amplitude, has a variable
duty cycle. The wider the pulse, higher the speed
obtained.
One of the reasons as to why dc motor are referred
over ac is, the ability to control the speed of the DC
motor using PWM.

ARULANANTH.T.S

12/1/16

Interfacing 8051 with PWM GENERATOR


Contd

If the PWM circuitry is embedded in the


chip, we have to load the registers with
high and low pulses then microcontroller
will take remaining controls.

If the PWM circuitry is not embedded in


the chip, we have to create various duty
cycle pulses using software.

ARULANANTH.T.S

12/1/16

DC motor CONTROL using PWM.

ARULANANTH.T.S

12/1/16

INTERFACING WITH DC MOTOR

ARULANANTH.T.S

12/1/16

USING L293,RUN A DC MOTOR, SWITCH P2.0


IF SW=0,ROTATE CLOCK,SW=1 , ROT
ANTICLOCK
ORG

0H
MAIN:
SETB P1.0
; ENABLE
JNB P2.0 ,CLOCK ;CHECK THE CLOCK
CLR P1.1;INPUT 1
;COUNTER CLOCKWISE
SETB P1.2;INPUT2 ;
CLOCK:

SETB P1.1;INPUT 1
CLR P1.2;INPUT2
SJMP MAIN
END

; CLOCKWISE

ARULANANTH.T.S

12/1/16

RTC REAL TIME CLOCK

DS12887 INTERFACING
WITH 8051

ARULANANTH.T.S

12/1/16

DS 12887:

ARULANANTH.T.S

12/1/16

DS 12887:

ARULANANTH.T.S

12/1/16

DS 12887:

ARULANANTH.T.S

12/1/16

PIN DIAGRAM FOR DS 12887

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

Memory:
128 bytes of non volatile ram
14 bytes of RAM ,for clock ,calender and
control register
114 bytes of NV-RAM

ARULANANTH.T.S

12/1/16

AS:ADDRESS STROBE is an input


pin,on the falling edge it will cause
the address to be latched
MOT:

DS:

DATA STROBE
DS=READ
DS is connected to
RD of 8051

MOT is connected
to ground
MOT=GND

ARULANANTH.T.S

12/1/16

R/W:input pin
.MOT=GNDWrite signal
CS:

Active low signal


To access read and
write
It only access
external
vge>4.25v

IRQ:

Output pin
Active low pin
It is in Bregister

ARULANANTH.T.S

12/1/16

SQW:

Output pin .it


produce 15
different square
wave

RESET:

Pin 18 is reset.It is an
input.
Active low pin
ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

Setting the time(16:15:50


pm)
MOV R0,#10;ADDR OR

REGISTER

MOV A,#20H; D6-D4 010

MOV

TO REG

MOV R0,#11; REG B


MOV A,#83H; BCD 24
HRS,DAYLIGHT

MOV X @R0,A

SECONDS AT

ADDR 0
MOV

A,#50H;SECONDS=50

OSC

MOVX @R0,A;SEND IT

R0,#0;

MOVX @R0,A; SET SECONDS

MOV

R0,#02;
MOV R0,#15H;
MOVX @R0,A;
MOV R0,#04;
MOV R0,#16H
MOVX @R0,A;
ARULANANTH.T.S

12/1/16

Interfacing I2C - Inter integrated circuit


serial bus

At any time the electrical power is turned off, the


Microcontroller will start from initial state after
power is turned on, losing all intermediate states.

To avoid this problem a Serial EEPROM is


interfaced to the microcontroller via I2C serial
BUS.

This is a two wire bus using a protocol to transfer


data between microcontroller and serial memory
and save the status of process event sequentially

ARULANANTH.T.S

12/1/16

Data Transfer from master to slave

A master device sends the sequence of signal with


START, ADDRESS, and WRITE protocol, then waits
for an acknowledge bit (A) from the slave
The slave will generate acknowledge bit only if its
internal address matches the value sent by the
master.
After that the master sends DATA and waits for
acknowledge (A) from the slave. The master
completes the byte transfer by generating a stop
bit (P)

ARULANANTH.T.S

12/1/16

Data transfer sequence

A Master to slave read or write sequence for I2C


follows the following order:

1.
2.
3.
4.
5.
6.
7.

Send the START bit (S).


Send the address (ADDR).
Send the Read(R)-1 / Write (W)-0 bit.
Wait for/Send an acknowledge bit (A).
Send/Receive the data byte (8 bits) (DATA).
Expect/Send acknowledge bit (A).
Send STOP bit (P).

ARULANANTH.T.S

12/1/16

Implementation of Traffic Light


Controller using 8051

Traffic lights or traffic signals are signaling


devices positioned at road intersections,
pedestrian crossings and other locations
to control competing flows of traffic.

ARULANANTH.T.S

12/1/16

Implementation of traffic light


controller using 8051

Traffic lights alternate the right of way of road


users by displaying lights of a standard color (red,
yellow/amber, and green), using a universal color
code.

In the typical sequence of colored lights:


Illumination of the green light allows traffic to
proceed in the direction denoted,

Illumination of the yellow/amber light denoting, if


safe to do so, prepare to stop short of the
intersection, and

ARULANANTH.T.S 12/1/16
Illumination of the red signal prohibits
any traffic

PIN ASSIGNMENT WITH 8051

ARULANANTH.T.S

12/1/16

LAN Direction

NORTH

WEST

SOUTH

EAST

8051 Lines

LEDs

P3.2

D8-Stop

P3.3

Traffic Light Controller

D9-Listen

P3.4

D10-Go

P3.5

D11-Stop

P3.6

D12-Listen

P3.7

D13-Go

P1.0

D14-Stop

P1.1

D15-Listen

P1.2

D16-Go

P1.3

D17-Stop

P1.4

D18-Listen

P1.5

D19-Go

Note:MakeSW32toTrafficlabelmarkingposition

ARULANANTH.T.S

12/1/16

CIRCUIT DIAGRAM TO INTERFACE TRAFFIC LIGHT

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

ARULANANTH.T.S

12/1/16

You might also like