You are on page 1of 40

CHAPTER 1

INTRODUCTION
1.1 INTRODUCTION
The advent of new high-speed technology and the growing computer capacity
provided realistic opportunity for new robot controls and realization of new methods of
control theory. This technical improvement together with the need for high performance
robots created faster, more accurate and more intelligent robots using new robots control
devices, new drives and advanced control algorithms.
This Project deals with live personal detection robot is based on 8 bit
Microcontroller. This obot follows which is drawn over the surface. !ere we are using
P" sensor for detect the which are detect human. The project is mainly used in the
#$%"& for $arth 'ua(e rescue.
"nternally it consists of " sensors. The infrared sensors are used to sense the live
persons. )ll the above systems are controlled by the Microcontroller. "n our project we
are using the popular 8 bit microcontroller.
The Microcontroller is used to control the motors. "t gets the signals from the P"
sensors and it drives the motors according to the sensor inputs. Two #* +are motors are
used to drive the robot.
HARDWARE REQUIREMENTS
,. P-.$ &/PP01
2. M"*- *-3T-#00$ 4)T85&627
8. #* +)$ M-T-
9. $0)1&
6.P" &$3&-
SIMULATION
T--0: ;$"0 M"*-<"&"-3
0)3+/)+$: $M%$##$# =* =0)3+/)+$
1.2BLOCK DIAGRAM :
1.3 Flow c!"# !$% Al&o"'#(

ALGORITHM
&tep ,: &tart
&tep 2: "nitialize micro controller
&tep 8: "nitialize motors
&tep 9: "nitialize P" sensor
&tep 6: Monitor P" sensor
&tep >: "f person detected
%uzzer on
motor rotates in specified direction
&tep ?: Monitor P" sensor
&tep 8: &top
CHAPTER 2
DESCRIPTION OF HARDWARE COMPONENTS
2.1 AT)*S+2
2.1.1 A BRIEF HISTOR, OF )-+1
"n ,58,, "ntel corporation introduced an 8 bit microcontroller called 8@6,. this
microcontroller had ,28 bytes of )M, 9; bytes of chip -M, two timers, one serial
port, and four ports all on a single chip. )t the time it was also referred as = ) &1&T$M
-3 ) *!"PA
The 8@6, is an 8-bit processor meaning that the *P/ can wor( only on 8 bits data
at a time. #ata larger than 8 bits has to be bro(en into 8 bits pieces to be processed by the
*P/. The 8@6, has a total of four "B- ports each 8 bit wide.
There are many versions of 8@6, with different speeds and amount of on-chip
-M and they are all compatible with the original 8@6,. this means that if you write a
program for one it will run on any of them.
The 8@6, is an original member of the 8@6, family. There are two other
members in the 8@6, family of microcontrollers. They are 8@62 and 8@8,. )ll the three
microcontrollers will have the same internal architecture, but they differ in the following
aspects.
8@8, has ,28 bytes of )M, two timers and > interrupts.
8@6, has 9; -M, ,28 bytes of )M, two timers and >
interrupts.
8@62 has 8; -M, 26> bytes of )M, three timers and 8
interrupts.
-f the three microcontrollers, 8@6, is the most preferable. Microcontroller
supports both serial and parallel communication.
"n the concerned project 8@62 microcontroller is used. !ere microcontroller used
is )T85&62, which is manufactured by )TM$0 laboratories.
3$*$&&"T1 -C M"*-*-3T-00$&:
Microprocessors brought the concept of programmable devices and made many
applications of intelligent e'uipment. Most applications, which do not need large amount
of data and program memory, tended to be costly.
The microprocessor system had to satisfy the data and program re'uirements so,
sufficient )M and -M are used to satisfy most applications .The peripheral control
e'uipment also had to be satisfied. Therefore, almost all-peripheral chips were used in the
design. %ecause of these additional peripherals cost will be comparatively high.
)n eDample:
8@86 chip needs:
)n )ddress latch for separating address from multipleD address and data.82-;%
)M and 82-;% -M to be able to satisfy most applications. )s also Timer E *ounter,
Parallel programmable port, &erial port, and "nterrupt controller are needed for its
efficient applications.
"n comparison a typical Micro controller 8@6, chip has all that the 8@6, board has
eDcept a reduced memory as follows.
9; bytes of -M as compared to 82-;%, ,28 %ytes of )M as compared to 82-;%.
%ul(y:
-n comparing a board full of chips 4Microprocessors7 with one chip with all
components in it 4Microcontroller7.
#ebugging:
0ots of Microprocessor circuitry and program to debug. "n Micro controller there
is no Microprocessor circuitry to debug.
&lower #evelopment time: )s we have observed Microprocessors need a lot of
debugging at board level and at program level, where as, Micro controller do not have the
eDcessive circuitry and the built-in peripheral chips are easier to program for operation.
&o peripheral devices li(e TimerE*ounter, Parallel programmable port, &erial
*ommunication Port, "nterrupt controller and so on, which were most often used were
integrated with the Microprocessor to present the Micro controller .)M and -M also
were integrated in the same chip. The -M size was anything from 26> bytes to 82;b or
more. )M was optimized to minimum of >9 bytes to 26> bytes or more.
Microprocessor has following instructions to perform:
,. eading instructions or data from program memory -M.
2. "nterpreting the instruction and eDecuting it.
8. Microprocessor Program is a collection of instructions stored in a 3onvolatile
memory.
9. ead #ata from "E- device
6. Process the input read, as per the instructions read in program memory.
>. ead or write data to #ata memory.
?. .rite data to "E- device and output the result of processing to -EP device.
2.1.2 I$#"o%.c#'o$ #o AT)*S+2
The system re'uirements and control specifications clearly rule out the use of ,>,
82 or >9 bit micro controllers or microprocessors. &ystems using these may be earlier to
implement due to large number of internal features. They are also faster and more reliable
but, the above application is satisfactorily served by 8-bit micro controller. /sing an
ineDpensive 8-bit Microcontroller will doom the 82-bit product failure in any competitive
mar(et place. *oming to the 'uestion of why to use 85&62 of all the 8-bit Microcontroller
available in the mar(et the main answer would be because it has 8(% Clash and 26> bytes
of data )M82 "E- lines, three ,>-bit timerEcounters, a $ight-vector two-level interrupt
architecture, a full dupleD serial port, on-chip oscillator, and cloc( circuitry.
"n addition, the )T85&62 is designed with static logic for operation down to zero
fre'uency and supports two software selectable power saving modes. The "dle Mode
stops the *P/ while allowing the )M, timerEcounters, serial port, and interrupt system
to continue functioning. The Power #own Mode saves the )M contents but freezes the
oscillator, disabling all other chip functions until the neDt hardware reset. The Clash
program memory supports both parallel programming and in &erial "n-&ystem
Programming 4"&P7. The 85&62 is also "n-)pplication Programmable 4")P7, allowing the
Clash program memory to be reconfigured even while the application is running.
%y combining a versatile 8-bit *P/ with Clash on a monolithic chip, the )tmel
)T85&62 is a powerful microcomputer which provides a highly fleDible and cost
effective solution to many embedded control applications.
2.1.3 FEATURES
*ompatible with M*&-6,F Products
G 8; %ytes of "n-&ystem Programmable 4"&P7 Clash Memory
H $ndurance: ,@@@ .riteE$rase *ycles
G 9.@< to 6.6< -perating ange
G Cully &tatic -peration: @ !z to 88 M!z
G Three-level Program Memory 0oc(
G 26> D 8-bit "nternal )M
G 82 Programmable "E- 0ines
G Three ,>-bit TimerE*ounters
G $ight "nterrupt &ources
G Cull #upleD /)T &erial *hannel
G 0ow-power "dle and Power-down Modes
G "nterrupt ecovery from Power-down Mode
G .atchdog Timer
G #ual #ata Pointer
-Power-off Clag
PIN DIAGRAM
FIG/2 PIN DIAGRAM OF )*S+2 IC
2.1.0 PIN DESCRIPTION

FIG/3 F.$c#'o$!l 1loc2 %'!&"!( o3 ('c"o co$#"oll4"
The 8@62 -scillator and *loc(:
The heart of the 8@6, circuitry that generates the cloc( pulses by which all the
internal all internal operations are synchronized. Pins IT)0, )nd IT)02 is provided
for connecting a resonant networ( to form an oscillator. Typically a 'uartz crystal and
capacitors are employed. The crystal fre'uency is the basic internal cloc( fre'uency of
the microcontroller. The manufacturers ma(e 8@6, designs that run at specific minimum
and maDimum fre'uencies typically , to ,> M!z.
M$M-"$&
Types of memory:
The 8@62 have three general types of memory. They are on-chip memory, eDternal
*ode memory and eDternal am. -n-*hip memory refers to physically eDisting memory
on the micro controller itself. $Dternal code memory is the code memory that resides off
chip. This is often in the form of an eDternal $P-M. $Dternal )M is the am that
resides off chip. This often is in the form of standard static )M or flash )M.
!5 Co%4 (4(o"6
*ode memory is the memory that holds the actual 8@62 programs that is to be run.
This memory is limited to >9;. *ode memory may be found on-chip or off-chip. "t is
possible to have 8; of code memory on-chip and >@; off chip memory simultaneously.
"f only off-chip memory is available then there can be >9; of off chip -M. This is
controlled by pin provided as $)
15 I$#4"$!l RAM
The 8@62 have a ban( of 26> bytes of internal )M. The internal )M is found
on-chip. &o it is the fastest am available. )nd also it is most fleDible in terms of reading
and writing. "nternal am is volatile, so when 8@6, is reset, this memory is cleared. 26>
bytes of internal memory are subdivided. The first 82 bytes are divided into 9 register
ban(s. $ach ban( contains 8 registers. "nternal )M also contains 26> bits, which are
addressed from 2@h to 2Ch. These bits are bit addressed i.e. each individual bit of a byte
can be addressed by the user. They are numbered @@h to CCh. The user may ma(e use of
these variables with commands such as &$T% and *0.
S74c'!l F.$c#'o$ "4&'8#4"4% (4(o"6:
&pecial function registers are the areas of memory that control specific
functionality of the 8@62 micro controller.
a7 )ccumulator 4@$@h7
)s its name suggests, it is used to accumulate the results of large no of
instructions. "t can hold 8 bit values.
b7 % registers 4@C@h7
The % register is very similar to accumulator. "t may hold 8-bit value. The b
register is only used by M/0 )% and #"< )% instructions. "n M/0 )% the higher byte
of the product gets stored in % register. "n div )% the 'uotient gets stored in % with the
remainder in ).
c7 &tac( pointer 48,h7
The stac( pointer holds 8-bit value. This is used to indicate where the
neDt value to be removed from the stac( should be ta(en from. .hen a value is to be
pushed onto the stac(, the 8@62 first store the value of &P and then store the value at the
resulting memory location. .hen a value is to be popped from the stac(, the 8@62
returns the value from the memory location indicated by &P and then decrements the
value of &P.
d7 #ata pointer
The &Cs #P0 and #P! wor( together wor( together to represent a ,>-bit value
called the data pointer. The data pointer is used in operations regarding eDternal )M
and some instructions code memory. "t is a ,>-bit &C and also an addressable &C.
e7 Program counter
The program counter is a ,> bit register, which contains the 2 byte address, which
tells the 8@62 where the neDt instruction to eDecute to be found in memory. .hen the
8@62 is initialized P* starts at @@@@h. )nd is incremented each time an instruction is
eDecutes. "t is not addressable &C.
f7 P*-3 4power control, 8?h7
The power control &C is used to control the 8@6,Js power control modes. *ertain
operation modes of the 8@6, allow the 8@6, to go into a type of =sleep modeA which
consumes much lee power.
g7 T*-3 4timer control, 88h7
The timer control &C is used to configure and modify the way in which the
8@6,Js two timers operate. This &C controls whether each of the two timers is running
or stopped and contains a flag to indicate that each timer has overflowed. )dditionally,
some non-timer related bits are located in T*-3 &C. These bits are used to configure
the way in which the eDternal interrupt flags are activated, which are set when an
eDternal interrupt occurs.
h7 TM-# 4Timer Mode, 85h7
The timer mode &C is used to configure the mode of operation of each of the
two timers. /sing this &C your program may configure each timer to be a ,>-bit timer,
or ,8 bit timer, 8-bit auto reload timer, or two separate timers. )dditionally you may
configure the timers to only count when an eDternal pin is activated or to count =eventsA
that are indicated on an eDternal pin.
i7 T- 4Timer @ lowEhigh, address 8)E8* h7
These two &Cs ta(en together represent timer @. Their eDact behavior depends
on how the timer is configured in the TM-# &CK however, these timers always count
up. .hat is configurable is how and when they increment in value.
j7 T, 4Timer , 0owE!igh, address 8%E 8# h7
These two &Cs, ta(en together, represent timer ,. Their eDact behavior depends on
how the timer is configured in the TM-# &CK however, these timers always count up..
(7 P@ 4Port @, address 5@h, bit addressable7
This is port @ latch. $ach bit of this &C corresponds to one of the pins on a micro
controller. )ny data to be outputted to port @ is first written on P@ register. Cor e.g., bit @
of port @ is pin P@.@, bit ? is pin p@.?. .riting a value of , to a bit of this &C will send a
high level on the corresponding "E- pin whereas a value of @ will bring it to low level.
l7 P, 4port ,, address 5@h, bit addressable7
This is port latch,. $ach bit of this &C corresponds to one of the pins on a micro
controller. )ny data to be outputted to port @ is first written on P@ register. Cor e.g., bit @
of port @ is pin P,.@, bit ? is pin P,.?. .riting a value of , to a bit of this &C will send a
high level on the corresponding "E- pin whereas a value of @ will bring it to low level
m7 P2 4port 2, address @)@h, bit addressable7:
This is a port latch2. $ach bit of this &C corresponds to one of the pins on a
micro controller. )ny data to be outputted to port @ is first written on P@ register. Cor e.g.,
bit @ of port @ is pin P2.@, bit ? is pin P2.?. .riting a value of , to a bit of this &C will
send a high level on the corresponding "E- pin whereas a value of @ will bring it to low
level.
n7 P8 4port 8, address %@h, bit addressable7 :
This is a port latch8. $ach bit of this &C corresponds to one of the pins on a
micro controller. )ny data to be outputted to port @ is first written on P@ register. Cor e.g.,
bit @ of port @ is pin P8.@, bit ? is pin P8.?. .riting a value of , to a bit of this &C will
send a high level on the corresponding "E- pin whereas a value of @ will bring it to low
level.
o7 "$ 4interrupt enable, @)8h7:
The "nterrupt $nable &C is used to enable and disable specific interrupts. The
low ? bits of the &C are used to enableEdisable the specific interrupts, where the M&%
bit is used to enable or disable all the interrupts. Thus, if the high bit of "$ is @ all
interrupts are disabled regardless of whether an individual interrupt is enabled by setting
a lower bit.

p7 "P 4"nterrupt Priority, @%8h7
The interrupt priority &C is used to specify the relative priority of each interrupt.
-n 8@6,, an interrupt maybe either low or high priority. )n interrupt may interrupt
interrupts. Cor e.g., if we configure all interrupts as low priority other than serial
interrupt. The serial interrupt always interrupts the system, even if another interrupt is
currently eDecuting. !owever, if a serial interrupt is eDecuting no other interrupt will be
able to interrupt the serial interrupt routine since the serial interrupt routine has the
highest priority.

'7 P&. 4Program &tatus .ord, @#@h7
The program &tatus .ord is used to store a number of important bits that are set
and cleared by 8@62 instructions. The P&. &C contains the carry flag, the auDiliary
carry flag, the parity flag and the overflow flag. )dditionally, it also contains the register
ban( select flags, which are used to select, which of the =A register ban(s currently in
use.
r7 &%/C 4&erial %uffer, 55h7
&%/C is used to hold data in serial communication. "t is physically two registers.
-ne is writing only and is used to hold data to be transmitted out of 8@62 via TI#. The
other is read only and holds received data from eDternal sources via I#. %oth mutually
eDclusive registers use address 55h.
I9O 7o"#8:
-ne major feature of a microcontroller is the versatility built into the inputEoutput
4"E-7 circuits that connect the 8@62 to the outside world. The main constraint that limits
numerous functions is the number of pins available in the 8@6, circuit. The #"P had 9@
pins and the success of the design depends on the fleDibility incorporated into use of
these pins. Cor this reason, 29 of the pins may each used for one of the two entirely
different functions which depend, first, on what is physically connected to it and, then, on
what software programs are used to =programA the pins.
PORT -
Port @ pins may serve as inputs, outputs, or, when used together, as a bi directional
low-order address and data bus for eDternal memory. To configure a pin as input, , must
be written into the corresponding port @ latch by the program. .hen used for interfacing
with the eDternal memory, the lower byte of address is first sent via P-T@, latched using
)ddress latch enable 4)0$7 pulse and then the bus is turned around to become the data
bus for eDternal memory.
PORT 1
Port , is eDclusively used for inputEoutput operations. P-T& , pin have no dual
function. .hen a pin is to be configured as input, , is to be written into the
corresponding Port , latch.
PORT 2
Port 2 maybe used as an inputEoutput port. "t may also be used to supply a high H
order address byte in conjunction with Port @ low-order byte to address eDternal memory.
Port 2 pins are momentarily changed by the address control signals when supplying the
high byte a ,>-bit address. Port 2 latches remain stable when eDternal memory is
addressed, as they do not have to be turned around 4set to ,7 for data input as in the case
for Port @.
PORT 3
Port 8 may be used to input Eoutput port. The input and output functions can be
programmed under the control of the P8 latches or under the control of various special
function registers. /nli(e Port @ and Port 2, which can have eDternal addressing functions
and change all eight-port b se, each pin of port 8 maybe individually programmed to be
used as "E- or as one of the alternate functions. The Port 8 alternate uses are:
INTERRUPTS:
The )T85&62 has a total of siD interrupt vectors: two eDternal interrupts 4"3T@ and
"3T,7, three timer interrupts 4Timers@, ,, and 27, and the serial port interrupt. These
interrupts are all shown in Cigure ,@. $ach of these interrupt sources can be individually
enabled or disabled by setting or clearing a bit in &pecial Cunction egister "$. "$ also
contains a global disable bit, $), which disables all interrupts at once. 3ote that Table 6
shows that bit position "$.> is unimplemented.
Timer 2 interrupt is generated by the logical - of bits TC2 and $IC2 in register
T2*-3. 3either of these flags is cleared by hardware when the service routine is
vectored
to. "n fact, the service routine may have to determine whether it was TC2 or $IC2 that
generated the interrupt, and that bit will have to be cleared in software.The Timer @ and
Timer , flags, TC@ and TC,, are set at &6P2 of the cycle in which the timers overflow.
The values are then polled by the circuitry in the neDt cycle. !owever, the Timer 2 flag,
TC2, is set at &2P2 and is polled in the same cycle in which the timer overflows.
Pin 4&C7 )lternate /se
P8.@-I# 4&%/C7 &erial data input
P8.,-TI# 4&%/C7 &erial data output
P8.2-"3T- @ 4T*-3.,7 $Dternal interrupt @
P8.8 - "3T- , 4T*-3.87 $Dternal interrupt ,
P8.9 - T@ 4TM-#7 $Dternal Timer @ input
P8.6 H T, 4TM-#7 $Dternal timer , input
P8.> - . $Dternal memory write pulse
P8.? - # $Dternal memory read pulse
2.2 Pow4" S.77l6
2.2., "3T-#/*T"-3
There are many types of power supply. Most are designed to convert high
voltage )* mains electricity to a suitable low voltage supply for electronics circuits and
other devices. ) power supply can by bro(en down into a series of bloc(s, each of which
performs a particular function. Cor eDample a 6< regulated supply can be shown as
below
F'& 2.1: Bloc2 D'!&"!( o3 ! R4&.l!#4% Pow4" S.77l6 S68#4(

&imilarly, ,2v regulated supply can also be produced by suitable selection
of the individual elements. $ach of the bloc(s is described in detail below and the
power supplies made from these bloc(s are described below with a circuit
diagram and a graph of their output:
2.2.2 T"!$83o"(4":
) transformer steps down high voltage )* mains to low voltage )*. !ere we are
using a center-tap transformer whose output will be sinusoidal with 8>volts pea( to pea(
value.
F'&: 2.2.1 O.#7.# W!:43o"( o3 #"!$83o"(4"
The low voltage )* output is suitable for lamps, heaters and special )* motors. "t
is not suitable for electronic circuits unless they include a rectifier and a smoothing
capacitor. The transformer output is given to the rectifier circuit.
2.2.3 R4c#'3'4":
) rectifier converts )* to #*, but the #* output is varying. There are several
types of rectifiersK here we use a bridge rectifier.
The %ridge rectifier is a circuit, which converts an ac voltage to dc voltage using
both half cycles of the input ac voltage. The %ridge rectifier circuit is shown in the figure.
The circuit has four diodes connected to form a bridge. The ac input voltage is applied to
the diagonally opposite ends of the bridge. The load resistance is connected between the
other two ends of the bridge.
Cor the positive half cycle of the input ac voltage, diodes #, and #8 conduct,
whereas diodes #2 and #9 remain in the -CC state. The conducting diodes will be in
series with the load resistance
0
and hence the load current flows through
0.

Cor the negative half cycle of the input ac voltage, diodes #2 and #9 conduct
whereas, #, and #8 remain -CC. The conducting diodes #2 and #9 will be in series
with the load resistance
0
and hence the current flows through
0
in the same direction
as in the previous half cycle. Thus a bi-directional wave is converted into unidirectional.
F'&."4 2.3 R4c#'3'4" c'"c.'#
3ow the output of the rectifier shown in Cigure 8.8 is shown below in Cigure 8.9
F'&."4 2.2.0 O.#7.# o3 #4 R4c#'3'4"
The varying #* output is suitable for lamps, heaters and standard motors. "t is not
suitable for lamps, heaters and standard motors. "t is not suitable for electronic circuits
unless they include a smoothing capacitor.
S(oo#'$& o" 3'l#4"'$&:
The smoothing bloc( smoothes the #* from varying greatly to a small ripple
and the ripple voltage is defined as the deviation of the load voltage from its #* value.
&moothing is also named as filtering.
Ciltering is fre'uently effected by shunting the load with a capacitor. The action
of this system depends on the fact that the capacitor stores energy during the conduction
period and delivers this energy to the loads during the no conducting period. "n this way,
the time during which the current passes through the load is prolonging Ted, and the
ripple is considerably decreased. The action of the capacitor is shown with the help of
waveform.
1) Figure 2.2.5 Smoothing action of capacitor
F'&."42. 2.; W!:43o"( o3 #4 "4c#'3'4% o.#7.# 8(oo#'$&
2.2.0 R4&.l!#o":
egulator eliminates ripple by setting #* output to a fiDed voltage. <oltage
regulator "*s are available with fiDed 4typically 6<, ,2< and ,6<7 or variable output
voltages. 3egative voltage regulators are also available
Many of the fiDed voltage regulator "*s has 8 leads 4input, output and high
impedance7. They include a hole for attaching a heat sin( if necessary. Lener diode is an
eDample of fiDed regulator which is shown here.

F'&."4
2.< R4&.l!#o"
T"!$83o"(4" = R4c#'3'4" = S(oo#'$& = R4&.l!#o":
2.3
HELICAL GEAR MOTOR:
) unit which creates mechanical energy from electrical energy and which
transmits mechanical energy through the gearboD at a reduced speed.
) gearhead and motor combination to reduce the speed of the motor to obtain the
desired speed or tor'ue.
+earmotors of all types and sizes including single E multiphase, universal, servo,
induction and synchronous types. #* gearmotors are configured in many types and
sizes, including brushless and servo. ) #* gearmotor consists of a rotor and a permanent
magnetic field stator and an integral gearboD or gearhead. The magnetic field is
maintained using either permanent magnets or electromagnetic windings. #* motors are
most commonly used in variable speed and tor'ue applications. ) #* servomotor has an
output shaft that can be positioned by sending a coded signal to the motor. )s the input
to the motor changes, the angular position of the output shaft changes as well.
&ervomotors are generally small and powerful for their size, and easy to control.
*ommon types of #* servomotors include brushless or gearmotor types. &tepper motors
are a class of motors that provide incremental motion, or steps, in response to pulses of
current that alternately change the polarity of the stator polesK step motors do not re'uire
feedbac( and are sometimes used in M-pen 0oop,M or no-feedbac( applications.
"mportant performance specifications to consider when searching for gearmotors include
shaft speed, continuous tor'ue, continuous current, and continuous output power. The
terminal voltage is the design #* motor voltage. The continuous tor'ue is the output
tor'ue capability of the motor under constant running conditions. *ontinuous current is
the maDimum rated current that can be supplied to the motor windings without
overheating. *ontinuous output power is the mechanical power provided by the motor
output.
"mportant #* motor specifications to consider include terminal voltage, motor
construction and commutation. The terminal voltage is the design #* motor voltage.
Motor construction choices include permanent magnet, shunt wound, series wound,
compound wound, disc armature, and coreless or slotless. *ommutation choices include
brush or brushless.
"mportant gearing specifications to consider for gearmotors and gearheads
include the gearing arrangement, gearboD ratio, and gearboD efficiency. +earing
arrangement choices for gearmotors or gearheads include spur, planetary, harmonic,
worm, and bevel. +earboD ratio is the ratio of input speed to output speed. ) ratio
greater than one, therefore, indicates speed reduction, while a ratio less than one indicates
speed increase. $fficiency is the percentage of power or tor'ue that is transferred through
the gearboD. 0osses occur due to factors such as friction and slippage inside the
gearboD.
Ceedbac( choices for gearmotors include integral encoder, integral resolver, and
integral tachometer. -ther important parameters to consider when specifying gearmotors
include shaft orientation or type and number of shafts, design units, motor shape,
diameter or width, housing length, 3$M) frame size, enclosure options and special or
eDtreme environment construction. *ommon features include multi-speed, reversible,
integral driver electronics, integral bra(e, integral clutch, and bra(e and clutch
combination
2.0 RELA,
2.9., -verview
) relay is an electrically operated switch. *urrent flowing through the coil of the
relay creates a magnetic field which attracts a lever and changes the switch contacts. The
coil current can be -3 or -CC so relays have two switch position and they are double
throw 4changeover7 switches.
elays allow one circuit to switch a second circuit which can be completely
separate from the first. Cor eDample a low voltage battery circuit can use a relay to switch
a 28@< )* mains circuit. There is no electrical connection inside the relay between the
two circuitsK the lin( is magnetic and mechanical.
The coil of a relay passes a relatively large current, typically 8@m) for a ,2<
relay, but it can be as much as ,@@m) for relays designed to operate from lower voltages.
Most "*s 4chips7 can not provide this current and a transistor is usually used to amplify
the small "* current to the larger value re'uired for the relay coil. The maDimum output
current for the popular 666 timer "* is 2@@m) so these devices can supply relay coils
directly without amplification.
elays are usually &P#T or #P#T but they can have many more sets of switch
contacts, for eDample relay with 9 sets of changeover contacts are readily available. Most
relays are designed for P*% mounting but you can solder wires directly to the pins
providing you ta(e care to avoid melting the plastic case of the relay.
The supplierNs catalogue should show you the relayNs connection. The coil will be
obvious and it may be connected either way round. elay coils produce brief high voltage
Nspi(esN when they are switched off and this can destroy transistors and "*s in the circuit.
To prevent damage you must connect a protection diode across the relay coil.
The relayJs switch connections are usually contains *-M, 3* and 3-.
COM O *ommon, always connect to thisK it is the moving part of the switch.
NC O 3ormally *losed, *-M is connected to this when the relay coil is off.
NO O 3ormally -pen, *-M is connected to this when the relay coil is on.
*onnect to *-M and 3- if you want the switched circuit to be on when the relay coil is
on.
*onnect to *-M and 3* if you want the switched circuit to be on when the relay coil is
off.
Most relays are &P#T or #P#T which are often described as Msingle pole changeoverM
4&P*-7
-r Mdouble pole changeoverM4#P*-7.
This is a &ingle Pole #ouble Throw relay. *urrent
will flow between the movable contact and one fiDed contact when the coil is energized
and between the movable contact and the alternate fiDed contact when the relay coil is
energized. The most commonly used relay in car audio, the %osch relay, is a &P#T relay..
This relay is a #ouble Pole #ouble Throw relay. "t
operates li(e the &P#T relay but has twice as many contacts. There are two completely
isolated sets of contacts.
2.9.2 )dvantages of elay:
elays can switch AC !$% DC, transistors can only switch #*.
elays can switch '& :ol#!&48, transistors cannot.
elays are a better choice for switching l!"&4 c.""4$#8 4P 6)7.
elays can switch (!$6 co$#!c#8 at once.
2.+ ULN2--3
/03 is mainly suited for interfacing between low-level circuits and
multiple peripheral power loads,.The series /032@II high voltage, high current
darlington arrays feature continuous load current ratings. The driving circuitry in- turn
decodes the coding and conveys the necessary data to the stepper motor, this module aids
in the movement of the arm through steppers
The driver ma(es use of the /032@@8 driver "*, which contains an array
of ? power #arlington arrays, each capable of driving 6@@m) of current. )t an
approDimate duty cycle, depending on ambient temperature and number of drivers
turned on, simultaneously typical power loads totaling over 28@w can be controlled.
The device has base resistors, allowing direct connection to any common
logic family. )ll the emitters are tied together and brought out to a separate
terminal. -utput protection diodes are includedK hence the device can drive
inductive loads with minimum eDtra components. Typical loads include relays,
solenoids, stepper motors, magnetic print hammers, multipleDed 0$#, incandescent
displays and heaters.
2.+.1 D!"l'$&#o$ P!'"
) #arlington pair is two transistors that act as a single transistor but with a much
higher current gain.
W!# '8 c.""4$# &!'$>
Transistors have a characteristic called current gain. This is referred to as its hC$. The
amount of current that can pass through the load when connected to a transistor that is
turned on e'uals the input current D the gain of the transistor 4hC$7 The current gain
varies for different transistor and can be loo(ed up in the data sheet for the device.
Typically it may be ,@@. This would mean that the current available to drive the load
would be ,@@ times larger than the input to the transistor.

2.+.2 W6 .84 ! D!"l'$&#o$ P!'">


"n some application the amount of input current available to switch on a transistor
is very low. This may mean that a single transistor may not be able to pass sufficient
current re'uired by the load.
)s stated earlier this e'uals the input current D the gain of the transistor 4hC$7. "f
it is not be possible to increase the input current then we need to increase the gain of the
transistor. This can be achieved by using a #arlington Pair.
) #arlington Pair acts as one transistor but with a current gain that e'uals:
Total current gain 4hC$ total7 O current gain of transistor , 4hC$ t,7 D current gain of
transistor 2 4hC$ t27
&o for eDample if you had two transistors with a current gain 4hC$7 O ,@@:
4hC$ total7 O ,@@ D ,@@
4hC$ total7 O ,@,@@@
1ou can see that this gives a vastly increased current gain when compared to a single
transistor. Therefore this will allow a very low input current to switch a much bigger load
current.
B!84 Ac#':!#'o$ ?ol#!&4
3ormally to turn on a transistor the base input voltage of the transistor will need to
be greater that @.?<. )s two transistors are used in a #arlington Pair this value is doubled.
Therefore the base voltage will need to be greater than @.?< D 2 O ,.9<.
"t is also worth noting that the voltage drop across collector and emitter pins of
the #arlington Pair when the turn on will be around @.5< Therefore if the supply voltage
is 6< 4as above7 the voltage across the load will be will be around 9.,< 46< H @.5<7
2.; PIR SENSOR
More advanced security systems include 7!88':4 '$3"!"4% 4P"7 motion
detectors. The Mmotion sensingM feature on most lights 4and security systems7 is a 7!88':4
system that detects '$3"!"4% 4$4"&6. These sensors are therefore (nown as PIR 4passive
infrared7 detectors or 76"o 4l4c#"'c sensors. These sensors MseeM the infrared energy
emitted by an intruderNs body heat. .hen an intruder wal(s into the field of view of the
detector, the sensor detects a sharp increase in infrared energy.
"n order to ma(e a sensor that can detect a human being, you need to
ma(e the sensor sensitive to the temperature of a human body. !umans, having a s(in
temperature of about 58 degrees C, radiate infra red energy with a wavelength between 5
and ,@ micrometers. Therefore, the sensors are typically sensitive in the range of 8 to ,2
micrometers. The devices themselves are simple electronic components not unli(e a
photo sensor. The infrared light bumps electrons off a substrate, and these electrons can
be detected and amplified into a signal.
1ou have probably noticed that your light is sensitive to motion, but not
to a person who is standing still. ThatNs because the electronics pac(age attached to the
sensor is loo(ing for a fairly "!7'% c!$&4 in the amount of infrared energy it is seeing.
.hen a person wal(s by, the amount of infrared energy in the field of view changes
rapidly and is easily detected. 1ou do not want the sensor detecting slower changes, li(e
the sidewal( cooling off at night.
1our motion sensing light has a wide field of view because of the l4$8
covering the sensor. "nfrared energy is a form of light, so you can focus and bend it with
plastic lenses. %ut itNs not li(e there is a 2-# array of sensors in there. There is a single 4or
sometimes two7 sensors inside loo(ing for changes in infrared energy.
"f you have a burglar alarm with motion sensors, you may have
noticed that the motion sensors cannot MseeM you when you are outside loo(ing through a
window. That is because glass is not very transparent to infrared energy. This, by the way,
is the basis of a greenhouse. 0ight passes through the glass into the greenhouse and heats
things up inside the greenhouse. The glass is then opa'ue to the infrared energy these
heated things are emitting, so the heat is trapped inside the greenhouse. "t ma(es sense
that a motion detector sensitive to infrared energy cannot see through glass windows.
The above figure 4top view7 illustrates how the P" sensors can be
used in the home security system. ) P" sensor can be placed at a corner of the desired
room so that it can sense the motion of the intruder.
CHAPTER 3
CIRCUIT DIAGRAM
8., $*$"<$
8.2 T)3&M"TT$

3.3 SAMPLE PROGRAMS
E@!(7l4 :
org @@h EE &tarting -f The Program Crom @@h memory
bac(: mov P,,Q66h EEMove 66h to Port,
acall delay EE *all #elay Cunction
mov P,,Q@))h EEMove 66h to Port,
lcall delay EE *all #elay Cunction
sjmp bac(
delay: mov r6,Q8@h
again: djnz r6,again EE +enerating delay
ret EE eturn -f 0oop
end EE $nd -f Program

CHAPTER 0
SOFTWARE DE?ELOPMENT AND CODING
0.1 I$#"o%.c#'o$:
"n this chapter the software used and the language in which the program code is
defined is mentioned and the program code dumping tools are eDplained. The chapter
also documents the development of the program for the application. This program has
been termed as =&ource codeA. %efore we loo( at the source code we define the two
header files that we have used in the code.
0.2 Tool8 U84%:
F'&."4 0.1 K4'l So3#w!"4/ '$#4"$!l 8#!&48
;eil development tools for the 8@6, Microcontroller )rchitecture support
every level of software developer from the professional applications
0.3 C+1 Co(7'l4" A A+1 M!c"o A884(1l4":
&ource files are created by the R<ision "#$ and are passed to the *6, *ompiler
or )6, Macro )ssembler. The compiler and assembler process source files and create
replaceable object files.
The ;eil *6, *ompiler is a full )3&" implementation of the * programming
language that supports all standard features of the * language. "n addition, numerous
features for direct support of the 8@6, architecture have been added.
0.0 SOURCE CODE
,. *lic( on the ;eil u<ision "con on #es(top
2. The following fig will appear
8. *lic( on the Project menu from the title bar
9. Then *lic( on 3ew Project
6. &ave the Project by typing suitable project name with no eDtension in u r own
folder sited in either *:B or #:B
>. Then *lic( on &ave button above.
?. &elect the component for u r project. i.e. )tmelSS
8. *lic( on the T &ymbol beside of )tmel
5. &elect )T85*6, as shown below
,@. Then *lic( on =-;A
,,. then *lic( either 1$& or 3-SSSmostly =3-A
,2. 3ow your project is ready to /&$
,8. 3ow double clic( on the Target,, you would get another option =&ource group
,A as shown in neDt page.
,9. *lic( on the file option from menu bar and select =newA
,6. The neDt screen will be as shown in neDt page, and just maDimize it by double
clic(ing on its blue boarder.
,>. 3ow start writing program in either in =*A or =)&MA
,?. Cor a program written in )ssembly, then save it with eDtension =. asmA and
for =*A based program save it with eDtension = .*A
,8. 3ow right clic( on &ource group , and clic( on =A%% 3'l48 #o G"o.7 So."c4A
,5. 3ow you will get another window, on which by default =*A files will appear.
2@. 3ow select as per your file eDtension given while saving the file
2,. *lic( only one time on option =ADDA
22. 3ow Press function (ey C? to compile. )ny error will appear if so happen.
28. if the file contains no error, then press *ontrolTC6 simultaneously.
29. Then *lic( =-;A
26. 3ow *lic( on the Peripherals from menu bar, and chec( your re'uired port as
shown in fig below
2>. #rag the port a side and clic( in the program file.
2?. 3ow (eep Pressing function (ey =C,,A slowly and observe.
28. 1ou are running your program successfully
R4B.'"4(4$#8:
Clash Magic wor(s on any versions of .indows, eDcept .indows 56. ,@Mb of
dis( space is re'uired. )s mentioned earlier, we are automating two different routines in
our project and hence we used the method of polling to continuously monitor those tas(s
and act accordingly

0.+ CODING
QincludeUreg6,.hP
sbit lmfOP,V9K
sbit lmbOP,V6K
sbit rmfOP,V>K
sbit rmbOP,V?K
sbit %/LL$OP8V9K
sbit P"OP8V?K
void delay4unsigned int val7
W
unsigned int D,yK
for4DO@KDUvalKDTT7
for4yO@KyU>@@KyTT7K
X
main47
W
P,O@D@fK
lmfO@K
lmbO@K
rmfO@K
rmbO@K
%/LL$O@K
while4,7
W
if4P"OO@7
W
%/LL$O,K
lmfO@K
lmbO@K
rmfO@K
rmbO@K
X
if4P"OO,7
W
%/LL$O@K
X
if4P,OO@D@?7 EECorward
W
lmfO,K
rmfO,K
delay42@@7K
lmfO@K
rmfO@K
X
if4P,OO@D@d7 EE%ac(ward
W
lmbO,K
rmbO,K
delay42@@7K
lmbO@K
rmbO@K
X
if4P,OO@D@e7 EE0eft
W
lmbO,K
rmfO,K
delay4,@@7K
lmbO@K
rmfO@K
X
if4P,OO@D@b7 EEight
W
lmfO,K
rmbO,K
delay4,@@7K
lmfO@K
rmbO@K
X
X
X
CONCLUSIONS
The project =!/M)3 #$T$*T"-3 -%-TA has been successfully
designed and tested. "ntegrating features of all the hardware components used have
developed it. Presence of all reasoned out and placed carefully thus contributing to the
best wor(ing. The controller ma(es use of a P" based input sensor to sense the human
being and give us an alert indication. )lso use of a remote which is used to control the
robot.
!ence this project provides best solution for the human to detect
terroristEthief inside the building.
%"%"0-+)P!1
1. ....M"T$0.#)T)%--;.*-M
2. ....)TM$0.#)T)%--;.*-M
3. ....C)3;0"3.*-M
0. ....;$"0.*-M
$C$$3*$&
,. MThe 8@6, Microcontroller )rchitecture, Programming Y )pplicationsM
%y ;enneth Z )yala.
2. MThe 8@6, Microcontroller Y $mbedded &ystemsM by Mohammed )li Mazidi and
Zanice +illispie Mazidi
8. MPower $lectronicsA by M # &ingh and ; % ;hanchandan
9. M0inear "ntegrated *ircuitsA by # oy *houdary Y &hail Zain
6. M$lectrical MachinesA by & ; %hattacharya
>. M$lectrical Machines ""A by % 0 Thereja
?. www.8@6,freeprojectsinfo.com

You might also like