0% found this document useful (0 votes)
149 views76 pages

Report About Car Documentation System

This document provides information about a project on a wireless car documentation checking system. It includes an acknowledgement section thanking those who provided guidance. It also includes sections on the contents, introduction, components used including RF modules, microcontrollers, sensors and other hardware. It provides block diagrams of the transmitter and receiver circuits and explains how the system will work to check a car's documentation wirelessly at toll plazas or checkpoints.

Uploaded by

Ankur Chopra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
149 views76 pages

Report About Car Documentation System

This document provides information about a project on a wireless car documentation checking system. It includes an acknowledgement section thanking those who provided guidance. It also includes sections on the contents, introduction, components used including RF modules, microcontrollers, sensors and other hardware. It provides block diagrams of the transmitter and receiver circuits and explains how the system will work to check a car's documentation wirelessly at toll plazas or checkpoints.

Uploaded by

Ankur Chopra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 76

Project

On
Wireless car documentation checking system
Submitted by:
Submitted to:
Acknowledgement
ACKNOWLEDGEMENT
Many individual have proudly influenced us during our undergraduate studies !"#ech"$
at SS%&#' (erabassi and it is pleasurevto acknowledge thiesr guidance and support"%n
SS%&#' % learned many things' like' the project training is mainly aimed at enabling the
student to apply their theoretical knowledge to practical as )#he theory is to know how
and practical to do how) and to appreciate the limitation of knowledge gained in the class
room to practical situation and to appreciate the importance of discipline' punctuality'
team work' sense of responsibility' money' value of time' dignity of labour"
% will like to e*press my gratitude towards Miss Vimmy Bhatia who took keen interest
in our project'Who helped me in every possible way and is source of inspiration for all
the group members"
% would also like to thank Mr. Sanjeev Chopraho!" E#e$troni$s % Comm&ni$ation'
who motivated me to complete our project with enthusiasm and hard work" +e helped
every time when % need
+A,P,&&# S%-.+
CONTENTS
S.N TO()C (AGEN
O.
*.
+
,
-
.
/
0
1
2
*3
**
*+
*,
*-
*.
*/
*0
*1
*2
+3
+*
++
)ntro!&$tion4
%n this project we will check the documentation of customer using ,/%(
module" %n this there is no need of paper ,0' driving license and other
documents" &verything will be in electronics records memories" When any car
will come in contact with government toll pla1a or checking system' then our
car ,/%( will transmit our car %( and documentation to that station" %f we will
have complete documents,0'(,%2%-. 3%0&-S&'%-S4,A-0& A-(
PO334#%O- 0+&5$ then barrier will open and will allow to car passing
otherwise barrier will not open and police will catch you" We will use .SM
modem for recharging the amount in our card" On r*er end it will check our all
documentations and will give response to it
We will use ,/ technology for this purpose"
,/ remote control which is built using +#67& and +#67( chips" #he remote
control is built using ,/ encoder chip +#67& that will generate different codes"
#hese codes will be transmitted by 898 M+1 ,/ transmitter" At the receiving
side these codes will be received by 898 M+1 ,/ receiver and decoded by ,/
decoder chip +#67("
%n this project we show that how we design a ,/ information transfer " %n
this project we use two ,/ module for wireless data transfer"%n this project
we use :;s<7 microcontroller as a main processor"" #his controller is
basically a 8= pin ic" %n this project we use two sensor also",OM of :;s<7
is :k and ram is 7<> byte" We are using 6>?7 lcd in this project" 3cd is
connected to port = which will display the no" On receiver side ,/ module
will give signal to microcontroller" Microcontroller is decision maker here
and informer to person on duty"%t will give data to 30( ' bu11er and 3&(@s"
we will also use four 3&(s for immediate action"
#hese sensor are connected to the port p9"8 and port p9"<

Pin no 8= is connected to the positive supply" %n this project we provide a <
volt dc power supply" #his power supply is truly regulated power supply"
Pin no 7= is connected to the negative supply" +ere we supply a negative
voltage on this pin" 0rystal is connected to the pin no 6: and 6; of the
microcontroller" 0rystal provide a clock signal to run the vehicle and
process all the internal reAuirement of the circuit" We use two sensor and
these two sensor are connected to the p9"8 and p9"< of the
microcontroller"/or the regulated power supply we use ic B:=< as a
regulator to provide a fi* < volt power supply"
%n this project we will make a transmitter for ,/ data transmission" Pin no
6of ,/ t* module is ground " second is for data ' third for 200 and fourth
for antenna #ransmitter
We transmitter whole project in few steps:
,/ transmitter
,/ module
&ncoder circuit
,/ receiver
,f receiver
(ecoder
Microcontroller circuit
2isual indicationC 30( and 3&(s
Audio alertC bu11er
C)5C6)T D)AG5AM 5ECE)VE5
C)5C6)T D)AG5AM T5ANSM)TTE5 )N CA5
!lock (iagram of receiver

MicroController
circuit
5 v dc
circuit
On/off
switch
Ht 12 d
Decoder chip
RF
Module
antenna
LCD display
1!2
"#$$%R
C&RC#&'
L%D visual
&(D&)C'&O( 12v DC
supply
Motor drive
circuit
DC *otor
B#o$7 !ia8ram transmitter
Holte+
Ht 12,%
encoder
RF
Module '-
antenna
.ensor
)nd MC#
/.M
MOD%M
D&0 switch
Component #ist
0omponent 3ist
S"-o" %tem Duantity ,ateE4nit
6 M04 :;S<7 6 :=
,/ module 6 >==
+#67& 6 9<
+#67(

(c .&A,&(
MO#O, 7 9<=
9 W+&&3S 7 <=
8 0AS#O, W+&&3 6 6==
< = 6=
> %0:6B > 6=
B = 6<
Push to On Sw 9 67
:
SO3(&,%-.
W%,& 6 7<
;
SO3(&,%-.
%,O- 6 67=
6= /34F 6 6=
66
0O--&0#%-.
W%,& 6 <=
67 #,<8: 7 7
69 #,<<: = 7
68 ,&S%S#&-0&S 7= ="<
6< 0APA0%#O,S
6===Gf 7 6=
6==Gf 6 <
8B=Gf 8 <
6> (%O(&S : 6
6B 3&( 6= 6
0rystal 67M+1 7 7<
6: %0 !AS& 9 <

6; %0 B:=< 2olt" ,eg 7 6<
7=
#,A-S/O,M&, ;
2 6 9=






76 P3H !OA,( 6 6==
77 #AP& ,O33 6 6=
79 0opper 0lad !oard 6 6==
78 /e0l9 6 6==
7<
ScrewsEbolt 7 7
!atteries 6 6<

WELCOME TO T9E WO5LD O: T9E M)C5OCONT5OLLE5S.
3ook around" -otice the smart IintelligentJ systemsK !e it the #"2' washing machines'
video games' telephones' automobiles' aero planes' power systems' or any application
having a 3&( or a 30( as a user interface' the control is likely to be in the hands of a
micro controllerL
Measure and control' that@s where the micro controller is at its best"
Micro controllers are here to stay" .oing by the current trend' it is obvious that micro
controllers will be playing bigger and bigger roles in the different activities of our lives"
#hese embedded chips are very small' but are designed to replace components much
bigger and bulky %n si1e" #hey process information very intelligently and efficiently"
#hey sense the environment around them" #he signals they gather are tuned into digital
data that streams through tributaries of circuit lines at the speed of light" %nside the
microprocessor collates and calculators" #he software has middling intelligence" #hen in
a split second' the processed streams are shoved out"
What is the primary difference between a microprocessor and a micro controllerK
4nlike the microprocessor' the micro controller can be considered to be a true
I0omputer on a chipJ"
%n addition to the various features like the A34' P0' SP and registers found on a
microprocessor' the micro controller also incorporates features like the ,OM' ,AM'
Ports' timers' clock circuits' counters' reset functions etc"
While the microprocessor is more a generalCpurpose device' used for read' write and
calculations on data' the micro controller' in addition to the above functions also controls
the environment"
89S52 MICRCONTROLLER.
12.52 M&CROCO('ROLL%R3 &s a 45 pin version of 51 fa*ily63 0ro7ra* written
for this controller is sa*e for the 1551 controller3 &n this controller there is total 82
input and output pins3 For controllin7 the process control3
OPTOCOUPLER ( PC 817) &n this pro9ect we use optocoupler to provide a
electrical isolation :etween process control circuit and *otor drive circuit3 &n this
pro9ect we use separate supply for processor and control circuit3 0c 11; is 4 pin
ic3 &n this coupler two pin is input and two pin is output3
13.* mi$ro $ontro##er
The 13.*
#he :=<6 developed and launched in the early :=Ms' is one of the most popular micro
controller in use today" %t has a reasonably large amount of built in ,OM and ,AM" %n
addition it has the ability to access e*ternal memory"
#he generic term M:*<6M is used to define the device" #he value of * defining the kind of
,OM' i"e" *N=' indicates none' *N9' indicates mask ,OM' *NB' indicates &P,OM and
*N; indicates &&P,OM or /lash"
A note on 5OM
#he early :=<6' namely the :=96 was designed without any ,OM" #his device could run
only with e*ternal memory connected to it" SubseAuent developments lead to the
development of the P,OM or the programmable ,OM" #his type had the disadvantage
of being highly unreliable"
#he ne*t in line' was the &P,OM or &rasable Programmable ,OM" #hese devices used
ultraviolet light erasable memory cells" #hus a program could be loaded' tested and
erased using ultra violet rays" A new program could then be loaded again"
An improved &P,OM was the &&P,OM or the electrically erasable P,OM" #his does
not reAuire ultra violet rays' and memory can be cleared using circuits within the chip
itself"
/inally there is the /3AS+' which is an improvement over the &&P,OM" While the
terms &&P,OM and flash are sometimes used interchangeably' the difference lies in the
fact that flash erases the complete memory at one stroke' and not act on the individual
cells" #his results in reducing the time for erasure"
Di;;erent mi$ro$ontro##ers in mar7et.
P%0 One of the famous microcontrollers used in the industries" %t is based
on ,%S0 Architecture which makes the microcontroller process faster than other
microcontroller"
%-#&3 #hese are the first to manufacture microcontrollers" #hese are
not as sophisticated other microcontrollers but still the easiest one to learn"
A#M&3 Atmel@s A2, microcontrollers are one of the most powerful in
the embedded industry" #his is the only microcontroller having 6kb of ram even
the entry stage" !ut it is unfortunate that in %ndia we are unable to find this kind of
microcontroller"
)nte# 13.*
%ntel :=<6 is 0%S0 architecture which is easy to program in assembly language and also
has a good support for +igh level languages"
#he memory of the microcontroller can be e*tended up to >8k"
#his microcontroller is one of the easiest microcontrollers to learn"
#he :=<6 microcontroller is in the field for more than 7= years" #here are lots of books
and study materials are readily available for :=<6"
Derivatives
#he best thing done by %ntel is to give the designs of the :=<6 microcontroller to
everyone" So it is not the fact that %ntel is the only manufacture for the :=<6 there more
than 7= manufactures' with each of minimum 7= models" 3iterally there are hundreds of
models of :=<6 microcontroller available in market to choose" Some of the major
manufactures of :=<6 are
Atmel
Philips
(hi#ips
#he PhilipsOs :=<6 derivatives has more number of features than in any
microcontroller" #he costs of the Philips microcontrollers are higher than the Atmel@s
which makes us to choose Atmel more often than Philips
Da##as
(allas has made many revolutions in the semiconductor market" (allas@s :=<6
derivative is the fastest one in the market" %t works 9 times as fast as a :=<6 can process"
!ut we are unable to get more in %ndia"
Atme#
#hese people were the one to master the flash devices" #hey are the cheapest
microcontroller available in the market" Atmel@s even introduced a 7=pin variant of :=<6
named 7=<6" #he Atmel@s :=<6 derivatives can be got in %ndia less than B= rupees" #here
are lots of cheap programmers available in %ndia for Atmel" So it is always good for
students to stick with :=<6 when you learn a new microcontroller"
<
Ar$hite$t&re
Architecture is must to learn because before learning new machine it is necessary to learn
the capabilities of the machine" #his is some thing like before learning about the car you
cannot become a good driver" #he architecture of the :=<6 is given below"
#he :=<6 doesn@t have any special feature than other microcontroller" #he only feature is
that it is easy to learn" Architecture makes us to know about the hardware features of the
microcontroller" #he features of the :=<6 are

85 !ytes of /lash Memory
67: * :C!it %nternal ,AM
/ully Static Operation: 6 M+1 to 78 M+1
97 Programmable %EO 3ines
#wo 6>C!it #imerE0ounters
Si* %nterrupt Sources < 2ectored$
Programmable Serial 0hannel
3ow Power %dle and Power (own Modes
#he :=<6 has a :C!it 0P4 that means it is able to process : bit of data at a time" :=<6
has 79< instructions" Some of the important registers and their functions are
3et@s now move on to a practical e*ample" We shall work on a simple practical
application and using the e*ample as a base' shall e*plore the various features of the
:=<6 microcontroller"
0onsider an electric circuit as follows'
#he positive side Pve$ of the battery is connected to one side of a switch" #he other side
of the switch is connected to a bulb or 3&( 3ight &mitting (iode$" #he bulb is then
connected to a resistor' and the other end of the resistor is connected to the negative Cve$
side of the battery"
When the switch is closed or Oswitched on@ the bulb glows" When the switch is open or
Oswitched off@ the bulb goes off
%f you are instructed to put the switch on and off every 9= seconds' how would you do itK
Obviously you would keep looking at your watch and every time the second hand crosses
9= seconds you would keep turning the switch on and off"
%magine if you had to do this action consistently for a full day" (o you think you would
be able to do itK -ow if you had to do this for a month' a yearKK
-o way' you would sayL
#he ne*t step would be' then to make it automatic" #his is where we use the
Microcontroller"
!ut if the action has to take place every 9= seconds' how will the microcontroller keep
track of timeK
E=e$&tion time
3ook at the following instruction'
$#r p*.3
#his is an assembly language instruction" %t means we are instructing the microcontroller
to put a value of O1ero@ in bit 1ero of port one" #his instruction is eAuivalent to telling the
microcontroller to switch on the bulb" #he instruction then to instruct the microcontroller
to switch off the bulb is'
Set p*.3
#his instructs the microcontroller to put a value of Oone@ in bit 1ero of port one"
(on@t worry about what bit 1ero and port one means" We shall learn it in more detail as
we proceed"
#here are a set of well defined instructions' which are used while communicating with
the microcontroller" &ach of these instructions reAuires a standard number of cycles to
e*ecute" #he cycle could be one or more in number"
+ow is this time then calculatedK
#he speed with which a microcontroller e*ecutes instructions is determined by what is
known as the crystal speed" A crystal is a component connected e*ternally to the
microcontroller" #he crystal has different values' and some of the used values are >M+Q'
6=M+Q' and 66"=<; M+1 etc"
#hus a 6=M+Q crystal would pulse at the rate of 6='==='=== times per second"
The time is $a#$&#ate! &sin8 the ;orm&#a
No o; $y$#es per se$on! > Crysta# ;re?&en$y in 9@ A *+.
:or a *3M9@ $rysta# the n&mBer o; $y$#es Co&#! Be"
*3"333"333A*+>1,,,,,.,,,,, $y$#es.
This means that in one se$on!" the mi$ro$ontro##er Co&#! e=e$&te 1,,,,,.,,,,,
$y$#es.
There;ore ;or one $y$#e" Chat Co&#! Be the timeD Try it o&t.
The instr&$tion $#r p*.3 Co&#! &se one $y$#e to e=e$&te. Simi#ar#y" the instr&$tion
setB p*.3 a#so &ses one $y$#e.
So 8o ahea! an! $a#$&#ate Chat Co&#! Be the n&mBer o; $y$#es re?&ire! to Be
e=e$&te! to 8et a time o; ,3 se$on!sE
Gettin8 Ba$7 to o&r B&#B e=amp#e" a## Ce Co&#! nee! to !o is to instr&$t the
mi$ro$ontro##er to $arry o&t some instr&$tions e?&iva#ent to a perio! o; ,3 se$on!s"
#i7e $o&ntin8 ;rom Fero &pCar!s" then sCit$h on the B&#B" $arry o&t instr&$tions
e?&iva#ent to ,3 se$on!s an! sCit$h o;; the B&#B.
G&st p&t the Cho#e thin8 in a #oop" an! yo& have a never en!in8 onHo;; se?&en$e.
3et us now have a look at the ;eat&res o; the 13.* $ore' keeping the above e*ample as a
reference'
*. 1HBit C(6. Consistin8 o; the IAJ an! IBJ re8isters'
Most of the transactions within the microcontroller are carried out through the OA@
register' also known as the Accumulator" %n addition all arithmetic functions are carried
out generally in the OA@ register" #here is another register known as the O!@ register' which
is used e*clusively for multiplication and division"
#hus an :Cbit notation would indicate that the ma*imum value that can be input into
these registers is O66666666@" Pu11ledK
#he value is not decimal 666' 66'666L %t represents a binary number' having an eAuivalent
value of O//@ in +e*adecimal and a value of 7<< in decimal"
We shall read in more detail on the different numbering systems namely the !inary and
+e*adecimal system in our ne*t module"
+. -K onH$hip 5OM
Once you have written out the instructions for the microcontroller' where do you put
these instructionsK
Obviously you would like these instructions to be safe' and not get deleted or changed
during e*ecution" +ence you would load it into the O,OM@
#he si1e of the program you write is bound to vary depending on the application' and the
number of lines" #he :=<6 microcontroller gives you space to load up to 85 of program
si1e into the internal ,OM"
85' that@s allK Well just wait" Hou would be surprised at the amount of stuff you can load
in this 85 of space"
Of course you could always e*tend the space by connecting to >85 of e*ternal ,OM if
reAuired"
,. *+1 Bytes onH$hip 5AM
#his is the space provided for e*ecuting the program in terms of moving data' storing
data etc"
-. ,+ )AO #ines. :o&rH 1 Bit ports" #aBe#e! (3" (*" (+" (,'
%n our bulb e*ample' we used the notation p6"=" #his means bit 1ero of port one" One bit
controls one bulb"
#hus port one would have : bits" #here are a total of four ports named p=' p6' p7' p9'
giving a total of 97 lines" #hese lines can be used both as input or output"
.. TCo */ Bit timers A $o&nters.
A microcontroller normally e*ecutes one instruction at a time" +owever certain
applications would reAuire that some event has to be tracked independent of the main
program"
#he manufacturers have provided a solution' by providing two timers" #hese timers
e*ecute in the background independent of the main program" Once the reAuired time has
been reached' remember the time calculations described aboveK$' they can trigger a
branch in the main program"
#hese timers can also be used as counters' so that they can count the number of events'
and on reaching the reAuired count' can cause a branch in the main program"
/. :&## D&p#e= seria# !ata re$eiver A transmitter.
#he :=<6 microcontroller is capable of communicating with e*ternal devices like the P0
etc" +ere data is sent in the form of bytes' at predefined speeds' also known as baud rates"
#he transmission is serial' in the sense' one Bit at a time
0. .H interr&pt so&r$es Cith tCo priority #eve#s TCo e=terna# an! three interna#'
(uring the discussion on the timers' we had indicated that the timers can trigger a branch
in the main program" +owever' what would we do in case we would like the
microcontroller to take the branch' and then return back to the main program' without
having to constantly check whether the reAuired time E count has been reachedK
#his is where the interrupts come into play" #hese can be set to either the timers' or to
some e*ternal events" Whenever the background program has reached the reAuired
criteria in terms of time or count or an e*ternal event' the branch is taken' and on
completion of the branch' the control returns to the main program"
Priority levels indicate which interrupt is more important' and needs to be e*ecuted first
in case two interrupts occur at the same time"
1. OnH$hip $#o$7 os$i##ator.
#his represents the oscillator circuits within the microcontroller" #hus the hardware is
reduced to just simply connecting an e*ternal crystal' to achieve the reAuired pulsing
rate"
()N :6NCT)ON O: )C 12C.*.
6 S&pp#y pin of this ic is pin no 8=" -ormally we apply a < volt regulated dc
power supply to this pin" /or this purpose either we use step down transformer
power supply or we use ; volt battery with B:=< regulator"
7 Gro&n! pin of this ic is pin no 7=" Pin no 7= is normally connected to the
ground pin normally negative point of the power supply"
9 KTAL is connected to the pin no 6: and pin no 6; of this ic" #he Auart1
crystal oscillator connected to F#A36 and F#A37 P%-" #hese pins also needs
two capacitors of 9= pf value" One side of each capacitor is connected to
crystal and other pis is connected to the ground point" -ormally we connect a
67 M+1 or 66"=<;7 M+1 crystal with this ic"" !ut we use crystal upto 7= M+1
to this pins
8 5ESET P%-"" Pin no ; is the reset pin of this ic"" %t is an active high pin" On
applying a high pulse to this pin' the micro controller will reset and terminate
all activities" #his is often referred to as a power on reset" #he high pulse must
be high for a minimum of 7 machine cycles before it is allowed to go low"
<" (O5T3 Port = occupies a total of : pins" (in no ,+ to pin no ,2" %t can be
used for input or output" We connect all the pins of the port = with the pullup
resistor 6= k ohm$ e*ternally" #his is due to fact that port = is an open drain
mode" %t is just like a open collector transistor"
>" (O5T*" A33 the ports in micrcontroller is : bit wide pin no * to pin no 1
because it is a : bit controller" All the main register and sfr all is mainly : bit
wide" Port 6 is also occupies a : pins" !ut there is no need of pull up resistor in
this port" 4pon reset port 6 act as a input port" 4pon reset all the ports act as a
input port
B" (O5T+. port 7 also have a : pins" %t can be used as a input or output" #here is
no need of any pull up resistor to this pin.
(O5T ," Port9 occupies a totoal : pins from pin no 6= to pin no 6B" %t can be
used as input or output" Port 9 does not reAuire any pull up resistor" #he same
as port 6 and port7" Port 9 is configured as an output port on reset" Port 9 has
the additional function of providing some important signals such as interrupts"
Port 9 also use for serial communication"
ALE A3& is an output pin and is active high" When connecting an :=96 to
e*ternal memory' port = provides both address and data" %n other words' the :=96
multiple*es address and data through port = to save pins" #he A3& pin is used for
demultiple*ing the address and data by connecting to the ic B8ls9B9 chip"
(SEN. PS&- stands for program store eneable" %n an :=96 based system in which
an e*ternal rom holds the program code' this pin is connected to the O& pin of the
rom"
EA. &A" %n :;c<6 :B<6 or any other family member of the ateml :;c<6 series all
come with onCchip rom to store programs' in such cases the &A pin is connected
to the 2cc" /or family member :=96 and :=97 is which there is no on chip rom'
code is stored in e*ternal memory and this is fetched by :=96" %n that case &A pin
must be connected to .-( pin to indicate that the code is stored e*ternally"
SPECIAL FUC!I" #E$IS!E# % SF#& ADD#ESSES'
ACC ACCUMULATOR 0E0H
B B REGISTER 0F0H
PSW PROGRAM STATUS WORD 0D0H
SP STACK POINTER 81H
DPTR DATA POINTER 2 BYTES
DPL LOW BYTE OF DPTR 82H
DPH HIGH BYTE OF DPTR 83H
P0 PORT0 80H
P1 PORT1 90H
P2 PORT2 0A0H
P3 PORT3 0B0H
TMOD TIMER/COUNTER MODE CONTROL 89H
TCON TIMER COUNTER CONTROL 88H
TH0 TIMER 0 HIGH BYTE 8CH
TLO TIMER 0 LOW BYTE 8AH
TH1 TIMER 1 HIGH BYTE 8DH
TL1 TIMER 1 LOW BYTE 8BH
SCON SERIAL CONTROL 98H
SBUF SERIAL DATA BUFFER 99H
PCON POWER CONTROL 87H
)NST56CT)ONS
SI$LE (I! IS!#UC!I"S'
SE!((I! SET THE BIT 1
CL# (I! CLEAR THE BIT 0
CPL (I! COMPLIMENT THE BIT 0 1, 10
)( (I!*!A#$E! JUMP TO TARGET IF BIT 1
)( (I!* !A#$E! JUMP TO TARGET IF BIT 0
)(C (I!*!A#$E! JUMP TO TARGET IF BIT 1 &THEN CLEAR THE
BIT

MOV )NST56CT)ONS
MOJ instruction simplv copv the data from one location to another location
MOV D"S
Copv the data from(S) source to D(destination)
+", #-*A , Copv contents of A into Register R0
+", #.*A , Copv contents of A into register R1
+", A*#/ , copv contents of Register R3 into Accnmulator.
DIRECT LOADING THROUGH MOJ
+", A*01/2 , Direct load the value of 23h in A
+", #-*0.1h , direct load the value of 12h in R0
+", #3*0-F42 , Load the F9 value in the Register R5
ADD IS!#UC!I"S.
ADD instructions adds the source bvte to the accumulator ( A) and place the result in the
Accumulator.
MOV A" L+.9
ADD A*0512 , BY this instructions we add the value 42h in Accumulator ( 42H
25H)
ADDA*#/ ,Bv this instructions we move the data from register r3 to
accumulator and then add the contents of the register into
accumulator .
SUBROUTINE CALL FUNCTION.
ACALL"TA5GET ADD5ESS
Bv this instructions we call subroutines with a target address within 2k bvtes from the
current program counter.
LCALL, TARGET ADDRESS.
ACALL is a limit for the 2 k bvte program counter, but for upto 64k bvte we use
LCALL instructions.. Note that LCALL is a 3 bvte instructions.
ACALL is a two bvte instructions.
A)+P !A#$E! ADD#ESS.
This is ;or aBso#&te j&mp
A)+P stand for absolute fump. It transfers program execution to the target address
unconditionallv. The target address for this instruction must be withib
2 k bvte of program memorv.
L)+P is also for absoltute fump. It tranfer program execution to the target addres
unconditionallv. This is a 3 bvte instructions LJMP fump to anv
address within 64 k bvte location.
IS!#UC!I"S #ELA!ED !" !2E CA##6
GC TA5GET
JUMP TO THE TARGET IF CY FLAG 1
GNC TA5GET
JUMP TO THE TARGET ADDRESS IF CY FLAG IS 0
)NST56CT)ONS 5ELASTED TO G6M( W)T9 ACC6M6LATO5
RQ #A,.&#
R4MP #O #A,.&# %/ A N =
R-Q #A,.&#
JUMP IF ACCUMULATOR IS NOT ZERO
This instructions fumps if registe A has a value other than :ero
%-S#,40#%O-S ,&3A#&( #O #+& ,O#A#&
,3 A
ROTATE LEFT THE ACCUMULATOR
BY this instructions we rotate the bits of A left. The bits rotated out of A are rotated back
into A at the opposite end
,, A
Bv this instruction we rotate the contents of the accumulator from right to left from LSB
to MSB
,,0 A
This is same as RR A but difference is that the bit rotated out of register first enter in to
carrv and then enter into MSB
,30 A
ROTATE A LEFT THROUGH CARRY
Same as above but but shift the data from MSB to carrv and carrv to LSB
,&#
This is return from subroutine. This instructions is used to return from a subroutine
previouslv entered bv instructions LCALL and ACALL.
,&#6
THIS is used at the end of an interrupt service routine. We use this instructions after
intruupt routine,
PUS2'
This copies the indicated bvte onto the stack and increments SP bv . This instructions
supports onlv direct addressing mode.
P"P'
POP FROM STACK.
This copies the bvte pointed to be SP to the location whose direct address is indicated,
and decrements SP bv 1. Notice that this instructions supports onlv direct addressing
mode.
DPTR INSTRUCTIONS.
+", DP!#*0.7 (I! ,ALUE
LOAD DATA POINTER
This instructions load the 16 bit dptr register with a 16 bit immediate value
MO2 0 A'SAP(P#,
This instructions moves a bvte of data located in program ROM into register A. This
allows us to put strings of data, such as look up table elements.
MO20 A'SAPP0
!his instr8ctions moves a byte of data located in the pro9ram area to A' the address of
the desired byte of data is formed by addin9 the pro9ram co8nter % PC& re9ister to the
ori9inal val8e of the acc8m8lator'
%-0 !H#&
This instructions add 1 to the register or memorv location specified bv the operand.
INC A
INC Rn
INC DIRECT
(&0 !H#&
This instructions subtracts 1 from the bvte operand. Note that CY is unchanged
DEC A
DEC Rn
DEC DIRECT
A5)T9MAT)C )NST56CT)ONS.
A-3 destCbyte' sourceCbyte
This perform a logical AND operation
This performs a logical AND on the operands, bit bv bit, storing the result in the
destination. Notice that both the source and destination values are bvte si:e onlv
`
(%2 A!
This instructions divides a bvte accumulator bv the bvte in register B. It is assumed that
both register A and B contain an unsigned bvte. After the division the quotient will be in
register A and the remainder in register B.
#MO( #%M&, MO(& $ ,&.%S#&,
!oth timer is the :;c<6 share the one register #MO(" 8 3S! bit for the timer = and 8
MS! for the timer 6"
%n each case lower 7 bits set the mode of the timer
4pper two bits set the operations"
.A#&: .ating control when set" #imerEcounter is enabled only while the
%-#F pin is high and the #,* control pin is set" When cleared' the timer is enabled
whenever the #,* control bit is set
0E# : #imer or counter selected cleared for timer operation input from internal
system clock$
M6 Mode bit 6
M= Mode bit =
M6 M= MO(& OP&,A#%-. MO(&
= = = 69 !%# #%M&,EMO(&
= 6 6 6> !%# #%M&, MO(&
6 = 7 : !%# A4#O ,&3OA(
6 6 9 SP3%# #%M&, MO(&
PSW P,O.,AM S#A#4S WO,($
0H PSW"B 0A,,H /3A.
A0 PSW"> A4F%3%A,H 0A,,H
/= PSW"< A2A%3A!3& /O, #+& 4S&, /,O .&-&,A3 P4,POS&
,S6 PSW"8 ,&.%S#&, !A-5 S&3&0#O, !%# 6
,S= PSW"9 ,&.%S#&, !A-5 S&3&0#O, !%# =
=2 PSW"7 O2&,/3OW /3A.
CC PSW"6 4S&, (&/%-A!3& !%#
P PSW"= PA,%#H /3A. S&#E03&A,&( !H +A,(WA,&
(CON 5EG)SATE5 NON B)T ADD5ESSABLE'
If the SMOD 0 ( DEFAULT ON RESET)
TH1 CRYSTAL FREQUENCY
256----
384 X BAUD RATE
If the SMOD IS 1
CRYSTAL FREQUENCY
#+6 N 7<>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
192 X BAUD RATE
There are two wavs to increase the baud rate of data transfer in the 8051
1. To use a higher frequencv crvstal
2. To change a bit in the PCON register
PCON register is an 8 bit register . Of the 8 bits, some are unused, and some are used for
the power control capabilitv of the 8051. the bit which is used for the serial
communication is D7, the SMOD bit. When the 8051 is powered up, D7 ( SMOD BIT)
OF PCON register is :ero. We can set it to high bv software and therebv double the
baud rate
!A4( ,A#& 0OMPA,%S%O- /O, SMO( N = A-( SMO( N6
T9* DEC)MAL' 9EK SMOD >3 SMOD >*
H, :D 2/33 *2+33
H/ :A -133 2/33
H*+ :- +-33 -133
H+- E1 *+33 +-33
:!AL ; ..'-341 +2<

%& %-#&,,4P# &-A!3& ,&.%S#O,$
&A %&"B (isable all interrupts if &A N =' no interrupts is acknowledged
%f &A is 6' each interrupt source is individually enabled or disbaled
!y sending or clearing its enable bit"
%&"> -O# implemented
&#7 %&"< enables or disables timer 7 overflag in :;c<7 only
&S %&"8 &nables or disables all serial interrupt
&#6 %&"9 &nables or (isables timer 6 overflow interrupt
&F6 %&"7 &nables or disables e*ternal interrupt
&#= %&"6 &nables or (isbales timer = interrupt"
&F= %&"= &nables or (isables e*ternal interrupt =
%-#&,,4P# P,%O,%#H ,&.%S#&,
%f the bit is =' the corresponding interrupt has a lower priority and if the bit is 6 the
corresponding interrupt has a higher priority
%P"B -O# %MP3&M&-#&(' ,&S&,2&( /O, /4#4,& 4S&"
%P"> -O# %MP3&M&-#&(' ,&S&,2&( /O, /4#4,& 4S&
P#7 %P"< (&/%-& #+& #%M&, 7 %-#&,,4P# P,%O,%#H 3&32&3
PS %P"8 (&/%-&S #+& S&,%A3 PO,# %-#&,,4P# P,%O,%#H 3&2&3
P#6 %P"9 (&/%-&S #+& #%M&, 6 %-#&,,4P# P,%O,%#H 3&2&3
PF6 %P"7 (&/%-&S &F#&,-A3 %-#&,,4P# 6 P,%O,%#H 3&2&3
P#= %P"6 (&/%-&S #+& #%M&, = %-#&,,4P# P,%O,%#H 3&2&3
PF= %P"= (&/%-&S #+& &F#&,-A3 %-#&,,4P# = P,%O,%#H 3&2&3
S0O-: S&,%A3 PO,# 0O-#,O3 ,&.%S#&, ' !%# A((,&SSA!3&
S0O-
SM= : S0O-"B Serial Port mode specifier
SM6 : S0O-"> Serial Port mode specifier
SM7 : S0O-"<
,&- : S0O-"8 SetEcleared by the software to &nableEdisable reception
#!: : S0O-"9 #he ;
th
bit that will be transmitted in modes 7 and 9' SetEcleared
!y software
,!: : S0O-"7 %n modes 7 T9' is the ;
th
data bit that was received" %n mode 6'
%f SM7 N =' ,!: is the stop bit that was received" %n mode =
,!: is not used
#6 : S0O-"6 #ransmit interrupt flag" Set by hardware at the end of the :
th
bit
#ime in mode =' or at the beginning of the stop bit in the other
Modes" Must be cleared by software
,6 S0O-"= ,eceive interrupt flag" Set by hardware at the end of the :
th
bit
#ime in mode =' or halfway through the stop bit time in the other
Modes" Must be cleared by the software"
TCON T)ME5 CO6NTE5 CONT5OL 5EG)STE5
#his is a bit addressable
#/6 #0O-"B #imer 6 overflow flag" Set by hardware when the #imerE0ounter 6
Overflows" 0leared by hardware as processor
#,6 #0O-"> #imer 6 run control bit" SetEcleared by software to turn #imer
0ounter 6 OnEoff
#/= #0O-"< #imer = overflow flag" Set by hardware when the timerEcounter =
Overflows" 0leared by hardware as processor
#,= #0O-"8 #imer = run control bit" SetEcleared by software to turn timer
0ounter = onEoff"
%&6 #0O-"9 &*ternal interrupt 6 edge flag
%#% #0O-"7 %nterrupt 6 type control bit
%&= #0O-"6 &*ternal interrupt = edge
%#= #0O-"= %nterrupt = type control bit"
C :=<6 %nstruction Set
Arithmeti$ Operations
Mnemonic (escription Si1e 0ycles
A(( A',n Add register to Accumulator A00$" 6 6
A(( A'direct Add direct byte to A00" 7 6
A(( A'S,i Add indirect ,AM to A00 " 6 6
A(( A'Udata Add immediate data to A00 " 7 6
A((0 A',n Add register to A00 with carry " 6 6
A((0 A'direct Add direct byte to A00 with carry" 7 6
A((0 A'S,i Add indirect ,AM to A00 with carry"6 6
A((0 A'Udata Add immediate data to A00 with carry" 7 6
S4!! A',n Subtract register from A00 with borrow" 6 6
S4!! A'direct Subtract direct byte from A00 with borrow 7 6
S4!! A'S,i Subtract indirect ,AM from A00 with borrow" 6 6
S4!! A'Udata Subtract immediate data from A00 with borrow" 7 6
%-0 A %ncrement A00" 6 6
%-0 ,n %ncrement register" 6 6
%-0 direct %ncrement direct byte" 7 6
%-0 S,i %ncrement indirect ,AM" 6 6
(&0 A (ecrement A00" 6 6
(&0 ,n (ecrement register" 6 6
(&0 direct (ecrement direct byte" 7 6
(&0 S,i (ecrement indirect ,AM" 6 6
%-0 (P#, %ncrement data pointer" 6 7
M43 A! Multiply A and ! ,esult: A VC low byte' ! VC high byte" 6 8
(%2 A! (ivide A by ! ,esult: A VC whole part' ! VC remainder" 6 8
(A A (ecimal adjust A00" 6 6
3ogical Operations
Mnemonic (escription Si1e 0ycles
A-3 A',n A-( ,egister to A00" 6 6
A-3 A'direct A-( direct byte to A00" 7 6
A-3 A'S,i A-( indirect ,AM to A00" 6 6
A-3 A'Udata A-( immediate data to A00" 7 6
A-3 direct'A A-( A00 to direct byte" 7 6
A-3 direct'Udata A-( immediate data to direct byte" 9 7
O,3 A',n O, ,egister to A00" 6 6
O,3 A'direct O, direct byte to A00" 7 6
O,3 A'S,i O, indirect ,AM to A00" 6 6
O,3 A'Udata O, immediate data to A00" 7 6
O,3 direct'A O, A00 to direct byte" 7 6
O,3 direct'Udata O, immediate data to direct byte" 9 7
F,3 A',n &*clusive O, ,egister to A00" 6 6
F,3 A'direct &*clusive O, direct byte to A00" 7 6
F,3 A'S,i &*clusive O, indirect ,AM to A00" 6 6
F,3 A'Udata &*clusive O, immediate data to A00" 7 6
F,3 direct'A &*clusive O, A00 to direct byte" 7 6
F,3 direct'Udata FO, immediate data to direct byte" 9 7
03, A 0lear A00 set all bits to 1ero$" 6 6
0P3 A 0ompliment A00" 6 6
,3 A ,otate A00 left" 6 6
,30 A ,otate A00 left through carry" 6 6
,, A ,otate A00 right" 6 6
,,0 A ,otate A00 right through carry" 6 6
SWAP A Swap nibbles within A00" 6 6
(ata #ransfer
Mnemonic (escription Si1e 0ycles
MO2 A',n Move register to A00" 6 6
MO2 A'direct Move direct byte to A00" 7
6
MO2 A'S,i Move indirect ,AM to A00" 6 6
MO2 A'Udata Move immediate data to A00" 7 6
MO2 ,n'A Move A00 to register" 6 6
MO2 ,n'direct Move direct byte to register" 7 7
MO2 ,n'Udata Move immediate data to register" 7 6
MO2 direct'A Move A00 to direct byte" 7 6
MO2 direct',n Move register to direct byte" 7 7
MO2 direct'direct Move direct byte to direct byte" 9 7
MO2 direct'S,i Move indirect ,AM to direct byte" 7 7
MO2 direct'Udata Move immediate data to direct byte" 9 7
MO2 S,i'A Move A00 to indirect ,AM" 6 6
MO2 S,i'direct Move direct byte to indirect ,AM" 7 7
MO2 S,i'Udata Move immediate data to indirect ,AM" 7 6
MO2 (P#,'Udata6> Move immediate 6> bit data to data pointer register" 9
7
MO20 A'SAP(P#, Move code byte relative to (P#, to A00 6> bit address$"
6 7
MO20 A'SAPP0 Move code byte relative to P0 to A00 6> bit address$"6 7
MO2F A'S,i Move e*ternal ,AM to A00 : bit address$" 6 7
MO2F A'S(P#, Move e*ternal ,AM to A00 6> bit address$" 6 7
MO2F S,i'A Move A00 to e*ternal ,AM : bit address$" 6 7
MO2F S(P#,'A Move A00 to e*ternal ,AM 6> bit address$" 6 7
P4S+ direct Push direct byte onto stack" 7 7
POP direct Pop direct byte from stack" 7 7
F0+ A',n &*change register with A00" 6 6
F0+ A'direct &*change direct byte with A00" 7 6
F0+ A'S,i &*change indirect ,AM with A00" 6 6
F0+( A'S,i &*change low order nibble of indirect
,AM with low order nibble of A00 6 6
!oolean 2ariable Manipulation
Mnemonic (escription Si1e 0ycles
03, 0 0lear carry flag" 6 6
03, bit 0lear direct bit" 7 6
S&#! 0 Set carry flag" 6 6
S&#! bitSet direct bit 7 6
0P3 0 0ompliment carry flag" 6 6
0P3 bit 0ompliment direct bit" 7 6
A-3 0'bit A-( direct bit to carry flag" 7 7
A-3 0'Ebit A-( compliment of direct bit to carry" 7 7
O,3 0'bit O, direct bit to carry flag" 7 7
O,3 0'Ebit O, compliment of direct bit to carry" 7 7
MO2 0'bit Move direct bit to carry flag" 7 6
MO2 bit'0 Move carry to direct bit" 7 7
R0 rel Rump if carry is set" 7 7
R-0 rel Rump if carry is not set" 7 7
R! bit'rel Rump if direct bit is set" 9 7
R-! bit'rel Rump if direct bit is not set" 9 7
R!0 bit'rel Rump if direct bit is set T clear bit" 9 7
(ro8ram Bran$hin8
Mnemonic (escription Si1e 0ycles
A0A33 addr66 Absolute subroutine call" 7 7
30A33 addr6> 3ong subroutine call" 9 7
,&# ,eturn from subroutine" 6 7
,&#% ,eturn from interrupt" 6 7
ARMP addr66 Absolute jump" 7 7
3RMP addr6> 3ong jump" 9 7
SRMP rel Short jump relative address$" 7 7
RMP SAP(P#, Rump indirect relative to the (P#," 6 7
RQ rel Rump relative if A00 is 1ero" 7 7
R-Q rel Rump relative if A00 is not 1ero" 7 7
0R-& A'direct'rel 0ompare direct byte to A00 and jump if not eAual" 9 7
0R-& A'Udata'rel 0ompare immediate byte to A00 and jump if not eAual"9 7
0R-& ,n'Udata'rel 0ompare immediate byte to register and jump if not eAual"9
7
0R-& S,i'Udata'rel 0ompare immediate byte to indirect and jump if not eAual"9
7
(R-Q ,n'rel (ecrement register and jump if not 1ero" 7 7
(R-Q direct'rel (ecrement direct byte and jump if not 1ero" 9 7
Other %nstructions
Mnemonic (escription Si1e 0ycles
-OP -o operation" 6 6
component Aty rate
%0:;0=<6' 6 >=
43-7==9' 6 9=
(iodes in8==6' 8 6
%0 B:=< 6 6<
Optocoupler P0:6B 8 67
#r<8: 8 9
#r <<: 8 9
Motors 67v 7 7<=
%0 base 7= pin 6 6=
0rystal 67 Mh1 6 7<
,esiatncec 6=k 8 "7<
8k 8 "7<
0ap 6=Gf 6 <
0onnecting wires 6 7=
%r sensors 9 67=
So;tCare4H
5eil compiler or 4MPS for programming
Window *p
e*ists which allows us to communicate with the vast 9 control lines as well as either 8 or
: %EO lines for the data bus" #he user may select whether the 30( is to operate with a 8C
bit data bus or an :Cbit data bus" %f a 8Cbit data bus is used' the 30( #he 88B:= standard
reAuires 9 control lines as well as either 8 or : %EO lines for the data bus" #he user may
select whether the 30( is to operate with a 8Cbit data bus or an :Cbit data bus" %f a 8Cbit
data bus is used' the 30( will reAuire a total of B data lines 9 control lines plus the 8
lines for the data bus$" %f an :Cbit data bus is used' the 30( will reAuire a total of 66 data
lines 9 control lines plus the : lines for the data bus$"
#he three control lines are referred to as EN' 5S' and 5W"
will reAuire a total of B data lines 9 control lines plus the 8 lines for the data bus$" %f an
:Cbit data bus is used' the 30( will reAuire a total of 66 data lines 9 control lines plus
the : lines for the data bus$"
#he three control lines are referred to as EN' 5S' and 5W"
#he EN line is called )&nable") #his control line is used to tell the 30( that you are
sending it data" #o send data to the 30(' your program should first set this line high 6$
and then set the other two control lines andEor put data on the data bus" When the other
lines are completely ready' bring EN low =$ again" #he 6C= transition tells the 88B:= to
take the data currently found on the other control lines and on the data bus and to treat it
as a command"
#he 5S line is the ),egister Select) line" When ,S is low =$' the data is to be treated as
a command or special instruction such as clear screen' position cursor' etc"$" When ,S is
high 6$' the data being sent is te*t data which should be displayed on the screen" /or
e*ample' to display the letter )#) on the screen you would set ,S high"
#he 5W line is the ),eadEWrite) control line" When ,W is low =$' the information on
the data bus is being written to the 30(" When ,W is high 6$' the program is effectively
Auerying or reading$ the 30(" Only one instruction ).et 30( status)$ is a read
command" All others are write commandsCCso ,W will almost always be low"
/inally' the data bus consists of 8 or : lines depending on the mode of operation selected
by the user$" %n the case of an :Cbit data bus' the lines are referred to as (!=' (!6' (!7'
(!9' (!8' (!<' (!>' and (!B"
/ortunately' a very popular standard e*ists which allows us to communicate with the vast
majority of data from an e*ternal source in this case' the :=<6$ and communicates
directly with the 30("
atic Showing Co!"n o# La$%& Light L%a'ing O(tica O$ciato&
0OMPO-&-# (&S0,%P#%O-
T5ANS:O5ME5
#ransformer works on the principle of mutual inductance" We know that if two coils or
windings are placed on the core of iron' and if we pass alternating current in one
winding' back emf or induced voltage is produced in the second winding" We know that
alternating current always changes with the time" So if we apply A0 voltage across one
winding' a voltage will be induced in the other winding" #ransformer works on this same
principle" %t is made of two windings wound around the same core of iron" #he winding
to which A0 voltage is applied is called primary winding" #he other winding is called as
secondary winding"

Vo#ta8e an! $&rrent re#ationship4
3et 2
6
volts be input alternating voltage applied to primary winding" %
6
Amp is input
alternating current through primary winding" 2
7
volt is output alternating voltage
produced in the secondary" %
7
amp be the current flowing through the secondary"
#hen relationship between input and output voltages is given by
2
6
E2
7
N -
6
E-
7
,elationship between input and output currents is
%
6
E%
7
N -
7
E-
6
Where -
6
is no" of turns of coil in primary and -
7
is number of turns in secondary $
We =now that Power ; C8rrent : ,olta9e' It is to be noted that inp8t power is e>8al to
o8tp8t power' Power is not chan9ed' If ,
1
is 9reater than ,
.
* then I
1
will be less than
I
.
' !his type of transformer is called as step 8p transformer' If ,
.
is
9reater than ,
1
* then I
.
will be less than I
1
' !his type of transformer is called as step
down transformer'
For step 8p transformer*
1
?
.
* i'e'* n8mber of t8rns of secondary windin9 is more
than those in primary'
For step down transformer*
.
?
1
* i'e'* n8mbers of t8rns of primary windin9 is more
than those in secondary'
,&S%S#O,S
#he flow of charge or current$ through any material' encounters an opposing force
similar in many respect to mechanical friction" #his opposing force is called resistance of
the material" %t is measured in ohms" %n some electric circuits resistance is deliberately
introduced in the form of the resistor"
,esistors are of following types:
6" Wire wound resistors"
7" 0arbon resistors"
9" Metal film resistors"
Wire Wo&n! 5esistors4
Wire wound resistors are made from a long usually -iC0hromium$ wound on a ceramic
core" 3onger the length of the wire' higher is the resistance" So depending on the value of
resistor reAuired in a circuit' the wire is cut and wound on a ceramic core" #his entire
assembly is coated with a ceramic metal" Such resistors are generally available in power
of 7 watts to several hundred watts and resistance values from 6ohm to 6==k ohms" #hus
wire wound resistors are used for high currents"
CarBon 5esistors4
0arbon resistors are divided into three types:
a" 0arbon composition resistors are made by mi*ing carbon grains with
binding material glue$ and moduled in the form of rods" Wire leads
are inserted at the two ends" After this an insulating material seals the
resistor" ,esistors are available in power ratings of 6E6=' 6E:' 6E8 '
6E7 ' 6"7 watts and values from 6 ohm to 7= ohms"
b" 0arbon film resistors are made by deposition carbon film on a ceramic
rod" #hey are cheaper than carbon composition resistors"
c" 0ement film resistors are made of thin carbon coating fired onto a
solid ceramic substrate" #he main purpose is to have more precise
resistance values and greater stability with heat" #hey are made in a
small sAuare with leads"

Meta# :i#m 5esistors4
#hey are also called thin film resistors" #hey are made of a thin metal coating deposited
on a cylindrical insulating support" #he high resistance values are not precise in valueW
however' such resistors are free of inductance effect that is common in wire wound
resistors at high freAuency"
VariaB#e 5esistors4
Potentiometer is a resistor where values can be set depending on the reAuirement"
Potentiometer is widely used in electronics systems" &*amples are volume control' tons
control' brightness and contrast control of radio or #"2" sets"
:&siB#e 5esistors4
#hese resistors are wire wound type and are used in #"2" circuits for protection" #hey
have resistance of less than 6< ohms" #heir function is similar to a fuse made to blow off
whenever current in the circuit e*ceeds the limit"
,esistance of a wire is directly proportional to its length and inversely proportional to its
thickness"
, 3
, 6EA
5ES)STO5 COLO5 CODE
E=amp#e4 *7 or *333 ohms

*
st
+
n!
,
r!
-
th



Ban!*
Ban! +
Ban! ,
Ban! -
COLO65 CODES
0O3O4, -4M!&
,
M43#%P3%&
,
0O3O4, #O3&,A-0
&
!lack
!rown
,ed
Orange
Hellow
.reen
!lue
2iolet
.rey
White
.old
Silver
=
6
7
9
8
<
>
B
:
;
6=
=
6=
6
6=
7

6=
9
6=
8
6=
<
6=
>
6=
B
6=
:
6=
;
6=
C6

6=
C7

.old
Silver
-o colour
<X
6=X
7=X
CA(AC)TO5S
A capacitor can store charge' and its capacity to store charge is called capacitance"
0apacitors consist of two conducting plates' separated by an insulating material known
as dielectric$" #he two plates are joined with two leads" #he dielectric could be air' mica'
paper' ceramic' polyester' polystyrene' etc" #his dielectric gives name to the capacitor"
3ike paper capacitor' mica capacitor etc"
Types o; $apa$itors4

Ca(a
)i*%+ ,a&ia-%
0apacitors can be broadly classified in two categories' i"e"' &lectrolytic capacitors and
-onC&lectrolytic capacitors as shown if the figure above"
E#e$tro#yti$ Capa$itor4
&lectrolytic capacitors have an electrolyte as a dielectric" When such an electrolyte is
charged' chemical changes takes place in the electrolyte" %f its one plate is charged
positively' same plate must be charged positively in future" We call such capacitors as
polari1ed" -ormally we see electrolytic capacitor as polari1ed capacitors and the leads
are marked with positive or negative on the can" -onCelectrolyte capacitors have
dielectric material such as paper' mica or ceramic" #herefore' depending upon the
dielectric' these capacitors are classified"
Mi$a Capa$itor4
%t is sandwich of several thin metal plates separated by thin sheets of mica" Alternate
plates are connected together and leads attached for outside connections" #he total
assembly is encased in a plastic capsule or !akelite case" Such capacitors have small
capacitance value <= to <==pf$ and high working voltage <==2 and above$" #he mica
capacitors have e*cellent characteristics under stress of temperature variation and high
voltage application" #hese capacitors are now replaced by ceramic capacitors"
Cerami$ Capa$itor:
Such capacitors have disc or hollow tabular shaped dielectric made of ceramic material
such as titanium dio*ide and barium titanate" #hin coating of silver compounds is
deposited on both sides of dielectric disc' which acts as capacitor plates" 3eads are
attached to each sides of the dielectric disc and whole unit is encapsulated in a moisture
E%ct& Non.
Gan8
$on!en
Trimme
r
Mi$a (aper Cerami$
proof coating" (isc type capacitors have very high value up to ="==6uf" #heir working
voltages range from 92 to >====2" #hese capacitors have very low leakage current"
!reakdown voltage is very high"
(aper Capa$itor4
%t consists of thin foils' which are separated by thin paper or wa*ed paper" #he sandwich
of foil and paper is then rolled into a cylindrical shape and enclosed in a paper tube or
encased in a plastic capsules" #he lead at each end of the capacitor is internally attached
to the metal foil" Paper capacitors have capacitance ranging from ="===6uf to 7"=uf and
working voltage rating as high as 7===2"
T9E D)ODE
(iodes are polari1ed' which means that they must be inserted into the P0! the correct
way round" #his is because an electric current will only flow through them in one
direction like air will only flow one way trough a tyre valve$" (iodes have two
connections' an anode and a cathode" #he cathode is always identified by a dot' ring or
some other mark"

/
#he P0! is often marked with a Psign for the cathode end" (iodes come in all shapes
and si1es" #hey are often marked with a type number" (etailed characteristics of a diode
can be found by looking up the type number in a data book" %f you know how to measure
resistance with a meter then test some diodes" A good one has low resistance in one
direction and high in other" #hey are speciali1ed types of diode available such as the
1ener and light emitting diode 3&($"
SMMBOLS O: D)::E5ENT D)ODES
ano!e $atho!e
simple diode 1ener diode


)C
%0 %ntegrated 0ircuit$ means that all the components of the circuit are fabricated on
same chip" (igital %0s are a collection of resistors' diodes' and transistors fabricated on a
single piece of semiconductor' usually silicon called a substrate' which is commonly
referred to as Owafer@" #he chip is enclosed in a protective plastic or ceramic package
from which pins e*tend out connecting the %0 to other device" Suffi* - or P stands for
dualCinCline plastic package (%P$$ while suffi* R or % stands for dualCinClime ceramic
package" Also the suffi* for W stands for flat ceramic package"
#he pins are numbered counter clockwise when viewed from the top of the package with
respect to an identity notch or dot at one end of the chip"#he manufacturer@s name can
usually be guessed from its logo that is printed on the %0" #he %0 type number also
indicates the manufacturer@s code" /or e"g" (M 8=: - S- B8=8 indicates -ational
Semiconductor and #e*as %nstruments"
Other e*amples are:
/air 0hild : 4A' 4A/
-ational Semiconductor : (M' 3M' 3+' 3/' and #A"
Motorola : M0' M/0"
Sprague : 45-' 43S' 43F"
Signetic : -Es' -&ES&' and S4"
!urrC!rown : !!"
#e*as %nstruments : S-"
#he middle portion i"e" the %0 type number tells about the %0 function and also the
family' which the particular %0 belongs to"%0@s that belongs to standard ##3 series have
an identification number that starts with B8W for e"g" B8=7' B83S=8' B8S=8 etc" %0@s that
belongs to standard 0MOS family their number starts with 8' like 8===' 8<6!' 8B78!'
68==" #he B80' B8+0' B8A0 T B8A0# series are newer 0MOS series"
2arious series with ##3 logic family are:C

Standard ##3 B8"
Schottky ##3 B8s"
3ow power Schottky B83S"
Advance Schottky B8AS"
Advanced 3ow Power Schottky B8A3s"
Also there are various series with 0MOS logic family as metal state 0MOS 8= or 68="
(oCer S&pp#y
/or ##3 circuits' the power supply pin is labeled 2
cc
and its nominal value"
/or 0MOS %0s' the power supply pin is labeled as 2
((
T its nominal value range from
#9 to 6:2"
6n$onne$te! )np&ts
An unconnected input is called Ifloating inputJ" #he floating ##3 input acts as logic 6"
+igh level is applied to it" #his characteristic is often used when
testing a ##3 circuit" A floating ##3 input will measure a (0 level between 6"82 to
6":2 when checked with 2OM as oscilloscope" %f a 0MOS input is left floating' it may
have disastrous results" #he %0 may become overheated and eventually destroy itself" /or
this reason' all inputs to 0MOS circuit must be connected to a 3OW or +%.+ level or to
the output of another %0"
RELAYError. Reference source not found
A relay is an electrically operated switch' !he relay contacts can be made to operate in
the pre@arran9ed fashion' For instance* normally open contacts close and normally
closed contacts open' In electroma9netic relays* the contacts however compleA they
mi9ht be* they have only two position i'e' "PE and CL"SED* whereas in case of
electroma9netic switches* the contacts can have m8ltiple positions'
S#,%P
O4# -E0
O4# -EO
SP,%-.
MA.-&#
79=2 P
NEED FOR THE USE OF RELAY
!he reason behind 8sin9 relay for switchin9 loads is to provide complete electrical
isolation' !he means that there is no electrical connection between the drivin9 circ8its
and the driven circ8its' !he drivin9 circ8it may be low volta9e operated low power
circ8its that control several =ilowatts of power' In o8r circ8it where a hi9h fan co8ld
be switched on or off dependin9 8pon the o8tp8t from the telephone'
Since the relay circ8it operated on a low volta9e* the controllin9 circ8it is >8ite safe'
In an electroma9netic relay the armat8re is p8lled by a ma9netic force only' !here is
no electrical connection between the coil of a relay and the switchin9 contacts of the
relay' If there are more than one contact they all are electrically isolated from each
other by mo8ntin9 them on ins8latin9 plates and washers' 2ence they can be wired to
control different circ8its independently'
Some of the pop8lar contacts forms are described belowB
.' Electroma9netic relay
1' Power #elay'
/' !ime Delay #elay'
5' Latchin9 #elay'
3' Crystal Can #elay'
7' Co@aAial #elay'
1. Electromagnetic relav.
An electroma9netic relay in its simplest form consists of a coil* a DC c8rrent passin9
thro89h which prod8ces a ma9netic field' !his ma9netic field attracts an armat8re*
which in t8rn operates the contacts' ormally open contacts close and normally closed
contacts open' Electroma9netic relays are made in a lar9e variety of contacts forms'
2. Power relavs.
Power relays are m8lti@pole heavy d8ty lapper type relays that are capable of switchin9
resistive loads of 8pto 13amp'' !hese relays are widely 8sed for a variety of ind8strial
application li=e control of fractional horse power motors* solenoids* heatin9 elements
and so on' !hese relays 8s8ally have b8tton li=e silver alloy contacts and the contact
weldin9 d8e to heavy in r8sh c8rrent is avoided by wipin9 action of the contacts to
>8ench the arc d8rin9 hi9h volta9e DC switchin9 th8s avoidin9 the contact weldin9'
3. Time Delav Relav.
A time delay relay is the one in which there is a desired amo8nt of time delay between
the application of the act8atin9 si9nal and operation of the load switchin9 devices'
4. Latching Relav.
In a Latchin9 #elay* the relay contacts remain in the last ener9iCed position even after
removal of si9nal in the relay control circ8it' !he contacts are held in the last relay@
ener9iCed position after removal of ener9isation either electrically or ma9netically'
!he contacts can be released to the normal position electrically or mechanically'
5. Crvstal Can Relav.
!hey are so called* as they resemble >8artC crystal in eAternal shapes' !hese are hi9h
performance hermetically sealed miniat8re or s8b@miniat8re relay widely 8sed in
aerospace and military application' !hese relays 8s8ally have 9old plated contacts and
th8s have eAtremely low contact resistance' D8e to low moment of inertia of the
armat8re and also d8e to statically and dynamically balanced nat8re of armat8re*
these relays switch >8ite reliably even 8nder eAtreme condition of shoc= and vibration'
6. Co-axial Relav.
A Co@aAial #elay has two basic parts* an act8ator which is nothin9 b8t some =ind of a
coil and a cavity* ho8sin9 the relay contacts' !he co@aAial relay are eAtensively 8sed
for radio fre>8ency switchin9 operations of e>8ipment
T9E G6NCT)ON T5ANS)STO5
Co##e$tor Co##e$tor
Base Base
Emitter Emitter

C C

B B

E E

N(N (N(
< < <
< <
< < <
< <
= = =
= =
= = =
= =
= = =
,, ,,
Runction transistors consists of two junctions made from -Ctype and PCtype
semiconductor materials and are called bipolar transistors two polarities$" #hey have
three connections emitter' base' and collector"
T5ANS)STO5 C655ENTS
0ollector
0urrent %c


%b
!ase current


&mitter %e
current

%e N %bP%c
#he forward biased baseEemitter junction causes electrons to be attracted from the emitter
area towards the base" Arriving in the base area' most of the negative electrons come
under the influence of the more positive collector and are attracted by it" #his is shown in
the left hand drawing' where the base current plus collector current eAuals the emitter
current" Alpha gain is collector current divided by emitter current' and is always less than
6" !eta gain is collector current divided by base current and can be fairly high number"
#herefore' causing a small base current to flow makes a much larger collector current to
flow" A small base current controls a large collector current" #here is ="> volts across the
baseYemitter junction' where it is forward biased ="9 volts for germanium$"
9oC to $ontro# sensors
What is a vo#ta8e !ivi!erD
Hou are going to find out but donZt be in too much of a hurry" Work through the 0hapter
and allow the e*planation to develop"
#he diagram below shows a #i8ht !epen!ent resistor' or LD5' together with its circuit
symbol:
#he lightCsensitive part of the 3(, is a wavy track of cadmium sulphide" 3ight energy
triggers the release of e*tra charge carriers in this material' so that its resistance falls as
the level of illumination increases"
A #i8ht sensor uses an 3(, as part of a voltage divider"
#he essential circuit of a voltage divider' also called a potentia# !ivi!er' is:
What happens if one of the resistors in the voltage divider is replaced by an 3(,K %n the
circuit below' R
top
is a 6= resistor' and an 3(, is used as R
bottom
:
Suppose the 3(, has a resistance of <== ' ="< ' in bright light' and 7== in the
shade these values are reasonable$"
When the 3(, is in the light' J
out
will be:
%n the shade' J
out
will be:
%n other words' this circuit gives a 3OW voltage when the 3(, is in the light' and a
+%.+ voltage when the 3(, is in the shade" #he voltage divider circuit gives an output
voltage which changes with illumination"
A sensor subsystem which functions like this could be thought of as a Z!ar7 sensorZ and
could be used to control lighting circuits which are switched on automatically in the
evening"
Perhaps this does not seem terribly e*citing' but almost every sensor circuit you can
think of uses a voltage divider" #hereZs just no other way to make sensor subsystems
work"
+ere is the voltage divider built with the 3(, in place of R
top
:
Temperat&re sensors
A temperatureCsensitive resistor is called a thermistor" #here are several different types:
#he resistance of most common types of thermistor decreases as the temperature rises"
#hey are called ne8ative temperat&re $oe;;i$ient' or nt$' thermistors" -ote the Ct[ ne*t
to the circuit symbol" A typical ntc thermistor is made using semiconductor metal o*ide
materials" Semiconductors have resistance properties midway between those of
conductors and insulators"$ As the temperature rises' more charge carriers become
available and the resistance falls"
Although less often used' it is possible to manufacture positive temperat&re $oe;;i$ient'
or pt$' thermistors" #hese are made of different materials and show an increase in
resistance with temperature"
+ow could you make a sensor circuit for use in a fire alarmK Hou want a circuit which
will deliver a +%.+ voltage when hot conditions are detected" Hou need a voltage divider
with the ntc thermistor in the R
top
position:
+ow could you make a sensor circuit to detect temperatures less than 8[0 to warn
motorists that there may be ice on the roadK Hou want a circuit which will give a +%.+
voltage in cold conditions" Hou need a voltage divider with the thermistor in place of
R
bottom
:
#his last application raises an important Auestion: +ow do you know what value of J
out

you are going to get at 8[0K
5ey point: #he biggest change in 2out from a voltage divider is obtained when ,top and
,bottom are eAual in value
So&n! sensors
DAnother name for a sound sensor is a mi$rophone" #he diagram shows a $ermet
mi$rophone:
0ermetZ stands for ZceramicZ and ZmetalZ" A mi*ture of these materials is used in making
the soundCsensitive part of the microphone" #o make them work properly' cermet
microphones need a voltage' usually around 6"< 2 across them" A suitable circuit for use
with a ; 2 supply is:
#he 8"B and the 6 resistors make a voltage divider which provides 6"> 2 across
the microphone" Sound waves generate small changes in voltage' usually in the range 6=C
7= m2" #o isolate these small signals from the steady 6"> 2' a $apa$itor is used"
Si8na#s ;rom sCit$hes
When a switch is used to provide an input to a circuit' pressing the switch usually
generates a voltage signal" %t is the voltage signal which triggers the circuit into action"
What do you need to get the switch to generate a voltage signalK " " " Hou need a voltage
divider" #he circuit can be built in either of two ways:
#he p&## !oCn resistor in the first circuit forces J
out
to become 3OW e*cept when the
push button switch is operated" #his circuit delivers a +%.+ voltage when the switch is
pressed" A resistor value of 6= is often used"
%n the second circuit' the p&## &p resistor forces J
out
to become +%.+ e*cept when the
switch is operated" Pressing the switch connects J
out
directly to = 2" %n other words' this
circuit delivers a 3OW voltage when the switch is pressed"
%n circuits which process logic signals' a 3OW voltage is called Zlogic =Z or just Z=Z' while
a +%.+ voltage is called Zlogic6Z or Z6Z" #hese voltage divider circuits are perfect for
providing input signals for logic systems"
What kinds of switches could you use" One variety of push button switch is called a
miniat&re ta$ti#e sCit$h" #hese are small switches which work well with prototype
board:
As you can see' the switch has four pins which are linked in pairs by internal metal strips"
Pressing the button bridges the contacts and closes the switch" #he e*tra pins are useful
in designing printed circuit boards for keyboard input and also stop the switch from
being moved about or bent once soldered into position"
#here are lots of other switches which you might want to use in a voltage divider
configuration" #hese include magneticallyCoperated ree! sCit$hes' ti#t sCit$hes and
press&re pa!s' all with burglar alarm applications"


Transistor Cir$&its
#his page e*plains the operation of transistors in circuits" Practical matters such as
testing' precautions when soldering and identifying leads are covered by the #ransistors
page"
.eneral: #ypes \ 0urrents \ /unctional model \ (arlington pair
Switching: %ntroduction \ 4se relayK \ %0 output \ for -P- \ and P-P \ Sensors \ %nverter
-e*t Page: Analogue and (igital Systems
Also See: #ransistors soldering' lead identification$
Types o; transistor
#here are two types of standard transistors' N(N and (N('
with different circuit symbols" #he letters refer to the layers
of semiconductor material used to make the transistor" Most
transistors used today are -P- because this is the easiest
type to make from silicon" #his page is mostly about -P-
transistors and if you are new to electronics it is best to start
by learning how to use these first"
#he leads are labelled Base !$' $o##e$tor 0$ and emitter &$"
#hese terms refer to the internal operation of a transistor but they are not much help in
understanding how a transistor is used' so just treat them as labelsL
A (arlington pair is two transistors connected together to give a very high current gain"
%n addition to standard bipolar junction$ transistors' there are ;ie#!He;;e$t transistors
which are usually referred to as :ETs" #hey have different circuit symbols and properties
and they are not yet$ covered by this page"
#ransistor circuit symbols
Transistor $&rrents
#he diagram shows the two current paths through a transistor" Hou can build this circuit
with two standard <mm red 3&(s and any general purpose low power -P- transistor
!06=:' !06:7 or !0<8: for e*ample$"
#he small Base $&rrent controls the larger $o##e$tor $&rrent"
When the sCit$h is $#ose! a small current flows into the base !$ of the transistor" %t is
just enough to make 3&( ! glow dimly" #he transistor amplifies this small current to
allow a larger current to flow through from its collector 0$ to its emitter &$" #his
collector current is large enough to make 3&( 0 light brightly"
When the sCit$h is open no base current flows' so the transistor switches off the
collector current" !oth 3&(s are off"
A transistor amplifies current and can be used as a switch"
#his arrangement where the emitter &$ is in the controlling circuit base current$ and in
the controlled circuit collector current$ is called $ommon emitter mo!e" %t is the most
widely used arrangement for transistors so it is the one to learn first"
:&n$tiona# mo!e# o; an N(N transistor
#he operation of a transistor is difficult to e*plain and understand in terms of its internal
structure" %t is more helpful to use this functional model:
#he baseCemitter junction behaves like a diode"
A base current %
!
flows only when the voltage 2
!&
across the baseCemitter junction
is ="B2 or more"
#he small base current %
!
controls the large collector current %c"
%c N h
/&
] %
!
unless the transistor is full on and saturated$
h
/&
is the current gain strictly the (0 current gain$' a typical value for h
/&
is 6==
it has no units because it is a ratio$
#he collectorCemitter resistance ,
0&
is controlled by the base current %
!
:
o %
!
N = ,
0&
N infinity transistor off
o %
!
small ,
0&
reduced transistor partly on
o %
!
increased ,
0&
N = transistor full on ZsaturatedZ$
Additional notes:
A resistor is often needed in series with the base connection to limit the base
current %
!
and prevent the transistor being damaged"
#ransistors have a ma*imum collector current %c rating"
#he $&rrent 8ain h
:E
$an vary Ci!e#y' even for transistors of the same typeL
A transistor that is ;&## on with ,
0&
N =$ is said to be Zsat&rate!Z"
When a transistor is saturated the collectorCemitter voltage 2
0&
is reduced to
almost =2"
When a transistor is saturated the collector current %c is determined by the supply
voltage and the e*ternal resistance in the collector
circuit' not by the transistorZs current gain" As a result
the ratio %cE%
!
for a saturated transistor is less than the
current gain h
/&
"
#he emitter current %
&
N %c P %
!
' but %c is much larger
than %
!
' so roughly %
&
N %c"
#here is a table showing technical data for some popular
transistors on the transistors page"
Dar#in8ton pair
#his is two transistors connected together so that the current amplified by the first is
amplified further by the second transistor" #he overall current gain is eAual to the two
individual gains multiplied together:
Dar#in8ton pair $&rrent 8ain" h
:E
> h
:E*
N h
:E+

h
/&6
and h
/&7
are the gains of the individual transistors$
#ouch switch circuit
#his gives the (arlington pair a very high current gain' such as 6====' so that only a tiny
base current is reAuired to make the pair switch on"
A Dar#in8ton pair Behaves #i7e a sin8#e transistor Cith a very hi8h $&rrent 8ain. %t
has three leads B' C and E$ which are eAuivalent to the leads of a standard individual
transistor" #o turn on there must be ="B2 across both the baseCemitter junctions which are
connected in series inside the (arlington pair' therefore it reAuires 6"82 to turn on"
(arlington pairs are available as complete packages but you can make up your own from
two transistorsW #,6 can be a
low power type' but normally #,7 will need to be high power" #he ma*imum collector
current %cma*$ for the pair is the same as %cma*$ for #,7"
A (arlington pair is sufficiently sensitive to respond to the small current passed by your
skin and it can be used to make a to&$hHsCit$h as shown in the diagram" /or this circuit
which just lights an 3&( the two transistors can be any general purpose low power
transistors" #he 6==k resistor protects the transistors if the contacts are linked with a
piece of wire"
6sin8 a transistor as a sCit$h
When a transistor is used as a switch it must be either O:: or ;&##y ON" %n the fully O-
state the voltage 2
0&
across the transistor is almost 1ero and the transistor is said to be
sat&rate! because it cannot pass any more collector current %c" #he output device
switched by the transistor is usually called the ZloadZ"
#he power developed in a switching transistor is very small:
%n the O:: state: power N %c ] 2
0&
' but %c N =' so the power is 1ero"
%n the ;&## ON state: power N %c ] 2
0&
' but 2
0&
N = almost$' so the power is very
small"
#his means that the transistor should not become hot in use and you do not need to
consider its ma*imum power rating" #he important ratings in switching circuits are the
ma=im&m $o##e$tor $&rrent )$ma=' and the minim&m $&rrent 8ain h
:E
min'" #he
transistorZs voltage ratings may be ignored unless you are using a supply voltage of more
than about 6<2" #here is a table showing technical data for some popular transistors on
the transistors page"
/or information about the operation of a transistor please see the functional model above"
(rote$tion !io!e
%f the load is a motor' relay or so#enoi! or any other device with a coil$ a diode must be
connected across the load to protect the transistor from the brief high voltage produced
when the load is switched off" #he diagram shows how a protection diode is connected
ZbackwardsZ across the load' in this case a relay coil"
0urrent flowing through a coil creates a magnetic field which collapses suddenly when
the current is switched off" #he sudden collapse of the magnetic field induces a brief high
voltage across the coil which is very likely to damage transistors and %0s" #he protection
diode allows the induced voltage to drive a brief
current through the coil and diode$ so the magnetic
field dies away Auickly rather than instantly" #his
prevents the induced voltage becoming high enough
to cause damage to transistors and %0s"
When to &se a re#ay
#ransistors cannot switch A0 or high voltages such
as mains electricity$ and they are not usually a good
choice for switching large currents ^ <A$" %n these
cases a relay will be needed' but note that a low
power transistor may still be needed to switch the
current for the relayZs coilL
A!vanta8es o; re#ays4
,elays can switch AC an! DC' transistors can only switch (0"
,elays can switch hi8h vo#ta8es' transistors cannot"
,elays are a better choice for switching #ar8e $&rrents ^ <A$"
,elays can switch many $onta$ts at once"
Disa!vanta8es o; re#ays4
,elays are B&#7ier than transistors for switching small currents"
,elays $annot sCit$h rapi!#y' transistors can switch many times per second"
,elays &se more poCer due to the current flowing through their coil"
,elays re?&ire more $&rrent than many )Cs $an provi!e' so a low power
transistor may be needed to switch the current for the relayZs coil"
Conne$tin8 a transistor to the o&tp&t ;rom an )C
,elays
Photographs _ ,apid &lectronics
Most %0s cannot supply large output currents so it may be necessary to use a transistor to
switch the larger current reAuired for output devices such as lamps' motors and relays"
#he <<< timer %0 is unusual because it can supply a relatively large current of up to
7==mA which is sufficient for some output devices such as low current lamps' bu11ers
and many relay coils without needing to use a transistor"
A transistor can also be used to enable an %0 connected to a low voltage supply such as
<2$ to switch the current for an output device with a separate higher voltage supply such
as 672$" #he two power supplies must be linked' normally this is done by linking their
=2 connections" %n this case you should use an -P- transistor"
A resistor ,
!
is reAuired to limit the current flowing into the base of the transistor and
prevent it being damaged" +owever' ,
!
must be sufficiently low to ensure that the
transistor is thoroughly saturated to prevent it overheating' this is particularly important
if the transistor is switching a large current ^ 6==mA$" A safe rule is to make the base
current %
!
about five times larger than the value
which should just saturate the transistor"
Choosin8 a s&itaB#e N(N transistor
#he circuit diagram shows how to connect an N(N
transistor' this will switch on the load when the %0
output is hi8h" %f you need the opposite action' with
the load switched on when the %0 output is #oC =2$
please see the circuit for a P-P transistor below"
#he procedure below e*plains how to choose a
suitable switching transistor"
6" #he transistorZs ma*imum collector current
%cma*$ must be greater than the load current
%c"
load current %c N
supply voltage 2s
load resistance ,
3
7" #he transistorZs minimum current gain h
/&
min$ must be at least ;ive times the load
current %c divided by the ma*imum output current from the %0"
h
/&
min$ ^ < ]
load current %c
ma*" %0 current
9" 0hoose a transistor which meets these reAuirements and make a note of its
properties: %cma*$ and h
/&
min$"
#here is a table showing technical data for some popular transistors on the
transistors page"
8" 0alculate an appro*imate value for the base resistor:
,
!
N
2c ] h
/& where 2c N %0 supply voltage
in a simple circuit with one supply this is 2s$ < ] %c
-P- transistor switch
load is on when %0 output is high$
6sin8 &nits in $a#$&#ations
,emember to use 2' A and or
2' mA and k " /or more details
please see the OhmZs 3aw page"
<" /or a simple circuit where the %0 and the load share the same power supply
2c N 2s$ you may prefer to use: ,
!
N ="7 ] ,
3
] h
/&

>" #hen choose the nearest standard value for the base resistor"
B" /inally' remember that if the load is a motor or relay coil a protection diode is
reAuired"
E=amp#e
#he output from a 8=== series 0MOS %0 is reAuired to operate a relay with a 6== coil"
#he supply voltage is >2 for both the %0 and load" #he %0 can supply a ma*imum current
of <mA"
6" 3oad current N 2sE,
3
N >E6== N ="=>A N >=mA' so transistor must have %cma*$ ^
>=mA"
7" #he ma*imum current from the %0 is <mA' so transistor must have h
/&
min$ ^ >=
< ] >=mAE<mA$"
9" 0hoose general purpose low power transistor !06:7 with %cma*$ N 6==mA and
h
/&
min$ N 6=="
8" ,
!
N ="7 ] ,
3
] h
/&
N ="7 ] 6== ] 6== N 7=== "
so choose ,
!
N 6k: or 7k7"
<" #he relay coil reAuires a protection diode"
Choosin8 a s&itaB#e (N( transistor
#he circuit diagram shows how to connect a (N(
transistor' this will switch on the load when the
%0 output is #oC =2$" %f you need the opposite
action' with the load switched on when the %0
output is hi8h please see the circuit for an
-P- transistor above"
#he procedure for choosing a suitable P-P
transistor is e*actly the same as that for an -P-
transistor described above"
6sin8 a transistor sCit$h Cith sensors
#he top circuit diagram shows an 3(, light
sensor$ connected so that the 3&( lights when the
3(, is in darkness" #he variable resistor adjusts
P-P transistor switch
load is on when %0 output is low$
3&( lights when the 3(, is !ar7
3&( lights when the 3(, is Bri8ht

the brightness at which the transistor switches on and off" Any general purpose low
power transistor can be used in this circuit"
#he 6=k fi*ed resistor protects the transistor from e*cessive base current which will
destroy it$ when the variable resistor is reduced to 1ero" #o make this circuit switch at a
suitable brightness you may need to e*periment with different values for the fi*ed
resistor' but it must not be less than 6k "
%f the transistor is switching a load with a coil' such as a motor or relay' remember to add
a protection diode across the load"
The sCit$hin8 a$tion $an Be inverte!' so the 3&( lights when the 3(, is brightly lit'
by swapping the 3(, and variable resistor" %n this case the fi*ed resistor can be omitted
because the 3(, resistance cannot be reduced to 1ero"
-ote that the switching action of this circuit is not particularly good because there will be
an intermediate brightness when the transistor will be part#y on not saturated$" %n this
state the transistor is in danger of overheating unless it is switching a small current" #here
is no problem with the small 3&( current' but the larger current for a lamp' motor or
relay is likely to cause overheating"
Other sensors' such as a thermistor' can be used with this circuit' but they may reAuire a
different variable resistor" Hou can calculate an appro*imate value for the variable
resistor ,v$ by using a multimeter to find the minimum and ma*imum values of the
sensorZs resistance ,min and ,ma*$:
VariaB#e resistor" 5v > s?&are root o; 5min N 5ma='
/or e*ample an 3(,: ,min N 6== ' ,ma* N 6M ' so ,v N sAuare root of 6== ] 6M$
N 6=k "
Hou can make a much better switching circuit with sensors connected to a suitable %0
chip$" #he switching action will be much sharper with no partly on state"
A transistor inverter NOT 8ate'
%nverters -O# gates$ are available on logic %0s but if you only reAuire one inverter it is
usually better to use this circuit" #he output signal voltage$ is the inverse of the input
signal:
When the input is high P2s$ the output is low =2$"
When the input is low =2$ the output is high P2s$"
Any general purpose low power -P- transistor can be used" /or general use ,
!
N 6=k
and ,
0
N 6k ' then the inverter output can be connected to a device with an input
impedance resistance$ of at least 6=k such as a logic %0 or a <<< timer trigger and
reset inputs$"
%f you are connecting the inverter to a 0MOS logic %0 input very high impedance$ you
can increase ,
!
to 6==k and ,
0
to 6=k ' this will reduce the current used by the
inverter"
B)B)L)OG5A(9M

6" +A-( !OO5 O/ &3&0#,O-%0S A"5" MA%-%"
7"+A-( !OO5 O/ &3&0#,O-%0S .4P#A T 54MA,"
9"3&# 4S 0 HAS+WA-# 5A-%#5A,"
8"S+HAM S&,%&S #A#A M0 .,%33"
<"(%.%#A3 SHS#&MS P,%-0%P3&S A-( APP3%0A#%O- ,O-A3( 3#O00%"
Si*th addition$
>"&3&0#,O-%0S /O, HO4 MA,0+ 6;;:$"
B"(%.%#A3 (&S%.- MO,%S MA-O"
Second addition$
:",&3AHS A-( %#S APP3%0A#%O- S+A,MA' M0"
!pbCpublishers$
;"MO(&,- A33 A!O4# MO#+&,!OA,( 3O#+%A' M"
!pbCpublishers$
6="POW&, S4PP3H /O, A33 O00AS%O- S+A,MA' M0"
!pbCpublishers$
66"0MOS (A#A !OO5 B8S&,%&S$ &0A"
!pbCpublishers$
67"P,A0#%0A3 2A34& A-( #,A-S%S#O, (A#A POP&"
!pbCpublishers$
69"P,A0#%0A3 #,A-S/O,M&, (&S%.- +A-( !OO5 3A!O-" &"
!pbCpublishers$
68 MO(&,- %0 MA-A+A, 3O#%A"
(A#A A-( S4!S#%#4#%O-A3 MA-4A3$

CODE4
Oteste! o7 !ate! *
O (+.34 LED BL)NK)NG O (+.*4 5ELAM
OPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
5S B)T (+..
5W B)T (+.-
E B)T (+.,
:L B)T (3.0
C(* B)T (*.3
C(+ B)T (*.*
LED B)T (+.3
B&FF B)T (,.0
LCD EQ6 (3

O5G 339
AGM( STA5T
O5G ,39
STA5T4
MOV LCD"L339
MOV A"L,19 O+P*/ MAT5)K
ACALL COMMAND
MOV A"L3+ O5ET65N 9OME
ACALL COMMAND
MOV A"L3* OCLEA5 D)S(LAM SC5EEN
ACALL COMMAND
MOV A"L3C9 OD)S(LAM ON C65SO5 O::
ACALL COMMAND
MOV A"L139 OMOVE C65SO5 TO :)5ST L)NE SECOND
COLO6MN
ACALL COMMAND
MOV D(T5"LTABLE* OD)S(LAM E5(
ACALL D)S(LAM
SETB LED

ACALL DELAM
MOV 5*"L33
MOV 53"L33
MOV 5+"L33
MOV 5,"L33
MOV 5-"L33
MOV 5."L33
MOV A"L139 OMOVE C65SO5 TO :)5ST L)NE SECOND
COLO6MN
ACALL COMMAND
MOV D(T5"LTABLE* OD)S(LAM E5(
ACALL D)S(LAM
MOV A"L3C39 OMOVE C65SO5 TO :)5ST L)NE SECOND
COLO6MN
ACALL COMMAND
MOV D(T5"LTABLE0 OD)S(LAM E5(
ACALL D)S(LAM
MA)N4
mov a"(*
$jne a"L3;;h"jn*
a$a## 5EAD)NG.
jn*4
mov a"p*
$jne a"L3;3h"7#
a$a## motoa$t
a$a## 5EAD)NG.
7#4
jnB p*.3"5EAD)NG*
jnB p*.*"5EAD)NG+
jnB p*.+"5EAD)NG,
jnB p*.,"5EAD)NG-
SGM( MA)N
5EAD)NG.4
ACALL LCDCL5
MOV A"L3C39
ACALL COMMAND
MOV D(T5"LTABLE/
ACALL D)S(LAM
AGM( MA)N
5EAD)NG*4
ACALL LCDCL5
MOV A"L139
ACALL COMMAND
MOV D(T5"LTABLE1
ACALL D)S(LAM
MOV A"L3C39
ACALL COMMAND
MOV D(T5"LTABLE+
ACALL D)S(LAM
MOV A"L3CA9
ACALL COMMAND
MOV A"53
ACALL 9TD
a$a## paye
AGM( MA)N
5EAD)NG+4
ACALL LCDCL5
MOV A"L139
ACALL COMMAND
MOV D(T5"LTABLE2
ACALL D)S(LAM
MOV A"L3C39
ACALL COMMAND
MOV D(T5"LTABLE,
ACALL D)S(LAM
MOV A"L3CA9
ACALL COMMAND
MOV A"5*
ACALL 9TD
a$a## paye
AGM( MA)N
5EAD)NG,4

ACALL LCDCL5
MOV A"L139
ACALL COMMAND
MOV D(T5"LTABLE*3
ACALL D)S(LAM
MOV A"L3C39
ACALL COMMAND
MOV D(T5"LTABLE-
ACALL D)S(LAM
MOV A"L3CA9
ACALL COMMAND
MOV A"5+
a$a## paye
ACALL 9TD

AGM( MA)N
5EAD)NG-4

ACALL LCDCL5
MOV A"L139
ACALL COMMAND
MOV D(T5"LTABLE**
ACALL D)S(LAM
MOV A"L3C39
ACALL COMMAND
MOV D(T5"LTABLE.
ACALL D)S(LAM
MOV A"L3CA9
ACALL COMMAND
MOV A"5,
ACALL 9TD
a$a## paye
AGM( MA)N
B6@@E4
$#r B&FF
a$a## DELAM
ACALL DELAM
ACALL DELAM
ACALL DELAM
SETB B6@@
5ET
motoa$t4
$#r p+.3
setB p+.*
a$a## DELAM
a$a## DELAM
a$a## DELAM
a$a## DELAM
setB p+.3
setB p+.*
a$a## DELAM
a$a## DELAM
a$a## DELAM
a$a## DELAM
a$a## DELAM
setB p+.3
$#r p+.*
a$a## DELAM
a$a## DELAM
a$a## DELAM
a$a## DELAM
setB p+.3
setB p+.*
ret
paye4 O sCi$thes to pay
jnB p*.-"jsm*
sjmp paye
jsm*4jB p*.."paye
a$a## motoa$t
a$a## 5EAD)NG.
ajmp MA)N
9TD4
5ET
O6T*4

ACALL W5)TE
5ET
LCDCL54
MOV A"L3*9 OCLEA5 D)S(LAM SC5EEN
ACALL COMMAND
5ET O D)S(LAM DATA ON LCD
D)S(LAM4
CL5 A
MOVC A"RASD(T5
G@ NEKT
ACALL W5)TE
GM( D)S(LAM
NEKT4
5ET
W5)TE4
ACALL C9KB6SM
MOV LCD"A
SETB 5S
CL5 5W
SETB E
a$a## !e#ay*
CL5 E
5ET
COMMAND4
ACALL C9KB6SM
MOV LCD"A
CL5 5S
CL5 5W
SETB E
a$a## !e#ay*
CL5 E
5ET
C9KB6SM4
SETB :L
SETB 5W
CL5 5S
C9ECK-4
CL5 E
SETB E
GB :L"C9ECK-
5ET

DELAM4
MOV 5/"L.
AGA)N4 MOV 50"L+
BACK4 DGN@ 50"BACK
DGN@ 5/"AGA)N
5ET
TABLE*4 DB TW)5ELESS CDCST"3
TABLE04 DB TWELCOME T"3
TABLE+4 DB T5C )NVAL)DT"3
TABLE,4 DB TD5)V)NG L)C E55T"3
TABLE-4 DB T(OLL6T)ON NCT"3
TABLE.4 DB T)NS65ANCE )NVAL)DT"3
TABLE/4 DB TEveythin8 C#earT"3
TABLE**4 DB T(AM 5S.*333T"3
TABLE14 DB T(AM 5S..33T"3
TABLE24 DB T(AM 5S./33T"3
TABLE*34 DB T(AM 5S.033T"3
en!
BiB#io8raphy4
http4AACCC.m&#tyremotes.$omAremoteHroBoHvehi$#e.htm
CCC.ri$7ysCor#!.$omAr;i!.htm#
CCC.atme#.$om
CCC.7ei#.$om
13.* mi$ro$ontro##er Boo7 AL) MA@)D)

You might also like