8/12/2019 36498324 Report Car Parking System
1/65
CAR PARKING SYSTEM
Introduction:
In the project Car Parking System we have shown the concept of an automatic car
parking system. As in the modern world everything is going automatic we have
uilt a system which will automatically sense the entry and e!it of cars through
the gate and then display the numer of cars in the parking lot. "ven we can set a
ma!imum capacity of cars with the help of user interface given in the hardware in
the form of switches so that there is no congestion. #e have deployed a
microcontroller which is used to sense the movement of cars and depending upon
whether there is a capacity of cars to enter$ it either opens the gate or not. It is
also possile to open a gate when any car enters in the parking lot or close the
door when a car e!its from the parking lot.
%here are two sets of sensors& one on the first gate 'entry gate( and one on the second
gate 'e!it gate(. #hen a car arrives at the door the microcontroller receives the
signal from the entry sensors and then checks whether there is a capacity of cars
to e accommodated. Simultaneously it will also display the numer of cars
present in the parking lot on a )C* screen and also opens the gate. #hen a car
moves out of the parking area the microcontroller reduces the count displayed
accordingly and also closes the gate. %he user will have an option to set the
ma!imum count for the cars with the help of switches connected to the
microcontroller.
%he sensing of entry and e!it of cars is done with the help of Infrared transmitters and
receivers. +efore the door the Infrared transmitter is mounted on one side and the
receiver is placed directly in front of the transmitter across the door. #hen a car
arrives the Infrared eam is locked y the car and the receiver is devoid of
Infrared rays and its output changes. %his change in output is sensed y the
microcontroller and accordingly it increments the count and opens the door if
there is some capacity. %he procedure for the e!it of the cars is similar as the
entry.
8/12/2019 36498324 Report Car Parking System
2/65
+lock *iagram of the Project&
Microcontroller unit&
,icrocontroller used in the project is A%-s/0. %his part is the heart of the project. It
checks for the entry and e!it of the car. It continuously polls the pins from where we
receive the signal from the intruder circuits.
MICROCONTROLLER
LCD ISOLATOR
CIRCUIT
KEY PAD
POWER
SUPPLY1
!"#$
INTRUDER%
&OR E'IT
GATE$
INTRUDER1
&OR ENTRY
GATE$
AMPLI&IER
MOTOR
(U))ER
8/12/2019 36498324 Report Car Parking System
3/65
#hen it detects the car from the entry gate then it checks whether there is any vacant
space in the parking lot. If there is vacant space then it opens the door and increases
the over all count in the parking lot y one. And after 1 seconds automatically closes
the door. And if it detects the car from the e!it gate then it decreases the count y one.
Inter*+cin, -it. /-itc.e/ 0e2+d$:
Interfacing with keypad makes instrument menu driven user friendly. %his will help to
the user to select the ma!imum capacity of the parking area.
Di/2l+ unit LCD$
)C* makes this instrument user friendly y displaying everything on the display. It is
an intelligent )C* module$ as it has inuilt controller which convert the alphaet anddigit into its ASCII code and then display it y its own i.e. we do not re2uired to
specify which )C* comination must glow for a particular alphaet or digit.
Ste22er Motor:
Stepper motor is used to open and close the door. It is interfaced with microcontroller
and takes command from the microcontroller to rotate some particular specified angle.
It can e interfaced with ,C3 as shown elow&
%he switching circuit is comprises of an optocoupler which will isolate the controller
from the outer spikes or fluctuations or from the e!ternal hardware and at the same
4P%4IS4)A%45
IC ',C%6 0"(
P4#"5 A,P)I7I"5
3SI89 +C1:
%5A8SIS%45
,otor #inding
8/12/2019 36498324 Report Car Parking System
4/65
time it drives a power transistor i.e. make it on when a signal from the controller pin
is applied to it. 4ptocoupler actually comprises of a diode and a phototransistor. It
comes in a *IP IC package. %hus signal from the ,C3 is given to the )"* part or
the driving part. #hen )"* egins to glow then the phototransistor acts as on switch
or short circuit. %his output is given to power transistor$ which will amplify the
current of the signal and then use it to drive winding of the ,otor. 9round is directly
given to the common of the ,otor. And ;vcc is provided to the motor winding
through the amplifier.
If user wants to switch 48 the ,otor winding$ then the microcontroller is sending a
signal to the optocoupler then ultimately that supply to that winding is 48. 5everse is
the case when ,C3 does not send any signal and thus$ supply to that winding is 477.
Intruder&
%he /// timer is used in the Infrared transmitters and receivers. At the transmitter it is
used to produce a pulse of 1- k
8/12/2019 36498324 Report Car Parking System
5/65
N C
< D o c > < R e v C
< T i t l e >
A
1 1M o n d a y , J a n u a r y 0 1 , 2 0 0 1
T i t l e
S i z e D o c u m e n t N u m e r R e v
D a t e ! S " e e t o #
0C O M M O N
$ 1% C & ' (
1
2
)
3
* 1
R + A - S . D T
)&
'12
T O M I C R O C O N T R O L L E R G R O U N D
4
T O M I C R O C O N T R O L L E R P O R T 2 . 1
8
R 1 - 1 0 0 K , R 2 - 1 K , R 3 - 4 7 0 E , R 4 - 4 7 K
6
R 1R
D 1
. / T D D +
12
7
C 1 - 2 2 M F / 2 5 V , C 2 - 1 0 4 P F
5
I R L E D
1
+
C 2C A . N .
0
_
I R L E D
1 2 V D C
5 5 5 I C
C 1
C
N O
I N T R U D E R S E N S O R
D 2 R '
R
R 2R
R )R
2
Entr+nce or E3it Detector:
%he entrance or the e!it of a person in the room is detected y using two infrared
modules. "ach module will contain an I5 transmitter and an I5 receiver. +efore the
door the Infrared transmitter is mounted on one side and the receiver is placed directly
in front of the transmitter on the other side of door. Infrared transmitter will
continuously transmit I5 waves and the receiver will continuously receive I5 waves.
%he I5 transmitter will use an I5 )"*. %his )"* can transmit I5 whenever it is
supplied from a /6volt voltage source. %he receiver can either e photodiode if the
width of the door is less or a special I5 receiver known as the I5 eye. 8ow whether a
person enters or e!its$ the eam of each module will e interrupted that is the output
from the two receivers which actually is the pulse output from two different
monostale multivirator using /// timers. %hus the outputs from the two receivers
are in the form of pulse.
8/12/2019 36498324 Report Car Parking System
6/65
(LOCK DIAGRAM &OR IR RECEI#ER
4@P %4 ,C3 43%P3% I5 I8P3%
At the receiver side the I5 eye or the I5 demodulator will demodulate the I5 signal
and then give its output to the trigger of a /// timer$ which is mounted as a
monostale virator. %hus whenever there is an interrupt in the I5 eam then
corresponding trigger will go from high to low thus the output from the /// timer will
e a pulse which is then generated as in monostale mode y applying a ve voltage
at the trigger a pulse is generated.
&e+ture/ o* t.e Pro4ect:
Powered y ;/B ;>0B supply
Current consumption D.E/mA for ,icrocontroller circuit$ D.?/mA for
switching circuit$ 0DDmA for amplification circuit
Automatic detection of any incoming@outgoing car
Automatic opening and closing of entry gate
3ser interface using )C* and switches
Always display the numer of cars present in the Parking )ot
#+riou/ Co52onent/ u/ed in 6+riou/ Module/ o* t.e Pro4ect +lon,
-it. /2eci*ic+tion/ +nd 7u+ntit:
Power Supply 3nit> ';/B(&
S. 8o. Component Specification Fty.
>. PC+ *esigned >
0. %ransformer 6D6$
/DDmA
>
1. *iode >8EDD? E
E. Cap. >DDD G7 >
/. 5egulator ?-D/ >
POWER
SUPPLY
555 TIMERP
8/12/2019 36498324 Report Car Parking System
7/65
Power Supply 3nit0 ';>0B(&
S. 8o. Component Specification Fty.
>. PC+ *esigned >
0. %ransformer 6D6$/DDmA
>
1. *iode >8EDD? E
E. Cap. >DDD G7 >
/. 5egulator ?->0 >
,icrocontroller 3nit&
S. 8o. Component Specification Fty.
>. PC+ *esigned >
0. +ase ED Pin >1. Crystal >>.D/0,
E. Cap. 11 P7 0
>DG7 >
/. ,C3 A%-s/0 >
:. ,icro switch >
?. 5esistance >D J >
)C* ,odule&
S. 8o. Component Specification Fty.
>. )C* Connector >: Pin >0. )C* >: ! 0 >
eypad ,odule '7or input to ,C3(&
S. 8o. Component Specification Fty.
>. PC+ 9.P.PC+ >
0. ,icro Switches 0 Pin 1
Intruder ,odule> '7or "ntry gate(&
S. 8o. Component Specification Fty.
>. PC+ *esigned >
0. +ase - Pin >
1. IC %imer /// >
E. 5esistance >D J >
E?D J >
>DD >
/. I5 Pair >
:. Capacitor >DG7 >
>D1 'D.D> G7( >
8/12/2019 36498324 Report Car Parking System
8/65
Intruder ,odule0 '7or "!it gate(&
S. 8o. Component Specification Fty.
>. PC+ *esigned >
0. +ase - Pin >1. IC %imer /// >
E. 5esistance >D J >
E?D J >
>DD >
/. I5 Pair >
:. Capacitor >DG7 >
>D1 'D.D> G7( >
,otor *river Card&
S. 8o. Component Specification Fty.
>. PC+ *esigned >
9eneral >
0. +ase : Pin E
1. 4pto coupler ->? E
E. 5esistance E?DJ E
/. %ransistor 1: E
:. Stepper ,otor >0B >
Det+iled 8+rd-+re De/cri2tion:
POWER SUPPLY
Power supplies are designed to convert high voltage AC mains to a suitale low
voltage supply for electronics circuits and other devices. A power supply can e
roken down into a series of locks$ each of which performs a particular function.
&or e3+52le + "# re,ul+ted /u22l:
"ach of the lock has its own function as descried elow
>. %ransformer steps down high voltage AC mains to low voltage AC.
0. 5ectifier converts AC to *C$ ut the *C output is varying.
8/12/2019 36498324 Report Car Parking System
9/65
1. Smoothing smoothes the *C from varying greatly to a small ripple.
E. 5egulator eliminates ripple y setting *C output to a fi!ed voltage.
TRANS&ORMER
%ransformers convert AC electricity from one voltage to another with little loss of
power. %ransformers work only with AC and this is one of the reasons why
mains electricity is AC. %he two types of transformers
Step6up transformers increase voltage$
Step6down transformers reduce voltage.
Tr+n/*or5er
,ost power supplies use a step6down transformer to reduce the dangerously
high mains voltage '01DB in 3( to a safer low voltage. %he input coil is
called the primary and the output coil is called the secondary. %here is no
electrical connection etween the two coils$ instead they are linked y an
alternating magnetic field created in the soft6iron core of the transformer. %hetwo lines in the middle of the circuit symol represent the core 9
%ransformers waste very little power so the power out is 'almost( e2ual to the power
in. 8ote that as voltage is stepped down current is stepped up. %he ratio of the numer
of turns on each coil$ called the turn ratio$ determines the ratio of the voltages. A step6
down transformer has a large numer of turns on its primary 'input( coil which is
connected to the high voltage mains supply$ and a small numer of turns on its
secondary 'output( coil to give a low output voltage.
8/12/2019 36498324 Report Car Parking System
10/65
Turn/ r+tio #2 N2
#/ N/
And Po-er Out Po-er In
Bs Is K Bp Ip
#here
Bp K primary 'input( voltage
N2 nu5;er o* turn/ on 2ri5+r coil
I2 2ri5+r in2ut$ current
N/ nu5;er o* turn/ on /econd+r coil
I/ /econd+r out2ut$ current
#/ /econd+r out2ut$ 6olt+,e
(RIDGE RECTI&IER
A ridge rectifier can e made using four individual diodes$ ut it is also availale in
special packages containing the four diodes re2uired. It is called a full6wave rectifier
ecause it uses all AC wave 'oth positive and negative sections(. >.EB is used up in
the ridge rectifier ecause each diode uses D.?B when conducting and there are
always two diodes conducting$ as shown in the diagram elow. +ridge rectifiers are
rated y the ma!imum current they can pass and the ma!imum reverse voltage they
can withstand 'this must e at least three times the supply 5,S voltage so the
rectifier can withstand the peak voltages(. In this alternate pairs of diodes conduct$
changing over the connections so the alternating directions of AC are converted to the
one direction of *C.
8/12/2019 36498324 Report Car Parking System
11/65
OUTPUT Full-wave Varying DC
SMOOT8ING
Smoothing is performed y a large value electrolytic capacitor connected across the
*C supply to act as a reservoir$ supplying current to the output when the varying
*C voltage from the rectifier is falling. %he diagram shows the unsmoothed
varying *C 'dotted line( and the smoothed *C 'solid line(. %he capacitor charges
2uickly near the peak of the varying *C$ and then discharges as it supplies current to
the output.
8ote that smoothing significantly increases the average *C voltage to almost the peak
value '>.E L 5,S value(. 7or e!ample :B 5,S AC is rectified to full wave *C of
aout E.:B 5,S '>.EB is lost in the ridge rectifier($ with smoothing this
increases to almost the peak value giving >.E L E.: K :.EB smooth *C.
8/12/2019 36498324 Report Car Parking System
12/65
Smoothing is not perfect due to the capacitor voltage falling a little as it discharges$
giving a small ripple voltage. 7or many circuits a ripple which is >DM of the supply
voltage is satisfactory and the e2uation elow gives the re2uired value for the
smoothing capacitor. A larger capacitor will give fewer ripples. %he capacitor value
must e douled when smoothing half6wave *C.
Smoothing capacitor for >DM ripple$ C K / L Io
#/ < *
W.ere
C /5oot.in, c+2+cit+nce in *+r+d/ &$
Io out2ut current *ro5 t.e /u22l in +52/ A$
#/ /u22l 6olt+,e in 6olt/ #$= t.i/ i/ t.e 2e+0 6+lue o* t.e un/5oot.ed
DC
* *re7uenc o* t.e AC /u22l in .ert> 8>$= "?8> in t.e UK
REGULATOR
Boltage regulator ICs are availale with fi!ed 'typically /$ >0 and >/B( or variale
output voltages. %hey are also rated y the ma!imum current they can pass. 8egative
voltage regulators are availale$ mainly for use in dual supplies. ,ost regulators
include some automatic protection from e!cessive current 'Noverload protectionO( and
overheating 'Nthermal protectionO(. ,any of the fi!ed voltage regulator ICs has 1 leads
and look like power transistors$ such as the ?-D/ ;/B >A regulator shown on the
right. %hey include a hole for attaching a heat sink if necessary.
8/12/2019 36498324 Report Car Parking System
13/65
Wor0in, o* Po-er Su22l
Tr+n/*or5er
%he low voltage AC output is suitale for lamps$ heaters and special AC motors. It is
not suitale for electronic circuits unless they include a rectifier and a smoothing
capacitor.
Tr+n/*or5er ! Recti*ier
%he varying *C output is suitale for lamps$ heaters and standard motors. It is not
suitale for electronic circuits unless they include a smoothing capacitor.
Tr+n/*or5er ! Recti*ier ! S5oot.in,
8/12/2019 36498324 Report Car Parking System
14/65
%he smooth *C output has a small ripple. It is suitale for most electronic circuits.
Tr+n/*or5er ! Recti*ier ! S5oot.in, ! Re,ul+tor
D 2
C 1
1 0 0 0 u
1 N 4 0 0 7 ! 5
V
, M ( 0 &
1 2
)
3 N 3 4 T
5
N
D
J 1
1
2
)
D )
" # $
D '
D 1
%he regulated *C output is very smooth with no ripple. It is suitale for all electronic
circuits.
T.e Microcontroller:
In our day to day life the role of micro6controllers has een immense. %hey are used
in a variety of applications ranging from home appliances$ 7A machines$ Bideo
games$ Camera$ "!ercise e2uipment$ Cellular phones musical Instruments to
Computers$ engine control$ aeronautics$ security systems and the list goes on.
Microcontroller 6er/u/ Micro2roce//or/:
8/12/2019 36498324 Report Car Parking System
15/65
#hat is the difference etween a microprocessor and microcontrollerQ %he
microprocessors 'such as -D-:$ -D0-:$ :-DDD etc.( contain no 5A,$ no 54, and no
I@4 ports on the chip itself. 7or this reason they are referred as general6 purpose
microprocessors. A system designer using general6 purpose microprocessor must add
e!ternal 5A,$ 54,$ I@4 ports and timers to make them functional. Although the
addition of e!ternal 5A,$ 54,$ and I@4 ports make the system ulkier and much
more e!pensive$ they have the advantage of versatility such that the designer can
decide on the amount of 5A,$ 54, and I@o ports needed to fit the task at hand. %his
is the not the case with microcontrollers. A microcontroller has a CP3 'a
microprocessor( in addition to the fi!ed amount of 5A,$ 54,$ I@4 ports$ and
timers are all emedded together on the chip& therefore$ the designer cannot add any
e!ternal memory$ I@4$ or timer to it. %he fi!ed amount of on chip 5A,$ 54,$ and
numer of I@4 ports in microcontrollers make them ideal for many applications in
which cost and space are critical. In many applications$ for e!ample a %B remote
control$ there is no need for the computing power of a E-: or even a -D-:
microprocessor. In many applications$ the space it takes$ the power it consumes$ and
the price per unit are much more critical considerations than the computing power.
%hese applications most often re2uire some I@4 operations to read signals and turn on
and off certain its. It is interesting to know that some microcontrollerRs manufactures
have gone as far as integrating an A*C and other peripherals into the
microcontrollers.
Microcontroller/ *or E5;edded S/te5/:
In the literature discussing microprocessors$ we often see a term emedded system.
,icroprocessors and microcontrollers are widely used in emedded system products.
An emedded product uses a microprocessor 'or microcontroller( to do one task and
one task only. A printer is an e!ample of emedded system since the processor inside
it performs one task only& namely$ get data and print it. Contrasting this with a I+,
PC which can e used for a numer of applications such as word processor$ print
server$ network server$ video game player$ or internet terminal. Software for a variety
of applications can e loaded and run. 4f course the reason a PC can perform myriad
tasks is that it has 5A, memory and an operating system that loads the application
software into 5A, and lets the CP3 run it. In an emedded system$ there is only oneapplication software that is urned into 54,. A PC contains or is connected to
8/12/2019 36498324 Report Car Parking System
16/65
various emedded products such as the keyoard$ printer$ modem$ disk controller$
sound card$ C*654, driver$ mouse and so on. "ach one of these peripherals has a
microcontroller inside it that performs only one task. 7or e!ample$ inside every mouse
there is a microcontroller to perform the task of finding the mouse position and
sending it to the PC.
Although microcontrollers are the preferred choice for many emedded systems$
there are times that a microcontroller is inade2uate for the task. 7or this reason$ in
many years the manufacturers for general6purpose microprocessors have targeted
their microprocessor for the high end of the emedded market.
Introduction to @?"1:
In >->$ Intel Corporation introduced an -6it microcontroller called the -D/>. %his
microcontroller had >0- ytes of 5A,$ E ytes of on6chip 54,$ two timers$ one
serial port$ and four ports '-6it( all on a single chip. %he -D/> is an -6it processor$
meaning the CP3 can work on only -6 it pieces to e processed y the CP3. %he
-D/> has a total of four I@4 ports$ each -6 it wide. Although -D/> can have a
ma!imum of :E ytes of on6chip 54,$ many manufacturers put only E ytes on
the chip.
%he -D/> ecame widely popular after Intel allowed other
manufacturers to make any flavor of the -D/> they please with the condition that they
remain code compatile with the -D/>. %his has led to many versions of the -D/> with
different speeds and amount of on6chip 54, marketed y more than half a do=en
manufacturers. It is important to know that although there are different flavors of the
-D/>$ they are all compatile with the original -D/> as far as the instructions are
concerned. %his means that if you write your program for one$ it will run on any one
of them regardless of the manufacturer. %he major -D/> manufacturers are Intel$
Atmel$ *allas Semiconductors$ Philips Corporation$ Infineon.
AT@C"1 &ro5 ATMEL Cor2or+tion:
%his popular -D/> chip has on6chip 54, in the form of flash memory. %his is ideal
for fast development since flash memory can e erased in seconds compared to
8/12/2019 36498324 Report Car Parking System
17/65
twenty minutes or more needed for the earlier versions of the -D/>. %o use the
A%-C/> to develop a microcontroller6ased system re2uires a 54, urner that
supports flash memory& that can e programmed y the serial C4, port of the PC.
Atmel ,icrocontroller A%-C/>
8+rd-+re *e+ture/
ED pin Ic.
E ytes of 7lash.
>0- +ytes of 5A,.
10 I@4 lines.
%wo>:6+it %imer@Counters.
7ive Bector.
%wo6)evel Interrupt Architecture.
7ull *uple! Serial Port.
4n Chip 4scillator and Clock Circuitry.
So*t-+re *e+ture/
+it ,anipulations
Single Instruction ,anipulation
8/12/2019 36498324 Report Car Parking System
18/65
Separate Program And *ata ,emory
E +ank 4f %emporary 5egisters
*irect$ Indirect$ 5egister and 5elative Addressing.
In addition$ the A%-C/> is designed with static logic for operation down to =ero
fre2uency and supports two software selectale power saving modes. %he Idle ,ode
stops the CP3 while allowing the 5A,$ timer@counters$ serial port and interrupt
system to continue functioning. %he Power *own ,ode saves the 5A, contents ut
free=es the oscillator disaling all other chip functions until the ne!t hardware reset.
%he Atmel 7lash devices are ideal for developing$ since they can e reprogrammed
easy and fast. If we need more code space for our application$ particularly for
developing -C!! projects with C language. Atmel offers a road range of
microcontrollers ased on the -D/> architecture$ with on6chip 7lash program memory.
http://www.atmel.com/atmel/products/prod71.htmhttp://www.atmel.com/atmel/products/prod71.htm8/12/2019 36498324 Report Car Parking System
19/65
Interal Architecture of A%-C/>
Pin de/cri2tion:
%he -C/> have a total of ED pins that are dedicated for various functions such as I@4$
5*$ #5$ address and interrupts. 4ut of ED pins$ a total of 10 pins are set aside for the
8/12/2019 36498324 Report Car Parking System
20/65
four ports PD$ P>$ P0$ and P1$ where each port takes - pins. %he rest of the pins are
designated as Bcc$ 98*$ %A)>$ %A)$ 5S%$ "A$ and PS"8. All these pins e!cept
PS"8 and A)" are used y all memers of the -D/> and -D1> families. In other
words$ they must e connected in order for the system to work$ regardless of whether
the microcontroller is of the -D/> or the -D1> family. %he other two pins$ PS"8 and
A)" are used mainly in -D1> ased systems.
#cc
Pin ED provides supply voltage to the chip. %he voltage source is ;/B.
GND
Pin 0D is the ground.
O/cill+tor C.+r+cteri/tic/:
%A)> and %A)0 are the input and output$ respectively$ of an inverting amplifier
which can e configured for use as an on6chip oscillator$ as shown in 7igure. "ither a
2uart= crystal or ceramic resonator may e used. %o drive the device from an e!ternal
clock source$ %A)0 should e left unconnected while %A)> is driven as shown in
7igure.
8/12/2019 36498324 Report Car Parking System
21/65
4scillator Connections
It must e noted that there are various speeds of the -D/> family. Speed refers to the
ma!imum oscillator fre2uency connected to the %A). 7or e!ample$ a >0 ,0 ,
8/12/2019 36498324 Report Car Parking System
22/65
pin numer 1> in the *IP packages. It is input pin and must e connected to either Bcc
or 98*. In other words$ it cannot e left unconnected.
PSEN
%his is an output pin. PS"8 stands for program store enale. It is the read
stroe to e!ternal program memory. #hen the microcontroller is e!ecuting from
e!ternal memory$ PS"8 is activated twice each machine cycle.
ALE
A)" 'Address latch enale( is an output pin and is active high. #hen
connecting a microcontroller to e!ternal memory$ port D provides oth address and
data. In other words the microcontroller multiple!es address and data through port D
to save pins. %he A)" pin is used for de6multiple!ing the address and data y
connecting to the 9 pin of the ?E)S1?1 chip.
IBO 2ort 2in/ +nd t.eir *unction/
%he four ports PD$ P>$ P0$ and P1 each use - pins$ making them -6it ports.
All the ports upon 5"S"% are configured as output$ ready to e used as output ports.
%o use any of these as input port$ it must e programmed.
Port ?
Port D occupies a total of - pins 'pins 10 to 1(. It can e used for input
or output. %o use the pins of port D as oth input and output ports$ each pin
must e connected e!ternally to a >D6ohm pull6up resistor. %his is due to fact
that port D is an open drain$ unlike P>$ P0 and P1. #ith e!ternal pull6up
resistors connected upon reset$ port D is configured as output port. In order to
make port D an input port$ the port must e programmed y writing > to all the
its of it. Port D is also designated as A*D6A*?$ allowing it to e used for
oth data and address. #hen connecting a microcontroller to an e!ternal
memory$ port D provides oth address and data. %he microcontroller
multiple!es address and data through port D to save pins. A)" indicates if PD
has address or data. #hen A)"KD$ it provides data *D6*?$ ut when A)"K>
it has address AD6A?. %herefore$ A)" is used for de6multiple!ing address and
data with the help of latch ?E)S1?1.
Port 1
8/12/2019 36498324 Report Car Parking System
23/65
Port > occupies a total of - pins 'pins > to -(. It can e used as input or
output. In contrast to port D$ this port does not re2uire pull6up resistors since it
has already pull6up resistors internally. 3pon reset$ port > is configures as an
output port. Similar to port D$ port > can e used as an input port y writing >
to all its its.
Port %
Port 0 occupies a total of - pins 'pins 0> to 0-(. It can e used as input
or output. ust like P>$ port 0 does not need any pull6up resistors since it has
pull6up resistors internally. 3pon reset port 0 is configured as output port. %o
make port 0 as input port$ it must e programmed as such y writing >s to it.
Port
Port 1 occupies a total of - pins 'pins >D to >?(. It can e used as input
or output. P1 does not need any pull6up resistors$ the same as P> and P0 did
not. Although port 1 is configured as output port upon reset$ this is not the way
it is most commonly used. Port 1 has an additional function of providing some
e!tremely important signals such as interrupts. Some of the alternate functions
of P1 are listed elow&
P1.D 5* 'Serial input(
P1.> %* 'Serial output(
P1.0 I8%D '"!ternal interrupt D(
P1.1 I8%> '"!ternal interrupt >(
P1.E %D '%imer D e!ternal input(
P1./ %> '%imer > e!ternal input(
P1.: #5 '"!ternal memory write stroe(
P1.? 5* '"!ternal memory read stroe(
Me5or S2+ce Alloc+tion
19 Intern+l ROM
8/12/2019 36498324 Report Car Parking System
24/65
%he -C/> has E ytes of on6chip 54,. %his E ytes 54,
memory has memory addresses of DDDD to D777h. Program addresses higher
than D777h$ which e!ceed the internal 54, capacity$ will cause the
microcontroller to automatically fetch code ytes from e!ternal memory.
Code ytes can also e fetched e!clusively from an e!ternal memory$
addresses DDDDh to 7777h$ y connecting the e!ternal access pin to ground.
%he program counter doesnRt care where the code is& the circuit designer
decides whether the code is found totally in internal 54,$ totally in e!ternal
54, or in a comination of internal and e!ternal 54,.
%9 Intern+l RAM
%he >0- ytes of 5A, inside the -D/> are assigned addresses DD to?7h. %hese >0- ytes can e divided into three different groups as follows&
>. A total of 10 ytes from locations DD to >7h are set aside for register
anks and the stack.
0. A total of >: ytes from locations 0Dh to 07h are set aside for it
addressale read@write memory and instructions.
A total of -D ytes from locations 1Dh to ?7h are used for read and write storage$ or
what is normally called a scratch pad. %hese -D locations of 5A, are widely used for
the purpose of storing data and parameters y -D/> programmers.
Inter*+cin, o* Microcontroller -it. LCD
%he )C*$ which is used as a display in the system$ is ),+>:0A. %he main features
of this )C* are& >:T0 display$ intelligent )C*$ used for alphanumeric characters
ased on ASCII codes. %his )C* contains >: pins$ in which - pins are used as -6it
data I@4$ which are e!tended ASCII. %hree pins are used as control lines these are
5ead@#rite pin$ "nale pin and 5egister select pin. %wo pins are used for +acklight
and )C* voltage$ another two pins are for +acklight )C* ground and one pin is
used for contrast change.
LCD 2in de/cri2tion
8/12/2019 36498324 Report Car Parking System
25/65
)i2uid Crystal *isplay&
)i2uid crystal displays ')C*( are widely used in recent years as compares to )"*s.
%his is due to the declining prices of )C*$ the aility to display numers$ characters
and graphics$ incorporation of a refreshing controller into the )C*$ their y relieving
the CP3 of the task of refreshing the )C* and also the ease of programming for
characters and graphics. BSS 6 9round
0 BCC 6 ;/B power supply
1 B"" 6 Power supply to control contrast
E 5S I 5SKD to select command register$ 5SK> to select data
register.
/ 5@# I 5@#KD for write$ 5@#K> for read
: " I@4 "nale
? *+D I@4 %he - it data us
- *+> I@4 %he - it data us
*+0 I@4 %he - it data us
>D *+1 I@4 %he - it data us
>> *+E I@4 %he - it data us
>0 *+/ I@4 %he - it data us
>1 *+: I@4 %he - it data us
>E *+? I@4 %he - it data us
8/12/2019 36498324 Report Car Parking System
26/65
V % %
1 6
1 &
1 '
1 )
1 2
1 1
1 0
7
6
&
'
)
2
1
(
1 6
1 &
1 '
1 )
1 2
1 1
1 0
7
6
&
'
)
2
1
(
D 7
E
V % %
D 4
C & # ' ( ) * 'R +
G # $
R / ,
G # $
D 0
D 3
D 6D 5
)
2
D 2D 1
)C* Pin *escription *iagram
#CC= #SS= #EE
%he voltage BCCand BSSprovided y ;/B and ground respectively while B""is used
for controlling )C* contrast. Bariale voltage etween 9round and Bcc is used to
specify the contrast 'or UdarknessU( of the characters on the )C* screen.
RS re,i/ter /elect$
%here are two important registers inside the )C*. %he 5S pin is used for their
selection as follows. If 5SKD$ the instruction command code register is selected$ then
allowing to user to send a command such as clear display$ cursor at home etc.. If
5SK>$ the data register is selected$ allowing the user to send data to e displayed on
the )C*.
RBW re+dB-rite$
%he 5@# 'read@write( input allowing the user to write information from it. 5@#K>$
when it read and 5@#KD$ when it writing.
EN en+;le$
%he enale pin is used y the )C* to latch information presented to its data pins.#hen data is supplied to data pins$ a high power$ a high6to6low pulse must e applied
to this pin in order to for the )C* to latch in the data presented at the data pins.
D?D d+t+ line/$
%he -6it data pins$ *D6*?$ are used to send information to the )C* or read the
contents of the )C*Rs internal registers. %o displays the letters and numers$ we send
ASCII codes for the letters A6H$ a6=$ and numers D6 to these pins while making 5S
K>. %here are also command codes that can e sent to clear the display or force the
cursor to the home position or link the cursor.
8/12/2019 36498324 Report Car Parking System
27/65
#e also use 5S KD to check the usy flag it to see if the )C* is ready to receive the
information. %he usy flag is *? and can e read when 5@# K> and 5S KD$ as
follows& if 5@# K> and 5S KD$ when *? K>'usy flag K>($ the )C* is usy taking
care of internal operations and will not accept any information. #hen *? KD$ the
)C* is ready to receive new information.
Inter*+cin, o* 5icro controller -it. LCD di/2l+:
In most applications$ the U5@#U line is grounded. %his simplifies the application
ecause when data is read ack$ the microcontroller I@4 pins have to e alternated
etween input and output modes.
In this case$ U5@#U to ground and just wait the ma!imum amount of time for each
instruction 'E.>ms for clearing the display or moving the cursor@display to the Uhome
positionU$ >:DGs for all other commands( and also the application software is simpler$
it also frees up a microcontroller pin for other uses. *ifferent )C* e!ecute
instructions at different rates and to avoid prolems later on 'such as if the )C* is
changed to a slower unit(. +efore sending commands or data to the )C* module$ the
,odule must e initiali=ed. 4nce the initiali=ation is complete$ the )C* can e
written to with data or instructions as re2uired. "ach character to display is written
like the control ytes$ e!cept that the U5SU line is set. *uring initiali=ation$ y setting
the US@CU it during the U,ove Cursor@Shift *isplayU command$ after each character
is sent to the )C*$ the cursor uilt into the )C* will increment to the ne!t position
'either right or left(. 8ormally$ the US@CU it is set 'e2ual to U>U(
8/12/2019 36498324 Report Car Parking System
28/65
Interfacing of ,icrocontroller with )C*
LCD Co55+nd Code
"""Ti5er:
%he -6pin ///
timer must e
one of the most
useful ICs ever
made and it is
used in manyprojects. #ith
AT27C&
1
711727
)0
)1
12)'&6(
21222)2'2&262(2
1011121)1'1&161(
)7))()6)&)')))2
RST8TA,28TA,1.S+N
A,+9.R5
+A93..
.1:0
.1:1
.1:2
.1:)
.1:'
.1:&
.1:6
.1:(
.2:09A
.2:19A7
.2:29A10
.2:)9A11
.2:'9A12
.2:&9A1)
.2:69A1'
.2:(9A1&
.):09R8D
.):19T8D
.):29NT
.):)9NT1
.):'9T
.):&9T1
.):69;R
.):(9RD
.0:09AD0
.0:19AD1
.0:29AD2
.0:)9AD)
.0:'9AD'
.0:&9AD&
.0:69AD6
.0:(9AD(
12)'&6(7
1011121)1'1&
16
12)'&6(71011121)1'1&163CC
3CC
1)
33-F
33-F
3CC3CC
22uF
3CC
8.
2
K
Code
'D Shift cursor position to left
>E Shift cursor position to right
>- Shift the entire display to left
>C Shift the entire display to right
-D 7orce cursor to the eginning of >stline
CD 7orce cursor to the eginning of 0nd line
1- 0 line and /L? matri!
8/12/2019 36498324 Report Car Parking System
29/65
just a few e!ternal components it can e used to uild many circuits$ not all of them
involve timingV
A popular version is the 8"/// and this is suitale in most cases where a O/// timerO
is specified. %he //: is a dual version of the /// housed in a >E6pin package$ the two
timers 'A and +( share the same power supply pins. %he circuit diagrams on this page
show a ///$ ut they could all e adapted to use one half of a //:.
)ow power versions of the /// are made$ such as the IC,?///$ ut these should only
e used when specified 'to increase attery life( ecause their ma!imum output
current of aout 0DmA 'with a B supply( is too low for many standard /// circuits.
%he IC,?/// has the same pin arrangement as a standard ///.
%he circuit symol for a /// 'and //:( is a o! with the pins arranged to suit the
circuit diagram& for e!ample /// pin - at the top for the ;Bs supply$ /// pin 1 output
on the right. 3sually just the pin numers are used and they are not laeled with their
function.
%he /// and //: can e used with a supply voltage 'Bs( in the range E./ to >/B '>-B
asolute ma!imum(.
8/12/2019 36498324 Report Car Parking System
30/65
Standard /// and //: ICs create a significant OglitchO on the supply when their output
changes state. %his is rarely a prolem in simple circuits with no other ICs$ ut in
more comple! circuits a /5oot.in, c+2+citor'eg >DDG7( should e connected across
the ;Bs and DB supply near the /// or //:.
%he input and output pin functions are descried riefly elow and there are fuller
e!planations covering the various circuits&
Astale 6 producing a s2uare wave
,onostale 6 producing a single pulse when triggered
+istale 6 a simple memory which can e set and reset
+uffer 6 an inverting uffer 'Schmitt trigger(
In2ut/ o* """B""F
Tri,,er in2ut: when W >@1Bs 'Oactive lowO( this makes the output high ';Bs(. It
monitors the discharging of the timing capacitor in an astale circuit. It has a high
input impedance X 0, .
T.re/.old in2ut:when X0
@1Bs 'Oactive highO( this makes the output low 'DB(T. Itmonitors the charging of the timing capacitor in astale and monostale circuits. It has
a high input impedance X >D, .
T providing the trigger input is X >@1Bs$ otherwise the trigger input will override the
threshold input and hold the output high ';Bs(.
Re/et in2ut:when less than aout D.?B 'Oactive lowO( this makes the output low
'DB($ overriding other inputs. #hen not re2uired it should e connected to ;Bs. It has
an input impedance of aout >Dk .
http://www.kpsec.freeuk.com/555timer.htm#astablehttp://www.kpsec.freeuk.com/555timer.htm#monostablehttp://www.kpsec.freeuk.com/555timer.htm#bistablehttp://www.kpsec.freeuk.com/555timer.htm#bufferhttp://www.kpsec.freeuk.com/555timer.htm#astablehttp://www.kpsec.freeuk.com/555timer.htm#monostablehttp://www.kpsec.freeuk.com/555timer.htm#bistablehttp://www.kpsec.freeuk.com/555timer.htm#buffer8/12/2019 36498324 Report Car Parking System
31/65
Control in2ut:this can e used to adjust the threshold voltage which is set internally
to e 0@1Bs. 3sually this function is not re2uired and the control input is connected to
DB with a D.D>G7 capacitor to eliminate electrical noise. It can e left unconnected if
noise is not a prolem.
%he di/c.+r,e 2inis not an input$ ut it is listed here for convenience. It is connected
to DB when the timer output is low and is used to discharge the timing capacitor in
astale and monostale circuits.
Out2ut o* """B""F
%he output of a standard /// or //: can sink and sourceup to 0DDmA. %his is more
than most ICs and it is sufficient to supply many output transducers directly$ including
)"*s 'with a resistor in series($ low current lamps$ pie=o transducers$ loudspeakers
'with a capacitor in series($ relay coils 'with diode protection( and some motors 'with
diode protection(. %he output voltage does not 2uite reach DB and ;Bs$ especially if a
large current is flowing.
%o switch larger currents you can connect a transistor.
%he aility to oth sink and source current means that two devices can e connectedto the output so that one is on when the output is low and the other is on when the
output is high. %he diagram shows two )"*s connected in this way. %his
arrangement is used in the
*isco )ights project to
make the )"*s flash
alternately.
http://www.kpsec.freeuk.com/components/ic.htm#sinksourcehttp://www.kpsec.freeuk.com/components/ic.htm#sinksourcehttp://www.kpsec.freeuk.com/trancirc.htm#ichttp://www.kpsec.freeuk.com/trancirc.htm#ichttp://www.kpsec.freeuk.com/components/ic.htm#sinksourcehttp://www.kpsec.freeuk.com/trancirc.htm#ic8/12/2019 36498324 Report Car Parking System
32/65
"""B""F A/t+;le
An astale circuit produces a Os2uare
waveO$ this is a digital waveform with
sharp transitions etween low 'DB( and
high ';Bs(. 8ote that the durations of
the low and high states may e different.
%he circuit is called an astale ecause
it is not stale in any state& the output is
continually changing etween OlowO and
OhighO.
%he time period '%( of the s2uare wave is the time for one complete cycle$ ut it is
usually etter to consider fre2uency'f( which is the numer of cycles per second.
T ?9 < R1 ! %R%$ < C1 and * 19
R1 ! %R%$ < C1
% K time period in seconds 's(
f K fre2uency in hert= ' K resistance in ohms ' (
50 K resistance in ohms ' (
C> K capacitance in farads '7(
%he time period can e split into two parts& T T5 ! T/
M+r0 ti5e'output high(& T5 ?9 < R1 ! R%$ < C1
S2+ce ti5e'output low(& T/ ?9 < R% < C1
,any circuits re2uire %m and %s to e almost e2ualY this is achieved if 50 is much
larger than 5>.
7or a standard astale circuit %m cannot e less than %s$ ut this is not too restricting
ecause the output can oth sink and source current. 7or e!ample an )"* can e
made to flash riefly with long gaps y connecting it 'with its resistor( etween ;Bs
and the output. %his way the )"* is on during %s$ so rief flashes are achieved with
5> larger than 50$ making %s short and %m long. If %m must e less than %s a diode
can e added to the circuit as e!plained under duty cycle elow.
/// astale output$ a s2uare wave
'%m and %s may e different(
/// astale circuit
http://www.kpsec.freeuk.com/acdc.htm#propshttp://www.kpsec.freeuk.com/acdc.htm#propshttp://www.kpsec.freeuk.com/555timer.htm#dutycyclehttp://www.kpsec.freeuk.com/acdc.htm#propshttp://www.kpsec.freeuk.com/acdc.htm#propshttp://www.kpsec.freeuk.com/555timer.htm#dutycycle8/12/2019 36498324 Report Car Parking System
33/65
C.oo/in, R1= R% +nd C1
5> and 50 should e in the range
>k to >, . It is est to choose
C> first ecause capacitors are
availale in just a few values.
C.oo/e C1to suit the fre2uency range you re2uire 'use the tale as a guide(.
C.oo/e R% to give the fre2uency 'f( you re2uire. Assume that 5> is much
smaller than 50 'so that %m and %s are almost e2ual($ then you can use&
R% ?9
* < C1
C.oo/e R1to e aout a tenth of 50 '>k min.( unless you want the mark
time %m to e significantly longer than the space time %s.
If you wish to use a 6+ri+;le re/i/torit is est to make it 50.
If 5> is variale it must have a fi!ed resistor of at least >k in series
'this is not re2uired for 50 if it is variale(.
A/t+;le o2er+tion
#ith the output high ';Bs( the capacitor C> is charged y current flowing through 5>
and 50. %he threshold and trigger inputs monitor the capacitor voltage and when it
reaches 0@1Bs 'threshold voltage( the output ecomes low and the discharge pin is
connected to DB.
""" +/t+;le *re7uencie/
C1R% 1?0
R1 10
R% 1??0
R1 1?0
R% 1M
R1 1??0
?9??1H& :-k
8/12/2019 36498324 Report Car Parking System
34/65
%he capacitor now discharges with current flowing through 50 into the discharge pin.
#hen the voltage falls to >@1Bs 'trigger voltage( the output ecomes high again and
the discharge pin is disconnected$ allowing the capacitor to start charging again.
%his cycle repeats continuously unless the reset input is connected to DB which forces
the output low while reset is DB.
An astale can e used to provide the cloc0 /i,n+lfor circuits such as counters.
A lo- *re7uencastale 'W >D
8/12/2019 36498324 Report Car Parking System
35/65
"""B""F Mono/t+;le
A monostale circuit produces a single output pulse when triggered. It is called a
monostale ecause it is stale in just onestate& Ooutput lowO. %he Ooutput highO state is
temporary.
/// monostale out$ a single pulse
/// monostale circuit with manual trigger
%he duration of the pulse is called the ti5e 2eriod'%( and this is determined y
resistor 5> and capacitor C>&
time period$ T 191 < R1 < C1
% K time period in seconds 's(
5> K resistance in ohms ' (
C> K capacitance in farads '7(
%he ma!imum reliale time period is aout >D minutes.
8/12/2019 36498324 Report Car Parking System
36/65
#hy >.>Q %he capacitor charges to 0@1 K :?M so it is a it longer than the
time constant '5> L C>( which is the time taken to charge to :1M.
C.oo/e C1 *ir/t'there are relatively few values availale(.
C.oo/e R1to give the time period you need. 5> should e in the range >k to
>, $ so use a fi!ed resistor of at least >k in series if 5> is variale.
(e-+rethat electrolytic capacitor values are not accurate$ errors of at least
0DM are common.
(e-+rethat electrolytic capacitors leak charge which sustantially increases
the time period if you are using a high value resistor 6 use the formula as only
a very rough guideV
Mono/t+;le o2er+tion
%he timing period is triggered 'started( when the tri,,erinput '/// pin 0( is less than
>@1Bs$ this makes the out2uthigh ';Bs( and the capacitor C> starts to charge through
resistor 5>. 4nce the time period has started further trigger pulses are ignored.
%he t.re/.oldinput '/// pin :( monitors the voltage across C> and when this reaches
0
@1Bs the time period is over and the out2ut ecomes low. At the same time
di/c.+r,e'/// pin ?( is connected to DB$ discharging the capacitor ready for the ne!t
trigger.
%he re/etinput '/// pin E( overrides all other inputs and the timing may e cancelled
at any time y connecting reset to DB$ this instantly makes the output low and
http://www.kpsec.freeuk.com/capacit.htm#timeconstanthttp://www.kpsec.freeuk.com/capacit.htm#timeconstant8/12/2019 36498324 Report Car Parking System
37/65
discharges the capacitor. If the reset function is not re2uired the reset pin should e
connected to ;Bs.
IR Li,.t E5itter
Princi2le o* O2er+tion
+ecause they emit at wavelengths which provide a close match to the peak spectral
response of silicon photo detectors$ oth 9aAs and 9aAlAs. %here are many off6the6
shelf$ commercially availale$ I5 )"* emitters that can e used for a discrete infrared
transceiver circuit design. It should e mentioned here that there are also a numer of
integrated transceivers that the designer can choose as well. In general$ there are four
characteristics of I5 emitters that designers have to e wary of&
5ise and 7all %ime
"mitter #avelength
"mitter Power
"mitter
8/12/2019 36498324 Report Car Parking System
38/65
;avelen
8/12/2019 36498324 Report Car Parking System
39/65
P6I68 photodiode
Avalanche photodiode
In P68 photodiode$ electron hole pairs are created in the depletion region of a p6n
junction in proportion to the optical power. "lectrons and holes are swept out y the
electric field$ leading to a current. In P6I68 photodiode$ electric field is concentrated
in a thin intrinsic layer. In avalanche photodiode$ like P6I68 photodiodes$ ut have an
additional layer in which an average of , secondary electron hole pairs are
generated through impact ioni=ation for each primary pair. Photodiodes usually have a
large sensitive detecting area that can e several hundreds microns in diameter.
IR Li,.t Detector
%he most common device used for detecting light energy in the standard data stream
is a photodiode$ Photo transistors are not typically used in Ir*A standard6compatile
systems ecause of their slow speed. Photo transistors typically have ton@toffof 0 Gs or
more. A photo transistor may e used$ however$ if the data rate is limited to .: k
with a pulse width of >./ Gs. A photodiode is packaged in such a way as to allow
light to strike the P8 junction.
Characteristic Curve of a 5everse +iased Photodiode
In infrared applications$ it is common practice to apply a reverse ias to the device.
5efer to 7igure 1.>? for a characteristic curve of a reverse iased photodiode. %herewill e a reverse current that will vary with the light level. )ike all diodes$ there is an
8/12/2019 36498324 Report Car Parking System
40/65
intrinsic capacitance that varies with the reverse ias voltage. %his capacitance is an
important factor in speed.
De/cri2tion
%he FS"?1 is a silicon PI8 photodiode encapsulated in an infrared transparent$lack$ plastic %D0 package.
1 2
;[
SE &e+ture/
*aylight filter
%D0 package
PI8 photodiode
5eceipting angle DZ Chip si=e K .>D?0 s2. inches '0.?>0 s2. mm(
Lin0 Di/t+nce
%o select an appropriate I5 photo6detect diode$ the designer must keep in mind the
distance of communication$ the amount of light that may e e!pected at that distance
and the current that will e generated y the photodiode given a certain amount of
light energy. %he amount of light energy$ or irradiance that is present at the active6
input interface is typically given in G#@cm0. %his is a convenient scale of light flu!.
Ste22er Motor:
Introduction to Ste22er Motor
%he stepper motor is an electromagnetic device that converts digital pulses into
mechanical shaft rotation. %he shaft or spindle of a stepper motor rotates in discrete
step increments when electrical command pulses are applied to it in the proper
8/12/2019 36498324 Report Car Parking System
41/65
se2uence. %he se2uence of the applied pulses is directly related to the direction of
motor shafts rotation. %he speed of the motor shafts rotation is directly related to the
fre2uency of the input pulses and the length of rotation is directly related to the
numer of input pulses applied. ,any advantages are achieved using this kind of
motors$ such as higher simplicity$ since no rushes or contacts are present$ low cost$
high reliaility$ high tor2ue at low speeds$ and high accuracy of motion. ,any
systems with stepper motors need to control the acceleration@ deceleration when
changing the speed.
Stepper ,otor
(i2ol+r 6B/9 Uni2ol+r Ste22er Motor/
%he two common types of stepper motors are the ipolar motor and the unipolar
motor. %he ipolar and unipolar motors are similar$ e!cept that the unipolar has a
center tap on each winding. %he ipolar motor needs current to e driven in oth
directions through the windings$ and a full ridge driver is needed .%he center tap onthe unipolar motor allows a simpler driving circuit$ limiting the current flow to one
direction. %he main drawack with the unipolar motor is the limited capaility to
energi=e all windings at any time$ resulting in a lower tor2ue compared to the ipolar
motor. %he unipolar stepper motor can e used as a ipolar motor y disconnecting
the center tap.
In unipolar there are / wires. 4ne common wire and four wires to which power
supply has to e given in a serial order to make it drive. +ipolar can have : wires and
a pair of wires is given supply at a time to drive it in steps.
8/12/2019 36498324 Report Car Parking System
42/65
A % 2.+/e -indin,$ uni2ol+r Ste22er Sc.e5+tic
A t-o 2.+/e -indin,$ ;i2ol+r /te22er 5otor
Dri6in, + Ste22er Motor:
Identi* t.e -ire& Common and windings
Connection to identi* t.e co55on -indin,
8/12/2019 36498324 Report Car Parking System
43/65
It has een seen that out of the five wires two are grouped as common. %he other four
are the windings that have to give supply to. ,ajor cru! here is to identify the
common line. ust take the multimeter and check the resistance etween the wires.
. %he rotation angle of the motor is proportional to the input pulse.
0. %he motor has full tor2ue at standstill 'if the windings are energi=ed(
1. Precise positioning and repeataility of movement since good stepper motors
have an accuracy of 1 /M of a step and this error is non cumulative from one
step to the ne!t.
E. "!cellent response to starting@ stopping@reversing.
/. Bery reliale since there are no contact rushes in the motor. %herefore$ the
life of the motor is simply dependant on the life of the earing.
:. %he motors response to digital input pulses provides open6loop control$
making the motor simpler and less costly to control.
?. It is possile to achieve very low speed synchronous rotation with a load that
is directly coupled to the shaft.
-. A wide range of rotational speeds can e reali=ed as the speed is proportional
to the fre2uency of the input pulses.
8/12/2019 36498324 Report Car Parking System
44/65
Di/+d6+nt+,e/:
>. 5esonances can occur if not properly controlled.
0. 8ot easy to operate at e!tremely high speeds.
Ste22er Motor T2e
%here are three asic stepper motor types. %hey are&
Bariale6reluctance
Permanent6magnet
/Z. 'E-
8/12/2019 36498324 Report Car Parking System
45/65
0E steps@revolution( P, motors as the motor name implies have permanent magnets
added to the motor structure. %he rotor no longer has teeth as with the B5 motor.
Instead the rotor is magneti=ed with alternating north and south poles situated in a
straight line parallel to the rotor shaft. %hese magneti=ed rotor poles provide an
increased magnetic flu! intensity and ecause of this the P, motor e!hiits improved
tor2ue characteristics when compared with the B5 type.
Princi2le o* + PM t2e /te22er 5otor
8;rid 8($
%he hyrid stepper motor is more e!pensive than the P, stepper motor ut provides
etter performance with respect to step resolution$ tor2ue and speed. %ypical step
angles for the hyrid stepper motor$ range from 1.:Z to D.Z '>DD EDD steps per
revolution(. %he hyrid stepper motor comines the est features of oth the P, and
B5 type stepper motors. %he rotor is multi toothed like the B5 motor and contains an
a!ially magneti=ed concentric magnet around its shaft. %he teeth on the rotor provide
an even etter path which helps guide the magnetic flu! to preferred locations in the
air gap. %his further increases the detent$ holding and dynamic tor2ue characteristics
of the motor when compared with oth the B5 and P, types.
8/12/2019 36498324 Report Car Parking System
46/65
Cro// /ection o* .;rid /te22er 5otor
A22lic+tion/ o* Ste22er Motor
A stepper motor can e a good choice whenever controlled movement is re2uired.
%hey can e used to advantage in applications where you need to control rotation
angle$ speed$ position and synchronism. +ecause of the inherent advantages listed
previously$ stepper motors have found their place in many different applications.
Some of these include printers$ plotters$ high end office e2uipment$ hard disk drives$
medical e2uipment$ fa! machines$ automotive and many more.
Tor7ue Gener+tion
%he tor2ue produced y a stepper motor depends on several factors&
\ %he step rate
\ %he drive current in the windings
\ %he drive design or type
In a stepper motor a tor2ue is developed when the magnetic flu!es of the rotor and
stator are displaced from each other. %he stator is made up of a high permeaility
magnetic material. %he presence of this high permeaility material causes the
magnetic flu! to e confined for the most part to the paths defined y the stator
structure in the same fashion that currents are confined to the conductors of an
electronic circuit. %his serves to concentrate the flu! at the stator poles. %he tor2ue
output produced y the motor is proportional to the intensity of the magnetic flu!
8/12/2019 36498324 Report Car Parking System
47/65
generated when the winding is energi=ed. %he asic relationship which defines the
intensity of the magnetic flu! is defined y&
< K '8 T i( @ l
#here&
8 K 8umer of winding turns
i K Current
< K ,agnetic field intensity
l K,agnetic flu! path length
%his relationship shows that the magnetic flu! intensity and conse2uently the tor2ue is
proportional to the numer of winding turns and the current and inversely
proportional to the length of the magnetic flu! path. It has een seen that the same
frame si=e stepper motor could have very different tor2ue output capailities simply
y changing the winding parameters.
P.+/e/= Pole/ +nd Ste22in, An,le/
3sually stepper motors have two phases$ ut three6 and five6phase motors also e!ist.
A ipolar motor with two phases has one winding@phase and a unipolar motor has one
winding$ with a center tap per phase. Sometimes the unipolar stepper motor is referred
to as a four phase motor$ even though it has only two phases. ,otors that have two
separate windings per phase also e!ist]these can e driven in either ipolar or
unipolar mode. A pole can e defined as one of the regions in a magneti=ed ody
where the magnetic flu! density is concentrated. +oth the rotor and the stator of a step
motor have poles.
In reality several more poles are added to oth the rotor and stator structure in order to
increase the numer of steps per revolution of the motor$ or in other words to provide
a smaller asic 'full step( stepping angle. %he permanent magnet stepper motor
contains an e2ual numer of rotor and stator pole pairs. %ypically the P, motor has
>0 pole pairs. %he stator has >0 pole pairs per phase. %he hyrid type stepper motor
has a rotor with teeth. %he rotor is split into two parts$ separated y a permanent
magnet making half of the teeth south poles and half north poles. %he numer of pole
pairs is e2ual to the numer of teeth on one of the rotor halves. %he stator of a hyrid
motor also has teeth to uild up a higher numer of e2uivalent poles 'smaller pole
pitch$ numer of e2uivalent poles K 1:D@teeth pitch( compared to the main poles$ on
which the winding coils are wound. It is the relationship etween the numer of rotor
8/12/2019 36498324 Report Car Parking System
48/65
poles and the e2uivalent stator poles$ and the numer the numer of phases that
determines the full6step angle of a stepper motor.
Ste2 An,le: %he angle with which the stepper motor turns for a single pulse if supply
to one wire or a pair is called step angle.
8PhK 8umer of e2uivalent poles per
Phase K numer of rotor poles
Ph K 8umer of phases8 K %otal numer of poles for all phases together
If the rotor and stator tooth pitch is une2ual$ a more6complicated relationship e!ist
O2tocou2ler:
It has one I5 )"* and a photo6 transistor. 4ne pin of the )"* is connected to the
,C3 to get a signal 'D or >( and the pin is given ground. #hen the signal from the,C3 is D$ then )"* emits light. %his light will turn on the 8P8 transistor. "mitter of
the transistor is grounded. Collector is connected to the P8P transistor whose emitter
is connected to Bccand collector to the relay.
%he purpose of using the optocouplers is to pass the supply from the PC@,C3 to the
appliances is for isolation of the port of the PC@,C3 from an e!ternal hardware.
%he voltage signal from the PC@,C3 is eing converted into light y the )"* and
then further converted into voltage y the phototransistor. %his ensures that there is no
physical connection etween the PC and the appliances. %he signal from the
PC@,C3 is coupled only through light so that if in any case the e!ternal hardware
' in this case &appliances( produces an error voltage it will not e passed over to the
port of the PC@,C3 and will not damage the internal circuitry of the PC@,C3.
8/12/2019 36498324 Report Car Parking System
49/65
,C%60" Pin *iagram
%he ,C%0 series opto isolators consist of a gallium arsenide infrared emitting
diode driving a silicon phototransistor in a :6pin dual in6line package. %here is noelectrical connection etween the two$ just a eam of light. %he light emitter is nearly
always an )"*. %he light sensitive device may e a photodiode$ phototransistor$ or
more esoteric devices such as thyristors$ triacs etc. %o carry a signal across the
isolation arrier$ optocouplers are operated in linear mode.
Pin De/cri2tion o* MCT%E
%he IC package may also e called an IC or a chip. It is important to note that each
type of optocoupler may use different pin assignments. 7or carrying a linear signal
across isolation arrier there are two types of optocouplers. +oth types use an infrared
light emitting diode ')"*( to generate and send a light signal across an isolation
arrier. %he difference is in the detection method. Some optocouplers use a
phototransistor detector while others use a photodiode detector which drives the ase
of a transistor.
Pin no9 &unction
> Anode
0 Cathode1 8C
E "mitter
/ Collector
: +ase
8/12/2019 36498324 Report Car Parking System
50/65
%he phototransistor detector uses the transistors collector ase junction to
detect the light signal. %his necessitates that the ase area e relatively large
compared to a standard transistor. %he result is a large collector to ase capacitance
which slows the collector rise time and limits the effective fre2uency response of the
device. In addition the amplified photocurrent flows in the collector ase junction and
modulates the response of the transistor to the photons. %his cause the transistor to
ehave in a non6linear manner. %ypical phototransistor gains range from >DD to >DDD.
%he photodiode@transistor detector comination on the other hand uses a diode
to detect the photons and convert them to a current to drive the transistor ase. %he
transistor no longer has a large ase area. %he response of this pair is not affected y
amplified photocurrent and the photodiode capacitance does not impair speed.
O2tocou2ler O2er+tion:
4ptocouplers are good devices for conveying analog information across a power
supply isolation arrier$ they operate over a wide temperature range and are often
safety agency approved they do$ however$ have many uni2ue operating
considerations.
4ptocouplers are current input and current output devices. %he input )"* is
e!cited y changes in drive current and maintains a relatively constant forward
voltage. %he output is a current which is proportional to the input current. %he output
current can easily e converted to a voltage through a pull6up or load resistor.
A22lic+tion/:
AC mains detection
5eed relay driving
Switch mode power supply feedack
%elephone ring detection
)ogic ground isolation
)ogic coupling with high fre2uency noise rejection.
&e+ture/:
Interfaces with common logic families
8/12/2019 36498324 Report Car Parking System
51/65
Input6output coupling capacitance W D./ p7
Industry Standard *ual6in line :6pin package
/1DD B5,S isolation test voltage
)ead6free component
Optocoupler (817)
Description
%he ? contains a light emitting diode optically coupled to a phototransistor.
It is packaged in a E6pin *IP package and availale in wide6lead spacing option.
Input6output isolation voltage is /DDD Brms. 5esponse time 'tr($ is typically E ms and
minimum C%5 'Current transfer ratio( is /DM at input current of / mA.
Po-er Tr+n/i/tor (C F$:
8/12/2019 36498324 Report Car Parking System
52/65
#+riou/ 8+rd-+re Tool/ u/ed +re:
Soldering Iron
Soldering #ire
5ion wire
7lu!
Cutter
%in wire
*e6soldering pump
,ultimeter
IC Programmer
PC
So*t-+re Tool/ u/ed +re:
eil compiler
SunromRs software to Program the ,icrocontroller 'A%-s/0(
"medded C )anguage
8/12/2019 36498324 Report Car Parking System
53/65
(+/ic Tutori+l/ *or Keil So*t-+re:
>. 4pen eil from the Start menu
0. %he 7igure elow shows the asic names of the windows referred in this document
St+rtin, + ne- A//e5;ler Pro4ect
>. Select 8ew Project from the Project ,enu.
8/12/2019 36498324 Report Car Parking System
54/65
0.8ame the project N%oggle.a/>R
1. Click on the Save +utton.
E. %he device window will e displayed.
/. Select the part you will e using to test with. 7or now we will use the *allas
Semiconductor part *S-CE0D.
8/12/2019 36498324 Report Car Parking System
55/65
:. *oule Click on the *allas Semiconductor.
?. Scroll down and select the *S-CE0D Part
-. Click 4
8/12/2019 36498324 Report Car Parking System
56/65
Cre+tin, Source &ile
>. Click 7ile ,enu and select 8ew.
0. A new window will open up in the eil I*".
8/12/2019 36498324 Report Car Parking System
57/65
1. #rite any code on this file.
E. Click on 7ile menu and select Save as^
8/12/2019 36498324 Report Car Parking System
58/65
/.8ame the file with e!tension '.asm for assemly language code .c for emedded
C language code(.
:. Click the Save +utton
Adding 7ile to the Project
>. "!pand %arget > in the %ree ,enu
8/12/2019 36498324 Report Car Parking System
59/65
0. Click on Project and select %argets$ 9roups$ 7iles^
1. Click on 9roups@Add 7iles ta
E. 3nder Availale 9roups select Source 9roup >
/. Click Add 7iles to 9roup^ utton
8/12/2019 36498324 Report Car Parking System
60/65
:. Change file type to Asm Source file'T.aTY T.src(
?. Click on toggle.a/>
-. Click Add utton
. Click Close +utton
>D. Click 4 utton when you return to %arget$ 9roups$ 7iles^ dialog o!.
8/12/2019 36498324 Report Car Parking System
61/65
>>. "!pand the Source 9roup > in the %ree menu to ensure that the file was added to
the project.
Creating
8/12/2019 36498324 Report Car Parking System
62/65
1. Select %arget %a
E. Change tal ',h=( from /D.D to >>.D/0
8/12/2019 36498324 Report Car Parking System
63/65
/. Select 4utput %a
:. Click on Create
8/12/2019 36498324 Report Car Parking System
64/65
8/12/2019 36498324 Report Car Parking System
65/65
CONCLUSION
I would like to conclude this project as a very great and enriching e!perience.
*uring the project las I familiari=ed myself with P.C.+ designing$ application of I.C.'its pin diagram($ mounting of components using soldering process and interfacing of
the hardware circuit with the computer.
%he circuit can e used at all places starting from domestic to the industrial sectors.
%he simplicity in the usage of this circuit helps it to e used y a large numer of
people as people with less knowledge of hardware can also use it without facing any
prolem. %he
I also learned aout the engg. 5esponsiility and aout their hard work. %his project
was not only good for personality development ut also great in terms of imparting
practical knowledge.
%hus I conclude our project with a very nice and wonderful e!perience