8/14/2019 DPGSOSORFV
1/90
A PROJECT REPORT ON
DETECTING POWER GRID SYNCHRONISATION FAILURE ON
SENSING OUT OF RANGE FREQUENCY OR VOLTAGE
Submitted in partial fulfillment of the requirements
For the award of the degree
AC!E"OR OF EN#$NEER$N#
$N
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EN#$NEER$N#
S&'$TTE( )
******************** +**************,
********************* +***************,
********************* +***************,
(EPART'ENT OF %%%%%%%%%%%%%%%%%%%%%%% EN#$NEER$N#
%%%%%%%%%%CO""E#E OF EN#$NEER$N#
AFF$"$ATE( TO %%%%%%%%%%% &N$-ERS$T)
CERTIFICATE
1
8/14/2019 DPGSOSORFV
2/90
This is to .ertif/ that the dissertation wor0 entitled DETECTING POWER GRID
SYNCHRONISATION FAILURE ON SENSING OUT OF RANGE
FREQUENCY OR VOLTAGE is the wor0 done b/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%submitted in partial
fulfillment for the award of 1AC!E"OR OF EN#$NEER$N# +2E,3in
%%%%%%%%%%%%%%%%%%%%%%%%%%Engineering from%%%%%%%%%%%%%% College of
Engineering affiliated to %%%%%%%%% &ni4ersit/5 !/derabad 2
________________ ____________
(Head of the depat!e"t# ECE$ (A%%&%ta"t Pofe%%o$
E'TERNAL E'AINER
2
8/14/2019 DPGSOSORFV
3/90
AC)NOWLEDGEENT
The satisfa.tion and euphoria that a..ompan/ the su..essful .ompletion of an/
tas0 would be in.omplete without the mentioning of the people whose .onstant
guidan.e and en.ouragement made it possible2 6e ta0e pleasure in presenting
before /ou5 our pro7e.t5 whi.h is result of studied blend of both resear.h and
0nowledge2
6e e8press our earnest gratitude to our internal guide5 Assistant Professor
%%%%%%%%%%%%%%5 (epartment of ECE5 our pro7e.t guide5 for his .onstant support5
en.ouragement and guidan.e2 6e are grateful for his .ooperation and his 4aluable
suggestions2
Finall/5 we e8press our gratitude to all other members who are in4ol4ed either
dire.tl/ or indire.tl/ for the .ompletion of this pro7e.t2
3
8/14/2019 DPGSOSORFV
4/90
DECLARATION
6e5 the undersigned5 de.lare that the pro7e.t entitled *DETECTING POWER
GRID SYNCHRONISATION FAILURE ON SENSING OUT OF RANGE
FREQUENCY OR VOLTAGE+5 being submitted in partial fulfillment for the
award of a.helor of Engineering (egree in Ele.troni.s and Communi.ation
Engineering5 affiliated to %%%%%%%%% &ni4ersit/5 is the wor0 .arried out b/ us2
%%%%%%%%%% %%%%%%%%% %%%%%%%%%
%%%%%%%%%% %%%%%%%%% %%%%%%%%%
4
8/14/2019 DPGSOSORFV
5/90
,- A.STRACT
This pro7e.t presents the de4elopment of a mi.ro.ontroller based islanding dete.tion for
grid .onne.ted in4erter with under9o4er 4oltage and under9o4er frequen./ islanding dete.tion
algorithms for predi.table bla.0out or brownouts2 The s/stem is based on a mi.ro.ontroller from
Atmel A-R famil/2 The mi.ro.ontroller monitors the under9o4er 4oltage deri4ed from a set of
.omparators and under9o4er frequen./ from b/ the interrupt program for the utilit/ grid and the
pro.essed 4alue of 4oltage and frequen./ for turning ON9OFF the rela/ between a grid
.onne.ted in4erter and the utilit/ grid2 The pro7e.t would alternati4el/ use a 4ariable frequen./
generator representing the in4erter using :::*timer for .hanging the frequen./ while a standard
4aria. shall be used to 4ar/ the input 4oltage for a.hie4ing the test .onditions b/ a lamp load
+indi.ating a predi.table bla.0out, being dri4en from the mi.ro.ontroller output as stated abo4e2
The mi.ro.ontroller used in the pro7e.t is of A-R famil/ whi.h is of ; bit2
The power suppl/ .onsists of a step down transformer 9?
8/14/2019 DPGSOSORFV
6/90
/-INTRODUCTION TO E.EDDED SYSTES
6
8/14/2019 DPGSOSORFV
7/90
What &% e!0edded %1%te!2
An Embedded S/stem is a .ombination of .omputer hardware and software5 and perhaps
additional me.hani.al or other parts5 designed to perform a spe.ifi. fun.tion2 An embedded
s/stem is a mi.ro.ontroller*based5 software dri4en5 reliable5 real*time .ontrol s/stem5
autonomous5 or human or networ0 intera.ti4e5 operating on di4erse ph/si.al 4ariables and in
di4erse en4ironments and sold into a .ompetiti4e and .ost .ons.ious mar0et2
An embedded s/stem is not a .omputer s/stem that is used primaril/ for pro.essing5 not a
software s/stem on PC or &N$B5 not a traditional business or s.ientifi. appli.ation2 !igh*end
embedded lower end embedded s/stems2 !igh*end embedded s/stem * #enerall/ =
8/14/2019 DPGSOSORFV
8/90
8/14/2019 DPGSOSORFV
9/90
I The/ will en.ounter a number of diffi.ulties when writing embedded s/stem software in
addition to those we en.ounter when we write appli.ations2
Throughput Our s/stem ma/ need to handle a lot of data in a short period of
time2
ResponseOur s/stem ma/ need to rea.t to e4ents qui.0l/2
Testabilit/Setting up equipment to test embedded software .an be diffi.ult2
(ebugabilit/6ithout a s.reen or a 0e/board5 finding out what the software is
doing wrong +other than not wor0ing, is a troublesome problem2
Reliabilit/ embedded s/stems must be able to handle an/ situation without
human inter4ention2
'emor/ spa.e 'emor/ is limited on embedded s/stems5 and /ou must ma0e
the software and the data fit into whate4er memor/ e8ists2
Program installation /ou will need spe.ial tools to get /our software into
embedded s/stems2
Power .onsumption Portable s/stems must run on batter/ power5 and the
software in these s/stems must .onser4e power2
Pro.essor hogs .omputing that requires large amounts of CP& time .an
.ompli.ate the response problem2
Cost Redu.ing the .ost of the hardware is a .on.ern in man/ embedded s/stem
pro7e.tsK software often operates on hardware that is barel/ adequate for the 7ob2
I Embedded s/stems ha4e a mi.ropro.essor9 mi.ro.ontroller and a memor/2 Some ha4e a
serial port or a networ0 .onne.tion2 The/ usuall/ do not ha4e 0e/boards5 s.reens or dis0
dri4es2
APPLICATIONS
?, 'ilitar/ and aerospa.e embedded software appli.ations
8/14/2019 DPGSOSORFV
10/90
, $ntelligent5 autonomous sensors2
CLASSIFICATION
Real Time S/stems2
RTS is one whi.h has to respond to e4ents within a spe.ified deadline2
A right answer after the dead line is a wrong answer2
RTS CLASSIFICATION
!ard Real Time S/stems
Soft Real Time S/stem
HARD REAL TIE SYSTE
L!ardL real*time s/stems ha4e 4er/ narrow response time2
E8ample Nu.lear power s/stem5 Cardia. pa.ema0er2
SOFT REAL TIE SYSTE
LSoftL real*time s/stems ha4e redu.ed .onstrains on LlatenessL but still must operate 4er/
qui.0l/ and repeatable2
E8ample Railwa/ reser4ation s/stem ta0es a few e8tra se.onds the data remains 4alid2
10
8/14/2019 DPGSOSORFV
11/90
3. BLOCK DIAGRAM
11
8/14/2019 DPGSOSORFV
12/90
Fig2 = lo.0 (iagram of the pro7e.t
12
8/14/2019 DPGSOSORFV
13/90
4. HARDWARE REQUIREMENTS
HARDWARE COPONENTS3
13
8/14/2019 DPGSOSORFV
14/90
?2 TRANSFOR'ER + ?< - AC,
2 RE"A)S
??2 P&S! &TTONS
?
8/14/2019 DPGSOSORFV
15/90
Transformers .on4ert AC ele.tri.it/ from one 4oltage to another with a little loss of power2
Step*up transformers in.rease 4oltage5 step*down transformers redu.e 4oltage2 'ost power
supplies use a step*down transformer to redu.e the dangerousl/ high 4oltage to a safer low
4oltage2
F$# 2? A T)P$CA" TRANSFOR'ER
The input .oil is .alled the primar/ and the output .oil is .alled the se.ondar/2 There is
no ele.tri.al .onne.tion between the two .oilsK instead the/ are lin0ed b/ an alternating magneti.
field .reated in the soft*iron .ore of the transformer2 The two lines in the middle of the .ir.uit
s/mbol represent the .ore2 Transformers waste 4er/ little power so the power out is +almost,
equal to the power in2 Note that as 4oltage is stepped down and .urrent is stepped up2
The ratio of the number of turns on ea.h .oil5 .alled the turn3s ratio5 determines the ratioof the 4oltages2 A step*down transformer has a large number of turns on its primar/ +input, .oil
whi.h is .onne.ted to the high 4oltage mains suppl/5 and a small number of turns on its
se.ondar/ +output, .oil to gi4e a low output 4oltage2
T&RNS RAT$O +-p 9 -s, + Np 9 Ns ,
6here5
-p primar/ +input, 4oltage2
-s se.ondar/ +output, 4oltage
Np number of turns on primar/ .oil
Ns number of turns on se.ondar/ .oil
$p primar/ +input, .urrent
$s se.ondar/ +output, .urrent2
15
8/14/2019 DPGSOSORFV
16/90
Idea6 po7e e89at&o"
The ideal transformer as a .ir.uit element
$f the se.ondar/ .oil is atta.hed to a load that allows .urrent to flow5 ele.tri.al power is
transmitted from the primar/ .ir.uit to the se.ondar/ .ir.uit2 $deall/5 the transformer is perfe.tl/
effi.ientK all the in.oming energ/ is transformed from the primar/ .ir.uit to the magneti. field
and into the se.ondar/ .ir.uit2 $f this .ondition is met5 the in.oming ele.tri. powermust equal
the outgoing power
gi4ing the ideal transformer equation
Transformers normall/ ha4e high effi.ien./5 so this formula is a reasonable
appro8imation2
$f the 4oltage is in.reased5 then the .urrent is de.reased b/ the same fa.tor2 The
impedan.e in one .ir.uit is transformed b/ the squareof the turns ratio2 For e8ample5 if an
impedan.e Zsis atta.hed a.ross the terminals of the se.ondar/ .oil5 it appears to the primar/
.ir.uit to ha4e an impedan.e of +Np9Ns,
8/14/2019 DPGSOSORFV
17/90
5-/ VOLTAGE REGULATOR :;5 ?
8/14/2019 DPGSOSORFV
18/90
F$# 2
8/14/2019 DPGSOSORFV
19/90
TA"E 2
8/14/2019 DPGSOSORFV
20/90
5-5 FILTER
Capa.iti4e filter is used in this pro7e.t2 $t remo4es the ripples from the output of re.tifier
and smoothens the (2C2 Output re.ei4ed from this filter is .onstant until the mains 4oltage and
load is maintained .onstant2 !owe4er5 if either of the two is 4aried5 (2C2 4oltage re.ei4ed at this
point .hanges2 Therefore a regulator is applied at the output stage2
The simple .apa.itor filter is the most basi. t/pe of power suppl/ filter2 The use of this
filter is 4er/ limited2 $t is sometimes used on e8tremel/ high*4oltage5 low*.urrent power supplies
for .athode*ra/ and similar ele.tron tubes that require 4er/ little load .urrent from the suppl/2
This filter is also used in .ir.uits where the power*suppl/ ripple frequen./ is not .riti.al and .an
be relati4el/ high2 elow figure .an show how the .apa.itor .harges and dis.harges2
20
8/14/2019 DPGSOSORFV
21/90
AVR Microcontroller
A microcontroller is s a computer on a chip, or if you prefer , a single chip computer .Micro
suggests that the device is small , and controllertells that the device might be used to control
objects , processes , or events . Another term to describe a microcontroller is embedded
controller; because the microcontroller and its support circuits are often built into, or embedded
in, the device they control .
You can find microcontroller in all kinds of things these days, any device that measures,
stores, control, calculate or displays information is a candidate for putting a microcontroller inside.
The largest single use for microcontroller is in automobiles just about ever car manufactured
today include at least one microcontroller for engine control, and often more to control additional
system in the car. In desktop computers, you can find microcontrollers inside keyboards ,
modems , printers and other peripherals . In test euipments, microcontroller make it easy toad
features ability to add features such as ability to store measurements, to create and store user
routines , and to display message and !aveforms . "onsumer products that use microcontrollers
includes cameras , video recorders , compacts disk players , and ovens . And these are just fe!
e#amples .
$icrocontrollers are basically LSIchips !ith millions of logic gates constituting an
Arithmetic and %ogic &nit 'ALU(, accompanying registers, bus control circuitry and an instruction
decoder. This is the definition in the strictest sense. $ost modern microcontrollers usually have
21
8/14/2019 DPGSOSORFV
22/90
on chip RAM and ROM and a fe! peripherals such as timers, serial interfaces such as a
UART'&niversal Asynchronous )eceiver Transmitter(, ports and evenADCs'Analog to *igital
"onverters(. A !ide variety of microcontrollers is available today. +ome are general purpose,
!hile some are optimied for special applications. A fe! !ell kno!n microcontrollers are Intel-s
/01, /0, 2entium, $otorola-s 3/// and 3//, Atmel-s A4) series, A$*-s Athlon, and the
relatively ne! 2+o" from "ypress. This tutorial is about the Intel /01.
A !ide variety of microcontrollers are available today. +ome are general purpose, !hile some
are optimied for special applications. A fe! !ell kno!n microcontroller of various families are
given belo!.
Intels family 8051(commercially available as89C51), /05, /61 /0 , 2entium etc
Avr family 7 ATtiny15 , ATtiny10 , AT90S100(A) ! AT90S"1" ! AT8/+5656 ,AT8/+5666, AT8/+5696 , AT8/+9919 , AT8/+9966 , AT8/+9969 , AT90S8515 !!AT90S85"5, ATmega6 , ATmega1/6 , ATmega131 , ATmega136 ,ATmega3/6 , etc
#ic family 7 2I"13:6 , 2I"13:9 , #IC1$%8&A ! 2I"13
8/14/2019 DPGSOSORFV
23/90
A fe, im-ortant terms
Word or Word size& )t is smallest grou of bits uon which normal arithmetic
oerations are carried out" although there
are instructions oerating on indi%idual bits#(
*emor+ units store bits in grous
called words( A wordmo%es in and out of
memor+ as a unit( A memor+ address is the
location of a word of the memor+( ,ord
si-e is usuall+ a multile of 8bits(
Arit!eti" #$d Lo%i" U$it&.his unit erforms basic arithmetic and logic functions
like add$ subtract and A/$ etc$ on oerands stored in memor+ or registers(
Re%ister& A register is a collection of fli!flos$ used to store limited amount of
data" a fli!flo stores one bit# such as status information$ ointers etc(
'ro%r#! #$d D#t# Me!or(& rogram memor+ is that art of the memor+ where
code written b+ the user is stored( )t also stores constants( .his memor+ is usuall+
the ROMand has to be rogrammed using secial hardware " although it can also
be rogrammed in s+stem#( )t also stores a rogram called the bootstra loader$
which gets the microcontroller started when ower is first turned on( 'ome oular
t+es of * are EPROM$ EEPROMand more recentl+ Flash( ata memor+ is that
art of the memor+ hierarch+ which is used to store %ariables defined b+ the user
and %alues generated during rogram eecution( .his memor+ is the A*(
23
8/14/2019 DPGSOSORFV
24/90
'ro%r#! Co)$ter& As mentioned re%iousl+ the users code is stored in the *(
,hile eecuting the rogram a secial register called the rogram ounter kees
track of the net instruction in the rogram to be fetched( At the start of a
rograms eecution the rogram ounter stores the address of the first instruction
of the rogram and as each instruction is eecuted$ it is incremented( .his hels the
microcontroller in knowing what location to fetch the net instruction from( .herogram ounter is not alwa+s incremented( or eamle when a :um to location
A kind of instruction is encountered$ the rogram ounter stores the address of
location A(
St#"* 'oi$ter& )n simle words a stack is a method of storing data in a articular
manner( .he data element that is first to go into a stack is the last to come out of it(
.he to of the stack is the onl+ lace in a stack where addition or deletion can
take lace( )n most microcontrollers the stack is stored starting from a secial
location in the memor+( ne of the uses of the stack is to store the contents of the
rogram ounter when a subroutine is encountered( .he 'tack ointer is a register
containing the address of the to of the stack(
Addressi$% Modes& *ost of the instructions in a rogram will mention its oerands
and their location i(e( addresses in memor+ or register sace( An address ma+ not
alwa+s be secified in absolute terms$ i(e( the address ma+ not be the address of
the oerand( )n such cases the mode of addressing used in the instruction tells the
microcontroller how to interret the address and calculate the oerands address(
.his is done to ro%ide the user fleibilit+$ to shorten the instruction si-e" not ha%ing
to secif+ the whole address$ but onl+ a art of it# etc( or eamle the indirect
addressing mode is used to secif+ a memor+ location where not the oerand but
its address is stored(
24
8/14/2019 DPGSOSORFV
25/90
I$terr)+ts& An interrut is a wa+ of asking the microcontroller to sto what it is
doing and attend to the source of the interrut( An eamle is that of ); s+stems
in microcontrollers( .hese ); s+stems issue an interrut when the+ recei%e some
data or ha%e comleted transmitting some data( .his hels in sa%ing rocessing
time as the microcontroller doesnt ha%e to kee checking the ); s+stems for an
arri%al of data or comletion of transfer of data( .here can be man+ other sources of
interruts(
'orts& .he+ are basicall+ gatewa+s through which ); transfers of a microcontroller
take lace( >2)?$, Timers etc., reuired to perform some predefined task.
25
8/14/2019 DPGSOSORFV
26/90
*oes this mean that themicrocontrolleris another name for a computer@ The ans!er is B?C
The computer on one hand is designed to perform all the general purpose tasks on a single machine like
you can use a computer to run a soft!are to perform calculations or you can use a computer to store
some multimedia file or to access internet through the bro!ser, !hereas the microcontrollers are meant to
perform only the specific tasks, for e.g., s!itching the A" off automatically !hen room temperature drops
to a certain defined limit and again turning it ?B !hen temperature rises above the defined limit.
There are number of popular families of microcontrollers !hich are used in different applications as per
their capability and feasibility to perform the desired task, most common of these are /01, A4) and 2I"
microcontrollers. In this article !e !ill introduce you !ith AVRfamily of microcontrollers.
I$trod)"tio$ to ATMEL A,R !i"ro"o$tro--er
2istory of AVR
A4) !as developed in the year 1883 by Atmel "orporation. The architecture of A4) !as developed
byAlf7>gil Dogenand4egard Eollan. A4) derives its name from its developers and stands for Alf34il
o4en Ve4ar/ ollan RISC microcontroller, also kno!n as Advanced Virtual RI+". The AT8/+010
!as the first microcontroller !hich !as based on AVR arcitect*reho!ever the first microcontroller to hit
the commercial market !as AT8/+15// in the year 188
8/14/2019 DPGSOSORFV
27/90
1. TinyAVR %ess memory, small sie, suitable only for simpler applications
5. Me4aAVR These are the most popular ones having good amount of memory 'upto 503 FD(, higher
number of inbuilt peripherals and suitable for moderate to comple# applications.
6. 6me4aAVR &sed commercially for comple# applications, !hich reuire large program memory and
high speed.
The follo!ing table compares the above mentioned A4) series of microcontrollers=
Series 7ame #ins %las Memory S-ecial %eat*re
TinyAVR 3765 /.07 FD +mall in sie
Me4aAVR 571// 97503FD >#tended peripherals
6me4aAVR 9971// 13769FD *$A , >vent +ystem
included
ats s-ecial ao*t AVR+They are fast= AVR microcontrollere#ecutes most of the instructions in single e#ecution cycle. A4)s
are about 9 times faster than 2I"s, they consume less po!er and can be operated in different po!er
saving modes. %et-s do the comparison bet!een the three most commonly used families of
microcontrollers.
8051 #IC AVR
S#33 +lo! $oderate ast
M3M.R: +mall %arge %arge
ARC2IT3CT;R3 "I+" )I+" )I+"
AC Bot 2resent Inbuilt Inbuilt
Timers Inbuilt Inbuilt Inbuilt
#M Cannels Bot 2resent Inbuilt Inbuilt
A4) is an 7bit microcontroller belonging to the family of )educed Instruction +et "omputer 'RISC(. In
)I+" architecture the instruction set of the computer are not only fe!er in number but also simpler and
faster in operation. The other type of categoriation is "I+" '"omple# Instruction +et "omputers(. Ee !ill
e#plore more on this !hen !e !ill learn about the architecture of A4) microcontrollers in follo!ing
section.
%et-s see !hat all this means. Ehat is 7bit This means that the microcontroller is capable of transmitting
and receiving 7bit data. The inputGoutput registers available are of 7bits. The A4) family controllers
have register based architecture !hich means that both the operands for an operation are stored in a
register and the result of the operation is also stored in a register. ollo!ing figure sho!s a simple
27
8/14/2019 DPGSOSORFV
28/90
e#ample performing ?) operation bet!een t!o input registers and storing the value in ?utput )egister.
The "2& takes values from t!o input registers IB2&T71 and IB2&T75, performs the logical operation and
stores the value into the ?&T2&T register. All this happens in 1 e#ecution cycle.
In our journey !ith the A4) !e !ill be !orking onAtmega13microcontroller, !hich is a 9/7pin I" and
belongs to the megaA4) category of A4)family. +ome of the features of Atmega13 are=H 13FD of lash memoryH 1FD of +)A$H 015 Dytes of >>2)?$H Available in 9/72in *I2H 7"hannel 1/7bit A*"H T!o 7bit TimersG"ountersH ?ne 137bit TimerG"ounterH 9 2E$ "hannelsH In +ystem 2rogrammer 'I+2(H +erial &+A)TH +2I InterfaceH *igital to Analog "omparator.
Arcitect*re of AVR
The A4) microcontrollers are based on the advanced )I+" architecture and consist of 65 # 7bit general
purpose !orking registers. Eithin one single clock cycle, A4) can take inputs from t!o general purpose
registers and put them to A%& for carrying out the reuested operation, and transfer back the result to an
arbitrary register. The A%& can perform arithmetic as !ell as logical operations over the inputs from the
register or bet!een the register and a constant. +ingle register operations like taking a complement can
also be e#ecuted in A%&. Ee can see that A4) does not have any register like accumulator as in /01
28
http://www.engineersgarage.com/atmega16-avr-microcontrollerhttp://www.engineersgarage.com/atmega16-avr-microcontroller8/14/2019 DPGSOSORFV
29/90
family of microcontrollers; the operations can be performed bet!een any of the registers and can be
stored in either of them.
A4) follo!s arvard Architecture format in !hich the processor is euipped !ith separate memories and
buses for 2rogram and the *ata information. ere !hile an instruction is being e#ecuted, the ne#t
instruction is pre7fetched from the program memory.
+ince A4) can perform single cycle e#ecution, it means that A4) can e#ecute 1 million instructions per
second if cycle freuency is 1$. The higher is the operating freuency of the controller, the higher !ill
be its processing speed. Ee need to optimie the po!er consumption !ith processing speed and hence
need to select the operating freuency accordingly.
There are t!o flavors for Atmega13 microcontroller=
1. Atme4a1$=7 ?perating freuency range is / 13 $.
5. Atme4a1$
The ATrefers to Atmel the manufacturer, Me4ameans that the microcontroller belong to $egaA4)
category, 1$signifies the memory of the controller, !hich is 13FD.
29
8/14/2019 DPGSOSORFV
30/90
Arcitect*re ia4ram Atme4a1$
ollo!ing points e#plain the building blocks of Atme4a1$ arcitect*re=
H I?. #ortsAtmega13 has four '2?)TA, 2?)TD, 2?)T" and 2?)T*( 8itinput7output ports.
H Internal Calirate/ .scillatorAtmega13 is euipped !ith an internal oscillator for driving its clock. Dy
default Atmega13 is set to operate at internal calibrated oscillator of 1 $. The ma#imum freuency of
internal oscillator is $h. Alternatively, ATmega13 can be operated using an e#ternal crystal oscillator
!ith a ma#imum freuency of 13$. In this case you need to modify the fuse bits. 'use Dits !ill be
e#plained in a separate tutorial(.
H AC InterfaceAtmega13 is euipped !ith an channelA*"'Analo4 to i4ital Converter( !ith a
resolution of 1/7bits. A*" reads the analog input for e.g., a sensor input and converts it into digital
information !hich is understandable by the microcontroller.
30
http://www.engineersgarage.com/embedded/avr-microcontroller-projects/adc-circuithttp://www.engineersgarage.com/embedded/avr-microcontroller-projects/adc-circuithttp://www.engineersgarage.com/embedded/avr-microcontroller-projects/adc-circuithttp://www.engineersgarage.com/embedded/avr-microcontroller-projects/adc-circuit8/14/2019 DPGSOSORFV
31/90
H Timers?Co*nters Atmega13 consists of t!o 7bit and one 137bit timerGcounter. Timers are useful for
generating precision actions for e.g., creating time delays bet!een t!o operations.
H atc/o4 TimerEatchdog timeris present !ith internal oscillator. Eatchdog timer continuously
monitors and resets the controller if the code gets stuck at any e#ecution action for more than a defined
time interval.
H Interr*-tsAtmega13 consists of 51 interrupt sources out of !hich four are e#ternal. The remaining are
internal interrupts !hich support the peripherals like &+A)T, A*", Timers etc.
H ;SART;niversal Syncrono*s an/ Asyncrono*s Receiver an/ Transmitterinterface is available
for interfacing !ith e#ternal device capable of communicating serially 'data transmission bit by bit(.
H @eneral #*r-ose Re4istersAtmega13 is euipped !ith 65 general purpose registers !hich are
coupled directly !ith the Arithmetic %ogical &nit 'A%&( of "2&.
H MemoryAtmega13 consist of three different memory sections=
1. %las 33#R.M= lash >>2)?$ or simple flash memory is used to store the program dumped or burnt
by the user on to the microcontroller. It can be easily erased electrically as a single unit. lash memory is
non7volatile i.e., it retains the program even if the po!er is cut7off. Atmega13 is available !ith 13FD of in
system programmable lash >>2)?$.
5. yte A//ressale 33#R.M= This is also a nonvolatile memory used to store data like values of certain
variables. Atmega13 has 015 bytes of >>2)?$, this memory can be useful for storing the lock code if !e
are designing an application like electronic door lock.
6. SRAM= +tatic )andom Access $emory, this is the volatile memory of microcontroller i.e., data is lost as
soon as po!er is turned off. Atmega13 is euipped !ith 1FD of internal +)A$. A small portion of +)A$is set aside for general purpose registers used by "2& and some for the peripheral subsystems of the
microcontroller.
31
http://www.engineersgarage.com/embedded/avr-microcontroller-projects/avr-watchdog-timers-circuithttp://www.engineersgarage.com/embedded/avr-microcontroller-projects/external-hardware-interruptshttp://www.engineersgarage.com/embedded/avr-microcontroller-projects/serial-communication-atmega16-usarthttp://www.engineersgarage.com/embedded/avr-microcontroller-projects/avr-watchdog-timers-circuithttp://www.engineersgarage.com/embedded/avr-microcontroller-projects/external-hardware-interruptshttp://www.engineersgarage.com/embedded/avr-microcontroller-projects/serial-communication-atmega16-usart8/14/2019 DPGSOSORFV
32/90
H IS#A4) family of controllers have In System #ro4rammalelash $emory !hich can be
programmed !ithout removing the I" from the circuit, I+2 allo!s to reprogram the controller !hile it is in
the application circuit.
H S#ISerial #eri-eral Interface, +2I port is used for serial communication bet!een t!o devices on a
common clock source. The data transmission rate of +2I is more than that of &+A)T.
H TI T,o ire Interface'TEI( can be used to set up a net!ork of devices, many devices can be
connected over TEI interface forming a net!ork, the devices can simultaneously transmit and receive
and have their o!n uniue address.
H ACAtmega13 is also euipped !ith a i4ital to Analo4 Converter'*A"( interface !hich can be
used for reverse action performed by A*". *A" can be used !hen there is a need of converting a digitalsignal to analog signal.
Vario*s microcontroller of Me4aAVR series
ATmega andAtmega65are other members of $egaA4) series controllers. They are uite similar
toATmega13in architecture. %o! po!er version $egaA4) controllers are also available in markets. The
follo!ing table sho!s the comparison bet!een different members of $egaA4) family=
#art 7ame R.M RAM 33#R.M I?0
#ins
Timer Interr*-ts .-erationVolta4e.-eratin4
fre*ency
#acBa4in4
ATme4a8 FD 1FD 015D 56 6 18 9.070.0 4 /713 $ 5
ATme4a8
module5 are
ine8pensi4e5 eas/ to use5 and it is e4en possible to produ.e a readout using the ; 8 ;> pi8els of
the displa/2 !ita.hi "C( displa/s ha4e a standard ASC$$ set of .hara.ters plus Japanese5 #ree0
and mathemati.al s/mbols2
For an ;*bit data bus5 the displa/ requires a @:- suppl/ plus ?? $9O lines2 For a *bit data
bus it onl/ requires the suppl/ lines plus se4en e8tra lines2 6hen the "C( displa/ is not enabled5
data lines are tri*state whi.h means the/ are in a state of high impedan.e +as though the/ are
dis.onne.ted, and this means the/ do not interfere with the operation of the mi.ro.ontroller
when the displa/ is not being addressed2
37
8/14/2019 DPGSOSORFV
38/90
F$# "C( ($SP"A)
The "C( also requires = L.ontrolL lines from the mi.ro.ontroller
Read data fo! data 6&"e% (&f &t &% ead&"?$Reading data from the "C( is done in the same wa/5 but .ontrol line R96 has to be high2
6hen we send a high to the "C(5 it will reset and wait for instru.tions2 T/pi.al instru.tions sent
to "C( displa/ after a reset are turning on a displa/5 turning on a .ursor and writing .hara.ters
from left to right2 6hen the "C( is initialied5 it is read/ to .ontinue re.ei4ing data or
38
Enable +E, This line allows a..ess to the displa/ through R96 and RS lines2 6hen this
line is low5 the "C( is disabled and ignores signals from R96 and RS2 6hen
+E, line is high5 the "C( .he.0s the state of the two .ontrol lines and responds
a..ordingl/2Read96rite +R96, This line determines the dire.tion of data between the "C( and
mi.ro.ontroller2 6hen it is low5 data is written to the "C(2 6hen it is high5
data is read from the "C(2
Register sele.t
+RS,
6ith the help of this line5 the "C( interprets the t/pe of data on data lines2
6hen it is low5 an instru.tion is being written to the "C(2 6hen it is high5 a
.hara.ter is being written to the "C(2
8/14/2019 DPGSOSORFV
39/90
8/14/2019 DPGSOSORFV
40/90
8/14/2019 DPGSOSORFV
41/90
8/14/2019 DPGSOSORFV
42/90
F$#2+b, :::T$'ER P$N ($A#RA'
=== .a%&4%
The ::: timer $C is a simple ; pin ($" pa.0age $C2 $t .an
be used as a monostable
be used as an astable
sour.e or sin0 ?>>mA
use suppl/ 4oltages of :4 to ?:4 disrupt the power suppl/ * use a de.oupling .apa.itorV
U%&"? the === a% a 09ffe
A buffer .ir.uit allows an input .ir.uit to be .onne.ted to an output .ir.uit5 it is li0e an
interfa.e between one .ir.uit and another2 The buffer .ir.uit requires 4er/ little input .urrent but
should be able to suppl/ adequate output .urrent2 The ::: .an suppl/ in e8.ess of ?>>mA of
.urrent and so .an be used as a .on4enient buffer for logi. gates whi.h .annot suppl/ mu.h
.urrent2 The ::: .an also Qsin0Q a similar amount of .urrent2
The .ir.uit used is
F$# 2+., ::: T$'ER AS A &FFER
The .ir.uit a.ts li0e an in4erter or NOT gate2 6hen the input is held low5 the output is high and
will pro4ide +sour.e, .urrent2 6hen the input is held high5 the output is low and will sin0 .urrent2
Remember5 for a buffer for e4en higher power de4i.es that require e4en larger .urrents5 the :::
buffer .an be used to dri4e a rela/ or a transistor .ir.uit2
U%&"? the === a% a !o"o%ta06e
The ::: .an be used as a monostable using the .ir.uit shown
42
8/14/2019 DPGSOSORFV
43/90
F$# 2+d, :::T$'ER AS A 'ONOSTA"E
The output is normall/ low but will go high for a short length of time depending on the
4alues of the other .omponents2
R and C determine the time period of the output pulse2
The input is normall/ high and goes low to trigger the output +falling edge triggered,2
The length of the input pulse must be less than the length of the output pulse2
The uF .apa.itor Qde.ouplesQ the suppl/ to a4oid affe.ting other parts of the .ir.uit2
$t is standard to add a ?>nF .apa.itor from pin: to gnd2
T ,-, R C
T * se.onds5 R * ohms5 C * FaradsThe minimum 4alue of R should be about ?0 to a4oid too mu.h .urrent flowing into the :::2
The ma8imum 4alue of R should be about ?' so that enough .urrent .an flow into the input of
the ::: and there is also .urrent to allow for the ele.trol/ti. .apa.itors lea0age .urrent2
The minimum 4alue of C ?>>pF to a4oid the timing equation being too far off2
The ma8imum 4alue of C should be about ?>>>WF as an/ bigger .apa.itors will dis.harge too
mu.h .urrent through the .hip2 These ma8imum and minimum 4alues gi4e a minimum period of
>2? Ws and a ma8imum period of ?>>>s2
U%&"? the === a% a" a%ta06e
The ::: .an be used as an astable using the .ir.uit shown
43
8/14/2019 DPGSOSORFV
44/90
F$# 2+e, ::: T$'ER AS A ASTA"E
The output will os.illate between high and low .ontinuousl/ * the .ir.uit is not stable in
an/ state
Ra5 Rband C determine the time period of the output
The reset5 pin 5 must be held high for the .ir.uit to os.illate2 $f pin is held low then the
output remains low2 Pin .an be used to turn the astable QonQ and QoffQ in effe.t
The uF .apa.itor Qde.ouplesQ the suppl/ to a4oid affe.ting other parts of the .ir.uit
$t is standard to add a ?>nF .apa.itor from pin: to gnd2
T
8/14/2019 DPGSOSORFV
45/90
mu.h .urrent through the .hip2 These ma8imum and minimum 4alues gi4e a minimum frequen./
of >2>>? ! and a ma8imum frequen./ of 2; '! +in realit/ it would not be able to attain these
frequen.ies,2
Considering the os.illations in more detail
the output is .ontrolled b/ the .harging and dis.harging of the .apa.itor2
The .apa.itor .harges through Ra and Rb2
ut dis.harges through the dis.harge pin +pin , and thus onl/ through Rb2
The time that the .apa.itor ta0es to .harge or dis.harge is gi4en as T >2 R C2
Thus the .harge time is >2 +Ra @ Rb, C2
The dis.harge time is >2 Rb C2
#i4ing a total time of +>2 +Ra @ Rb, C, @ +>2 Rb C, >2 +Ra @
8/14/2019 DPGSOSORFV
46/90
F$# 2+f, OPERAT$ON OF :::T$'ER
The resistors are arranged a.ross the power suppl/ to form a potential di4ider2 The
4oltages at the 7un.tions of the potential di4ider are
8/14/2019 DPGSOSORFV
47/90
A rela/ is an ele.tri.all/ operated swit.h2 Current flowing through the .oil of the rela/
.reates a magneti. field whi.h attra.ts a le4er and .hanges the swit.h .onta.ts2 The .oil .urrent
.an be on or off so rela/s ha4e two swit.h positions and most ha4e double throw +.hangeo4er,
swit.h .onta.ts as shown in the diagram2
Fig 2; Rela/ showing .oil and swit.h .onta.ts
Rela/s allow one .ir.uit to swit.h a se.ond .ir.uit whi.h .an be .ompletel/ separate
from the first2 For e8ample a low 4oltage batter/ .ir.uit .an use a rela/ to swit.h a - AC
mains .ir.uit2 There is no ele.tri.al .onne.tion inside the rela/ between the two .ir.uitsK the lin0
is magneti. and me.hani.al2
The .oil of a rela/ passes a relati4el/ large .urrent5 t/pi.all/ =>mA for a ?>mA for rela/s designed to operate from lower 4oltages2 'ost $Cs +.hips,
.annot pro4ide this .urrent and atransistoris usuall/ used to amplif/ the small $C .urrent to the
larger 4alue required for the rela/ .oil2 The ma8imum output .urrent for the popular ::: timer
$C is >mA so these de4i.es .an suppl/ rela/ .oils dire.tl/ without amplifi.ation2
47
http://www.kpsec.freeuk.com/trancirc.htm#ichttp://www.kpsec.freeuk.com/trancirc.htm#ic8/14/2019 DPGSOSORFV
48/90
8/14/2019 DPGSOSORFV
49/90
8/14/2019 DPGSOSORFV
50/90
App6&4at&o"% of e6a1%
Rela/s are used to and for
Control a high*4oltage .ir.uit with a low*4oltage signal5 as in some t/pes of modems or
audio amplifiers2
Control a high*.urrent .ir.uit with a low*.urrent signal5 as in the starter solenoid of an
automobile2
(ete.t and isolate faults on transmission and distribution lines b/ opening and .losing
.ir.uit brea0ers2 Time dela/ fun.tions2 Rela/s .an be modified to dela/ opening or dela/ .losing a set of
.onta.ts2 A 4er/ short +a fra.tion of a se.ond, dela/ would use a .opper dis0 between the
armature and mo4ing blade assembl/2 Current flowing in the dis0 maintains magneti.
field for a short time5 lengthening release time2 For a slightl/ longer +up to a minute,
dela/5 a dashpot is used2 A dashpot is a piston filled with fluid that is allowed to es.ape
slowl/2 The time period .an be 4aried b/ in.reasing or de.reasing the flow rate2 For longer
time periods5 a me.hani.al .lo.0wor0 timer is installed2
5-,, PUSH .UTTONS
Fig 2??+a, Push uttons
A push*button +also spelled pushbutton, or simpl/ button is a simple swit.h me.hanism for
.ontrolling some aspe.t of a ma.hine or a pro.ess2 uttons are t/pi.all/ made out of hard
50
http://en.wikipedia.org/wiki/File:Tactile_switches.jpg8/14/2019 DPGSOSORFV
51/90
8/14/2019 DPGSOSORFV
52/90
P9%h to ON 09tto"3
Fig22??+b, push on button
$nitiall/ the two .onta.ts of the button are open2 6hen the button is pressed the/ be.ome
.onne.ted2 This ma0es the swit.hing operation using the push button2
5-, LED
A light*emitting diode +"E(, is a semi.ondu.torlight sour.e2 "E(s are used as indi.ator
lamps in man/ de4i.es5 and are in.reasingl/ used for lighting2 6hen a light*emitting diode is
forward biased +swit.hed on,5 ele.trons are able to re.ombine with holes within the de4i.e5
releasing energ/ in the form ofphotons2
This effe.t is .alled ele.trolumines.en.e and the.olorof the light +.orresponding to the
energ/ of the photon, is determined b/ the energ/ gap of the semi.ondu.tor2 An "E( is often
small in area +less than ? mm
8/14/2019 DPGSOSORFV
53/90
T1pe% of LED+S
Fig 2?=+a, T/pes of "E(
"ight*emitting diodes are used in appli.ations as di4erse as repla.ements for a4iation lighting5
automoti4e lighting as well as in traffi. signals2 The .ompa.t sie5 the possibilit/ of narrow
bandwidth5 swit.hing speed5 and e8treme reliabilit/ of "E(s has allowed new te8t and 4ideo
displa/s and sensors to be de4eloped5 while their high swit.hing rates are also useful in ad4an.ed
.ommuni.ations te.hnolog/2
E6e4to"&4 S1!0o63
Fig 2?=+b, s/mbol of "E(
Co6o% a"d !ate&a6% of LED+S
Con4entional "E(s are made from a 4ariet/ of inorgani. semi.ondu.tor materials5 the
following table shows the a4ailable .olors with wa4elength range5 4oltage drop and material2
Wh&te LED+S
"ight Emitting (iodes +"E(, ha4e re.entl/ be.ome a4ailable that are both white and
bright5 so bright that the/ seriousl/ .ompete with in.andes.ent lamps in lighting appli.ations2
53
http://en.wikipedia.org/wiki/Navigation_light#Aviation_navigation_lightshttp://en.wikipedia.org/wiki/Automotive_lighting#Light_emitting_diodes_.28LED.29http://en.wikipedia.org/wiki/Traffic_signalhttp://en.wikipedia.org/wiki/Semiconductor_materialshttp://en.wikipedia.org/wiki/File:LED_symbol.svghttp://en.wikipedia.org/wiki/File:Verschiedene_LEDs.jpghttp://en.wikipedia.org/wiki/Navigation_light#Aviation_navigation_lightshttp://en.wikipedia.org/wiki/Automotive_lighting#Light_emitting_diodes_.28LED.29http://en.wikipedia.org/wiki/Traffic_signalhttp://en.wikipedia.org/wiki/Semiconductor_materials8/14/2019 DPGSOSORFV
54/90
The/ are still prett/ e8pensi4e as .ompared to a #O6 lamp but draw mu.h less .urrent and
pro7e.t a fairl/ well fo.used beam2
6hen run within their ratings5 the/ are more reliable than lamps as well2 Red "E(s are
now being used in automoti4e and tru.0 tail lights and in red traffi. signal lights2 )ou will be
able to dete.t them be.ause the/ loo0 li0e an arra/ of point sour.es and the/ go on and off
instantl/ as .ompared to .on4entional in.andes.ent lamps2
Fig 2?=+., 6hite "E( spe.trum
"E(s are mono.hromati. +one .olor, de4i.es2 The .olor is determined b/ the band gap of
the semi.ondu.tor used to ma0e them2 Red5 green5 /ellow and blue "E(s are fairl/ .ommon2
6hite light .ontains all .olors and .annot be dire.tl/ .reated b/ a single "E(2 The most
.ommon form of LwhiteL "E( reall/ isnQt white2 $t is a #allium Nitride blue "E( .oated with a
phosphor that5 when e8.ited b/ the blue "E( light5 emits a broad range spe.trum that in addition
to the blue emission5 ma0es a fairl/ white light2
There is a .laimthat these white "E(Qs ha4e a limited life2 After ?>>> hours or so of
operation5 the/ tend to /ellow and dim to some e8tent2 Running the "E(s at more than their
rated .urrent will .ertainl/ a..elerate this pro.ess2
There are two primar/ wa/s of produ.ing high intensit/ white*light using "E(s2 One is
to use indi4idual "E(s that emit threeprimar/ .olorsXred5 green5 and blueXand then mi8 all
the .olors to form white light2 The other is to use a phosphor material to .on4ert mono.hromati.
light from a blue or &- "E( to broad*spe.trum white light5 mu.h in the same wa/ a fluores.ent
light bulb wor0s2 (ue to metamerism5it is possible to ha4e quite different spe.tra that appear
white2
5-,5 ,N5
8/14/2019 DPGSOSORFV
55/90
(iodes are used to .on4ert AC into (C these are used as half wa4e re.tifier or full wa4e
re.tifier2 Three points must he 0ept in mind while using an/ t/pe of diode2
?2 'a8imum forward .urrent .apa.it/
> diodes
The number and 4oltage .apa.it/ of some of the important diodes a4ailable in the mar0et are as
follows
(iodes of number $N>>?5 $N>>>=5 $N>>5 $N>>:5 $N>>D and $N>> ha4e
ma8imum re4erse bias 4oltage .apa.it/ of :>- and ma8imum forward .urrent .apa.it/
of ? Amp2
(iode of same .apa.ities .an be used in pla.e of one another2 esides this diode of more
.apa.it/ .an be used in pla.e of diode of low .apa.it/ but diode of low .apa.it/ .annot
be used in pla.e of diode of high .apa.it/2 For e8ample5 in pla.e of $N>>>? or
$N>> .an be used but $N>>? or $N>>< .annot be used in pla.e of $N>>2The diode
)?
8/14/2019 DPGSOSORFV
56/90
FigPN Jun.tion diode
PN UNCTION OPERATION
Now that /ou are familiar with P* and N*t/pe materials5 how these materials are 7oined
together to form a diode5 and the fun.tion of the diode5 let us .ontinue our dis.ussion with the
operation of the PN 7un.tion2 ut before we .an understand how the PN 7un.tion wor0s5 we
must first .onsider .urrent flow in the materials that ma0e up the 7un.tion and what happensinitiall/ within the 7un.tion when these two materials are 7oined together2
C9e"t F6o7 &" the NT1pe ate&a6
Condu.tion in the N*t/pe semi.ondu.tor5 or .r/stal5 is similar to .ondu.tion in a .opper
wire2 That is5 with 4oltage applied a.ross the material5 ele.trons will mo4e through the .r/stal
7ust as .urrent would flow in a .opper wire2 This is shown in figure ?*?:2 The positi4e
potential of the batter/ will attra.t the free ele.trons in the .r/stal2 These ele.trons will lea4e
the .r/stal and flow into the positi4e terminal of the batter/2 As an ele.tron lea4es the .r/stal5
an ele.tron from the negati4e terminal of the batter/ will enter the .r/stal5 thus .ompleting the
.urrent path2 Therefore5 the ma7orit/ .urrent .arriers in the N*t/pe material +ele.trons, are
56
8/14/2019 DPGSOSORFV
57/90
repelled b/ the negati4e side of the batter/ and mo4e through the .r/stal toward the positi4e
side of the batter/2
C9e"t F6o7 &" the PT1pe ate&a6
Current flow through the P*t/pe material is illustrated2 Condu.tion in the P material is b/
positi4e holes5 instead of negati4e ele.trons2 A hole mo4es from the positi4e terminal of the P
material to the negati4e terminal2 Ele.trons from the e8ternal .ir.uit enter the negati4e
terminal of the material and fill holes in the 4i.init/ of this terminal2 At the positi4e terminal5
ele.trons are remo4ed from the .o4alent bonds5 thus .reating new holes2 This pro.ess
.ontinues as the stead/ stream of holes +hole .urrent, mo4es toward the negati4e terminal2
5-,= RESISTORS
A resistor is a two*terminal ele.troni. .omponent designed to oppose an ele.tri. .urrent b/
produ.ing a 4oltage drop between its terminals in proportion to the .urrent5 that is5 in a..ordan.e
with OhmQs law
VIR
Resistors are used as part of ele.tri.al networ0s and ele.troni. .ir.uits2 The/ are e8tremel/
.ommonpla.e in most ele.troni. equipment2 Pra.ti.al resistors .an be made of 4arious
.ompounds and films5 as well as resistan.e wire +wire made of a high*resisti4it/ allo/5 su.h as
ni.0el9.hrome,2
The primar/ .hara.teristi.s of resistors are their resistan.e and the power the/ .an
dissipate2 Other .hara.teristi.s in.lude temperature .oeffi.ient5 noise5 and indu.tan.e2 "ess well*
0nown is .riti.al resistan.e5 the 4alue below whi.h power dissipation limits the ma8imum
permitted .urrent flow5 and abo4e whi.h the limit is applied 4oltage2 Criti.al resistan.e depends
upon the materials .onstituting the resistor as well as its ph/si.al dimensionsK itQs determined b/
design2 Resistors .an be integrated into h/brid and printed .ir.uits5 as well as integrated .ir.uits2
57
8/14/2019 DPGSOSORFV
58/90
Sie5 and position of leads +or terminals, are rele4ant to equipment designersK resistors must be
ph/si.all/ large enough not to o4erheat when dissipating their power2
A resistor is a two*terminalpassi4e ele.troni. .omponentwhi.h implements ele.tri.al
resistan.e as a .ir.uit element2 6hen a 4oltage - is applied a.ross the terminals of a resistor5 a
.urrent $ will flow through the resistor in dire.t proportionto that 4oltage2 The re.ipro.al of the
.onstant of proportionalit/ is 0nown as the resistan.eR5 sin.e5 with a gi4en 4oltage -5 a larger
4alue of R further LresistsL the flow of .urrent $ as gi4en b/ OhmQs law
Resistors are .ommon elements of ele.tri.al networ0s and ele.troni. .ir.uits and are
ubiquitous in most ele.troni. equipment2 Pra.ti.al resistors .an be made of 4arious .ompounds
and films5 as well as resistan.e wire +wire made of a high*resisti4it/ allo/5 su.h as ni.0el*
.hrome,2 Resistors are also implemented within integrated .ir.uits5 parti.ularl/ analog de4i.es5
and .an also be integrated into h/bridandprinted .ir.uits2
The ele.tri.al fun.tionalit/ of a resistor is spe.ified b/ its resistan.e .ommon
.ommer.ial resistors are manufa.tured o4er a range of more than orders of magnitude2 6hen
spe.if/ing that resistan.e in an ele.troni. design5 the required pre.ision of the resistan.e ma/
require attention to the manufa.turing toleran.eof the .hosen resistor5 a..ording to its spe.ifi.
appli.ation2 The temperature .oeffi.ientof the resistan.e ma/ also be of .on.ern in some
pre.ision appli.ations2 Pra.ti.al resistors are also spe.ified as ha4ing a ma8imumpowerrating
whi.h must e8.eed the anti.ipated power dissipation of that resistor in a parti.ular .ir.uit this is
mainl/ of .on.ern in power ele.troni.s appli.ations2 Resistors with higher power ratings are
ph/si.all/ larger and ma/ require heat sin0ing2 $n a high 4oltage .ir.uit5 attention must
sometimes be paid to the rated ma8imum wor0ing 4oltage of the resistor2
58
http://en.wikipedia.org/wiki/Terminal_(electronics)http://en.wikipedia.org/wiki/Passivity_(engineering)http://en.wikipedia.org/wiki/Electronic_componenthttp://en.wikipedia.org/wiki/Electrical_resistancehttp://en.wikipedia.org/wiki/Electrical_resistancehttp://en.wikipedia.org/wiki/Direct_proportionhttp://en.wikipedia.org/wiki/Resistancehttp://en.wikipedia.org/wiki/Ohm's_lawhttp://en.wikipedia.org/wiki/Electrical_networkshttp://en.wikipedia.org/wiki/Resistance_wirehttp://en.wikipedia.org/wiki/Integrated_circuitshttp://en.wikipedia.org/wiki/Hybrid_circuithttp://en.wikipedia.org/wiki/Printed_circuit_boardhttp://en.wikipedia.org/wiki/Orders_of_magnitudehttp://en.wikipedia.org/wiki/Engineering_tolerance#Electrical_component_tolerancehttp://en.wikipedia.org/wiki/Temperature_coefficienthttp://en.wikipedia.org/wiki/Power_(physics)http://en.wikipedia.org/wiki/Heat_sinkhttp://en.wikipedia.org/wiki/Terminal_(electronics)http://en.wikipedia.org/wiki/Passivity_(engineering)http://en.wikipedia.org/wiki/Electronic_componenthttp://en.wikipedia.org/wiki/Electrical_resistancehttp://en.wikipedia.org/wiki/Electrical_resistancehttp://en.wikipedia.org/wiki/Direct_proportionhttp://en.wikipedia.org/wiki/Resistancehttp://en.wikipedia.org/wiki/Ohm's_lawhttp://en.wikipedia.org/wiki/Electrical_networkshttp://en.wikipedia.org/wiki/Resistance_wirehttp://en.wikipedia.org/wiki/Integrated_circuitshttp://en.wikipedia.org/wiki/Hybrid_circuithttp://en.wikipedia.org/wiki/Printed_circuit_boardhttp://en.wikipedia.org/wiki/Orders_of_magnitudehttp://en.wikipedia.org/wiki/Engineering_tolerance#Electrical_component_tolerancehttp://en.wikipedia.org/wiki/Temperature_coefficienthttp://en.wikipedia.org/wiki/Power_(physics)http://en.wikipedia.org/wiki/Heat_sink8/14/2019 DPGSOSORFV
59/90
The series indu.tan.eof a pra.ti.al resistor .auses its beha4ior to depart from ohms lawK
this spe.ifi.ation .an be important in some high*frequen./ appli.ations for smaller 4alues of
resistan.e2 $n a low*noise amplifierorpre*ampthe noise .hara.teristi.s of a resistor ma/ be an
issue2 The unwanted indu.tan.e5 e8.ess noise5 and temperature .oeffi.ient are mainl/ dependent
on the te.hnolog/ used in manufa.turing the resistor2 The/ are not normall/ spe.ified
indi4iduall/ for a parti.ular famil/ of resistors manufa.tured using a parti.ular te.hnolog/2 A
famil/ of dis.rete resistors is also .hara.teried a..ording to its form fa.tor5 that is5 the sie of
the de4i.e and position of its leads +or terminals, whi.h is rele4ant in the pra.ti.al manufa.turing
of .ir.uits using them2
U$its
The ohm+s/mbol , is the S$unit of ele.tri.al resistan.e5 named after #eorg Simon
Ohm2 An ohm is equi4alent to a 4oltper ampere2Sin.e resistors are spe.ified and manufa.tured
o4er a 4er/ large range of 4alues5 the deri4ed units of milliohm +? m ?>Y=,5 0ilohm +? 0
?>=,5 and megohm +? ' ?>D, are also in .ommon usage2
The re.ipro.al of resistan.e R is .alled .ondu.tan.e# ?9R and is measured in Siemens
+S$unit,5 sometimes referred to as a mho2 Thus a Siemens is the re.ipro.al of an ohm S Y ?2
Although the .on.ept of .ondu.tan.e is often used in .ir.uit anal/sis5 pra.ti.al resistors are
alwa/s spe.ified in terms of their resistan.e +ohms, rather than .ondu.tan.e2
5-,B CAPACITORS
A .apa.itor or .ondenser is a passi4e ele.troni. .omponent .onsisting of a pair of .ondu.tors
separated b/ a diele.tri.2 6hen a 4oltage potential differen.e e8ists between the .ondu.tors5 an
ele.tri. field is present in the diele.tri.2 This field stores energ/ and produ.es a me.hani.al for.e
between the plates2 The effe.t is greatest between wide5 flat5 parallel5 narrowl/ separated.ondu.tors2
An ideal .apa.itor is .hara.teried b/ a single .onstant 4alue5 .apa.itan.e5 whi.h is
measured in farads2 This is the ratio of the ele.tri. .harge on ea.h .ondu.tor to the potential
differen.e between them2 $n pra.ti.e5 the diele.tri. between the plates passes a small amount of
59
http://en.wikipedia.org/wiki/Inductancehttp://en.wikipedia.org/wiki/Low-noise_amplifierhttp://en.wikipedia.org/wiki/Pre-amphttp://en.wikipedia.org/wiki/Ohm_(unit)http://en.wikipedia.org/wiki/%CE%A9http://en.wikipedia.org/wiki/SIhttp://en.wikipedia.org/wiki/Electrical_resistancehttp://en.wikipedia.org/wiki/Georg_Simon_Ohmhttp://en.wikipedia.org/wiki/Georg_Simon_Ohmhttp://en.wikipedia.org/wiki/Volthttp://en.wikipedia.org/wiki/Amperehttp://en.wikipedia.org/wiki/Conductancehttp://en.wikipedia.org/wiki/Siemens_(unit)http://en.wikipedia.org/wiki/SIhttp://en.wikipedia.org/wiki/Mhohttp://en.wikipedia.org/wiki/Inductancehttp://en.wikipedia.org/wiki/Low-noise_amplifierhttp://en.wikipedia.org/wiki/Pre-amphttp://en.wikipedia.org/wiki/Ohm_(unit)http://en.wikipedia.org/wiki/%CE%A9http://en.wikipedia.org/wiki/SIhttp://en.wikipedia.org/wiki/Electrical_resistancehttp://en.wikipedia.org/wiki/Georg_Simon_Ohmhttp://en.wikipedia.org/wiki/Georg_Simon_Ohmhttp://en.wikipedia.org/wiki/Volthttp://en.wikipedia.org/wiki/Amperehttp://en.wikipedia.org/wiki/Conductancehttp://en.wikipedia.org/wiki/Siemens_(unit)http://en.wikipedia.org/wiki/SIhttp://en.wikipedia.org/wiki/Mho8/14/2019 DPGSOSORFV
60/90
8/14/2019 DPGSOSORFV
61/90
8/14/2019 DPGSOSORFV
62/90
A .apa.itor .onsists of two .ondu.tors separated b/ a non*.ondu.ti4e region2 The non*
.ondu.ti4e region is .alled the diele.tri. or sometimes the diele.tri. medium2 $n simpler terms5
the diele.tri. is 7ust an ele.tri.al insulator2 E8amples of diele.tri. mediums are glass5 air5 paper5
4a.uum5 and e4en a semi.ondu.tor depletion region.hemi.all/ identi.al to the .ondu.tors2 A
.apa.itor is assumed to be self*.ontained and isolated5 with no net ele.tri. .harge and no
influen.e from an/ e8ternal ele.tri. field2 The .ondu.tors thus hold equal and opposite .harges
on their fa.ing surfa.es5 and the diele.tri. de4elops an ele.tri. field2 $n S$ units5 a .apa.itan.e of
one faradmeans that one .oulombof .harge on ea.h .ondu.tor .auses a 4oltage of one 4olt
a.ross the de4i.e2
The .apa.itor is a reasonabl/ general model for ele.tri. fields within ele.tri. .ir.uits2 An ideal
.apa.itor is wholl/ .hara.teried b/ a .onstant .apa.itan.e C5 defined as the ratio of .harge ZM
on ea.h .ondu.tor to the 4oltage - between them
Sometimes .harge build*up affe.ts the .apa.itor me.hani.all/5 .ausing its .apa.itan.e to 4ar/2 $n
this .ase5 .apa.itan.e is defined in terms of in.remental .hanges
E$er%( stor#%e
6or0must be done b/ an e8ternal influen.e to Lmo4eL .harge between the .ondu.tors in a
.apa.itor2 6hen the e8ternal influen.e is remo4ed the .harge separation persists in the ele.tri.
field and energ/ is stored to be released when the .harge is allowed to return to its equilibrium
position2 The wor0 done in establishing the ele.tri. field5 and hen.e the amount of energ/ stored5
is gi4en b/
C)rre$t/0o-t#%e re-#tio$
The .urrent i+t, through an/ .omponent in an ele.tri. .ir.uit is defined as the rate of flow of a
.harge q+t, passing through it5 but a.tual .harges5 ele.trons5 .annot pass through the diele.tri.
la/er of a .apa.itor5 rather an ele.tron a..umulates on the negati4e plate for ea.h one that lea4es
the positi4e plate5 resulting in an ele.tron depletion and .onsequent positi4e .harge on one
62
http://en.wikipedia.org/wiki/Electrical_conductorhttp://en.wikipedia.org/wiki/Dielectric_mediumhttp://en.wikipedia.org/wiki/Insulator_(electrical)http://en.wikipedia.org/wiki/Vacuumhttp://en.wikipedia.org/wiki/Semiconductorhttp://en.wikipedia.org/wiki/Depletion_regionhttp://en.wikipedia.org/wiki/Electric_chargehttp://en.wikipedia.org/wiki/SIhttp://en.wikipedia.org/wiki/Faradhttp://en.wikipedia.org/wiki/Coulombhttp://en.wikipedia.org/wiki/Volthttp://en.wikipedia.org/wiki/Work_(thermodynamics)http://en.wikipedia.org/wiki/Equilibriumhttp://en.wikipedia.org/wiki/Electrical_conductorhttp://en.wikipedia.org/wiki/Dielectric_mediumhttp://en.wikipedia.org/wiki/Insulator_(electrical)http://en.wikipedia.org/wiki/Vacuumhttp://en.wikipedia.org/wiki/Semiconductorhttp://en.wikipedia.org/wiki/Depletion_regionhttp://en.wikipedia.org/wiki/Electric_chargehttp://en.wikipedia.org/wiki/SIhttp://en.wikipedia.org/wiki/Faradhttp://en.wikipedia.org/wiki/Coulombhttp://en.wikipedia.org/wiki/Volthttp://en.wikipedia.org/wiki/Work_(thermodynamics)http://en.wikipedia.org/wiki/Equilibrium8/14/2019 DPGSOSORFV
63/90
ele.trode that is equal and opposite to the a..umulated negati4e .harge on the other2 Thus the
.harge on the ele.trodes is equal to the integral of the .urrent as well as proportional to the
4oltage as dis.ussed abo4e2 As with an/ antideri4ati4e5a .onstant of integration is added to
represent the initial 4oltage 4 +t>,2 This is the integral form of the .apa.itor equation5
2
Ta0ing the deri4ati4e of this5 and multipl/ing b/ C5 /ields the deri4ati4e form5
2
The dual of the .apa.itor is the indu.tor5 whi.h stores energ/ in the magneti. fieldrather than the
ele.tri. field2 $ts .urrent*4oltage relation is obtained b/ e8.hanging .urrent and 4oltage in the
.apa.itor equations and repla.ing C with the indu.tan.e "2
63
http://en.wikipedia.org/wiki/Integralhttp://en.wikipedia.org/wiki/Antiderivativehttp://en.wikipedia.org/wiki/Constant_of_integrationhttp://en.wikipedia.org/wiki/Duality_(electrical_circuits)http://en.wikipedia.org/wiki/Inductorhttp://en.wikipedia.org/wiki/Magnetic_fieldhttp://en.wikipedia.org/wiki/Integralhttp://en.wikipedia.org/wiki/Antiderivativehttp://en.wikipedia.org/wiki/Constant_of_integrationhttp://en.wikipedia.org/wiki/Duality_(electrical_circuits)http://en.wikipedia.org/wiki/Inductorhttp://en.wikipedia.org/wiki/Magnetic_field8/14/2019 DPGSOSORFV
64/90
8/14/2019 DPGSOSORFV
65/90
1! A%r 'tudio
2! on+rog
A,R St)dio1'ro%r#! Editor2&)nstructions for rogramming and omiling within A= 'tudio 4en A= 'tudio$ +ou should be greeted with the following dialog&>it /ew
>it /ew ro:ect( )f this dialog does not show$ go to ro:ect !? /ew ro:ect(@ou should see the following dialog&
65
8/14/2019 DPGSOSORFV
66/90
hoose A= for ro:ect t+e and t+e in a ro:ect name( .his eamlewill make a director+ calledtestB and a file called test(c( >it net to choose +our latform "+ou canchoose A= 'imulator to be able to
simulate +our ro:ect in A= 'tudio# then hit inish(A new window should come u where +ou can t+e in +our code( /otice itwill highlight the roer s+nta( .+e in a samle rogram like the following&
66
8/14/2019 DPGSOSORFV
67/90
8/14/2019 DPGSOSORFV
68/90
$n the ne8t step sele.t LA-R mi.roL and /our mi.ro.ontroller t/pe that /ou will be programming
+e82 ATmega;,2
At this point Pon/Prog .onfiguration is .omplete and we .an open he8 program with whi.hA-R mi.ro.ontroller will be flashed2 #o to LFileL menu5 sele.t LOpen Program +F"AS!,
File 222L5 and point to the he8 file to open it up2 )ou should see he8 numbers as shown on the
s.reen below2 $f /ou ha4enQt .onne.ted A-R Programmer dongle to /our .omputerQs seri
port /et5 then now is the time2 'a0e sure that A-R Programmer is ph/si.all/ .onne.ted to /our
A-R mi.ro.ontroller through So.0et PC or through $CSP D*P$N .onne.tor2 Finall/ .li.0 on the
68
8/14/2019 DPGSOSORFV
69/90
8/14/2019 DPGSOSORFV
70/90
8/14/2019 DPGSOSORFV
71/90
Cli.0 on L)esL button to .onfirm the programming2
Now sit tight5 rela8 and wat.h the programming progress on the status bar2 Pon/Prog will program A-Rmi.ro.ontroller and 4erif/ if the he8 file was transferred without an/ errors2 For /our information this pro.ess
shouldnQt reall/ ta0e more than ?> to => se.onds2 This depends on the sie of the program that /ouQre tr/ing to
flash2
After programming is .ompleted L6rite su..essfulL window will be shown letting /ou 0now that A-R
mi.ro.ontroller has been programmed5 and is now read/ to be used2
71
8/14/2019 DPGSOSORFV
72/90
About AVR Programmer
This simple A-R Programmer will allow /ou to painlessl/ transfer he8 programs to most
AT'E" A-R mi.ro.ontrollers without sa.rifi.ing /our budget and time2 $t is more reliable than
most other simple A-R programmers a4ailable out there and .an be built in 4er/ short amount of
time2
A-R programmer .onsists of in*.ir.uit serial programmer +dongle, and small p.b with a ($P
so.0et where /ou .an fit /our mi.ro.ontroller and ha4e it qui.0l/ programmed2
)ou ma/ also use this programmer as a stand alone in*.ir.uit serial programmer that .an be used
to .on4enientl/ program A-R mi.ro.ontrollers without remo4ing them from the target .ir.uit2
Entire A-R programmer has been build with using .ommon parts and fits in the .ase of the
serial .onne.tor2 The so.0et p.b has been .reated to fit a
8/14/2019 DPGSOSORFV
73/90
8/14/2019 DPGSOSORFV
74/90
8/14/2019 DPGSOSORFV
75/90
beginning2 This operation of high to low of the reset pin ta0es pla.e in fra.tion of a se.ond as
de.ided b/ the time .onstant R and C2
For e8ample A ?>WF .apa.itor and a ?>0[ resistor would render a ?>>ms time to pin number
from logi. high to low5 there after the pin number remains low2
OPERATION E'PLANATION
Wo>&"?3
$slanding of grid is .onne.ted to in4erter whi.h is basi.all/ managing two parameters2
One parameter is 4oltage and other parameter is frequen./2 Sin.e we .annot .hange the
frequen./ we ha4e ta0en a ::: timer in a free running astable mode5 the frequen./ of whi.h .an
be 4aried b/ R2 we 0now that b/ the R C .ombination5 the multi*4ibrator mode of the :::
timer output .an be generated at different frequen.ies2 So5 the output is gi4en to the 'C pin =2>
of port = of 'C whi.h has the pro4ision of .hanging the frequen./ ;! :
So5 the 'C will get the .hanged frequen./ at pin =2> of port =5 we also ha4e pro4ision of fitting
the dire.t frequen./ at pin =2> of port = sin.e the dire.t frequen./ we are not sure that what will
be the frequen./ at that parti.ular time2 $t .ould be somewhere alwa/s awa/ from :>! whi.h is
diffi.ult to test it2 This is the reason wh/ we use a ::: timer for gi4ing pre.isel/ :! or :> !
or ! whi.h has to be tested b/ the program2 $n the program it is so written that the output
from ::: timer whi.h is fed to the 'C goes to be low ; ! or abo4e :
.orresponding outputs of 'C will go high and whi.h will result in swit.hing GON or OFFH a
load to indi.ate that the islanding has ta0en pla.e2 +for frequen./ .on.erned,2
As per the 4oltage is .on.erned we ha4e ta0en < .omparators2 oth the .omparators are
gi4en to i2e25 one for in4erting input and other for non*in4erting input whi.h are gi4en at a
parti.ular 4oltage2 $nitiall/ the/ are so set that the output of these two .omparators whi.h is
going to 'C pin >2? and pin >2< of port
8/14/2019 DPGSOSORFV
76/90
.ommand, and if it goes low +it gi4es a low .ommand, to the mi.ro.ontroller2 That is how the
low*high5 high*low .ommands are handled b/ mi.ro.ontroller then the program ta0es ones2
This program is also written that in either of these .ases whether the few is low 9 high +or,
it .ould be either in high 9 low .ondition the duration will be :>5 5 ; >D greater than :
8/14/2019 DPGSOSORFV
77/90
8/14/2019 DPGSOSORFV
78/90
? &: "'=:;
? &D ::: T$'ER
IC .a%e%
? >*P$N
< ;*P$N
? ?*P$N
DIODE
; (?*(; $N>>
Ta"%&%to%
? M? C:
&%4e66a"eo9%
? CR)STA"? ??2>:
8/14/2019 DPGSOSORFV
79/90
8/14/2019 DPGSOSORFV
80/90
8/14/2019 DPGSOSORFV
81/90
8/14/2019 DPGSOSORFV
82/90
TR>>K
TR?>K
.nt>K
temp>K
tempT">K
!e8>> *^ ?se.
.nt@@.ntK
T!?>8FCK
T"?>8FEK
4oid !e8K
&C! i5rem>K
&$T ni0K
for+i>Ki];Ki@@,
`
if++4al,+?^^i,,
sumsum@pow+K
7+&$T,sumK
779K
82
8/14/2019 DPGSOSORFV
83/90
8/14/2019 DPGSOSORFV
84/90
8/14/2019 DPGSOSORFV
85/90
8/14/2019 DPGSOSORFV
86/90
8/14/2019 DPGSOSORFV
87/90
&C! 7K
&$T iK
for+7>K7].h?K7@@,
for+i>Ki]?
8/14/2019 DPGSOSORFV
88/90
,
8/14/2019 DPGSOSORFV
89/90
is performed without mi.ro.ontroller2 Firstl/5 we .he.0 the output of the transformer5 whether
we get the required ?< 4 AC 4oltage2
Then we appl/ this 4oltage to the power suppl/ .ir.uit2 Note that we do this test without
mi.ro.ontroller be.ause if there is an/ e8.essi4e 4oltage5 this ma/ lead to damaging the
.ontroller2 6e .he.0 for the input to the 4oltage regulator i2e25 are we getting an input of ? thpin2 !en.e we .he.0 for the
4oltage le4el at >thpin2 Similarl/5 we .he.0 for the other terminals for the required 4oltage2 $n
this wa/ we .an assure that the 4oltage at all the terminals is as per the requirement2
,-.I.LIOGRAPHY
TE'T .OO)S REFERED
?2 GThe ;>:? 'i.ro.ontroller and Embedded s/stemsH b/ 'uhammad Ali 'aidi and Jani.e
#illispie 'aidi 5 Pearson Edu.ation2
89
8/14/2019 DPGSOSORFV
90/90