Anda di halaman 1dari 74

KARNATAKA STATE OPEN UNIVERSITY

MANASA GANGOTHRI, MYSORE- 570006


CERTIFICATE
This is to certify that this project entitled Intelligent Energy Saver Submitted by
Ashok Kumar TS ith !egister "o ##$%#&'(TE)*%+ is submitted on,,, to the
KARNATAKA STATE OPEN UNIVERSITY- Karnataka- India- in partial fulfillment of
the re.uirements for the aard of B.Tech i E!ec"#$ic% &' C$(()ic&"i$ is a record
of bonafied ork undertaken by him/
Student "ame0 Ashok Kumar TS Internal 1uide "ame0 2r/Kannan
Signature0 3esignation0
3ate0 Internal 1uide Signature0
3ate0
Study )enter "ame0 E4ternal 1uide "ame0
Seal of Study )entre 3esignation0
E4ternal 1uide Signature0
3ate0 3ate0

5 # 5
KARNATAKA STATE OPEN UNIVERSITY
MANASA GANGOTHRI, MYSORE- 570006
TIT*E OF THE PRO+ECT REPORT
Intelligent Energy Saver
A PRO+ECT REPORT
Submitted by
A%h$, K)(&# TS
--./-0*BTEC0/5
Under the guidance of
M#.K&&
I 1&#"i&! 2)!2i!!(e" $2 "he #e3)i#e(e"
F$# "he &4&#' $2 "he 'e5#ee $2
B.Tech
In
Electronics and )ommunication Engg
A"
Sh&#&'& Vi,&% T#)%"
N$..506-6-., /
'
2!$$#. *&,%h(i c$(1!e7, -0
"h
(&i
/7
"h
c#$%%, .
"h
8!$c,, +&9&&5&#, B&5&!$#e---
M$"h : Ye&#
+)!9-/0-.
5 % 5

;ec!&#&"i$
I certify that
a/ The ork contained in this report is original and has been done by me under the
guidance of my supervisor6s7/
b/ The ork has not been submitted to any other Institute for any degree or diploma/
c/ I have folloed the guidelines provided by the Institute in preparing the report/
d/ I have conformed to the norms and guidelines given in the Ethical )ode of )onduct
of the Institute/
e/ 8henever I have used materials 6data- theoretical analysis- figures- and te4t7 from
other sources- I have given due credit to them by citing them in the te4t of the report
and giving their details in the references/ 9urther- I have taken permission from the
copyright oners of the sources- henever necessary/
5 & 5
ACKNO<*E;GEMENT
9irst and foremost- e ould like to e4press our special thanks to- 3r/ 2 Sukumar- our head of the
department and 3r/ : ;dayashankara for their guidance and support in completing the project/
8e ould like to sincerely thamk all our lecturers and lab faculty for their suggestions- guidance and help
rendered in completing this project/ 8e also thank all our friends ithout hose help and suggestions this
project ould not have taken its present form/
8e do hope that e have covered all the aspects of an end user<s needs/ 8e look forard to the feedback
on the improvement of this project/
HARISHA BH
ASHOK KUMAR
ROSHAN
5 $ 5
ABSTRACT
Intelligent Energy Saving System can be used in places like here lighting is very important/ The
libraries ill be ell illuminated ith many lamps/ 8hen people are not present at a reading place the
lighting can be made =99 and hen they are present- the lighting made ="/ All these can be done through
by 3imming circuit and >I! sensor/
If a person entering to the monitored area- the >I! sensors activates and sense the person- gives to
the micro controller/ The Infrared energy emitted from the living body is focused by a 9resnel lens segment/
Then only the >I! sensor activates/ After sensing the person '3! checks the light intensity of the
monitored area- hether it is bright or dark/ 3epending on the '3! output- the lamp may be =" ? =99 by
using 3immer circuit/
(y using this system e can adjust the speed of 9an according to the room temperature measured by
Thermostat- hich is connected to the micro controller/
To display the room temperature of >I! mode operation e are using the ')3 display/
5 + 5
IN;E=
>A1E "=

#/ INTRO;UCTION >
#/# =bjective of the >roject #*
#/% (lock 3iagram ##
#/& >inciple =f =peration #%
#/$ System 9eatures #&
#/+ E.uipments #+
%/ ;ESCRIPTION OF THE PRO+ECT 6
%/# (lock 3iagram 3escription
%/% Schematic 3iagrams
%/& Schematic E4planation
&. HAR;<ARE ;ESCRIPTION -0
&/# 2icrocontroller 6>I)#@9A%7
&/% >assive Infrared Sensor
&/& 'ight 3ependent !esistor
&/$ Thermostat 63S#@%#7
&/+ Bero )rossing 3etector
&/@ >oer Supply
&/A 'i.uid )rystal 3isplay
&/C 3immer
&/D =ptocoupler
&/#* 'oads
$/ SO<FT<ARE ;ESCRIPTION 6.
$/# 9lo )hart
$/% Source )ode
+. RESU*T
@/ CONC*USION AN; FUTURE ;IRECTIONS
BIB*IOGRAPHY
5 @ 5
*IST OF FIGURES
-. (lock 3iagram
%/ Schematic 3iagram
&/ Architecture of >I)#@9A%
$/ >in 3iagram of >I) #@9A%
+/ =peration of >I! 3iagram
@/ =peration of '3! 3iagram
A/ '3! )ircuit 3iagram
C/ >in 3iagram of 3S#@%#
D/ 9unctional (lock 3iagram of 3S#@%#
#*/ B)3 )ircuit 3iagram
##/ B)3 =utput aveform
#%/ >oer )ircuit 3iagram
#&/ >in 3iagram of ')3
#$/ 3immer )ircuit 3iagram
#+/ >in 3iagram of =pto)oupler

5 A 5
CHAPTER -
INTRO;UCTION
-. INTRO;UCTION
Intelligent Energy Saving System- the aim of the project is to save the energy/ In this project
e are using various sensors- controlling and display/
Eoever- in this project ork the basic signal processing of various parameters hich are
temperature- '3!- Smoke sensor/ 9or measuring various parameters values- various sensors are used and the
output of these sensors are converted to control the parameters/ The control circuit is designed using micro5
controller/ The outputs of all the three parameters are fed to micro5controller/ The output of the micro5
controller is used to drive the ')3 display- so that the value of each parameter can be displayed/ In addition
to the ')3 display micro5controller outputs are also used to driver a relay independently/ This relay
energiFes and de5energiFes automatically according to the condition of the parameter/
-.- OB+ECTIVE OF THE PRO+ECT? -
The aim of the project is to save the energy or poer- used in places like libraries here lighting is
very important for the people ho come to read books/ So- the libraries ill be ell illuminated ith many
lamps/
At the same time hen people are not present at a particular reading place the lighting can be made
off by using 3immer and hen people come to that area- according to the '3! lighting can be made
sufficiently brighter/
(y using this system- e can also adjust the speed of the 9an according to the room
temperature using Thermostat and 3immer/
5 C 5
-./ PRINCIP*E OF OPERATION
)onsider a particular table in the library- hich is connected ith our e4perimental kit /8hen a
person entering into that place the >I! sensor absorbs the black body radiation emitted by that person and
activates it/ The ')3 display ill displays the >I! ="/
After some time delay the light ill glos for some time by using the 3immer circuit and ith the
help of '3! sensor it checks the room lightening - and it takes the condition hen the light is sufficient the
lamp ill be in =99 state and hen light is insufficient the lamp ill be in =" state/
8ith the help of Thermostat sensor the room temperature is measured and the speed of the 9an varies
according to the temperature of Thermostat/ The ')3 display ill displays the room temperature in degree
centigrade/
8hen a person is leaving that place- the >I! sensor ill activate again and firstly the 9an ill be
=99 and after some time delay the lamp also ill be =99/ "o the ')3 display is in stand by mode state/
And the main supply poer ill be sitched =99/
5 D 5
-.0 B*OCK ;IAGRAM?
-.. S9%"e( Fe&")#e%?

Easy operation
)onvenient
Affordable
Re3)i#e' S,i!!%?
;nderstanding of 2icro controller
Embedded ) >rogramming
;nderstanding Interfacing Techni.ues
Knoledge on Sensors
5 #* 5
3esign and 9abrication of >)(
P#$@ec" 1h&%e? -
Schematic design and draing of >)(
3esign and Interfacing )ircuits for 2icro controller
>reparation of >)(
Assembling and Testing of Interfacing )ircuits
)ode for the Application
3ebugging and Testing
>roject !eport
-.. EAUIPMENTS? -
>rinted )ircuit (oard
2icro controller >I) #@9A%
+:- #%: 3c >oer supply
I! sensor >assive Infrared Sensor
'3! 'ight 3ependent !esistor
Thermostat
')3 =ptra4- % line by #@ characters
Bero )rossing 3etector
5 ## 5
'amp
9an
CHAPTER /.
;ESCRIPTION OF THE PRO+ECT
/. ;ESCRIPTION OF THE PRO+ECT? -
/.- B*OCK ;IAGRAM E=P*ANATION? -
PIR SENSOR? -
A >I! detector is a motion detector that senses the heat emitted by a living body/ These are
often fitted to security lights so that they ill sitch on automatically if approached/ They are very effective
in enhancing home security systems/
The sensor is passive because- instead of emitting a beam of light or microave energy that
must be interrupted by a passing person in order to sense that person- the >I! is simply sensitive to the
infrared energy emitted by every living thing/ 8hen an intruder alks into the detector<s field of vision- the
detector sees a sharp increase in infrared energy/
*;R? -
'3!<s or 'ight 3ependent !esistors are very useful especially in light?dark sensor circuits/
These help in automatically sitching =" ?=99 the street lights and etc/- normally the resistance of an '3!
is very high- sometimes as very high as #****** ohms- but hen they are illuminated ith light- resistance
drop dramatically/ Electronic opto sensors are the devices that alter their electrical characteristics- in the
presence of visible or invisible light/ The best5knon devices of these types are the light dependent resistor
6'3!7- the photo diode and the phototransistors/
BC;? -
5 #% 5
A Fero crossing detector literally detects the transition of a signal aveform from positive
and negative- ideally providing a narro pulse that coincides e4actly ith the Fero voltage condition/
THERMOSTAT? -
In this project e are making use 3S #@%# thermostat- it<s a non5contact digital type
temperature transducer suitable for measuring room temperature/ The ord Gthermistor< is an acronym for
thermal resistor- i/e/- a temperature sensitive resistor/ It is used to detect very small changes in temperature/
The variation in temperature is reflected through appreciable variation of the resistance of the device/
*C; ;ISP*AY? -
A li.uid crystal is a material 6normally organic for ')3<s7 that ill flo like a li.uid but
hose molecular structure has some properties normally associated ith solids/ The 'i.uid )rystal 3isplay
6')37 is a lo poer device/ The poer re.uirement is typically in the order of microatts for the ')3/
Eoever- an ')3 re.uires an e4ternal or internal light source/ 8e are making use of ')3 in our project to
display the >I! mode and room temperature/
OPTOCOUP*ER? -
=ptocoupler is a device that uses a short optical transmission path to transfer a signal
beteen elements of a circuit- typically a transmitter and a receiver- hile keeping them electrically isolated/
A common implementation involves a 'E3 and a phototransistor- separated so that light may travel across a
barrier but electrical current may not/
;IMMER? -
3immers are devices used to vary the brightness of a light/ (y decreasing or increasing the
!2S voltage and hence the mean poer to the lamp it is possible to vary the intensity of the light output/
Although variable5voltage devices are used for various purposes- the term dimmer is generally reserved for
those intended to control lighting/
5 #& 5
/./ SCHEMATIC ;IAGRAM? -
5 #$ 5
/.0 SCHEMATIC E=P*ANATION? -
PORT A? -
>ort A can acts as a both input as ell as output port/ It is having @ pins 6A*5A+7/ In these A*
is connected to 3immer#- A# is connected to 3immer% and A$ is connected to B)3 output/
PORT B? -
>ort ( can acts as a both input as ell as output port/ It is having C pins 6(*5(A7/ In these (#
connected to register selection pin6!?S7- (% is connected to read?rite6!?87 and (& pin is connected to
enable pin/
PORT C? -
>ort ) can acts as a both input as ell as output port/ It is having C pins 6)*5)A7/ In
these !)& and !)$ connected to the thermostat pins/
#%2 EF )rystal =scillator is connected in beteen D
th
and #*
th
pins of micro controller/
!eset pin is connected to the pin number# i/e/- 2)'!?:>>/
C
th
and #D
th
pins are connected to ground 6:ss7/
5 #+ 5

CHAPTER 0.
HAR;<ARE ;ESCRIPTION
0. HAR;<ARE ;ESCRIPTION0 5
&/# MICRO CONTRO**ER? -
INTRO;UCTION? -
2icrocontrollers these days are silent orkers in many apparatus- ranging from the ashing
machine to the video recorder/ "early all of these controllers are mask programmed and therefore are of very
little use for applications that re.uire the programs to be changed during the course of e4ecution/
Even if the programs could be altered- the information necessary to do so an instruction set-
an assembler language and description for the basic hardare is either very difficult to obtain or are in
ade.uate hen it came to the issue of accessibility/
A marked e4ception to the above category is the >I)I@9A% micro controller belonging to the
>I) family/ This microcontroller has features that seem to make it more accessible than any other single
chip microcontroller ith a reasonable price tag/
The >I)I@9A%- an C5bit single chip microcontroller has got a poerful )>; optimiFed for
control applications/ The >I)I@9A% is an C H bit single chip microcontroller/ The #@fACAAA provides a
significantly more poerful architecture- a more poerful instruction set and a full serial port/
5 #@ 5
The >I)I@9A% is a complete micro controller/ There are $* pins needed by the five5
bidirectional ports/ >ins provide poer- allo you to connect a crystal clock and provide a fe timing and
control signals/
The architecture includes the A';- 8 register- the stackI a block of registers/ All these
devices are connected to via internal C5bit data bus/
Each I?= port is also connected to the C5bit internal data bus through a series of registers/
These registers hold data during I?= transfers and control the I?= ports/ The architectural block diagram also
shos the >I)I@9A% !=2 and !A2
C$(1&#i%$ $2 (ic#$1#$ce%%$# &' (ic#$c$"#$!!e#?
The difference beteen 2icroprocessor and 2icro controller is 2icroprocessor can only
process ith the data- 2icro controller can control e4ternal device/ That is if you ant sitch =" or
=99 a device- you need peripheral I)s to do this ork ith 2icro controller you can directly control the
device/
'ike 2icroprocessor- 2icro controller is available ith different features/ It is available ith
inbuilt memory- I?= lines- timer and A3)/ The micro controller- hich e are going to use/
A'C&"&5e% $2 Mic#$c$"#$!!e#%?
#/ If a system is developed ith a microprocessor- the designer has to go for e4ternal memory such as
!A2- !=2 or E>!=2 and peripherals and hence the siFe of the >)( ill be large enough to hold all the
re.uired peripherals/
%/ (ut the microcontroller has got all these peripheral facilities on a single chip so development of a
similar system ith a microcontroller reduces >)( siFe and cost of the design/
&/ =ne of the major difference beteen a microcontroller and a microprocessor is that a controller often
deals ith bits- not bytes as in the real orld application- for e4ample sitch contacts can only be open or
close- indicators should be lit or dark and motors can be either turned on or off and so forth/
$/ The 2icrocontroller has to C5bit timers? counters built ithin it- hich makes it more suitable to
this application since e need to produce some accurate timer delays/ It is even more advantageous that the
timers also act as interrupt/
5 #A 5
ABOUT PICI6F7/?
The >I)I@9A% is a lo5poer- high5performance )2=S C5bit microcomputer ith %K bytes
9lash programmable and erasable read only memory 6>E!=27/ >I)I @9A% is a poerful microcomputer-
hich provides a highly fle4ible and cost5effective solution to many embedded control application/
FEATURES OF PIC -6F7/? -
Hi5h 1e#2$#(&ce RISC CPU?
=nly &+ single ord instructions to learn
All single cycle instructions e4cept for program branches- hich are to5cycle/
=perating speed0 3)5%* 2EB clock input
3)5%** ns instruction cycle
;p to %k 4 #$ ords of program 2emory-
;p to #%C 4 C bytes of 3ata 2emory 6!A27
>inout compatible to >I) #@)A%?A%A and >I) #@9CA%/
Interrupt capability/
Eight5 level deep hard are stack/
3irect- Indirect and !elative Addressing modes/
Pe#i1he#&! Fe&")#e%?
Eigh Sink?Source )urrent0 %+ mA
Timer*0 C5bit timer?counter ith C5bit prescaler
Timer#0 #@5bit timer?counter ith prescaler- can be incremented during
:ia E4ternal crystal?clock/
Timer%0 C5bit timer?counter ith C5bit period register- prescaler and
postscaler
)apture- )ompare- >82 6))>7 module
5 )apture is #@5bit- ma4/ resolution is #%/+ ns
5 #C 5
)ompare is #@5bit- ma4/ resolution is %** ns
>82 ma4/ resolution is #*5bit
C5bit- +5channel analog5to5digital converter
Synchronous Serial >ort 6SS>7 ith S>IJ 62aster?Slave7 and I
%
)J 6Slave7
(ron5out detection circuitry for (ron5out !eset 6(=!7
CMOS Tech$!$59?
'o poer- high speed )2=S 9'ASE technology
9ully static design
8ide operating voltage range0 %/*: to +/+:
Industrial temperature range
'o poer consumption0
K */@ mA typical L &:- $ 2EF
%* MA typical L &:- &% kEF
K # MA typical standby current
S1eci&! Mic#$c$"#$!!e# Fe&")#e%?
#-*** erase?rite cycle 9'ASE program memory typical
>oer5 on !eset 6>=!7
>oer5up Timer 6>8!T7
=scillator Start Hup Timer 6=ST7
8atchdog Timer 683T7 ith its on on5chip !) oscillator for reliable operation/
!) oscillator for reliable operation
>rogrammable code protection
>oer saving S'EE> mode
Selectable oscillator options
In5)ircuit Serial >rogrammingJ 6I)S>J7 via % pins
>rocessor read access to program memory
5 #D 5
ARCHITECTURE OF PIC -6F7/ MICRO CONTRO**ER? -
The >I)#@9A% belongs to the 2id5!ange family of the >I) micro devices/ The program
memory contains %K ords- hich translate to %*$C instructions- since each #$5bit program memory ord is
the same idth as each device instruction/ The data memory 6!A27 contains #%C bytes/ There are %% I?= pins
that are user configurable on a pin5to5pin basis/ Some pins are multiple4ed ith other device functions/
The%e 2)c"i$% ic!)'e? -
E7"e#&! i"e##)1"
Ch&5e $ PORTB i"e##)1"%
Ti(e#0 c!$c, i1)"
Ti(e#- c!$c,6$%ci!!&"$#
C&1")#e6C$(1&#e6P<M
A6; c$Ce#"e#
SPI6I
/
C
*$4 V$!"&5e P#$5#&((i5
Ici#c)i" ;e8))5e#

5 %* 5
ARCHITECTURE ;IAGRAM OF PIC -6F7/?-
5 %# 5
PIN ;IGRAM OF PIC -6F7/?
5 %% 5
PIN ;ESCRIPTION?
MC*R6VPP?
2aster )lear 6!eset7 input or programming voltage input/ This pin is an active lo !ESET to the
device/
RA0 - RA5?
These are the bi5directional Input ? output >=!TA pins/
!A#- !A%- are the analog inputs #- analog input%/
!A& can also be analog input& or analog reference voltage/
!A$ can also be the clock input to the Timer* module/ =utput is open drain type/
!A+ can also be analog input$ or the slave select for the synchronous serial port/
VSS?
1round reference for logic and I?= pins/
OSC-6C*K-?
=scillator crystal input ? E4ternal clock source input/
OSC/6C*KO?
=scillator crystal output/ )onnects to crystal or resonator in )rystal =scillator mode/ In !) mode- the
=S)% pin outputs )'K=- hich has #?$ the fre.uency of =S)#- and denotes the instruction cycle rate/
RC0 D RC7?
These are the bidirectional Input ? =utput >=!T) pins/
!)*?T#=S=? T#)K/ !)* can also be the Timer# oscillator output or Timer#
)lock input/
!)#?T#=SI is the Timer# oscillator input/
!)%?))> is the )apture# input?)ompare# output? >82# output/
5 %& 5
!)&?S)K?S)'/ !)& can also be the synchronous serial clock input?output for
(oth S>I and I%) modes/
!)$?S3I?S3A is the S>I 3ata In 6S>I mode7 or 3ata I?= 6I%) mode7/
!)+?S3= is e the S>I 3ata =ut 6S>I mode7/
!)@
!)A/
V;;?
>ositive supply for logic and I?= pins/
RB0 D RB7?
These are the bi5directional I?= >=!T( pins/ >=!T( can be softare
programmed for internal eak pull5up on all inputs/
!(*?I" is the e4ternal interrupt pin/
!(#- !(%- !(& are the bi5directional pins/
!($ is the Interrupt5on5change pin/
!(+ is the Interrupt5on5change pin/
!(@?>1) is the Interrupt5on5change pin/ Serial programming clock/
!(A?>13 is the Interrupt5on5change pin/ Serial programming data/
I 6 O PORTS?
Some pins for these I?= ports are multiple4ed ith an alternate function for the peripheral features on
the device/ In general- hen a peripheral is enabled- that pin may not be used as a general purpose I?= pin/
Additional information on I?= ports may be found in the >I) micro 2id5!ange 2); !eference 2anual-
63S&&*%&7/
PORTA &' "he TRISA Re5i%"e#?
>=!TA is a @5bit ide- bi5directional port/ The corresponding data direction register is T!ISA/
Setting a T!ISA bit 6N #7 ill make the corresponding >=!TA pin an input 6i/e/- put the corresponding
output driver in a Ei5Impedance mode7/ )learing a T!ISA bit 6N *7 ill make the corresponding >=!TA pin
an output 6i/e/- put the contents of the output latch on the selected pin
!eading the >=!TA register- reads the status of the pins- hereas riting to it ill rite to the port
latch/ All rite operations are read5modify5rite operations/ Therefore- a rite to a port implies that the port
pins are read- this value is modified and then ritten to the port data latch >in !A$ is multiple4ed ith the
Timer* module clock input to become the !A$?T*)KI pin/ The !A$?T*)KI pin is an Schmitt Trigger input
and an open drain output/
5 %$ 5
All other !A port pins have TT' input levels and full )2=S output drivers/ =ther >=!TA pins are
multiple4ed ith analog inputs and analog :!E9 input/ The operation of each pin is selected by
clearing?setting the control bits in the A3)="# register 6A?3 )ontrol !egister#7/
=ther >=!TA pins are multiple4ed ith analog inputs and analog :!E9 input/ The operation of each
pin is selected by clearing?setting the control bits in the A3)="# register 6A?3 )ontrol !egister#7/ =ther
>=!TA pins are multiple4ed ith analog inputs and analog :!E9 input/ The operation of each pin is
selected by clearing?setting the control bits in the A3)="# register 6A?3 )ontrol !egister#7/
The T!ISA register controls the direction of the !A pins- even hen they are being used as analog
inputs/ The user must ensure the bits in the T!ISA register are maintained set hen using them as analog
inputs/
PORTB &' "he TRISB Re5i%"e#?
>=!T( is an C5bit ide- bi5directional port/ The corresponding data direction register is T!IS(/
Setting a T!IS( bit 6N #7 ill make the corresponding >=!T( pin an input 6i/e/- put the corresponding
output driver in a Ei5Impedance mode7/ )learing a T!IS( bit 6N *7 ill make the corresponding >=!T( pin
an output 6i/e/- put the contents of the output latch on the selected pin7/
Each of the >=!T( pins has a eak internal pull5up/ A single control bit can turn on all the pull5ups/
This is performed by clearing bit !(>; 6=>TI="KAO7/ The eak pull5up is automatically turned off hen
the port pin is configured as an output/ The pull5ups are disabled on a >oer5on !eset/
9our of >=!T(<s pins- !(A0!($- have an interrupt5on5change feature/ =nly pins configured as
inputs can cause this interrupt to occur 6i/e/- any !(A0!($ pin configured as an output is e4cluded from the
interrupt on change comparison7/ The input pins 6of !(A0!($7 are compared ith the old value latched on
the last read of >=!T(/ The mismatch outputs of !(A0!($ are =!<d together to generate the !( >ort
)hange Interrupt ith flag bit !(I9 6I"T)="K*O7/
PORTC &' "he TRISC Re5i%"e#?
>=!T) is an C5bit ide- bi5directional port/ The corresponding data direction register is T!IS)/
Setting a T!IS) bit 6N #7 ill make the corresponding >=!T) pin an input 6i/e/- put the corresponding
output driver in a Ei5Impedance mode7/ )learing a T!IS) bit 6N *7 ill make the corresponding >=!T) pin
an output 6i/e/- put the contents of the output latch on the selected pin7/ >=!T) is multiple4ed ith several
peripheral functions/ >=!T) pins have Schmitt Trigger input buffers/
5 %+ 5
8hen enabling peripheral functions- care should be taken in defining T!IS bits for each >=!T) pin/
Some peripherals override the T!IS bit to make a pin an out5put- hile other peripherals override the T!IS
bit to make a pin an input/ Since the T!IS bit override is in effect hile the peripheral is enabled- read5
modify5rite instructions 6(S9- ()9- P=!897 ith T!IS) as destination should be avoided/ The user
should refer to the corresponding peripheral section for the correct T!IS bit settings/
C&1")#e M$'e?
In )apture mode- ))>!#E0 ))>!#' captures the #@5bit value of the T2!# register hen an event
occurs on pin !)%?))>#/ An event is defined as0
Q Every falling edge
Q Every rising edge
Q Every $th rising edge
Q Every #@th rising edge
An event is selected by control bits ))>#2&0))>#2* 6))>#)="K&0*O7/ 8hen a capture is made-
the interrupt re.uest flag bit ))>#I9 6>I!#K%O7 is set/ It must be cleared in softare/ If another capture
occurs before the value in register ))>!# is read- the old captured value is overritten by the ne captured
value/
C$(1&#e M$'e?
In )ompare mode- the #@5bit ))>!# register value is constantly compared against the T2!#
register pair value/ 8hen a match occurs- the !)%?))># pin is0
Q 3riven Eigh
Q 3riven 'o
Q !emains ;nchanged
The action on the pin is based on the value of control bits ))>#2&0 ))>#2* 6))>#)="K&0*O7/ At
the same time- interrupt flag bit ))>#I9 is set/ The output may become inverted hen the mode of
the module is changed from )ompare?)lear on 2atch 6))>42K&0*O N G#**#<7 to )ompare?Set on 2atch
6))>42K&0*O N G#***<7/ This may occur as a result of any operation that selectively clears bit ))>42*-
such as a ()9 instruction/ 8hen this condition occurs- the output becomes inverted hen the instruction is
e4ecuted/ It ill remain inverted for all folloing )ompare operations- until the module is reset/
5 %@ 5
ANA*OG-TO-;IGITA* CONVERTER EA6;F MO;U*E?
The analog5to5digital 6A?37 converter module has five inputs for the >I)#@9A%/ The A?3 allos
conversion of an analog input signal to a corresponding C5bit digital number/ The output of the sample and
hold is the input into the converter- hich generates the result via successive appro4imation/ The analog
reference voltage is softare selectable to either the device<s positive supply voltage 6:337 or the voltage
level on the !A&?A"&?:!E9 pin/
The A?3 converter has a uni.ue feature of being able to operate hile the device is in S'EE> mode/
To operate in S'EE>- the A?3 conversion clock must be derived from the A?3<s internal !) oscillator/
The A?3 module has three registers0
Q A?3 !esult !egister A3!ES
Q A?3 )ontrol !egister * A3)="*
Q A?3 )ontrol !egister # A3)="#
A device !ESET forces all registers to their !ESET state/ This forces the A?3 module to be turned
off and any conversion is aborted/ The A3)="* register- shon in !egister #*5#- controls the
operation of the A?3 module/ The A3)="# register- shon in !egister #*5%- configures the functions of the
port pins/ The port pins can be configured as analog inputs 6!A& can also be a voltage reference7 or a digital
I?=/
OSCI**ATOR CONFIGURATIONS?
The >I)#@9A% can be operated in four different =scillator modes/ The user can program to
configuration bits 69=S)# and 9=S)*7 to select one of these four 2odes0
Q '> 'o >oer )rystal
Q PT )rystal?!esonator
Q ES Eigh Speed )rystal?!esonator
Q !) !esistor?)apacitor
RESET?
The >I)#@9A% differentiates beteen various kinds of !ESET0
Q >oer5on !eset 6>=!7
Q 2)'! !eset during normal operation
Q 2)'! !eset during S'EE>
Q 83T !eset 6during normal operation7
Q 83T 8ake5up 6during S'EE>7
5 %A 5
Q (ron5out !eset 6(=!7
Some registers are not affected in any !ESET condition/ Their status is unknon on >=! and
unchanged in any other !ESET/ 2ost other registers are reset to a !ESET state on >oer5on !eset
6>=!7- on the 2)'! and 83T !eset- on 2)'! !eset during S'EE>- and (ron5out !eset 6(=!7/ They
are not affected by a 83T 8ake5up- hich is vieed as the resumption of normal operation/ The T= and
>3 bits are set or cleared differently in different !ESET situations- as indicated in Table ##5$/ These bits are
used in softare to determine the nature of the !ESET/
P$4e#-$ Re%e" EPORF?
A >oer5on !eset pulse is generated on5chip hen :33 rise is detected 6in the range of #/%: 5
#/A:7/ To take advantage of the >=!- tie the 2)'! pin to :33- A ma4imum rise time for :33 is
specified/ 8hen the device starts normal operation 6e4its the !ESET condition7- device5operating
parameters 6volt5age- fre.uency- temperature-7 must be met to ensure operation/ If these conditions are not
met- the device must be held in !ESET until the operating conditions are met/
P$4e#-)1 Ti(e# EP<RTF?
The >oer5up Timer provides a fi4ed A% ms nominal time5out on poer5up only
9rom the >=!/ The >oer5up Timer operates on an internal !) oscillator/ The chip is kept in !ESET as
long as the >8!T is active/ The >8!T<s time delay allos :33 to rise to an acceptable level/
A configuration bit is provided to enable? disable the >8!T/ The poer5up time delay ill vary from
chip to chip due to :33- temperature and process variation/
O%ci!!&"$# S"&#"-)1 Ti(e# EOSTF?
The =scillator Start5up Timer 6=ST7 provides #*%$ oscillator cycles 6from =S)# input7 delay after
the >8!T delay is over 6if enabled7/ This helps to ensure that the crystal oscillator or resonator has started
and stabiliFed/ The =ST time5out is invoked only for PT- '> and ES modes and only on >oer5on !eset or
ake5up from S'EE>/
B#$4-$)" Re%e" EBORF?
The configuration bit- (=!E"- can enable or disable the (ron5out !eset circuit/ If :33 falls
belo :(=! 6parameter 3**+- about $:7 for longer than T(=! 6parameter R&+- about #** Ms7- the bron5
out situation ill reset the device/ If :33 falls belo :(=! for less than T(=!- a !ESET may not occur/
=nce the bron5out occurs- the device ill remain in (ron5out !eset until :33 rises above :(=!/ The
>oer5up Timer then keeps the device in !ESET for T>8!T 6parameter R&&- about A% ms7/ If :33 should
fall belo :(=! during T>8!T- the (ron5out !eset process ill restart hen :33 rises above :(=!-
5 %C 5
ith the >oer5up Timer !eset/ The >oer5up Timer is alays enabled hen the (ron5out !eset circuit is
enabled- regardless of the state of the >8!T configuration bit/
P$4e# C$"#$!6S"&")% Re5i%"e# EPCONF?
The >oer )ontrol?Status !egister- >)="- has to bits to indicate the type of !ESET that last
occurred/ (it* is (ron5out !eset Status bit- (=!/ (it (=! is unknon on a >oer5on !eset/ It must
then be set by the user and checked on subse.uent !ESETS to see if bit (=! cleared- indicating a (ron5
out !eset occurred/ 8hen the (ron5out !eset is disabled- the state of the (=! bit is unpredictable/
(it# is >=! 6>oer5on !eset Status bit7/ It is cleared on a >oer5on !eset and unaffected otherise/
The user must set this bit folloing a >oer5on !eset/
<&"ch'$5 Ti(e# E<;TF?
The 8atchdog Timer is a free running- on5chip !) oscillator that does not re.uire any e4ternal
components/ This !) oscillator is separate from the !) oscillator of the S)#?)'KI pin/ That means that the
83T ill run- even if the clock on the =S)#?)'KI and =S)%? )'K= pins of the device has been stopped-
for e4ample- by e4ecution of a S'EE> instruction/
3uring normal operation- a 83T time5out generates a device !ESET 68atchdog Timer !eset7/ If the
device is in S'EE> mode- a 83T time5out causes the device to ake5up and continue ith normal
operation 68atchdog Timer 8ake5up7/ The T= bit in the STAT;S register ill be cleared upon a 8atchdog
Timer time5out/
P#$5#&( Ve#i2ic&"i$6C$'e P#$"ec"i$?
If the code protection bit6s7 have not been programmed- the on5chip program memory can be read
out for verification purposes/
I; *$c&"i$%?
9our memory locations 6%***h 5 %**&h7 are designated as I3 locations- here the user can store
checksum or other code identification numbers/ These locations are not accessible during normal e4ecution-
but are readable and ritable during program?verify/ It is recommended that only the four 'east Significant
bits of the I3 location are used/
I-Ci#c)i" Se#i&! P#$5#&((i5?
>I)#@9A% microcontrollers can be serially programmed hile in the end application circuit/ This is
simply done ith to lines for clock and data and three other lines for poer- ground- and the programming
5 %D 5
voltage/ This allos customers to manufacture boards ith unprogrammed devices- and then program the
micro controller just before shipping the product/ This also allos the most recent firmare or a custom
firmare to be programmed/
INSTRUCTION SET SUMMARY?
Each >I)#@9A% instruction is a #$5bit ord divided into an =>)=3E that specifies the instruction
type and one or more operands that further specify the operation of the instruction/ The >I)#@9A%
instruction set summary in Table #%5% lists byte5oriented- bit5oriented- and literal and control operations/
Table #%5# shos the opcode field descriptions/ 9or byte5oriented instructions- Gf< represents a file register
designator and Gd< represents a destination designator/ The file register designator specifies hich file
register is to be used by the instruction/
The destination designator specifies here the result of the operation is to be placed/ If Gd< is
Fero- the result is placed in the 8 register/ If Gd< is one- the result is placed in the file register specified in the
instruction/
9or bit5oriented instructions- Gb< represents a bit field designator hich selects the number of the bit
affected by the operation- hile Gf< represents the number of the file in hich the bit is located/ 9or literal
and control operations- Gk< represents an eight or eleven5bit constant or literal value/
The instruction set is highly orthogonal and is grouped into three basic categories0
Q (yte5oriented operations
Q (it5oriented operations
Q 'iteral and control operations
All instructions are e4ecuted ithin one single instruction cycle- unless a conditional test is
true or the program counter is changed as a result of an instruction/ In this case- the e4ecution takes to
instruction cycles- ith the second cycle e4ecuted as a "=>/ =ne instruction cycle consists of four oscillator
periods/ Thus- for an oscillator fre.uency of $ 2EF- the normal instruction e4ecution time is # Ms/ If
a conditional test is true- or the program counter is changed as a result of an instruction- the instruction
e4ecution time is % Ms/
I/C PROTOCO*
HISTORY OF THE I/C BUS
The I%) bus as developed in the early #DC*Ss by >hilips Semiconductors/ Its original purpose as
to provide an easy ay to connect a )>; to peripheral chips in a T:5set/ IT) is a multi5master serial
5 &* 5
computer bus used to attach lo5speed peripherals to a motherboard- embedded system- or cell phone/ The
name stands for Inter5Integrated )ircuit and is pronounced I-s.uared-C and also- I-two-C/
THE I/C BUS PROTOCO*
The I%) bus physically consists of % active ires and a ground connection/ The active ires- called
S3A and S)'- are both bi5directional/ S3A is the Serial data line- and S)' is the Serial clock line/
Every device hooked up to the bus has its on uni.ue address- no matter hether it is an 2);- ')3
driver- memory- or ASI)/ Each of these chips can act as a receiver and?or transmitter- depending on the
functionality/ =bviously- an ')3 driver is only a receiver- hile a memory or I?= chip can be both
transmitter and receiver/
The I%) bus is a multi5master bus/ This means that more than one I) capable of initiating a data
transfer can be connected to it/ The I%) protocol specification states that the I) that initiates a data transfer
on the bus is considered the B)% M&%"e#/ )onse.uently- at that time- all the other I)s are regarded to be B)%
S!&Ce%/
As bus masters are generally microcontrollers- letSs take a look at a general Sinter5I) chatS on the bus/
'et<s consider the folloing setup and assume the 2); ants to send data to one of its slaves/
OPERATION?-
9irst- the 2); ill issue a START condition/ This acts as an SAttentionS signal to all
of the connected devices/ All I)s on the bus ill listen to the bus for incoming data/
Then the 2); sends the A;;RESS of the device it ants to access- along ith an indication
hether the access is a !ead or 8rite operation 68rite in our e4ample7/ Eaving received the address- all I)Ss
ill compare it ith their on address/ If it doesnSt match- they simply ait until the bus is released by the
5 &# 5
stop condition 6see belo7/ If the address matches- hoever- the chip ill produce a response called the
ACKNO<*E;GEMENT signal/
=nce the 2); receives the acknoledge- it can start transmitting or receiving ;ATA/ In our case-
the 2); ill transmit data/ 8hen all is done- the 2); ill issue the STOP condition/ This is a signal that
the bus has been released and that the connected I)s may e4pect another transmission to start any moment/
8e have had several states on the bus in our e4ample0 STA!T- A33!SS- A)K"=8'E31E2E"T-
3ATA and ST=>/ These are all uni.ue conditions on the bus/ (efore e take a closer look at these bus
conditions e need to understand a bit about the physical structure and hardare of the bus
THE I/C BUS HAR;<ARE STRUCTURE
As e4plained earlier- the bus physically consists of % active ires called S;A 6data7 and SC*
6clock7- and a ground connection/
(oth S3A and S)' are initially bi5directional/ This means that in a particular device- these lines can
be driven by the I) itself or from an e4ternal device/ In order to achieve this functionality- these signals use
open collector or open drain outputs 6depending on the technology7/
The bus interface is built around an input buffer and an open drain or open collector transistor/ 8hen
the bus is I3'E- the bus lines are in the logic EI1E state 6note that e4ternal pull5up resistors are necessary
for this hich is easily forgotten7/ To put a signal on the bus- the chip drives its output transistor- thus pulling
the bus to a '=8 level/ The Upull5up resistorU in the devices as seen in the figure is actually a small current
source or even non5e4istent/
I%) (us Events0 The STA!T and ST=> conditions0
>rior to any transaction on the bus- a STA!T condition needs to be issued on the bus/ The start
condition acts as a signal to all connected I)Ss that something is about to be transmitted on the bus/ As a
result- all connected chips ill listen to the bus/
5 &% 5
After a message has been completed- a ST=> condition is sent/ This is the signal for all devices on
the bus that the bus is available again 6idle7/ If a chip as accessed and has received data during the last
transaction- it ill no process this information 6if not already processed during the reception of the
message7/
START? The chip issuing the Start condition first pulls the S3A 6data7 line lo- and ne4t pulls the S)'
6clock7 line lo/

STOP? The (us 2aster first releases the S)' and then the S3A line.

A single message can contain multiple Start conditions/ The use of this so5 called Urepeated startU
is common in I%)/
A Stop condition alays denotes the E"3 of a transmission/ Even if it is issued in the middle of a
transaction or in the middle of a byte/ It is Ugood behaviorU for a chip that- in this case- it
disregards the information sent and resumes the Ulistening stateU- aiting for a ne start condition/
I/C BUS EVENTS? TRANSMITTING A BYTE TO A S*AVE?
=nce the %"&#" condition has been sent- a byte can be transmitted by the 2ASTE! to the S'A:E.
5 && 5
This first byte after a start condition ill identify the slave on the bus 6address7 and ill select the
mode of operation/ The meaning of all folloing bytes depends on the slave.
As the I%) bus gained popularity- it as soon discovered that the number of available addresses as
too small/ Therefore- one of the reserved addresses has been allocated to a ne task to sitch to #*5bit
addressing mode/ If a standard slave 6not able to resolve e4tended addressing7 receives this address- it onSt
do anything 6since itSs not its address7/
If there are slaves on the bus that can operate in the e4tended #*5bit addressing mode- they ill A''
respond to the ACK cycle issued by the master/ The second byte that gets transmitted by the master ill
then be taken in and evaluated against their address/
I/C BUS EVENTS? RECEIVING A BYTE FROM A S*AVE?
=nce the slave has been addressed and the %!&Ce h&% &c,$4!e'5e' this- a byte can be received from
the slave if the !?8 bit in the address as set to !EA3 6set to S#S7/
The protocol synta4 is the same as in "#&%(i""i5 & 89"e "$ & %!&Ce- e4cept that no the master is
not alloed to touch the S3A line/ >rior to sending the C clock pulses needed to clock in a byte on the S)'
line- the master releases the S3A line/ The slave ill no take control of this line/ The line ill then go high
if it ants to transmit a S#S or- if the slave ants to send a S*S- remain lo/


All the master has to do is generate a rising edge on the S)' line 6%7- read the level on S3A 6&7 and
generate a falling edge on the S)' line 6$7/ The slave ill not change the data during the time that S)' is
high/ 6=therise a S"&#" $# S"$1 c$'i"i$ might inadvertently be generated.)
5 &$ 5
3uring 6#7 and 6+7- the slave may change the state of the S3A line/
In total- this se.uence has to be performed C times to complete the data byte/ (ytes are alays
transmitted 2S( first
The meaning of all bytes being read depends on the slave/ There is no such thing as a Uuniversal
status registerU/ Vou need to consult the data sheet of the slave being addressed to kno the meaning of each
bit in any byte transmitted/
I/C BUS EVENTS? GETTING ACKNO<*E;GE FROM A S*AVE?
8hen an address or data byte has been transmitted onto the bus then this must be acknoledged by
the slave6s7/ In case of an address0 If the address matches its on then that slave and only that slave ill
respond to the address ith an A)K/ In case of a byte transmitted to an already addressed slave then that
slave ill respond ith an A)K as ell/
The slave that is going to give an A)K pulls the S3A line lo immediately after reception of the Cth
bit transmitted- or- in case of an address byte- immediately after evaluation of its address/ In practical
applications this ill not be noticeable/

This means that as soon as the master pulls S)' lo to complete the transmission of the bit 6#7- S3A
ill be pulled lo by the slave 6%7/
The master no issues a clock pulse on the S)' line 6&7/ The slave ill release the S3A line upon
completion of this clock pulse 6$7/
5 &+ 5
The bus is no available again for the master to continue sending data or to generate a stop
condition/
In case of '&"& 8ei5 4#i""e "$ & %!&Ce- this cycle must be completed before a %"$1 c$'i"i$ can
be generated/ The slave ill be blocking the bus 6S3A kept lo by slave7 until the master has generated a
clock pulse on the S)' line/
I/C BUS EVENTS? GIVING ACKNO<*E;GE TO A S*AVE?
;pon #ece1"i$ $2 & 89"e 2#$( & %!&Ce- the master must acknoledge this to the slave device/
The master is in full control of the S3A and the S)' line/

After transmission of the last bit to the master 6#7 the slave ill release the S3A line/ The S3A line
should then go high 6%7/ The 2aster ill no pull the S3A line lo 6&7 /
"e4t- the master ill put a clock pulse on the S)' line 6$7/ After completion of this clock pulse- the
master ill again release the S3A line 6+7/The slave ill no regain control of the S3A line 6@7/
If the master ants to stop receiving data from the slave- it must be able to send a %"$1 c$'i"i$.
Since the slave regains control of the S3A line after the A)K cycle issued by the master- this could
lead to problems/
'etSs assume the ne4t bit ready to be sent to the master is a */ The S3A line ould be pulled lo by
the slave immediately after the master takes the S)' line lo/ The master no attempts to generate a Stop
condition on the bus/ It releases the S)' line first and then tries to release the S3A line 5 hich is held lo
by the slave/ )onclusion0 "o Stop condition has been generated on the bus/
5 &@ 5
This condition is called a "A)K0 "ot acknoledge/
I/C BUS EVENTS? NO ACKNO<*E;GE EFROM S*AVE TO MASTERF?
This is not e4actly a condition/ It is merely a state in the data flo beteen master and slave/
If- after transmission of the Cth bit from the master to the slave the slave does not pull the S3A line
lo- then this is considered a "o A)K condition/
This means that either0
The slave is not there 6in case of an address7
The slave missed a pulse and got out of sync ith the S)' line of the master/
The bus is UstuckU/ =ne of the lines could be held lo permanently/
In any case the master should abort by attempting to send a stop condition on the bus/
APP*ICATIONS
IT) is appropriate for peripherals here simplicity and lo manufacturing cost are more important than
speed/ )ommon applications of the IT) bus are0
!eading configuration data from S>3 E>!=2<s on S3!A2- 33! S3!A2- 33!% S3!A2
memory sticks 63I227 and other stacked >) boards
Supporting systems management for >)I cards- through a S2(us %/* connection/
Accessing ":!A2 chips that keep user settings/
Accessing lo speed 3A)s/
Accessing lo speed A3)s/
)hanging contrast- hue- and color balance settings in monitors 63isplay 3ata )hannel7/
)hanging sound volume in intelligent speakers/
)ontrolling ='E3?')3 displays- like in a cell phone/
!eading hardare monitors and diagnostic sensors- like a )>; thermostat and fan speed/
!eading real time clocks/
Turning on and turning off the poer supply of system components/
5 &A 5
A particular strength of IT) is that a microcontroller can control a netork of device chips ith just to
general5purpose I?= pins and softare/
>eripherals can also be added to or removed from the IT) bus hile the system is running- hich makes it
ideal for applications that re.uire hot sapping of components/
0./ PASSIVE INFRARE; SENSOR EPIRF? -
A >I! detector is a motion detector that senses the heat emitted by a living body/ These are often
fitted to security lights so that they ill sitch on automatically if approached/ They are very effective in
enhancing home security systems/
The sensor is passive because- instead of emitting a beam of light or microave energy that must be
interrupted by a passing person in order to sense that person- the >I! is simply sensitive to the infrared
energy emitted by every living thing/ 8hen an intruder alks into the detector<s field of vision- the detector
sees a sharp increase in infrared energy/
A >I! sensor light is designed to turn on hen a person approaches- but ill not react to a person
standing still/ The lights are designed this ay/ A moving person e4hibits a sudden change in infrared
energy- but a sloer change is emitted by a motionless body/ Sloer changes are also caused by gradual
fluctuations in the temperature of the environment/ If the light ere sensitive to these sloer changes- it
ould react to the sidealk cooling off at night- instead of the motion of a burglar/
If you have a >I! light- you may notice that it is more sensitive on cold days than on arm days/
This is because the difference in temperature beteen the ambient air and the human body is greater on cold
days- making the rise in temperature easier for the sensor to detect/ This has drabacks- thoughI if the sensor
is too sensitive- it ill pick up things you don<t ant it to such as the movement of small animals/
>assive infrared sensor is an electronic device- hich measures infrared light radiating from objects
in its field of vie/ >I!s are often used in the construction of >I!5based motion detectors/ Apparent motion
is detected hen an infrared source ith one
5 &C 5
temperature- such as a human- passes in front of an infrared source ith another temperature- such as a all/
All objects emit hat is knon as black body radiation/ This energy is invisible to the human eye but
can be detected by electronic devices designed for such a purpose/ The term S>assiveS in this instance means
the >I! does not emit energy of any type but merely accepts incoming infrared radiation/
Infrared radiation enters through the front of the sensor- knon as the sensor face/ At the core of a
>I! is a solid state sensor or set of sensors- made from appro4imately #?$ inches s.uare of natural or
artificial pyroelectric materials- usually in the form of a thin film- out of gallium nitride 61a"7- caesium
nitrate 6)s"=
&
7- polyvinyl fluorides- derivatives of phenylpyraFine- and cobalt phthalocyanine/ 6See
pyroelectric crystals/7 'ithium tantalate 6'iTa=
&
7 is a crystal e4hibiting both pieFoelectric and pyroelectric
properties/
The sensor is often manufactured as part of an integrated circuit and may consist of one 6#7- to 6%7
or four 6$7 Spi4elsS of e.ual areas of the pyroelectric material/ >airs of the sensor pi4els may be ired as
opposite inputs to a differential amplifier/ In such a configuration- the >I! measurements cancel each other
so that the average temperature of the field of vie is removed from the electrical signalI an increase of I!
energy across the entire sensor is self5cancelling and ill not trigger the device/ This allos the device to
resist false indications of change in the event of being e4posed to flashes of light or field5ide illumination/
6)ontinuous bright light could still saturate the sensor materials and render the sensor unable to register
further information/7
At the same time- this differential arrangement minimiFes common5mode interferenceI this allos
the device to resist triggering due to nearby electric fields/ Eoever- a differential pair of sensors cannot
measure temperature in that configuration and therefore this configuration is specialiFed for motion
detectors/
In a >I!5based motion detector- the >I! sensor is typically mounted on a printed circuit board- hich
also contains the necessary electronics re.uired to interpret the signals from the chip/ The complete circuit is
contained in a housing- hich is then mounted in a location here the sensor can vie the area to be
monitored/ Infrared energy is able to reach the sensor through the indo because the plastic used is
transparent to infrared radiation 6but only translucent to visible light7/ This plastic sheet prevents the
introduction of dust and insects- hich could obscure the sensorSs field of vie/
OPERATION OF PIR SENSOR?
5 &D 5
A fe mechanisms have been used to focus the distant infrared energy onto the sensor surface/ The
indo may have 9resnel lenses molded into it/ Alternatively- sometimes >I! sensors are used ith plastic
segmented parabolic mirrors to focus the infrared energyI hen mirrors are used- the plastic indo cover
has no 9resnel lenses molded into it/ A filtering indo 6or lens7 may be used to limit the avelengths to C5
#$ micrometers- hich is most sensitive to human infrared radiation 6D/$ micrometers being the strongest7/
The >I! device can be thought of as a kind of infrared Gcamera<- hich remembers the amount of
infrared energy focused on its surface/ =nce poer is applied to the >I! the electronics in the >I! shortly
settle into a .uiescent state and energiFe a small relay/ This relay controls a set of electrical contacts- hich
are usually connected to the detection input of an alarm control panel/ If the amount of infrared energy
focused on the sensor changes ithin a configured time period- the device ill sitch the state of the alarm
output relay/ The alarm output relay is typically a Unormally closed 6")7U relayI also kno as a U9orm (U
relay/
A person entering the monitored area is detected hen the infrared energy emitted from the intruderSs
body is focused by a 9resnel lens or a mirror segment and overlaps a section on the chip- hich had
previously been looking at some much cooler part of the protected area/ That portion of the chip is no
much armer than hen the intruder asnSt there/ As the intruder moves- so does the hot spot on the surface
of the chip/ This moving hot spot causes the electronics connected to the chip to de5energiFe the relay-
operating its contacts- thereby activating the detection input on the alarm control panel/ )onversely- if an
intruder ere to try to defeat a >I! perhaps
5 $* 5
(y holding some sort of thermal shield beteen himself and the >I!- a corresponding ScoldS spot moving
across the face of the chip ill also cause the relay to de5energiFe unless the thermal shield has the same
temperature as the objects behind it/
2anufacturers recommend careful placement of their products to prevent false alarms/ They suggest
mounting the >I!s in such a ay that the >I! cannot SseeS out of a indo/ Although the avelength of
infrared radiation to hich the chips are sensitive does not penetrate glass very ell- a strong infrared source
6a vehicle headlight- sunlight reflecting from a vehicle indo7 can overload the chip ith enough infrared
energy to fool the electronics and cause a false 6non5intruder caused7 alarm/ A person moving on the other
side of the glass hoever ould not be SseenS by the >I!/
They also recommended that the >I! not be placed in such a position that an E:A) vent ould blo
hot or cold air onto the surface of the plastic- hich covers the housingSs indo/ Although air has very lo
emissivity 6emits very small amounts of infrared energy7- the air bloing on the plastic indo cover could
change the plasticSs temperature enough to- once again- fool the electronics/
>I!s come in many configurations for a ide variety of applications/ The most common used in
home security systems has numerous 9resnel lenses or mirror segments and has an effective range of about
thirty feet/ Some larger >I!s are made ith single segment mirrors and can sense changes in infrared energy
5 $# 5
over one hundred feet aay from the >I!/ There are also >I!s designed ith reversible orientation mirrors-
hich allo either broad coverage 6##*W ide7 or very narro ScurtainS coverage/
>I!s can have more than one internal sensing element so that- ith the appropriate electronics and
9resnel lens- it can detect direction/ 'eft to right- right to left- up or don and provide an appropriate output
signal/
0.0 *IGHT ;EPEN;ENT RESISTOR? -
'3!s or 'ight 3ependent !esistors are very useful especially in light?dark sensor circuits/ "ormally
the resistance of an '3! is very high- sometimes as high as #*** *** ohms- but hen they are illuminated
ith light resistance drops dramatically/
Electronic opto sensors are the devices that alter their electrical characteristics- in the presences of
visible or invisible light/ The best5knon devices of this type are the light dependent resistor 6'3!7- the
photo diode and the phototransistors/
'ight dependent resistor as the name suggests depends on light for the variation of resistance/
'3! are made by depositing a film of cadmium sulphide or cadmium selenide on a substrate of
ceramic containing no or very fe free electrons hen not illuminated/ The film is deposited in a Fig Fag
fashion in the form of a strip/ The longer the strip the more the value of resistance/
8hen light falls on the strip- the resistance decreases/ In the absence of light the resistance can be in
the order of #*K ohm to #+K ohm and is called the dark resistance/
3epending on the e4posure of light the resistance can fall don to value of +** ohms/ The poer
ratings are usually smaller and are in the range +*m to /+/ Though very sensitive to light- the sitching
time is very high and hence cannot be used for high fre.uency applications/ They are used in chopper
amplifiers/
'ight dependent resistors are available as discs */+cm to %/+cm/ The resistance rises to several 2ega
ohms under dark conditions/
The belo figure shoes that hen the torch is turned on- the resistance of the '3! falls- alloing
current to pass through it is shon in figure/
5 $% 5


The basic construction and symbol for '3! are shon in above figures respectively/ The device
consists of a pair of metal film contacts/ Separated by a snakelike track of cadmium sulphide film- designed
to provide the ma4imum possible contact area ith the to metal films/ The structure is housed in a clear
plastic or resin case- to provide free access to e4ternal light/ >ractical '3!s are available in variety of siFes
and packages styles- the most popular siFe having a face diameter of roughly #*mm/ practical '3! is shon
in belo figure/

S1ec"#&! #e%1$%e?
The resistors are only light dependent over a limited range of avelengths/ '3!s have their
ma4imum response at about @C*nm/
Te(1e#&")#e 'e1e'ec9?
5 $& 5
Electrons can be e4cited not only by photons but also by thermal agitation/ The dark resistance is
therefore not infinite at normal temperatures/ It increases ith the ambient temperature coefficient is-
hoever- very small and can be neglected/
Rec$Ce#9 #&"e?
8hen an '3! is brought from a certain illuminating level into total darkness- the resistance does not
increase immediately to the dark value/ The recovery rate is specified in k ohm?second and for current '3!
types it is more than %**k ohm?second/ The recovery rate is much greater in the reverse direction- e/g/ going
from darkness to illumination level of &** lu4- it takes less than #*ms to reach a resistance hich
corresponds ith a light level of $** lu4/
'3!s are sensitive- ine4pensive- and readily available devices/ They have good poer and voltage
handling capabilities- similar to those of a conventional resistor/ Their only siginificant defect is that they are
fairly lo acting- taking tens or hundreds of '3! include light and dark5activated sitches and alarms- light
beam alarms and reflective smoke alarms etc/ A '3! may be connected either ay round and no special
precautions are re.uired hen soldering/
3arkness0 2a4imum resistance- about #2ohm/
:ery bright light0 2inimum resistance- about #** ohm/
The '3! is a variable resistor hose resistance decreases ith the increase in light intensity/ To
cadmium sulphide 6cds7 photoconductive cells ith spectral response similar to that of the human eye/ The
cell resistance falls ith increasing light intensity/
*;R Ci#c)i" ;i&5#&(? -
5 $$ 5
Fe&")#e%?
Eigh reliability
'ight eight
8ide spectral response
8ide ambient temperature range
A11!ic&"i$%?
Smoke detection
Automatic lighting control
(urglar alarm systems
)amera 6electronic shutter7
Strobe 6color temperature reading7
&/$ 3igital Thermometer and Thermostat 63S#@%#70 5
FEATURES? -
Temperature measurements re.uire no e4ternal components
5 $+ 5
2easures temperatures from 5++W) to X#%+W) in */+W) increments/ 9ahrenheit e.uivalent is 5@AW9
to %+AW9 in */DW9 increments
Temperature is read as a D5bit value 6%5byte transfer7
8ide poer supply range 6%/A: to +/+:7
)onverts temperature to digital ord in less than # second
Thermostatic settings are user definable and nonvolatile
3ata is read from?ritten via a %5ire serial interface 6open drain I?= lines7
Applications include thermostatic controls- industrial systems- consumer
products- Thermometers- or any thermal sensitive system
C5pin 3I> or S= package 6#+*mil and %*Cmil7
ABSO*UTE MA=IMUM RATINGS?
:oltage on Any >in !elative to 1round 5*/+: to X@/*:
=perating Temperature !ange 5++Y) to X#%+Y)
Storage Temperature !ange 5++Y) to X#%+Y)
;ESCRIPTION?
The 3S#@%# 3igital Thermometer and Thermostat provides D5bit temperature readings- hich
indicate the temperature of the device/ The thermal alarm output- T=;T- is active hen the temperature of
the device e4ceeds a user5defined temperature TE05 The output remains active until the temperature drops
belo user defined temperature T'- alloing for any hysteresis necessary/
;ser5defined temperature settings are stored in nonvolatile memory so parts may be programmed
prior to insertion in a system/ Temperature settings and temperature readings are all communicated to?from
the 3S#@%# over a simple %5ire serial interface/
PIN ;ESCRIPTION?

PIN ASSIGNMENT
S3A 5 %58ire Serial 3ata Input?=utput/
S)' 5 %58ire Serial )lock
1"3 5 1round
T=;T 5 Thermostat =utput Signal
A* 5 )hip Address Input 3S#@%# C5>I" S*6#+* mil7
5 $@ 5

A1 - Chip Address Input
A% 5 )hip Address Input
:33 5 >oer Supply :oltage 3S#@%# C5>I" 3I> 6&**mil7

OPERATION?
Me&%)#i5 Te(1e#&")#e?
The 3S#@%# measures temperature using a band gap5based temperature sensor/ A delta5sigma
analog5to digital converter 6A3)7 converts the measured temperature to a digital value that is calibrated in
W)I for W9 applications- a lookup table or conversion routine must be used/
The temperature reading is provided in a D5bit- to<s complement reading by issuing the !EA3
TE2>E!AT;!E command/ Table % describes the e4act relationship of output data to measured
temperature/ The data is transmitted through the %5ire serial interface- 2S( first/ The 3S#@%# can measure
temperature over the range of 5++Y) to X#%+Y) in */+Y) increments/
;S-6/- FUNCTIONA* B*OCK ;IAGRAM?
The#($%"&" C$"#$!? -
In its operating mode- the 3S#@%# functions as a thermostat ith programmable hysteresis as shon
in 9igure &/ The thermostat output updates as soon as a temperature conversion is complete/
5 $A 5
8hen the 3S#@%#<s temperature meets or e4ceeds the value stored in the high temperature trip
register 6TE7- the output becomes active and ill stay active until the temperature falls belo the
temperature stored in the lo temperature trigger register 6T'7/ In this ay- any amount of hysteresis may be
obtained/
The active state for the output is programmable by the user so that an active state may either be a
logic U#U 6:337 or a logic U*U 6*:7/ This is done using the >=' bit in the configuration register as
e4plained in the =peration and )ontrol section of this datasheet/
THERMOSTAT OUTPUT OPERATION? -
;A EThe#($%"&" $)"1)", Ac"iCe G Hi5hF
OPERATION AN; CONTRO*? -
The 3S#@%# must have temperature settings resident in the TE and T' registers for thermostatic
operation/ A configuration?status register also determines the method of operation that the 3S#@%# ill use
in a particular application- as ell as indicating the status of the temperature conversion operation/
The c$2i5)#&"i$ #e5i%"e# i% 'e2ie' &% 2$!!$4%?
8here
;ONE N )onversion 3one bit/ # N )onversion complete- * N )onversion in progress/
THF N Temperature Eigh 9lag/ This bit ill be set to # hen the temperature is greater than or e.ual to
the value of TE/ It ill remain # until reset by riting * into this location or removing poer from the
5 $C 5
device/ This feature provides a method of determining if the 3S#@%# has ever been subjected to
temperatures above TE hile poer has been applied/
T*F N Temperature 'o 9lag/ This bit ill be set to # hen the temperature is less than or e.ual to the
value of T'/ It ill remain # until reset by riting * into this location or removing poer from the
device/ This feature provides a method of determining if the 3S#@%# has ever been subjected to
temperatures belo T' hile poer has been applied/
NVB N "onvolatile 2emory (usy flag/ # N 8rite to an E% memory cell in progress- * Nnonvolatile
memory is not busy/ A copy to E% may take up to #* ms/
PO* N =utput >olarity (it/ # N active high- * N active lo/ This bit is nonvolatile/
#SE=T N =ne Shot 2ode/ If #SE=T is #- the 3S#@%# ill perform one temperature conversion upon
receipt of the Start )onvert T protocol/ If #SE=T is *- the 3S#@%# ill continuously perform temperature
conversions/ This bit is nonvolatile/
= N !eserved/
9or typical thermostat operation the 3S#@%# ill operate in continuous mode/ Eoever- for
applications here only one reading is needed at certain times or to conserve poer- the one5shot mode may
be used/ "ote that the thermostat output 6T=;T7 ill remain in the state it as in after the last valid
temperature conversion cycle hen operating in one5shot mode/
The ;S-6/- (&9 $1e#&"e i "he 2$!!$4i5 "4$ ($'e%?
#/ Slave receiver mode0 Serial data and clock are received through S3A and S)'/ After each byte is
received an acknoledge bit is transmitted/ STA!T and ST=> conditions are recogniFed as the beginning
and end of a serial transfer/ Address recognition is performed by hardare after reception of the slave
address and direction bit/
%/ Slave transmitter mode0 The first byte is received and handled as in the slave receiver mode/
Eoever- in this mode the direction bit ill indicate that the transfer direction is reversed/ Serial data is
transmitted on S3A by the 3S#@%# hile the serial clock is input on S)'/ STA!T and ST=> conditions are
recogniFed as the beginning and end of a serial transfer/
5 $D 5
COMMAN; SET?
To rite to the 3S#@%#- the master ill issue the slave address of the 3S#@%# and the !?8 bit ill
be set to */ After receiving an acknoledge- the bus master provides a command protocol/ After receiving
this protocol- the 3S#@%# ill issue an acknoledge and then the master may send data to the 3S#@%#/ If
the 3S#@%# is to be read- the master must send the command protocol as before and then issue a repeated
STA!T condition and the control byte again- this time ith the !?8 bit set to # to allo reading of the
data from the 3S#@%#/ The command set for the 3S#@%# as shon in Table & is as follos0
Re&' Te(1e#&")#e HAAhI? -
This command reads the last temperature conversion result/ The 3S#@%# ill send % bytes- in the
format described earlier- hich are the contents of this register/
Acce%% TH HA-hI? -
If !?8 is * this command rites to the TE 6EI1E TE2>E!AT;!E7 register/ After issuing this
command- the ne4t % bytes ritten to the 3S#@%#- in the same format as described for reading temperature-
ill set the high temperature threshold for operation of the T=;T output/ If !?8 is # the value stored in
this register is read back/
Acce%% T* HA/hI? -
If !?8 is * this command rites to the T' 6'=8 TE2>E!AT;!E7 register/ After issuing this
command- the ne4t % bytes ritten to the 3S#@%#- in the same format as described for reading temperature-
ill set the high temperature threshold for
operation of the T=;T output/ If !?8 is # the value stored in this register is read back/
Acce%% C$2i5 HAChI? -
If !?8 is * this command rites to the configuration register/ After issuing this command- the ne4t
data byte is the value to be ritten into the configuration register/ If !?8 is # the ne4t data byte read is the
value stored in the configuration register.
Re&' C$)"e# HAJhI? -
This command reads the value )ountY!emain/ This command is valid only if !?8 is #/
Re&' S!$1e HA>hI? -
This command reads the value )ountY>erY)/ This command is valid only if !?8 is #/
5 +* 5
S"&#" C$Ce#" T HEEhI? -
This command begins a temperature conversion/ "o further data is re.uired/ In one5shot mode the
temperature conversion ill be performed and then the 3S#@%# ill remain idle/ In continuous mode this
command ill initiate continuous conversions/
S"$1 C$Ce#" T H//hI? -
This command stops temperature conversion/ "o further data is re.uired/ This command may be
used to halt a 3S#@%# in continuous conversion mode/ After issuing this command- the current temperature
measurement ill be completed and the 3S#@%#
ill remain idle until a Start )onvert T is issued to resume continuous operation/
0.5 BERO CROSSING ;ETECTOR EBC;F? -
Bero crossing detectors as a group are not a ell5understood application- although they are essential
5 +# 5
elements in a ide range of products/ It has probably escaped the notice of readers ho have looked at the
lighting controller and the 'inkitF )osine (urst 1enerator- but both of these rely on a Fero crossing
detector for their operation/
A Fero crossing detector literally detects the transition of a signal aveform from positive and
negative- ideally providing a narro pulse that coincides e4actly ith the Fero voltage condition/ At first
glance- this ould appear to be an easy enough task- but in fact it is .uite comple4- especially here high
fre.uencies are involved/ In this instance- even # kEF starts to present a real challenge if e4treme accuracy is
needed/
The not so humble comparator plays a vital role 5 ithout it- most precision Fero crossing detectors
ould not ork- and eSd be ithout digital audio- >82 and a multitude of other applications taken for
granted/
B&%ic !$4 2#e3)ec9? -
The Fero crossing detector as used for the dimmer ramp generator/ Although it has almost Fero phase
inaccuracy- that is largely because the pulse is so broad that any inaccuracy is completely samped/ The
comparator function is handled by transistor Z# 5 very basic- but ade.uate for the job/
The circuit is also sensitive to level- and for acceptable performance the A) aveform needs to be of
reasonably high amplitude/ #%5#+: A) is typical/ If the voltage is too lo- the pulse idth ill increase/ !#
is there to ensure that the voltage falls to Fero 5 stray capacitance is sufficient to stop the circuit from
orking ithout it/
5 +% 5
B&%ic 50660HK Be#$ C#$%%i5 ;e"ec"$#
The pulse idth of this circuit 6at +*EF7 is typically around @**us 6*/@ms7 hich sounds fast enough/
The problem is that at +*EF each half cycle takes only #*ms 6C/&&ms at @*EF7- so the pulse idth is over
+[ of the total period/ This is hy most dimmers can only claim a range of #*[5D*[ 5 the Fero crossing
pulse lasts too long to allo more range/
8hile this is not a problem ith the average dimmer- it is not acceptable for precision applications/
9or a tone burst generator 6either the cosine burst or a SconventionalS tone burst generator7- any inaccuracy
ill cause the sitched aveform to contain glitches.
5 +& 5
BC; OUTPUT <AVEFORM? -

5 +$ 5
0.6 PO<ER SUPP*Y?
>oer supply block consists of folloing units0
Step don transformer/
(ridge rectifier circuit/
Input filter/
:oltage regulators/
=utput filter/
Indicator unit/
S"e1 '$4 "#&%2$#(e#?
The step5don transformer is used to step don the supply voltage of %&*v ac from mains to loer
values- as the various I)<s used in this project re.uire reduced voltages/ The transformer consists of primary
and secondary coils/ To reduce or step don the voltage- the transformer is designed to contain less number
of turns in its secondary core/ The outputs from the secondary coil hich is center tapped are the ac values
of *v- #+v and #+v/ The conversion of these ac values to dc values to dc values is done using the full ave
rectifier unit/
Rec"i2ie# Ui"?
A diode bridge is an arrangement of four diodes connected in a bridge circuit/ That provides the
polarity of output voltage of any polarity of the input voltage/ 8hen used in its most common application-
for conversion of alternating current 6A/)7 input into direct current 63/)7 output- it is knon as a bridge
rectifier/ The diagram describes a diode5bridge design knon as a full ave rectifier/ This design can be
used to rectify single phase A/)/ hen no transformer center tap is available/ A bridge rectifier makes use of
four diodes in a bridge arrangement to achieve full ave rectification/ This is a 8idely used configuration-
both ith individual diodes ired as shon and ith single component bridges here the diode bridge is
ired internally/
9or both positive and negative sings of the transformer- there is a forard path through the diode
bridge/ (oth conduction paths cause current to flo in the same direction through the load resister-
accomplishing full5ave rectification/ 8hile one set of diodes is forard biased- the other set is reverse
biased and effectively eliminated from the circuit/
I1)" Fi!"e#? -
)apacitors are used as filters/ The ripples from the dc voltages are removed and pure dc voltage is
obtained/ The primary action performed by capacitor is charging and discharging/ It charges in positive half
cycle of the ac voltage and it ill discharge in negative half cycle/ So it allos only ac voltage and does not
allo the dc voltage/ This filter is fi4ed before the regulator/ )apacitors used here are of the value #***u9
5 ++ 5
Re5)!&"$# )i"? -
!egulator regulates the output voltage to a specific value/ The output voltage is maintained
irrespective of the fluctuations in the input dc voltage/ 8henever there are any ac voltage fluctuations- the
dc voltage also changes- and to avoid this regulators are used/
Re5)!&"$#% c& 8e c!&%%i2ie' &%? -
-. P$%i"iCe #e5)!&"$#, 4hich #e5)!&"e% "he 1$%i"iCe C$!"&5eE7J05,7J-/F
#. L input pin
%/ O ground pin
&/ O output pin
/. Ne5&"iCe #e5)!&"$#, 4hich #e5)!&"e% "he e5&"iCe C$!"&5e E7>-/F.
#/ O ground pin
%/ O input pin
&/ O output pin
Re5)!&"$#% )%e' i "hi% &11!ic&"i$ &#e0 5
AC*+ hich provides +v dc
AC#% hich provides #%v dc
AD#% hich provides 5#%#v dc
O)" 1)" Fi!"e#? -
This filter is fi4ed after the !egulator circuit to filter any of the possibly found ripples in the output
received finally/ )apacitors used here are of value #*9/
5 +@ 5
P$4e# S)11!9 Ci#c)i" ;i&5#&(?
0.7 *IAUI; CRYSTA* ;ISP*AY E*C;F? -
')3 is a type of display used in digital atches and many portable computers/ ')3 displays utiliFe
to sheets of polariFing material ith a li.uid crystal solution beteen them/ An electric current passed
through the li.uid causes the crystals to align so that light cannot pass through them/ ')3 technology has
advanced very rapidly since its initial inception over a decade ago for use in lap top computers/ Technical
achievements has resulted in brighter displace- higher resolutions- reduce response times and cheaper
manufacturing process/
The li.uid crystals can be manipulated through an applied electric voltage so that light is alloed to
pass or is blocked/ (y carefully controlling here and hat avelength 6color7 of light is alloed to pass-
the ')3 monitor is able to display images/ A backlight provides ')3 monitor<s brightness/
=ver the years many improvements have been made to ')3 to help enhance resolution- image-
sharpness and response times/
=ne of the latest such advancement is applied to glass during acts as sitch alloing control of light
at the pi4el level- greatly improving ')3<s ability to display small5siFed fonts and image clearly/
5 +A 5
=ther advances have alloed ')3<s to greatly reduce li.uid crystal cell response times/ !esponse
time is basically the amount of time it takes for a pi4el to change colors- in reality response time is the
amount of time it takes a li.uid crystal cell to go from being active to inactive/
Thi% i% ')e "$ 2$!!$4i5 #e&%$%?
The declining prices of ')3s/
The ability to display numbers- characters and graphics/ This is in contrast to 'E3s- hich
are limited to numbers and a fe characters/
An intelligent ')3 display of to lines- %* characters per line that is interfaced to the pic#@fA%
microcontroller/
Incorporation of a refreshing controller into the ')3- thereby relieving the )>; to keep displaying
the data/ Ease of programming for characters and graphics/
2ost of the ')3 modules conform to a standard interface specification/ A #$5pin access is provided
having eight data lines- three control lines and three poer lines/ The connections are laid out in one of the
to common configurations- either to ros of seven pins- or a single ro of #$ pins/
=ne of these pins is numbered on the ')3<s printed circuit board 6>)(7- but if not- it is .uite easy to
locate pin#/ Since this pin is connected to ground- it often has a thicker >)( track- connected to it- and it is
generally connected to metal ork at same point/
PIN ;IAGRAM OF *C;? -
5 +C 5
PIN ;ESCRIPTIONS? -
Vcc, V%% &' Vee? -
8hile :cc and :ss provide X+: and ground respectively- :ee is used for controlling ')3 contrast/
RS Re5i%"e# Se!ec"? -
There are to very important registers inside the ')3/ The !S pin is used for their selection as
follos/
If !SN*- the instruction command code register is selected- alloing the user to send a command
such as clear display- cursor at home- etc/
If !SN#- the data register is selected- alloing the user to send data to be displayed on the ')3/
R6<, #e&'64#i"e? -
!?8 input allos the user to rite information to the ')3 or read information from it/
!?8 N # for reading/
!?8N * for riting/
EN, e&8!e? -
The ')3 to latch information presented to its data pins uses the enable pin/ 8hen data is supplied to
data pins- a highHto5lo pulse must be applied to this pin in order for the ')3 to latch in the data present at
the data pins/ This pulse must be a minimum of $+* ns ide/
;0 D ;7? -
The CHbit data pins- 3= H 3A- are used to send information to the ')3 or read the contents of the
')3<s internal registers/
To display letters and numbers- e send AS)II codes for the letters AHB- a5F numbers *5D to these
pins hile making !SN#/
5 +D 5
There are also instruction command codes that can be sent to the ')3 to clear the display or force
the cursor to home position or blink the instruction command codes/
8e also use !S N * to check the busy flag bit to see if the ')3 is ready to receive information/ The
busy flag is 3A and can be read hen !?8N# and !SN*- as follos0 if !?8 N #- !S N */ 8hen 3AN # 6busy
flag N #7- the ')3 is busy taking care of internal operations and ill not accept any information/
P#$"$"91e ci#c)i"? -
9or a ')3 module to be used effectively in any piece of e.uipment- a 2icroprocessor or 2icro
controller is usually- re.uired to drive it/ Eoever- before attempting a series of sitches to the pins of the
module/ This can be a .uite benefical step- if even you are thoroughly conversant ith the orkings of
microprocessors/
0.J ;IMMER? -
3immers are devices used to vary the brightness of a light/ (y decreasing or increasing the !2S
voltage and hence the mean poer to the lamp it is possible to vary the intensity of the light output/
Although variable5voltage devices are used for various purposes- the term dimmer is generally reserved for
those intended to control lighting/
2odern dimmers are built from silicon5controlled rectifiers 6S)!7 instead of potentiometers or
variable resistors because they have higher efficiency/ A variable resistor ould dissipate poer by heat
6efficiency as lo as */+7/ (y sitching on and off- theoretically a dimmer does not heat up 6efficiency close
to #/*7/
Thyristor 6and briefly- thyratrom7 dimmers ere introduced to solve some of these problems/
(ecause they use sitching techni.ues instead of potential division there is almost no asted poer-
dimming can be almost instantaneous and is easily controlled by remote electronics/
Triacs are used instead of S)! thyristors in loer cost designs- but do not have the surge handling
capacity of back5to5back S)!Ss- and are only suitable for loads less than about %* Amps/ The sitches
generate some heat during sitching- and can cause interference/ 'arge inducors are used as part of the
circuitry to suppress this interference/ 8hen the dimmer is at +*[ poer the sitches are sitching their
highest voltage 6O&** : in Europe7 and the sudden surge of poer causes the coils on the inductor to move-
creating buFFing sound associated ith some types of dimmerI this same effect can be heard in the filaments
5 @* 5
of the incandescent lamps as UsingingU/ The suppression circuitry adds a lot of eight to the dimmer- and is
often insufficient to prevent buFFing to be heard on audio systems that share the mains supply ith the
lighting loads/ This development also made it possible to make dimmers small enough to be used in place of
normal domestic light sitches/
CIRCUIT ;IAGRAM? -
TRIAC ;RIVER MOC 00/-? -
;ESCRIPTION? -
These devices consist of a Al1aAs infrared emitting diode optically coupled to a monolithic silicon
detector performing the function of a Fero voltage crossing bilateral triac driver/
They are designed for use ith a triac in the interface of logic systems to e.uipment poered from
##+ :A) lines- such as teletyperiters- )!Ts- solid5state relays- industrial controls- printers- motors-
solenoids and consumer appliances- etc/
5 @# 5
APP*ICATIONS? -
Q Solenoid?valve controls
Q 'ighting controls
Q Static poer sitches
Q A) motor drives
Q Temperature controls
Q E/2/ contactors
Q A) motor starters
Q Solid5state relays
FEATURES? -
Q Simplifies logic control of ##+ :A) poer
Q Bero voltage crossing
Q dv?dt of %*** :? s typical- #*** :? s guaranteed
0.> OPTOCOUP*ER? -
=pto coupler is a device that uses a short optical transmission path to transfer a signal beteen
elements of a circuit- typically a transmitter and a receiver- hile keeping them electrically isolated \ since
the signal goes from an electrical signal to an optical signal back to an electrical signal- electrical contact
along the path is broken/ A common implementation involves a 'E3 and a phototransistor- separated so that
light may travel across a barrier but electrical current may not/
8hen an electrical signal is applied to the input of the opto5isolator- its 'E3 lights- its light sensor
then activates- and a corresponding electrical signal is generated at the output/ ;nlike a transformer- the
opto5isolator allos for 3) coupling and generally provides significant protection from serious overvoltage
conditions in one circuit affecting the other/ 8ith a photodiode as the detector- the output current is
proportional to the amount of incident light supplied by the emitter/
The diode can be used in a photovoltaic mode or a photoconductive mode/ In photovoltaic mode- the
diode acts like a current source in parallel ith a forard5biased diode/ The output current and voltage are
5 @% 5
dependent on the load impedance and light intensity/ In photoconductive mode- the diode is connected to a
supply voltage- and the magnitude of the current conducted is directly proportional to the intensity of light/
An opto5isolator can also be constructed using a small incandescent lamp in place of the 'E3I such a
device- because the lamp has a much sloer response time than a 'E3- ill filter out noise or half5ave
poer in the input signal/ In so doing- it ill also filter out any audio5 or higher5fre.uency signals in the
input/ It has the further disadvantage- of course- 6an overhelming disadvantage in most applications7 that
incandescent lamps have relatively short life spans/
Thus- such an unconventional device is of e4tremely limited usefulness- suitable only for
applications such as science projects/ The optical path may be air or a dielectric aveguide/ The transmitting
and receiving elements of an optical isolator may be contained ithin a single compact module- for
mounting- for e4ample- on a circuit boardI in this case- the module is often called an $1"$i%$!&"$# or $1"$-
i%$!&"$#/ The photosensor may be a photocell- phototransistor- or an optically triggered S)! or Triac/
=ccasionally- this device ill in turn operate a poer relay or contactor/
FEATURES OF OPTOCOUP*ER? -
Q Interfaces ith common logic families
Q Input5output coupling capacitance K */+ >f
Q Industry Standard 3ual5in line @5pin package
Q +&** :!2S isolation test voltage
PIN ;IAFRAM OF OPTOCOUP*ER? -
5 @& 5
A11!ic&"i$%?
A) mains detection
!eed relay driving
Sitch mode poer supply feedback
Telephone ring detection
'ogic ground isolation
'ogic coupling ith high fre.uency noise rejection
0.-0 *OA;S? -
In this intelligent energy saving system e are using to loads- lamp and 9an/ According to the light
intensity of the particular room or cabin the '3! ill senses- depending on the '3! output the lamp ill be
="?=99/ This system is only applicable for lamps and not applicable for tube lights- because the starting
voltage of the tube lights is high compared to lamps/
(y using Thermostat and 3immer e can adjust the speed of the 9an according to the changes of the
room temperature/
5 @$ 5
.. SOFT<ARE ;ESCRIPTION0 5
$/# 9'=8 )EA!T0 5
9alse
5 @+ 5
InitialiFation
3immer#]dimmer% off
Is
>I!on]'3
!
'o
)ompliment
3immer # on
!ead temperature
Is temp/
%COtK&*
&*OtK&%
&%OtK&$
&@Ot
Set firing angle and
sitch on dimmer %
../ SOURCE CO;E? -
P#$5#&( 2$# PIC-6F7/? -
M ic!)'eN-627/.hL
M )%e 'e!&9 Ec!$c,G-/000000F
M 2)%e% h% , $4'" , 1#$"ec"
M )%e i/cE(&%"e#, %'&GPINOc. , %c!GPINOc0F
M ic!)'e N!c'8.cL
i" "e(1h , "e(1! P
i"- 7G0 , 9G0 P
i" ( P
M 'e2ie Kc' PINO&.
M 'e2ie 1i# PINOB0
M 'e2ie !'# PINO&/
M 'e2ie 'i(- PINO&0
M 'e2ie 'i(/ PINO&-
M ic!)'e N"e(1e#&")#e.cL
M ic!)'e N'i((e#-.cL
M ic!)'e N'i((e#/.cL
M INTOE=T
V$i' (&iE F
Q
O)"1)"O!$4E'i(-F P
O)"1)"O!$4E'i(/F P
=G0P YG0P
Se")1O&'cO1$#"%E NOOANA*OGS F P66 A!! &#e 'i5i"&! $!9
"e(1Oi"i"E F P
!c'Oi"i"E F P
*C;OPUTCERS2 PO<ER SAVERTF P
'e!&9O(%E/000F P
<hi!eE-F
Q
I2 EU i1)"E1i#F F
5 @@ 5
Q
$)"1)"Ohi5hE'i(-F P
<hi!eEU i1)"E1i#F FQV
=GW7 P
*C;OPUTCERS PIR ON RF P
;e!&9O(%E5000F P
V
i2E7G G0F
Q
I2E9G G-F
Q
'e!&9O(%E/0000F P
YG0 P
V
$)"1)"O!$4E'i(-F P
$)"1)"O!$4E'i(/FP
*C;OPUTCERS STAN; BY RF P
'e!&9O(% E000FP
V
i2E7G G-F
Q
9G-P
"e(1O#e&' E FP
i2 E"e(1!G G07J0F "e(1!G5P
e!%e "e(1!G0P
1#i"2E!c'O1)"c, TSTEMP? X0/'.X' 'cT, "e(1h,"e(1!F P
i2E"e(1hLG/7 :: "e(1hNG/J F
Q
8&c,/5? i2E U i1)"EKc'FF5$"$ 8&c,/5P 6 64&i"i5 "$ 5e" Ke#$ %"&#"

'e!&9O(%E5FP
$)"1)"Ohi5hE'i(/FP
8&c,/6? i2E U i1)"EKc'FF5$"$ 8&c,/6P 6 64&i"i5 "$ 5e" Ke#$ %"&#"
$)"1)"O!$4E'i(/FP
'e!&9O(%E5FP
$)"1)"Ohi5hE'i(/FP
5 @A 5
8&c,/7? i2E U i1)"EKc'FF5$"$ 8&c,/7P
$)"1)"O!$4E'i(/FP
V
i2 E"e(1hLG/> :: "e(1hNG0- F
Q
8&c,/0? i2E U i1)"EKc'FF5$"$ 8&c,/0P 6 64&i"i5 "$ 5e" Ke#$ %"&#"

'e!&9O(%E5FP 6 6 -6-

$)"1)"Ohi5hE'i(/FP
8&c,00? i2E U i1)"EKc'FF5$"$ 8&c,00P 6 64&i"i5 "$ 5e" Ke#$ %"&#"

$)"1)"O!$4E'i(/FP

'e!&9O(%E5FP
$)"1)"Ohi5hE'i(/FP
8&c,0/? i2E U i1)"EKc'FF5$"$ 8&c,0/P
$)"1)"O!$4E'i(/FP
V
i2 E"e(1hL0- :: "e(1hNG00 F
Q
8&c,>? i2E U i1)"EKc'FF5$"$ 8&c,>P 6 64&i"i5 "$ 5e" Ke#$ %"&#"
'e!&9O(%E5FP 6 6 -6-
$)"1)"Ohi5hE'i(/FP
8&c,-0? i2E U i1)"EKc'FF5$"$ 8&c,-0P 6 64&i"i5 "$ 5e" Ke#$ %"&#"
$)"1)"O!$4E'i(/FP
'e!&9O(%E5FP
$)"1)"Ohi5hE'i(/FP
8&c,--? i2E U i1)"EKc'FF5$"$ 8&c,--P
$)"1)"O!$4E'i(/FP
5 @C 5
V
i2 E"e(1hL00 :: "e(1hNG05 F
Q
8&c,-/? i2E U i1)"EKc'FF5$"$ 8&c,-/P 6 64&i"i5 "$ 5e" Ke#$ %"&#"
'e!&9O(%E0FP 6 6 -6-
$)"1)"Ohi5hE'i(/FP
8&c,-0? i2E U i1)"EKc'FF5$"$ 8&c,-0P 6 64&i"i5 "$ 5e" Ke#$ %"&#"
$)"1)"O!$4E'i(/FP
'e!&9O(%E0FP
$)"1)"Ohi5hE'i(/FP
8&c,-.? i2E U i1)"EKc'FF5$"$ 8&c,-.P
$)"1)"O!$4E'i(/FP
V
i2 E"e(1hL05 :: "e(1hNG07 F
Q
8&c,-5? i2E U i1)"EKc'FF5$"$ 8&c,-5P 6 64&i"i5 "$ 5e" Ke#$ %"&#"
'e!&9O(%E/FP
$)"1)"Ohi5hE'i(/FP
8&c,-6? i2E U i1)"EKc'FF5$"$ 8&c,-6P 6 64&i"i5 "$ 5e" Ke#$ %"&#"
$)"1)"O!$4E'i(/FP
'e!&9O(%E/FP
$)"1)"Ohi5hE'i(/FP
8&c,-7? i2E U i1)"EKc'FF5$"$ 8&c,-7P
$)"1)"O!$4E'i(/FP
V
i2 E"e(1hL07F $)"1)"Ohi5hE'i(/F P
i2 Ei1)"E!'#F F$)"1)"Ohi5hE'i(-F P
i2 EU I1)"E!'#F F$)"O!$4E'i(-F P
V
V
V
5 @D 5

P#$5#&( 2$# "he#($%"&"?-
"e(1Oii"EF
Q
i/cO%"&#"EFP
i/cO4#i"eE07>0FP66 'eCice &''#e%%
i/cO4#i"eE07&cFP66 c$"#$! #e5i%"e#
i/cO4#i"eE00FP66 4#i"e ($'e
i/cO%"$1EFP
'e!&9O(%E-0FP
i/cO%"&#"EFP
i/cO4#i"eE07>0FP66 'eCice &''#e%%
i/cO4#i"eE07eeFP66 c$"#$! #e5i%"e#
i/cO%"$1EFP
V
"e(1O#e&'EF
Q
i/cO%"&#"EFP
i/cO4#i"eE07>0FP
i/cO4#i"eE07&&FP
i/cO%"&#"EFP
i/cO4#i"eE07>-FP
"e(1hGi/cO#e&'EFP
"e(1!Gi/cO#e&'E0FP
i/cO%"$1EFP
V
5 A* 5

CHAPTER 6
C!NC"USI!N #
$UTURE %IRECTI!NS
C!NC"USI!N&
Intelligent Energy Saving System is not limited for any particular application- it can be used any
here in a process industries ith little modifications in softare coding according to the re.uirements/ This
concept not only ensures that our ork ill be usable in the future but also provides the fle4ibility to adapt
and e4tend- as needs change/
In this project ork e have studied and implemented a complete orking model using a >I)
microcontroller/ The programming and interfering of >I) microcontroller has been mastered during the
implementation/ This ork includes the study of energy saving system in many applications
$UTURE %IRECTI!NS&

8e e4cept that our ne4t generation ill develop this energy saving system ith ire less netork/
In our project e connected all the sensors to micro controller ith the ires/ This can be developed
ith ire less such that e can place different sensors in different places/ This sensor ill activate the micro
controller ith the signals instead of using ires/
This system can also be applicable to various loads like pressure- force and etc/ by increasing the
number of ports of the micro controller/
5 A# 5
BIB*IOGRAPHY
'I'"I!GRAPH(
'!!)S RE$ERRE%&
#7 Adler- !/ (/- A/ )/ Smith- and !/ '/ 'ongani0 Introduction to Semiconductor Physics- vol/ #- p/ AC-
Semiconductor Electronics Education )omitee- ^ohn 8iley ] Sons- Inc., "e Vork -#D@$/
%7 Schade- =/ E/0 Analysis of Rectifier Operation- proc. IRE, vol/&#- pp/ &$#5&@#- ^uly- #D$&/
&7 Stout- 2/ (/0 Analysis of Rectifier Circuits- Elec. En., vol/ +$- September- #D&+/
$7 ^acob 2illman )hristos )/ Ealkias/0 Electronic !e"ices And Circuits- Tata 2c1ra5Eill
>ublishing )ompany 'td/ Sep- %**&/
+7 9air- B/ E/0 Pie#oelectric Crystals in Oscillator Circuits- $ell System %ech. &., vol/%$- April- #D$+/
@7 Eakim- S/ s/0Open and Closed 'oop Response of (eed)ac* Amplifiers- Electron. En., =ctober-
#D@%
A7 (ode- E/ 8/0 +eati"e (eed)ac* in Current Amplifier !esin- 3/ :an "ostrand )ompany- Inc.,
>rinceton- "/^/- #D$+/
C7 Sahney- A/K/0 Electrical and Electronic ,easurements and Instruments- 3hanpat !ai ] )o/
%**&/
D7 Vang- E/S0 (undamentals of Semiconductor !e"ices- chap/ # 2c1ra Eill (ook )ompany- "e
Vork- #DAC/
#*7 Shive- ^/"/0 Semiconductor !e"ices- chaps C]D- 3/:an "ostrand Inc/ >rinceton- "/^/- #D+D/
##7 2illman- ^/0 ,icroelectronics- !iital and Analo Circuits and Systems- 2c1ra Eill (ook
)ompany- "e Vork- #DAD/
#%7 !oger ' Stevens 0 Serial Communications- 3ontrics- #DDA
#&7 !obert Terusalim0 Prorammin in 'uo %5nd edition- 3/ :an "ostrand )ompany- Inc., >rinceton-
"/^/- #DCA/
5 A% 5
#$7 ^an A4elson0 Parallel Port Complete- 2c1ra Eill (ook )ompany- "e Vork- #DCD/
#+7 >eter E/Anderson- PIC C Routines copyriht- (altimore- 23- "ov-<DD
#@7 (ahadur- (/0 'i.uid Crystals- Applications and /ses- 'itton Systems )anada- #DD%/
#A7 2yke >redko0 Prorammin and Customi#in PIC ,icrocontrollers- AmaFon- #DDC/
#C7 2yke >redko0 0and)oo* of ,icrocontrollers- AmaFon- #CCA/
*ourna+, Referred
#7 Innovation0 2agaFine of !esearch ] Technology-%***
%7 International ^ournal of !eliability- Zuality and Safety Engineering6I^!ZSE7
Editor5in5chief
Eoang >ham
3ept/ of Industrial Eng
&7 ^ournal of Electronics 2anufacturing 6^E27
Editor5in5)hief
>aul >/ )onay
8olfson School of 2echanical ] 2anufacturing Engineering

$7 9oundations and Trends in Electronic 3esign Automation 69TE3A7
Editor Hin5chief
Sharad 2alik-
3ept/of Electrical Eng/-
>rinceton ;niversity/
+7 >rinted )ircuit 3esign =nline 62agaFine7/
@7 3esign 2agaFine/
A7 ^ournal of Instrumentation 6^"IST7/
C7 2icrocontroller solutions/
5 A& 5
%ATA SHEETS&
#7 pic#@fA% datasheets/
%7 =ptre4 ')3 data sheet
&7 I%)Y(;SYS>E)I9I)ATI="Y#DD+/pdf
5 A$ 5