ABSTRACT
Intelligent Energy Saving System can be used in places like where lighting is very important. The libraries will be well illuminated with many lamps. When people are not present at a reading place the lighting can be made OFF and when they are present, the lighting made O . !ll these can be done through by "imming circuit and #I$ sensor. I% a person entering to the monitored area, the #I$ sensors activates and sense the person, gives to the micro controller. The In%rared energy emitted %rom the living body is %ocused by a Fresnel lens segment. Then only the #I$ sensor activates. !%ter sensing the person &"$ checks the light intensity o% the monitored area, whether it is bright or dark. "epending on the &"$ output, the lamp may be O ' OFF by using "immer circuit. (y using this system we can ad)ust the speed o% Fan according to the room temperature measured by Thermostat, which is connected to the micro controller. To display the room temperature o% #I$ mode operation we are using the &*" display.
+,+
INDEX
#!-E O
,. INTRODUCTION ,., ,./ ,.0 ,.1 ,.2 Ob)ective o% the #ro)ect (lock "iagram #inciple O% Operation System Features E3uipments 9 ,. ,, ,/ ,0 ,2 6
/. DESCRIPTION OF THE PROJECT /., /./ /.0 0., 0./ 0.0 0.1 0.2 0.7 0.8 0.; 0.< 1. (lock "iagram "escription Schematic "iagrams Schematic E4planation
0. HARDWARE DESCRIPTION 5icrocontroller 6#I*,7F8/9 #assive In%rared Sensor &ight "ependent $esistor Thermostat 6"S,7/,9 :ero *rossing "etector #ower Supply &i3uid *rystal "isplay "immer Optocoupler
10
0.,. &oads SOWFTWARE DESCRIPTION 1., Flow *hart 64
1./ Source *ode
2. 7.
RESULT CONCLUSION AND FUTURE DIRECTIONS BIBLIOGRAPHY
+/+
LIST OF FIGURES
1. (lock "iagram /. Schematic "iagram 0. !rchitecture o% #I*,7F8/ 1. #in "iagram o% #I* ,7F8/ 2. Operation o% #I$ "iagram 7. Operation o% &"$ "iagram 8. &"$ *ircuit "iagram ;. #in "iagram o% "S,7/, <. Functional (lock "iagram o% "S,7/, ,.. :*" *ircuit "iagram ,,. :*" Output wave%orm ,/. #ower *ircuit "iagram ,0. #in "iagram o% &*" ,1. "immer *ircuit "iagram ,2. #in "iagram o% Opto*oupler
+0+
CHAPTER 1 INTRODUCTION
1. INTRODUCTION
+1+
Intelligent Energy Saving System, the aim o% the pro)ect is to save the energy. In this pro)ect we are using various sensors, controlling and display. =owever, in this pro)ect work the basic signal processing o% various parameters which are temperature, &"$, Smoke sensor. For measuring various parameters values, various sensors are used and the output o% these sensors are converted to control the parameters. The control circuit is designed using micro+ controller. The outputs o% all the three parameters are %ed to micro+controller. The output o% the micro+controller is used to drive the &*" display, so that the value o% each parameter can be displayed. In addition to the &*" display micro+controller outputs are also used to driver a relay independently. This relay energi>es and de+ energi>es automatically according to the condition o% the parameter.
1.1 OBJECTIVE OF THE PROJECT: The aim o% the pro)ect is to save the energy or power, used in places like libraries where lighting is very important %or the people who come to read books. So, the libraries will be well illuminated with many lamps. !t the same time when people are not present at a particular reading place the lighting can be made o%% by using "immer and when people come to that area, according to the &"$ lighting can be made su%%iciently brighter. (y using this system, we can also ad)ust the speed o% the Fan according to the room temperature using Thermostat and "immer.
1. PRINCIPLE OF OPERATION
+2+
*onsider a particular table in the library, which is connected with our e4perimental kit .When a person entering into that place the #I$ sensor absorbs the black body radiation emitted by that person and activates it. The &*" display will displays the ?#I$ O @. !%ter some time delay the light will glows %or some time by using the "immer circuit and with the help o% &"$ sensor it checks the room lightening , and it takes the condition when the light is su%%icient the lamp will be in OFF state and when light is insu%%icient the lamp will be in O state. With the help o% Thermostat sensor the room temperature is measured and the speed o% the Fan varies according to the temperature o% Thermostat. The &*" display will displays the room ?temperature in degree centigrade@. When a person is leaving that place, the #I$ sensor will activate again and %irstly the Fan will be OFF and a%ter some time delay the lamp also will be OFF. ow the &*" display is in stand by mode state. !nd the main supply power will be switched OFF.
+7+
1.! BLOC" DIAGRA#:
ZERO CROSSING DETECTOR
OPTOCOUPLER
PIR SENSOR LAMP
DIMMER1 POWER SUPPLY MICRO CONTROLLER PIC 16F72
DIMMER2
FAN
LDR CIRCUIT
LCD DISPLAY OPTOCOUPLER THERMOSTAT
1.4 S$%&'( F')&*+'%:
• • •
Easy operation *onvenient !%%ordable
+8+
R',*-+'. S/-00%:
• Anderstanding o% 5icro controller • Embedded * #rogramming • Anderstanding Inter%acing Techni3ues • Bnowledge on Sensors • "esign and Fabrication o% #*(
P+12'3& 45)%': • • • • • • • Schematic design and drawing o% #*( "esign and Inter%acing *ircuits %or 5icro controller #reparation o% #*( !ssembling and Testing o% Inter%acing *ircuits *ode %or the !pplication "ebugging and Testing #ro)ect $eport
1.4 E6UIP#ENTS: ? ? ? #rinted *ircuit (oard 5icro controller à #I* ,7F8/ 2C, ,/C "c #ower supply
+;+
? ? ? ? ? ? ?
I$ sensor à #assive In%rared Sensor &"$ à &ight "ependent $esistor Thermostat &*" à Optra4, / line by ,7 characters :ero *rossing "etector & Fan
+<+
CHAPTER .
DESCRIPTION OF THE PROJECT
+ ,. +
. DESCRIPTION OF THE PROJECT: .1 BLOC" DIAGRA# EXPLANATION: PIR SENSOR: ! #I$ detector is a motion detector that senses the heat emitted by a living body. These are o%ten %itted to security lights so that they will switch on automatically i% approached. They are very e%%ective in enhancing home security systems. The sensor is passive because, instead o% emitting a beam o% light or microwave energy that must be interrupted by a passing person in order to ?sense@ that person, the #I$ is simply sensitive to the in%rared energy emitted by every living thing. When an intruder walks into the detectorDs %ield o% vision, the detector ?sees@ a sharp increase in in%rared energy.
LDR: &"$Ds or &ight "ependent $esistors are very use%ul especially in light'dark sensor circuits. These help in automatically switching O 'OFF the street lights and etc., normally the resistance o% an &"$ is very high, sometimes as very high as ,...... ohms, but when they are illuminated with light, resistance drop dramatically. Electronic opto sensors are the devices that alter their electrical characteristics, in the presence o% visible or invisible light. The best+known devices o% these types are the light dependent resistor 6&"$9, the photo diode and the phototransistors.
7CD: ! >ero crossing detector literally detects the transition o% a signal wave%orm %rom positive and negative, ideally providing a narrow pulse that coincides e4actly with the >ero voltage condition.
THER#OSTAT: In this pro)ect we are making use "S ,7/, thermostat, itDs a non+ contact digital type temperature transducer suitable %or measuring room temperature.
+ ,, +
The word EthermistorD is an acronym %or thermal resistor, i.e., a temperature sensitive resistor. It is used to detect very small changes in temperature. The variation in temperature is re%lected through appreciable variation o% the resistance o% the device.
LCD DISPLAY: ! li3uid crystal is a material 6normally organic %or &*"Ds9 that will %low like a li3uid but whose molecular structure has some properties normally associated with solids. The &i3uid *rystal "isplay 6&*"9 is a low power device. The power re3uirement is typically in the order o% microwatts %or the &*". =owever, an &*" re3uires an e4ternal or internal light source. We are making use o% &*" in our pro)ect to display the #I$ mode and room temperature.
OPTOCOUPLER: Optocoupler is a device that uses a short optical transmission path to trans%er a signal between elements o% a circuit, typically a transmitter and a receiver, while keeping them electrically isolated. ! common implementation involves a &E" and a phototransistor, separated so that light may travel across a barrier but electrical current may not.
DI##ER: "immers are devices used to vary the brightness o% a light. (y decreasing or increasing the $5S voltage and hence the mean power to the lamp it is possible to vary the intensity o% the light output. !lthough variable+voltage devices are used %or various purposes, the term dimmer is generally reserved %or those intended to control lighting.
+ ,/ +
.
SCHE#ATIC DIAGRA#: -
+ ,0 +
.! SCHE#ATIC EXPLANATION: PORT A: #ort ! can acts as a both input as well as output port. It is having 7 pins 6!.+!29. In these !. is connected to "immer,, !, is connected to "immer/ and !1 is connected to :*" output.
PORT B: #ort ( can acts as a both input as well as output port. It is having ; pins 6(.+(89. In these (, connected to register selection pin6$'S9, (/ is connected to read'write6$'W9 and (0 pin is connected to enable pin.
PORT C: #ort * can acts as a both input as well as output port. It is having ; pins 6*.+*89. In these $*0 and $*1 connected to the thermostat pins. ,/5 => *rystal Oscillator is connected in between <th and ,.th pins o% micro controller. $eset pin is connected to the pin number, i.e., 5*&$'C##. ;th and ,<th pins are connected to ground 6Css9.
+ ,1 +
CHAPTER !. HARDWARE DESCRIPTION
!. HARDWARE DESCRIPTIONF +
+ ,2 +
0., #ICRO CONTROLLER: INTRODUCTION: 5icrocontrollers these days are silent workers in many apparatus, ranging %rom the washing machine to the video recorder. early all o% these controllers are mask programmed and there%ore are o% very little use %or applications that re3uire the programs to be changed during the course o% e4ecution. Even i% the programs could be altered, the in%ormation necessary to do so an instruction set, an assembler language and description %or the basic hardware is either very di%%icult to obtain or are in ade3uate when it came to the issue o% accessibility. ! marked e4ception to the above category is the #I*I7F8/ micro controller belonging to the #I* %amily. This microcontroller has %eatures that seem to make it more accessible than any other single chip microcontroller with a reasonable price tag. The #I*I7F8/, an ;+bit single chip microcontroller has got a power%ul *#A optimi>ed %or control applications. The #I*I7F8/ is an ; G bit single chip microcontroller. The ,7%8;88! provides a signi%icantly more power%ul architecture, a more power%ul instruction set and a %ull serial port. The #I*I7F8/ is a complete micro controller. crystal clock and provide a %ew timing and control signals. There are 1. pins
needed by the %ive+bidirectional ports. #ins provide power, allow you to connect a
The architecture includes the !&A, W register, the stackH a block o% registers. !ll these devices are connected to via internal ;+bit data bus.
+ ,7 +
Each I'O port is also connected to the ;+bit internal data bus through a series o% registers. These registers hold data during I'O trans%ers and control the I'O ports. The architectural block diagram also shows the #I*I7F8/ $O5 and $!5
C1(4)+-%18 19 (-3+14+13'%%1+ )8. (-3+1318&+100'+:
The di%%erence between 5icroprocessor and 5icro controller is 5icroprocessor can only process with the data, 5icro controller can control e4ternal device. That is i% you want switch ?O @ or ?OFF@ a device, you need peripheral I*s to do this work with 5icro controller you can directly control the device. &ike 5icroprocessor, 5icro controller is available with di%%erent %eatures. It is available with inbuilt memory, I'O lines, timer and !"*. The micro controller, which we are going to use.
A.
8&);'% 19 #-3+1318&+100'+%:
,. I% a system is developed with a microprocessor, the designer has to go %or e4ternal memory such as $!5, $O5 or E#$O5 and peripherals and hence the si>e o% the #*( will be large enough to hold all the re3uired peripherals. /. (ut the microcontroller has got all these peripheral %acilities on a single chip so development o% a similar system with a microcontroller reduces #*( si>e and cost o% the design. 0. One o% the ma)or di%%erence between a microcontroller and a microprocessor is that a controller o%ten deals with bits, not bytes as in the real world application, %or e4ample switch contacts can only be open or close, indicators should be lit or dark and motors can be either turned on or o%% and so %orth.
1.
The 5icrocontroller has two ;+bit timers' counters built within it, which
makes it more suitable to this application since we need to produce some accurate timer delays. It is even more advantageous that the timers also act as interrupt.
ABOUT PICI6F< :
The #I*I7F8/ is a low+power, high+per%ormance *5OS ;+bit microcomputer with /B bytes Flash programmable and erasable read only memory + ,8 +
6#E$O59. #I*I 7F8/ is a power%ul microcomputer, which provides a highly %le4ible and cost+e%%ective solution to many embedded control application.
FEATURES OF PIC 16F< : H-;5 4'+91+()83' RISC CPU:
• • • Only 02 single word instructions to learn !ll single cycle instructions e4cept %or program branches, which are two+cycle. Operating speedF "*+/. 5=: clock input ? ? ? • • • • "*+/.. ns instruction cycle Ap to /k 4 ,1 words o% program 5emory, Ap to ,/; 4 ; bytes o% "ata 5emory 6$!59
#inout compatible to #I* ,7*8/'8/! and #I* ,7F;8/. Interrupt capability. Eight+ level deep hard ware stack. "irect, Indirect and $elative !ddressing modes.
P'+-45'+)0 F')&*+'%:
• • • =igh Sink'Source *urrentF /2 m! Timer.F ;+bit timer'counter with ;+bit prescaler Timer,F ,7+bit timer'counter with prescaler, can be incremented during Cia E4ternal crystal'clock. • Timer/F ;+bit timer'counter with ;+bit period register, prescaler and postscaler • *apture, *ompare, #W5 6**#9 module + *apture is ,7+bit, ma4. resolution is ,/.2 ns • *ompare is ,7+bit, ma4. resolution is /.. ns
+ ,; +
• • • •
#W5 ma4. resolution is ,.+bit ;+bit, 2+channel analog+to+digital converter Synchronous Serial #ort 6SS#9 with S#II 65aster'Slave9 and I/*I 6Slave9 (rown+out detection circuitry %or (rown+out $eset 6(O$9
C#OS T'358101;$:
• • • • • &ow power, high speed *5OS F&!S= technology Fully static design Wide operating voltage rangeF /..C to 2.2C Industrial temperature range &ow power consumptionF J ..7 m! typical K 0C, 1 5=> /. L! typical K 0C, 0/ k=> J , L! typical standby current
S4'3-)0 #-3+1318&+100'+ F')&*+'%:
• ,,... erase'write cycle F&!S= program memory typical • #ower+ on $eset 6#O$9 • #ower+up Timer 6#W$T9 • Oscillator Start Gup Timer 6OST9 • • • • • • • Watchdog Timer 6W"T9 with its own on+chip $* oscillator %or
reliable operation. $* oscillator %or reliable operation #rogrammable code protection #ower saving S&EE# mode Selectable oscillator options In+*ircuit Serial #rogrammingI 6I*S#I9 via / pins #rocessor read access to program memory
+ ,< +
ARCHITECTURE OF PIC 16F< #ICRO CONTROLLER: The #I*,7F8/ belongs to the 5id+$ange %amily o% the #I* micro devices. The program memory contains /B words, which translate to /.1; instructions, since each ,1+bit program memory word is the same width as each device instruction. The data memory 6$!59 contains ,/; bytes. There are // I'O pins that are user con%igurable on a pin+to+pin basis. Some pins are multiple4ed with other device %unctions. T5'%' 9*83&-18% -830*.': -
• • • • • • • • •
E=&'+8)0 -8&'++*4& C5)8;' 18 PORTB -8&'++*4&% T-('+0 3013/ -84*& T-('+1 3013/>1%3-00)&1+ C)4&*+'>C1(4)+'>PW# A>D 318:'+&'+ SPI>I C L1? V10&);' P+1;+)((-8; I83-+3*-& D'@**;'+
+ /. +
ARCHITECTURE DIAGRA# OF PIC 16F< :
+ /, +
PIN DIGRA# OF PIC 16F< :
+ // +
PIN DESCRIPTION:
#CLR>VPP: 5aster *lear 6$eset9 input or programming voltage input. This pin is an active low $ESET to the device. RA0 - RAA: These are the bi+directional Input ' output #O$T! pins. $!,, $!/, are the analog inputs ,, analog input/. $!0 can also be analog input0 or analog re%erence voltage. $!1 can also be the clock input to the Timer. module. Output is open drain type. $!2 can also be analog input1 or the slave select %or the synchronous serial port. VSS: -round re%erence %or logic and I'O pins. OSC1>CL"1: Oscillator crystal input ' E4ternal clock source input. OSC >CL"O: Oscillator crystal output. *onnects to crystal or resonator in *rystal Oscillator mode. In $* mode, the OS*/ pin outputs *&BO, which has ,'1 the %re3uency o% OS*,, and denotes the instruction cycle rate. RC0 B RC<: These are the bidirectional Input ' Output #O$T* pins. $*.'T,OSO' T,*B. $*. can also be the Timer, oscillator output or Timer, *lock input.
+ /0 +
$*,'T,OSI is the Timer, oscillator input. $*/'**# is the *apture, input'*ompare, output' #W5, output. $*0'S*B'S*&. $*0 can also be the synchronous serial clock input'output %or (oth S#I and I/* modes. $*1'S"I'S"! is the S#I "ata In 6S#I mode9 or "ata I'O 6I/* mode9. $*2'S"O is e the S#I "ata Out 6S#I mode9. $*7 $*8. VDD: #ositive supply %or logic and I'O pins. RB0 B RB<: These are the bi+directional I'O #O$T( pins. #O$T( can be so%tware programmed %or internal weak pull+up on all inputs. $(.'I is the e4ternal interrupt pin. $(,, $(/, $(0 are the bi+directional pins. $(1 is the Interrupt+on+change pin. $(2 is the Interrupt+on+change pin. $(7'#-* is the Interrupt+on+change pin. Serial programming clock. $(8'#-" is the Interrupt+on+change pin. Serial programming data.
I > O PORTS:
Some pins %or these I'O ports are multiple4ed with an alternate %unction %or the peripheral %eatures on the device. In general, when a peripheral is enabled, that pin may not be used as a general purpose I'O pin. !dditional in%ormation on I'O ports may be %ound in the #I* micro 5id+$ange 5*A $e%erence 5anual, 6"S00./09. PORTA )8. &5' TRISA R';-%&'+: #O$T! is a 7+bit wide, bi+directional port. The corresponding data direction register is T$IS!. Setting a T$IS! bit 6M ,9 will make the corresponding #O$T! pin an input 6i.e., put the corresponding output driver in a =i+Impedance mode9. *learing a T$IS! bit 6M .9 will make the corresponding #O$T! pin an output 6i.e., put the contents o% the output latch on the selected pin $eading the #O$T! register, reads the status o% the pins, whereas writing to it will write to the port latch. !ll write operations are read+modi%y+write operations. There%ore, a write to a port implies that the port pins are read, this value is modi%ied + /1 +
and then written to the port data latch #in $!1 is multiple4ed with the Timer. module clock input to become the $!1'T.*BI pin. The $!1'T.*BI pin is an Schmitt Trigger input and an open drain output. !ll other $! port pins have TT& input levels and %ull *5OS output drivers. Other #O$T! pins are multiple4ed with analog inputs and analog C$EF input. The operation o% each pin is selected by clearing'setting the control bits in the !"*O , register 6!'" *ontrol $egister,9. Other #O$T! pins are multiple4ed with analog inputs and analog C$EF input. The operation o% each pin is selected by clearing'setting the control bits in the !"*O , register 6!'" *ontrol $egister,9. Other #O$T! pins are multiple4ed with analog inputs and analog C$EF input. The operation o% each pin is selected by clearing'setting the control bits in the !"*O , register 6!'" *ontrol $egister,9. The T$IS! register controls the direction o% the $! pins, even when they are being used as analog inputs. The user must ensure the bits in the T$IS! register are maintained set when using them as analog inputs.
PORTB )8. &5' TRISB R';-%&'+:
#O$T( is an ;+bit wide, bi+directional port. The corresponding data direction register is T$IS(. Setting a T$IS( bit 6M ,9 will make the corresponding #O$T( pin an input 6i.e., put the corresponding output driver in a =i+Impedance mode9. *learing a T$IS( bit 6M .9 will make the corresponding #O$T( pin an output 6i.e., put the contents o% the output latch on the selected pin9. Each o% the #O$T( pins has a weak internal pull+up. ! single control bit can turn on all the pull+ups. This is per%ormed by clearing bit $(#A 6O#TIO J8N9. The weak pull+up is automatically turned o%% when the port pin is con%igured as an output. The pull+ups are disabled on a #ower+on $eset. Four o% #O$T(Ds pins, $(8F$(1, have an interrupt+on+change %eature. Only pins con%igured as inputs can cause this interrupt to occur 6i.e., any $(8F$(1 pin con%igured as an output is e4cluded %rom the interrupt on change comparison9. The
+ /2 +
input pins 6o% $(8F$(19 are compared with the old value latched on the last read o% #O$T(. The ?mismatch@ outputs o% $(8F$(1 are O$Dd together to generate the $( #ort *hange Interrupt with %lag bit $(IF 6I T*O J.N9.
PORTC )8. &5' TRISC R';-%&'+:
#O$T* is an ;+bit wide, bi+directional port. The corresponding data direction register is T$IS*. Setting a T$IS* bit 6M ,9 will make the corresponding #O$T* pin an input 6i.e., put the corresponding output driver in a =i+Impedance mode9. *learing a T$IS* bit 6M .9 will make the corresponding #O$T* pin an output 6i.e., put the contents o% the output latch on the selected pin9. #O$T* is multiple4ed with several peripheral %unctions. #O$T* pins have Schmitt Trigger input bu%%ers. When enabling peripheral %unctions, care should be taken in de%ining T$IS bits %or each #O$T* pin. Some peripherals override the T$IS bit to make a pin an out+put, while other peripherals override the T$IS bit to make a pin an input. Since the T$IS bit override is in e%%ect while the peripheral is enabled, read+modi%y+write instructions 6(SF, (*F, OO$WF9 with T$IS* as destination should be avoided. The user should re%er to the corresponding peripheral settings. section %or the correct T$IS bit
C)4&*+' #1.':
In *apture mode, **#$,=F **#$,& captures the ,7+bit value o% the T5$, register when an event occurs on pin $*/'**#,. !n event is de%ined asF P Every %alling edge P Every rising edge P Every 1th rising edge P Every ,7th rising edge !n event is selected by control bits **#,50F**#,5. 6**#,*O J0F.N9. When a capture is made, the interrupt re3uest %lag bit **#,IF 6#I$,J/N9 is set. It must be cleared in so%tware. I% another capture occurs be%ore the value in register **#$, is read, the old captured value is overwritten by the new captured value.
C1(4)+' #1.':
+ /7 +
In *ompare mode, the ,7+bit **#$, register value is constantly compared against the T5$, register pair value. When a match occurs, the $*/'**#, pin isF P "riven =igh P "riven &ow P $emains Anchanged The action on the pin is based on the value o% control bits **#,50F **#,5. 6**#,*O J0F.N9. !t the same time, interrupt %lag bit **#,IF is set. The output may become inverted when the mode o% the module is changed %rom *ompare'*lear on 5atch 6**#45J0F.N M E,..,D9 to *ompare'Set on 5atch 6**#45J0F.N M E,...D9. This may occur as a result o% any operation that selectively clears bit **#45., such as a (*F instruction. When this condition occurs, the output becomes inverted when the instruction is e4ecuted. It will remain inverted %or all %ollowing *ompare operations, until the module is reset.
ANALOG-TO-DIGITAL CONVERTER CA>DD #ODULE:
The analog+to+digital 6!'"9 converter module has %ive inputs %or the #I*,7F8/. The !'" allows conversion o% an analog input signal to a corresponding ;+ bit digital number. The output o% the sample and hold is the input into the converter, which generates the result via successive appro4imation. The analog re%erence voltage is so%tware selectable to either the deviceDs positive supply voltage 6C""9 or the voltage level on the $!0'! 0'C$EF pin. The !'" converter has a uni3ue %eature o% being able to operate while the device is in S&EE# mode. To operate in S&EE#, the !'" conversion clock must be derived %rom the !'"Ds internal $* oscillator. The !'" module has three registersF P !'" $esult $egister!"$ES P !'" *ontrol $egister . P !'" *ontrol $egister , !"*O . !"*O ,
! device $ESET %orces all registers to their $ESET state. This %orces the !'" module to be turned o%% and any conversion is aborted. The !"*O . register, shown in $egister ,.+,, controls the operation o% the !'" module. The !"*O , register, shown in $egister ,.+/, con%igures the %unctions o% the port pins. The port pins can be con%igured as analog inputs 6$!0 can also be a voltage re%erence9 or a digital I'O. + /8 +
OSCILLATOR CONFIGURATIONS:
The #I*,7F8/ can be operated in %our di%%erent Oscillator modes. The user can program two con%iguration bits 6FOS*, and FOS*.9 to select one o% these %our 5odesF P &# &ow #ower *rystal P OT *rystal'$esonator P =S =igh Speed *rystal'$esonator P $* $esistor'*apacitor
RESET:
The #I*,7F8/ di%%erentiates between various kinds o% $ESETF P #ower+on $eset 6#O$9 P 5*&$ $eset during normal operation P 5*&$ $eset during S&EE# P W"T $eset 6during normal operation9 P W"T Wake+up 6during S&EE#9 P (rown+out $eset 6(O$9 Some registers are not a%%ected in any $ESET condition. Their status is unknown on #O$ and unchanged in any other $ESET. 5ost other registers are reset to a ?$ESET state@ on #ower+on $eset 6#O$9, on the 5*&$ and W"T $eset, on 5*&$ $eset during S&EE#, and (rown+out $eset 6(O$9. They are not a%%ected by a W"T Wake+up, which is viewed as the resumption o% normal operation. The TO and #" bits are set or cleared di%%erently in di%%erent $ESET situations, as indicated in Table ,,+1. These bits are used in so%tware to determine the nature o% the $ESET.
P1?'+-18 R'%'& CPORD:
! #ower+on $eset pulse is generated on+chip when C"" rise is detected 6in the range o% ,./C + ,.8C9. To take advantage o% the #O$, tie the 5*&$ pin to C"", ! ma4imum rise time %or C"" is speci%ied. When the device starts normal operation 6e4its the $ESET condition9, device+operating parameters 6volt+age, %re3uency, temperature,9 must be met to ensure operation. I% these conditions are not met, the device must be held in $ESET until the operating conditions are met.
+ /; +
P1?'+-*4 T-('+ CPWRTD:
The #ower+up Timer provides a %i4ed 8/ ms nominal time+out on power+up only From the #O$. The #ower+up Timer operates on an internal $* oscillator. The chip is kept in $ESET as long as the #W$T is active. The #W$TDs time delay allows C"" to rise to an acceptable level.
! con%iguration bit is provided to enable' disable the #W$T. The power+up time delay will vary %rom chip to chip due to C"", temperature and process variation.
O%3-00)&1+ S&)+&-*4 T-('+ COSTD:
The Oscillator Start+up Timer 6OST9 provides ,./1 oscillator cycles 6%rom OS*, input9 delay a%ter the #W$T delay is over 6i% enabled9. This helps to ensure that the crystal oscillator or resonator has started and stabili>ed. The OST time+out is invoked only %or OT, &# and =S modes and only on #ower+on $eset or wake+up %rom S&EE#.
B+1?8-1*& R'%'& CBORD:
The con%iguration bit, (O$E , can enable or disable the (rown+out $eset circuit. I% C"" %alls below C(O$ 6parameter "..2, about 1C9 %or longer than T(O$ 6parameter Q02, about ,.. Ls9, the brown+out situation will reset the device. I% C"" %alls below C(O$ %or less than T(O$, a $ESET may not occur. Once the brown+out occurs, the device will remain in (rown+out $eset until C"" rises above C(O$. The #ower+up Timer then keeps the device in $ESET %or T#W$T 6parameter Q00, about 8/ ms9. I% C"" should %all below C(O$ during T#W$T, the (rown+out $eset process will restart when C"" rises above C(O$, with the #ower+up Timer $eset. The #ower+up Timer is always enabled when the (rown+out $eset circuit is enabled, regardless o% the state o% the #W$T con%iguration bit.
P1?'+ C18&+10>S&)&*% R';-%&'+ CPCOND:
The #ower *ontrol'Status $egister, #*O , has two bits to indicate the type o% $ESET that last occurred. (it. is (rown+out $eset Status bit, (O$. (it (O$ is unknown on a #ower+on $eset. It must then be set by the user and checked on subse3uent $ESETS to see i% bit (O$ cleared, indicating a (rown+out $eset
+ /< +
occurred. When the (rown+out $eset is disabled, the state o% the (O$ bit is unpredictable. (it, is #O$ 6#ower+on $eset Status bit9. It is cleared on a #ower+on $eset and una%%ected otherwise. The user must set this bit %ollowing a #ower+on $eset.
W)&35.1; T-('+ CWDTD:
The Watchdog Timer is a %ree running, on+chip $* oscillator that does not re3uire any e4ternal components. This $* oscillator is separate %rom the $* oscillator o% the S*,'*&BI pin. That means that the W"T will run, even i% the clock on the OS*,'*&BI and OS*/' *&BO pins o% the device has been stopped, %or e4ample, by e4ecution o% a S&EE# instruction. "uring normal operation, a W"T time+out generates a device $ESET 6Watchdog Timer $eset9. I% the device is in S&EE# mode, a W"T time+out causes the device to wake+up and Timer time+out. continue with normal operation 6Watchdog Timer Wake+up9. The TO bit in the ST!TAS register will be cleared upon a Watchdog
P+1;+)( V'+-9-3)&-18>C1.' P+1&'3&-18:
I% the code protection bit6s9 have not been programmed, the on+chip program memory can be read out %or veri%ication purposes. ID L13)&-18%: Four memory locations 6/...h + /..0h9 are designated as I" locations, where the user can store checksum or other code identi%ication numbers. These locations are not accessible during normal e4ecution, but are readable and writable during program'veri%y. It is recommended that only the %our &east Signi%icant bits o% the I" location are used.
+ 0. +
I8-C-+3*-& S'+-)0 P+1;+)((-8;:
#I*,7F8/ microcontrollers can be serially programmed while in the end application circuit. This is simply done with two lines %or clock and data and three other lines %or power, ground, and the programming voltage. This allows customers to manu%acture boards with unprogrammed devices, and then program the micro controller )ust be%ore shipping the product. This also allows the most recent %irmware or a custom %irmware to be programmed.
INSTRUCTION SET SU##ARY:
Each #I*,7F8/ instruction is a ,1+bit word divided into an O#*O"E that speci%ies the instruction type and one or more operands that %urther speci%y the operation o% the instruction. The #I*,7F8/ instruction set summary in Table ,/+/ lists byte+oriented, bit+oriented, and literal and control operations. Table ,/+, shows the opcode %ield descriptions. For byte+oriented instructions, E%D represents a %ile register designator and EdD represents a destination designator. The %ile register designator speci%ies which %ile register is to be used by the instruction. The destination designator speci%ies where the result o% the operation is to be placed. I% EdD is >ero, the result is placed in the W register. I% EdD is one, the result is placed in the %ile register speci%ied in the instruction. For bit+oriented instructions, EbD represents a bit %ield designator which selects the number o% the bit a%%ected by the operation, while E%D represents the number o% the %ile in which the bit is located. For literal and control operations, EkD represents an eight or eleven+bit constant or literal value. The instruction set is highly orthogonal and is grouped into three basic categoriesF P (yte+oriented operations P (it+oriented operations P &iteral and control operations !ll instructions are e4ecuted within one single instruction cycle, unless a conditional test is true or the program counter is changed as a result o% an instruction. In this case, the e4ecution takes two instruction cycles, with the second cycle e4ecuted as a O#. One instruction cycle consists o% %our oscillator periods.
+ 0, +
Thus, %or an oscillator %re3uency o% 1 5=>, the normal instruction e4ecution time is , Ls. I% a conditional test is true, or the program counter is changed as a result o% an instruction, the instruction e4ecution time is / Ls.
I C PROTOCOL
HISTORY OF THE I C BUS
The I/* bus was developed in the early ,<;.Rs by #hilips Semiconductors. Its original purpose was to provide an easy way to connect a *#A to peripheral chips in a TC+set. IS* is a multi+master serial computer bus used to attach low+speed peripherals to a motherboard, embedded system, or cell phone. The name stands %or Inter+ Integrated *ircuit and is pronounced I-s3uared-C and also, I-two-C.
THE I C BUS PROTOCOL
The I/* bus physically consists o% / active wires and a ground connection. The active wires, called S"! and S*&, are both bi+directional. S"! is the Serial data line, and S*& is the Serial clock line. Every device hooked up to the bus has its own uni3ue address, no matter whether it is an 5*A, &*" driver, memory, or !SI*. Each o% these chips can act as a receiver and'or transmitter, depending on the %unctionality. Obviously, an &*" driver is only a receiver, while a memory or I'O chip can be both transmitter and receiver. The I/* bus is a multi+master bus. This means that more than one I* capable o% initiating a data trans%er can be connected to it. The I/* protocol speci%ication states that the I* that initiates a data trans%er on the bus is considered the B*% #)%&'+. *onse3uently, at that time, all the other I*s are regarded to be B*% S0):'%.
+ 0/ +
!s bus masters are generally microcontrollers, letRs take a look at a general Rinter+I* chatR on the bus. &etDs consider the %ollowing setup and assume the 5*A wants to send data to one o% its slaves.
OPERATION:First, the 5*A will issue a START condition. This acts as an R!ttentionR signal to all o% the connected devices. !ll I*s on the bus will listen to the bus %or incoming data. Then the 5*A sends the ADDRESS o% the device it wants to access, along with an indication whether the access is a $ead or Write operation 6Write in our e4ample9. =aving received the address, all I*Rs will compare it with their own address. I% it doesnRt match, they simply wait until the bus is released by the stop condition 6see below9. I% the address matches, however, the chip will produce a response called the AC"NOWLEDGE#ENT signal. Once the 5*A receives the acknowledge, it can start transmitting or receiving DATA. In our case, the 5*A will transmit data. When all is done, the 5*A will 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. We have had several states on the bus in our e4ampleF ST!$T, !""$SS, !*B OW&E"-E5E T, "!T! and STO#. These are all uni3ue conditions on the bus. (e%ore we take a closer look at these bus conditions we need to understand a bit about the physical structure and hardware o% the bus
+ 00 +
THE I C BUS HARDWARE STRUCTURE
!s e4plained earlier, the bus physically consists o% / active wires called SDA 6data9 and SCL 6clock9, and a ground connection. (oth S"! and S*& are initially bi+directional. This means that in a particular device, these lines can be driven by the I* itsel% or %rom an e4ternal device. In order to achieve this %unctionality, these signals use open collector or open drain outputs 6depending on the technology9. The bus inter%ace is built around an input bu%%er and an open drain or open collector transistor. When the bus is I"&E, the bus lines are in the logic =I-= state 6note that e4ternal pull+up resistors are necessary %or this which is easily %orgotten9. To put a signal on the bus, the chip drives its output transistor, thus pulling the bus to a &OW level. The Tpull+up resistorT in the devices as seen in the %igure is actually a small current source or even non+e4istent.
I/* (us EventsF The ST!$T and STO# conditionsF
#rior to any transaction on the bus, a ST!$T condition needs to be issued on the bus. The start condition acts as a signal to all connected I*Rs that something is about to be transmitted on the bus. !s a result, all connected chips will listen to the bus. !%ter a message has been completed, a STO# condition is sent. This is the signal %or all devices on the bus that the bus is available again 6idle9. I% a chip was accessed and has received data during the last transaction, it will now process this in%ormation 6i% not already processed during the reception o% the message9.
+ 01 +
START: The chip issuing the Start condition %irst pulls the S"! 6data9 line low, and ne4t pulls the S*& 6clock9 line low.
STOP: The (us 5aster %irst releases the S*& and then the S"! line.
•
! single message can contain multiple Start conditions. The use o% this so+ called Trepeated startT is common in I/*.
•
! Stop condition always denotes the E " o% a transmission. Even i% it is issued in the middle o% a transaction or in the middle o% a byte. It is Tgood behaviorT %or a chip that, in this case, it disregards the in%ormation sent and resumes the Tlistening stateT, waiting %or a new start condition.
I C BUS EVENTS: TRANS#ITTING A BYTE TO A SLAVE:
Once the %&)+& condition has been sent, a byte can be transmitted by the 5!STE$ to the S&!CE.
+ 02 +
This %irst byte a%ter a start condition will identi%y the slave on the bus 6address9 and will select the mode o% operation. The meaning o% all %ollowing bytes depends on the slave.
!s the I/* bus gained popularity, it was soon discovered that the number o% available addresses was too small. There%ore, one o% the reserved addresses has been allocated to a new task to switch to ,.+bit addressing mode. I% a standard slave 6not able to resolve e4tended addressing9 receives this address, it wonRt do anything 6since itRs not its address9. I% there are slaves on the bus that can operate in the e4tended ,.+bit addressing mode, they will !&& respond to the AC" cycle issued by the master. The second byte that gets transmitted by the master will then be taken in and evaluated against their address.
I C BUS EVENTS: RECEIVING A BYTE FRO# A SLAVE:
Once the slave has been addressed and the %0):' 5)% )3/81?0'.;'. this, a byte can be received %rom the slave i% the $'W bit in the address was set to $E!" 6set to R,R9. The protocol synta4 is the same as in &+)8%(-&&-8; ) @$&' &1 ) %0):' , e4cept that now the master is not allowed to touch the S"! line. #rior to sending the ; clock pulses needed to clock in a byte on the S*& line, the master releases the S"! line. The slave will now take control o% this line. The line will then go high i% it wants to transmit a R,R or, i% the slave wants to send a R.R, remain low.
+ 07 +
!ll the master has to do is generate a rising edge on the S*& line 6/9, read the level on S"! 609 and generate a %alling edge on the S*& line 619. The slave will not change the data during the time that S*& is high. 6Otherwise a S&)+& 1+ S&14 318.-&-18 might inadvertently be generated.) "uring 6,9 and 629, the slave may change the state o% the S"! line. In total, this se3uence has to be per%ormed ; times to complete the data byte. (ytes are always transmitted 5S( %irst
The meaning o% all bytes being read depends on the slave. There is no such thing as a Tuniversal status registerT. Uou need to consult the data sheet o% the slave being addressed to know the meaning o% each bit in any byte transmitted.
I C BUS EVENTS: GETTING AC"NOWLEDGE FRO# A SLAVE:
When an address or data byte has been transmitted onto the bus then this must be acknowledged by the slave6s9. In case o% an addressF I% the address matches its own then that slave and only that slave will respond to the address with an !*B. In case o% a byte transmitted to an already addressed slave then that slave will respond with an !*B as well.
+ 08 +
The slave that is going to give an !*B pulls the S"! line low immediately a%ter reception o% the ;th bit transmitted, or, in case o% an address byte, immediately a%ter evaluation o% its address. In practical applications this will not be noticeable.
This means that as soon as the master pulls S*& low to complete the transmission o% the bit 6,9, S"! will be pulled low by the slave 6/9. The master now issues a clock pulse on the S*& line 609. The slave will release the S"! line upon completion o% this clock pulse 619. The bus is now available again %or the master to continue sending data or to generate a stop condition. In case o% .)&) @'-8; ?+-&&'8 &1 ) %0):', this cycle must be completed be%ore a %&14 318.-&-18 can be generated. The slave will be blocking the bus 6S"! kept low by slave9 until the master has generated a clock pulse on the S*& line.
I C BUS EVENTS: GIVING AC"NOWLEDGE TO A SLAVE:
Apon +'3'4&-18 19 ) @$&' 9+1( ) %0):', the master must acknowledge this to the slave device. The master is in %ull control o% the S"! and the S*& line.
+ 0; +
!%ter transmission o% the last bit to the master 6,9 the slave will release the S"! line. The S"! line should then go high 6/9. The 5aster will now pull the S"! line low 609 . e4t, the master will put a clock pulse on the S*& line 619. !%ter completion o% this clock pulse, the master will again release the S"! line 629.The slave will now regain control o% the S"! line 679. I% the master wants to stop receiving data %rom the slave, it must be able to send a %&14 318.-&-18. Since the slave regains control o% the S"! line a%ter the !*B cycle issued by the master, this could lead to problems. &etRs assume the ne4t bit ready to be sent to the master is a .. The S"! line would be pulled low by the slave immediately a%ter the master takes the S*& line low. The master now attempts to generate a Stop condition on the bus. It releases the S*& line %irst and then tries to release the S"! line + which is held low by the slave. *onclusionF o Stop condition has been generated on the bus. This condition is called a !*BF ot acknowledge.
I C BUS EVENTS: NO AC"NOWLEDGE CFRO# SLAVE TO #ASTERD:
This is not e4actly a condition. It is merely a state in the data %low between master and slave.
+ 0< +
I%, a%ter transmission o% the ;th bit %rom the master to the slave the slave does not pull the S"! line low, then this is considered a o !*B condition. This means that eitherF
• • •
The slave is not there 6in case o% an address9 The slave missed a pulse and got out o% sync with the S*& line o% the master. The bus is TstuckT. One o% the lines could be held low permanently.
In any case the master should abort by attempting to send a stop condition on the bus.
APPLICATIONS
IS* is appropriate %or peripherals where simplicity and low manu%acturing cost are more important than speed. *ommon applications o% the IS* bus areF • • • • • • • $eading con%iguration data %rom S#" E#$O5Ds on S"$!5, ""$ S"$!5, ""$/ S"$!5 memory sticks 6"I559 and other stacked #* boards Supporting systems management %or #*I cards, through a S5(us /.. connection. !ccessing C$!5 chips that keep user settings. !ccessing low speed "!*s. !ccessing low speed !"*s. *hanging contrast, hue, and color balance settings in monitors 6"isplay "ata *hannel9. *hanging sound volume in intelligent speakers.
+ 1. +
• • • •
*ontrolling O&E"'&*" displays, like in a cell phone. $eading hardware monitors and diagnostic sensors, like a *#A thermostat and %an speed. $eading real time clocks. Turning on and turning o%% the power supply o% system components.
! particular strength o% IS* is that a microcontroller can control a network o% device chips with )ust two general+purpose I'O pins and so%tware. #eripherals can also be added to or removed %rom the IS* bus while the system is running, which makes it ideal %or applications that re3uire hot swapping o% components.
!.
PASSIVE INFRARED SENSOR CPIRD: ! #I$ detector is a motion detector that senses the heat emitted by a living
body. These are o%ten %itted to security lights so that they will switch on automatically i% approached. They are very e%%ective in enhancing home security systems.
The sensor is passive because, instead o% emitting a beam o% light or microwave energy that must be interrupted by a passing person in order to ?sense@ that person, the #I$ is simply sensitive to the in%rared energy emitted by every living thing. When an intruder walks into the detectorDs %ield o% vision, the detector ?sees@ a sharp increase in in%rared energy. ! #I$ sensor light is designed to turn on when a person approaches, but will not react to a person standing still. The lights are designed this way. ! moving person e4hibits a sudden change in in%rared energy, but a slower change is emitted by a motionless body. Slower changes are also caused by gradual %luctuations in the
+ 1, +
temperature o% the environment. I% the light were sensitive to these slower changes, it would react to the sidewalk cooling o%% at night, instead o% the motion o% a burglar. I% you have a #I$ light, you may notice that it is more sensitive on cold days than on warm days. This is because the di%%erence in temperature between the ambient air and the human body is greater on cold days, making the rise in temperature easier %or the sensor to detect. This has drawbacks, thoughH i% the sensor is too sensitive, it will pick up things you donDt want it to such as the movement o% small animals.
#assive in%rared sensor is an electronic device, which measures in%rared light radiating %rom ob)ects in its %ield o% view. #I$s are o%ten used in the construction o% #I$+based motion detectors. !pparent motion is detected when an in%rared source with one temperature, such as a human, passes in %ront o% an in%rared source with another temperature, such as a wall. !ll ob)ects emit what is known as black body radiation. This energy is invisible to the human eye but can be detected by electronic devices designed %or such a purpose. The term R#assiveR in this instance means the #I$ does not emit energy o% any type but merely accepts incoming in%rared radiation. In%rared radiation enters through the %ront o% the sensor, known as the sensor %ace. !t the core o% a #I$ is a solid state sensor or set o% sensors, made %rom appro4imately ,'1 inches s3uare o% natural or arti%icial pyroelectric materials, usually in the %orm o% a thin %ilm, out o% gallium nitride 6-a 9, caesium nitrate 6*s O 09, polyvinyl %luorides, derivatives o% phenylpyra>ine, and cobalt phthalocyanine. 6See pyroelectric crystals.9 &ithium tantalate 6&iTaO 09 is a crystal e4hibiting both pie>oelectric and pyroelectric properties. The sensor is o%ten manu%actured as part o% an integrated circuit and may consist o% one 6,9, two 6/9 or %our 619 Rpi4elsR o% e3ual areas o% the pyroelectric material. #airs o% the sensor pi4els may be wired as opposite inputs to a di%%erential ampli%ier. In such a con%iguration, the #I$ measurements cancel each other so that the
+ 1/ +
average temperature o% the %ield o% view is removed %rom the electrical signalH an increase o% I$ energy across the entire sensor is sel%+cancelling and will not trigger the device. This allows the device to resist %alse indications o% change in the event o% being e4posed to %lashes o% light or %ield+wide illumination. 6*ontinuous bright light could still saturate the sensor materials and render the sensor unable to register %urther in%ormation.9 !t the same time, this di%%erential arrangement minimi>es common+mode inter%erenceH this allows the device to resist triggering due to nearby electric %ields. =owever, a di%%erential pair o% sensors cannot measure temperature in that con%iguration and there%ore this con%iguration is speciali>ed %or motion detectors.
In a #I$+based motion detector, the #I$ sensor is typically mounted on a printed circuit board, which also contains the necessary electronics re3uired to interpret the signals %rom the chip. The complete circuit is contained in a housing, which is then mounted in a location where the sensor can view the area to be monitored. In%rared energy is able to reach the sensor through the window because the plastic used is transparent to in%rared radiation 6but only translucent to visible light9. This plastic sheet prevents the introduction o% dust and insects, which could obscure the sensorRs %ield o% view.
OPERATION OF PIR SENSOR:
! %ew mechanisms have been used to %ocus the distant in%rared energy onto the sensor sur%ace. The window may have Fresnel lenses molded into it. !lternatively, sometimes #I$ sensors are used with plastic segmented parabolic mirrors to %ocus the in%rared energyH when mirrors are used, the plastic window cover has no Fresnel lenses molded into it. ! %iltering window 6or lens9 may be used to limit the wavelengths to ;+,1 micrometers, which is most sensitive to human in%rared radiation 6<.1 micrometers being the strongest9. The #I$ device can be thought o% as a kind o% in%rared EcameraD, which remembers the amount o% in%rared energy %ocused on its sur%ace. Once power is
+ 10 +
applied to the #I$ the electronics in the #I$ shortly settle into a 3uiescent state and energi>e a small relay. This relay controls a set o% electrical contacts, which are usually connected to the detection input o% an alarm control panel. I% the amount o% in%rared energy %ocused on the sensor changes within a con%igured time period, the device will switch the state o% the alarm output relay. The alarm output relay is typically a Tnormally closed 6 *9T relayH also know as a TForm (T relay. ! person entering the monitored area is detected when the in%rared energy emitted %rom the intruderRs body is %ocused by a Fresnel lens or a mirror segment and overlaps a section on the chip, which had previously been looking at some much cooler part o% the protected area. That portion o% the chip is now much warmer than when the intruder wasnRt there. !s the intruder moves, so does the hot spot on the sur%ace o% the chip. This moving hot spot causes the electronics connected to the chip to de+energi>e the relay, operating its contacts, thereby activating the detection input on the alarm control panel. *onversely, i% an intruder were to try to de%eat a #I$ perhaps
+ 11 +
(y holding some sort o% thermal shield between himsel% and the #I$, a corresponding RcoldR spot moving across the %ace o% the chip will also cause the relay to de+energi>e unless the thermal shield has the same temperature as the ob)ects behind it. 5anu%acturers recommend care%ul placement o% their products to prevent %alse alarms. They suggest mounting the #I$s in such a way that the #I$ cannot RseeR out o% a window. !lthough the wavelength o% in%rared radiation to which the chips are sensitive does not penetrate glass very well, a strong in%rared source 6a vehicle headlight, sunlight re%lecting %rom a vehicle window9 can overload the chip with enough in%rared energy to %ool the electronics and cause a %alse 6non+intruder caused9 alarm. ! person moving on the other side o% the glass however would not be RseenR by the #I$. They also recommended that the #I$ not be placed in such a position that an =C!* vent would blow hot or cold air onto the sur%ace o% the plastic, which covers the housingRs window. !lthough air has very low emissivity 6emits very small amounts o% in%rared energy9, the air blowing on the plastic window cover could change the plasticRs temperature enough to, once again, %ool the electronics. #I$s come in many con%igurations %or a wide variety o% applications. The most common used in home security systems has numerous Fresnel lenses or mirror segments and has an e%%ective range o% about thirty %eet. Some larger #I$s are made with single segment mirrors and can sense changes in in%rared energy over one hundred %eet away %rom the #I$. There are also #I$s designed with reversible orientation mirrors, which allow either broad coverage 6,,.V wide9 or very narrow RcurtainR coverage. #I$s can have more than one internal sensing element so that, with the appropriate electronics and Fresnel lens, it can detect direction. &e%t to right, right to le%t, up or down and provide an appropriate output signal.
!.! LIGHT DEPENDENT RESISTOR: + 12 +
&"$s or &ight "ependent $esistors are very use%ul especially in light'dark sensor circuits. ormally the resistance o% an &"$ is very high, sometimes as high as ,... ... ohms, but when they are illuminated with light resistance drops dramatically. Electronic opto sensors are the devices that alter their electrical characteristics, in the presences o% visible or invisible light. The best+known devices o% this type are the light dependent resistor 6&"$9, the photo diode and the phototransistors. &ight dependent resistor as the name suggests depends on light %or the variation o% resistance. • &"$ are made by depositing a %ilm o% cadmium sulphide or cadmium selenide
on a substrate o% ceramic containing no or very %ew %ree electrons when not illuminated. The %ilm is deposited in a >ig >ag %ashion in the %orm o% a strip. The longer the strip the more the value o% resistance. • When light %alls on the strip, the resistance decreases. In the absence o% light the resistance can be in the order o% ,.B ohm to ,2B ohm and is called the dark resistance. "epending on the e4posure o% light the resistance can %all down to value o% 2.. ohms. The power ratings are usually smaller and are in the range 2.mw to .2w. Though very sensitive to light, the switching time is very high and hence cannot be used %or high %re3uency applications. They are used in chopper ampli%iers. &ight dependent resistors are available as discs ..2cm to /.2cm. The resistance rises to several 5ega ohms under dark conditions. The below %igure shoes that when the torch is turned on, the resistance o% the &"$ %alls, allowing current to pass through it is shown in %igure.
+ 17 +
The basic construction and symbol %or &"$ are shown in above %igures respectively. The device consists o% a pair o% metal %ilm contacts. Separated by a snakelike track o% cadmium sulphide %ilm, designed to provide the ma4imum possible contact area with the two metal %ilms. The structure is housed in a clear plastic or resin case, to provide %ree access to e4ternal light. #ractical &"$s are available in variety o% si>es and packages styles, the most popular si>e having a %ace diameter o% roughly ,.mm. practical &"$ is shown in below %igure.
S4'3&+)0 +'%418%':
The resistors are only light dependent over a limited range o% wavelengths. &"$s have their ma4imum response at about 7;.nm.
+ 18 +
T'(4'+)&*+' .'4'8.'83$:
Electrons can be e4cited not only by photons but also by thermal agitation. The dark resistance is there%ore not in%inite at normal temperatures. It increases with the ambient temperature coe%%icient is, however, very small and can be neglected.
R'31:'+$ +)&':
When an &"$ is brought %rom a certain illuminating level into total darkness, the resistance does not increase immediately to the dark value. The recovery rate is speci%ied in k ohm'second and %or current &"$ types it is more than /..k ohm'second. The recovery rate is much greater in the reverse direction, e.g. going %rom darkness to illumination level o% 0.. lu4, it takes less than resistance which corresponds with a light level o% 1.. lu4. &"$s are sensitive, ine4pensive, and readily available devices. They have good power and voltage handling capabilities, similar to those o% a conventional resistor. Their only sigini%icant de%ect is that they are %airly low acting, taking tens or hundreds o% &"$ include light and dark+activated switches and alarms, light beam alarms and re%lective smoke alarms etc. ! &"$ may be connected either way round and no special precautions are re3uired when soldering. • • "arknessF 5a4imum resistance, about ,5ohm. Cery bright lightF 5inimum resistance, about ,.. ohm. ,.ms to reach a
The &"$ is a variable resistor whose resistance decreases with the increase in light intensity. Two cadmium sulphide 6cds9 photoconductive cells with spectral response similar to that o% the human eye. The cell resistance %alls with increasing light intensity.
+ 1; +
LDR C-+3*-& D-);+)
-
F')&*+'%:
• • • • =igh reliability &ight weight Wide spectral response Wide ambient temperature range
A440-3)&-18%:
• • • • Smoke detection !utomatic lighting control (urglar alarm systems *amera 6electronic shutter9
+ 1< +
•
Strobe 6color temperature reading9
0.1 "igital Thermometer and Thermostat 6"S,7/,9F +
FEATURES: ? ? Temperature measurements re3uire no e4ternal components 5easures temperatures %rom +22V* to W,/2V* in ..2V* increments.
Fahrenheit e3uivalent is +78VF to /28VF in ..<VF increments ? ? ? ? ? ? Temperature is read as a <+bit value 6/+byte trans%er9 Wide power supply range 6/.8C to 2.2C9 *onverts temperature to digital word in less than , second Thermostatic settings are user de%inable and nonvolatile "ata is read %rom'written via a /+wire serial inter%ace 6open drain I'O lines9 !pplications include thermostatic controls, industrial systems, consumer products, Thermometers, or any thermal sensitive system ? ;+pin "I# or SO package 6,2.mil and /.;mil9 ABSOLUTE #AXI#U# RATINGS: Coltage on !ny #in $elative to -round Operating Temperature $ange Storage Temperature $ange DESCRIPTION: The "S,7/, "igital Thermometer and Thermostat provides <+bit temperature readings, which indicate the temperature o% the device. The thermal alarm output, TOAT, is active when the temperature o% the device e4ceeds a user+de%ined temperature T=F+ The output remains active until the temperature drops below user de%ined temperature T&, allowing %or any hysteresis necessary. +..2C to W7..C +22X* to W,/2X* +22X* to W,/2X*
+ 2. +
Aser+de%ined 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'%rom the "S,7/, over a simple /+wire serial inter%ace. PIN DESCRIPTION: PIN ASSIGNMENT S"! + /+Wire Serial "ata Input'Output. S*& + /+Wire Serial *lock - " + -round TOAT + Thermostat Output Signal !. + *hip !ddress Input "S,7/, ;+#I S.6,2. mil9
A1 - Chip Address Input !/ + *hip !ddress Input C"" + #ower Supply Coltage "S,7/, ;+#I "I# 60..mil9
OPERATION: #')%*+-8; T'(4'+)&*+':
The "S,7/, measures temperature using a band gap+based temperature sensor. ! delta+sigma analog+to digital converter 6!"*9 converts the measured temperature to a digital value that is calibrated in V*H %or VF applications, a lookup table or conversion routine must be used.
The temperature reading is provided in a <+bit, twoDs complement reading by issuing the $E!" TE5#E$!TA$E command. Table / describes the e4act relationship o% output data to measured temperature. The data is transmitted through
+ 2, +
the /+wire serial inter%ace, 5S( %irst. The "S,7/, can measure temperature over the range o% +22X* to W,/2X* in ..2X* increments.
DS16 1 FUNCTIONAL BLOC" DIAGRA#:
T5'+(1%&)& C18&+10: In its operating mode, the "S,7/, %unctions as a thermostat with programmable hysteresis as shown in Figure 0. The thermostat output updates as soon as a temperature conversion is complete. When the "S,7/,Ds temperature meets or e4ceeds the value stored in the high temperature trip register 6T=9, the output becomes active and will stay active until the
+ 2/ +
temperature %alls below the temperature stored in the low temperature trigger register 6T&9. In this way, any amount o% hysteresis may be obtained. The active state %or the output is programmable by the user so that an active state may either be a logic T,T 6C""9 or a logic T.T 6.C9. This is done using the #O& bit in the con%iguration register as e4plained in the Operation and *ontrol section o% this datasheet.
THER#OSTAT OUTPUT OPERATION: D6 CT5'+(1%&)& 1*&4*&E A3&-:' F H-;5D
OPERATION AND CONTROL: The "S,7/, must have temperature settings resident in the T= and T& registers %or thermostatic operation. ! con%iguration'status register also determines the method o% operation that the "S,7/, will use in a particular application, as well as indicating the status o% the temperature conversion operation. T5' 3189-;*+)&-18 +';-%&'+ -% .'9-8'. )% 91001?%:
Where DONE M *onversion "one bit. ?,@ M *onversion complete, ?.@ M *onversion in progress.
+ 20 +
THF M Temperature =igh Flag. This bit will be set to ?,@ when the temperature is greater than or e3ual to the value o% T=. It will remain ?,@ until reset by writing ?.@ into this location or removing power %rom the device. This %eature provides a method o% determining i% the "S,7/, has ever been sub)ected to temperatures above T= while power has been applied. TLF M Temperature &ow Flag. This bit will be set to ?,@ when the temperature is less than or e3ual to the value o% T&. It will remain ?,@ until reset by writing ?.@ into this location or removing power %rom the device. This %eature provides a method o% determining i% the "S,7/, has ever been sub)ected to temperatures below T& while power has been applied.
NVB M
onvolatile 5emory (usy %lag. ?,@ M Write to an E/ memory cell in
progress, ?.@ Mnonvolatile memory is not busy. ! copy to E/ may take up to ,. ms. POL M Output #olarity (it. ?,@ M active high, ?.@ M active low. This bit is nonvolatile. ,S=OT M One Shot 5ode. I% ,S=OT is ?,@, the "S,7/, will per%orm one temperature conversion upon receipt o% the Start *onvert T protocol. I% ,S=OT is ?.@, the "S,7/, will continuously per%orm temperature conversions. This bit is nonvolatile. X M $eserved. For typical thermostat operation the "S,7/, will operate in continuous mode. =owever, %or applications where only one reading is needed at certain times or to conserve power, the one+shot mode may be used. cycle when operating in one+shot mode. T5' DS16 1 ()$ 14'+)&' -8 &5' 91001?-8; &?1 (1.'%: ote that the thermostat output 6TOAT9 will remain in the state it was in a%ter the last valid temperature conversion
+ 21 +
,.
Slave receiver modeF Serial data and clock are received through S"! and
S*&. !%ter each byte is received an acknowledge bit is transmitted. ST!$T and STO# conditions are recogni>ed as the beginning and end o% a serial trans%er. !ddress recognition is per%ormed by hardware a%ter reception o% the slave address and direction bit. /. Slave transmitter modeF The %irst byte is received and handled as in the slave
receiver mode. =owever, in this mode the direction bit will indicate that the trans%er direction is reversed. Serial data is transmitted on S"! by the "S,7/, while the serial clock is input on S*&. ST!$T and STO# conditions are recogni>ed as the beginning and end o% a serial trans%er.
CO##AND SET:
To write to the "S,7/,, the master will issue the slave address o% the "S,7/, and the $'W bit will be set to ?.@. !%ter receiving an acknowledge, the bus master provides a command protocol. !%ter receiving this protocol, the "S,7/, will issue an acknowledge and then the master may send data to the "S,7/,. I% the "S,7/, is to be read, the master must send the command protocol as be%ore and then issue a repeated ST!$T condition and the control byte again, this time with the $'W bit set to ?,@ to allow reading o% the data %rom the "S,7/,. The command set %or the "S,7/, as shown in Table 0 is as %ollowsF
R'). T'(4'+)&*+' GAA5H: This command reads the last temperature conversion result. The "S,7/, will send / bytes, in the %ormat described earlier, which are the contents o% this register.
A33'%% TH GA15H: I% $'W is ?.@ this command writes to the T= 6=I-= TE5#E$!TA$E9 register. !%ter issuing this command, the ne4t / bytes written to the "S,7/,, in the same %ormat as described %or reading temperature, will set the high temperature threshold %or operation o% the TOAT output. I% $'W is ?,@ the value stored in this register is read back.
+ 22 +
A33'%% TL GA 5H: I% $'W is ?.@ this command writes to the T& 6&OW TE5#E$!TA$E9 register. !%ter issuing this command, the ne4t / bytes written to the "S,7/,, in the same %ormat as described %or reading temperature, will set the high temperature threshold %or operation o% the TOAT output. I% $'W is ?,@ the value stored in this register is read back.
A33'%% C189-; GAC5H: I% $'W is ?.@ this command writes to the con%iguration register. !%ter issuing this command, the ne4t data byte is the value to be written into the con%iguration register. I% $'W is ?,@ the ne4t data byte read is the value stored in the con%iguration register.
R'). C1*8&'+ GAI5H: This command reads the value *ountX$emain. This command is valid only i% $'W is ?,@.
R'). S014' GA95H: This command reads the value *ountX#erX*. This command is valid only i% $'W is ?,@.
S&)+& C18:'+& T GEE5H: This command begins a temperature conversion. o %urther data is re3uired. In one+shot mode the temperature conversion will be per%ormed and then the "S,7/, will remain idle. In continuous mode this command will initiate continuous conversions.
S&14 C18:'+& T G 5H: -
+ 27 +
This command stops temperature conversion.
o %urther data is re3uired. This
command may be used to halt a "S,7/, in continuous conversion mode. !%ter issuing this command, the current temperature measurement will be completed and the "S,7/, will remain idle until a Start *onvert T is issued to resume continuous operation.
!.A 7ERO CROSSING DETECTOR C7CDD: :ero crossing detectors as a group are not a well+understood application, although they are essential elements in a wide range o% products. It has probably
+ 28 +
escaped the notice o% readers who have looked at the lighting controller and the &inkwit> *osine (urst -enerator, but both o% these rely on a >ero crossing detector %or their operation. ! >ero crossing detector literally detects the transition o% a signal wave%orm %rom positive and negative, ideally providing a narrow pulse that coincides e4actly with the >ero voltage condition. !t %irst glance, this would appear to be an easy enough task, but in %act it is 3uite comple4, especially where high %re3uencies are involved. In this instance, even , k=> starts to present a real challenge i% e4treme accuracy is needed. The not so humble comparator plays a vital role + without it, most precision >ero crossing detectors would not work, and weRd be without digital audio, #W5 and a multitude o% other applications taken %or granted.
B)%-3 01? 9+',*'83$: The >ero crossing detector as used %or the dimmer ramp generator. !lthough it has almost >ero phase inaccuracy, that is largely because the pulse is so broad that any inaccuracy is completely swamped. The comparator %unction is handled by transistor Y, + very basic, but ade3uate %or the )ob. The circuit is also sensitive to level, and %or acceptable per%ormance the !* wave%orm needs to be o% reasonably high amplitude. ,/+,2C !* is typical. I% the voltage is too low, the pulse width will increase. $, is there to ensure that the voltage %alls to >ero + stray capacitance is su%%icient to stop the circuit %rom working without it.
+ 2; +
B)%-3 A0>60HJ 7'+1 C+1%%-8; D'&'3&1+ The pulse width o% this circuit 6at 2.=>9 is typically around 7..us 6..7ms9 which sounds %ast enough. The problem is that at 2.=> each hal% cycle takes only ,.ms 6;.00ms at 7.=>9, so the pulse width is over 2Z o% the total period. This is why most dimmers can only claim a range o% ,.Z+<.Z + the >ero crossing pulse lasts too long to allow more range. While this is not a problem with the average dimmer, it is not acceptable %or precision applications. For a tone burst generator 6either the cosine burst or a RconventionalR tone burst generator9, any inaccuracy will cause the switched wave%orm to contain glitches.
+ 2< +
7CD OUTPUT WAVEFOR#: -
+ 7. +
!.6 POWER SUPPLY:
#ower supply block consists o% %ollowing unitsF • • • • • • Step down trans%ormer. (ridge recti%ier circuit. Input %ilter. Coltage regulators. Output %ilter. Indicator unit.
S&'4 .1?8 &+)8%91+('+:
The step+down trans%ormer is used to step down the supply voltage o% /0.v ac %rom mains to lower values, as the various I*Ds used in this pro)ect re3uire reduced voltages. The trans%ormer consists o% primary and secondary coils. To reduce or step down the voltage, the trans%ormer is designed to contain less number o% turns in its secondary core. The outputs %rom the secondary coil which is center tapped are the ac values o% .v, ,2v and ,2v. The conversion o% these ac values to dc values to dc values is done using the %ull wave recti%ier unit.
R'3&-9-'+ U8-&:
! diode bridge is an arrangement o% %our diodes connected in a bridge circuit. That provides the polarity o% output voltage o% any polarity o% the input voltage. When used in its most common application, %or conversion o% alternating current 6!.*9 input into direct current 6".*9 output, it is known as a bridge recti%ier. The diagram describes a diode+bridge design known as a %ull wave recti%ier. This design can be used to recti%y single phase !.*. when no trans%ormer center tap is available. ! bridge recti%ier makes use o% %our diodes in a bridge arrangement to achieve %ull wave recti%ication. This is a Widely used con%iguration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally. For both positive and negative swings o% the trans%ormer, there is a %orward path through the diode bridge. (oth conduction paths cause current to %low in the same direction through the load resister, accomplishing %ull+wave recti%ication. While one set o% diodes is %orward biased, the other set is reverse biased and e%%ectively eliminated %rom the circuit. + 7, +
I84*& F-0&'+: *apacitors are used as %ilters. The ripples %rom the dc voltages are removed and pure dc voltage is obtained. The primary action per%ormed by capacitor is charging and discharging. It charges in positive hal% cycle o% the ac voltage and it will discharge in negative hal% cycle. So it allows only ac voltage and does not allow the dc voltage. This %ilter is %i4ed be%ore the regulator. *apacitors used here are o% the value ,...uF
R';*0)&1+ *8-&: $egulator regulates the output voltage to a speci%ic value. The output voltage is maintained irrespective o% the %luctuations in the input dc voltage. Whenever there are any ac voltage %luctuations, the dc voltage also changes, and to avoid this regulators are used.
R';*0)&1+% 3)8 @' 30)%%-9-'. )%: 1. P1%-&-:' +';*0)&1+E ?5-35 +';*0)&'% &5' 41%-&-:' :10&);'C<I0AE<I1 D
,. K input pin /. N ground pin 0. N output pin . N'
&-:' +';*0)&1+E ?5-35 +';*0)&'% &5' 8'
&-:' :10&);' C<91 D. ,. N ground pin /. N input pin 0. N output pin
+ 7/ +
R';*0)&1+% *%'. -8 &5-% )440-3)&-18 )+'F +
8;.2 which provides 2v dc 8;,/ which provides ,/v dc 8<,/ which provides +,/,v dc
O*& 4*& F-0&'+: This %ilter is %i4ed a%ter the $egulator circuit to %ilter any o% the possibly %ound ripples in the output received %inally. *apacitors used here are o% value ,.F.
P1?'+ S*440$ C-+3*-& D-);+)
+ 70 +
!.< LI6UID CRYSTAL DISPLAY CLCDD: &*" is a type o% display used in digital watches and many portable computers. &*" displays utili>e to sheets o% polari>ing material with a li3uid crystal solution between them. !n electric current passed through the li3uid causes the crystals to align so that light cannot pass through them. &*" technology has advanced very rapidly since its initial inception over a decade ago %or use in lap top computers. Technical achievements has resulted in brighter displace, higher resolutions, reduce response times and cheaper manu%acturing process. The li3uid crystals can be manipulated through an applied electric voltage so that light is allowed to pass or is blocked. (y care%ully controlling where and what wavelength 6color9 o% light is allowed to pass, the &*" monitor is able to display images. ! backlight provides &*" monitorDs brightness. Over the years many improvements have been made to &*" to help enhance resolution, image, sharpness and response times. One o% the latest such advancement is applied to glass during acts as switch allowing control o% light at the pi4el level, greatly improving &*"Ds ability to display small+si>ed %onts and image clearly. Other advances have allowed &*"Ds to greatly reduce li3uid crystal cell response times. $esponse time is basically the amount o% time it takes %or a pi4el to ?change colors@, in reality response time is the amount o% time it takes a li3uid crystal cell to go %rom being active to inactive.
T5-% -% .*' &1 91001?-8; +')%18%: • • The declining prices o% &*"s. The ability to display numbers, characters and graphics. This is in contrast to &E"s, which are limited to numbers and a %ew characters.
+ 71 +
!n intelligent &*" display o% two lines, /. characters per line that is inter%aced to the pic,7%8/ microcontroller. Incorporation o% a re%reshing controller into the &*", thereby relieving the *#A to keep displaying the data. Ease o% programming %or characters and graphics. 5ost o% the &*" modules con%orm to a standard inter%ace speci%ication. ! ,1+ pin access is provided having eight data lines, three control lines and three power lines. The connections are laid out in one o% the two common con%igurations, either two rows o% seven pins, or a single row o% ,1 pins. One o% these pins is numbered on the &*"Ds printed circuit board 6#*(9, but i% not, it is 3uite easy to locate pin,. Since this pin is connected to ground, it o%ten has a thicker #*( track, connected to it, and it is generally connected to metal work at same point.
PIN DIAGRA# OF LCD: -
PIN DESCRIPTIONS: V33E V%% )8. V'': While Ccc and Css provide W2C and ground respectively, Cee is used %or controlling &*" contrast.
+ 72 +
RS R';-%&'+ S'0'3&: There are two very important registers inside the &*". The $S pin is used %or their selection as %ollows. I% $SM., the instruction command code register is selected, allowing the user to send a command such as clear display, cursor at home, etc. I% $SM,, the data register is selected, allowing the user to send data to be displayed on the &*".
R>WE +').>?+-&': $'W input allows the user to write in%ormation to the &*" or read in%ormation %rom it. $'W M , %or reading. $'WM . %or writing.
ENE '8)@0': The &*" to latch in%ormation presented to its data pins uses the enable pin. When data is supplied to data pins, a highGto+low pulse must be applied to this pin in order %or the &*" to latch in the data present at the data pins. This pulse must be a minimum o% 12. ns wide.
D0 B D<: The ;Gbit data pins, "O G "8, are used to send in%ormation to the &*" or read the contents o% the &*"Ds internal registers. To display letters and numbers, we send !S*II codes %or the letters !G:, a+> numbers .+< to these pins while making $SM,.
+ 77 +
There are also instruction command codes that can be sent to the &*" to clear the display or %orce the cursor to home position or blink the instruction command codes. We also use $S M . to check the busy %lag bit to see i% the &*" is ready to receive in%ormation. The busy %lag is "8 and can be read when $'WM, and $SM., as %ollowsF i% $'W M ,, $S M .. When "8M , 6busy %lag M ,9, the &*" is busy taking care o% internal operations and will not accept any in%ormation.
P+1&1&$4' 3-+3*-&: For a &*" module to be used e%%ectively in any piece o% e3uipment, a 5icroprocessor or 5icro controller is usually, re3uired to drive it. =owever, be%ore attempting a series o% switches to the pins o% the module. This can be a 3uite bene%ical step, i% even you are thoroughly conversant with the workings o% microprocessors.
!.I
DI##ER: "immers are devices used to vary the brightness o% a light. (y decreasing or
increasing the $5S voltage and hence the mean power to the lamp it is possible to vary the intensity o% the light output. !lthough variable+voltage devices are used %or various purposes, the term dimmer is generally reserved %or those intended to control lighting. 5odern dimmers are built %rom silicon+controlled recti%iers 6S*$9 instead o% potentiometers or variable resistors because they have higher e%%iciency. ! variable resistor would dissipate power by heat 6e%%iciency as low as ..29. (y switching on and o%%, theoretically a dimmer does not heat up 6e%%iciency close to ,..9. Thyristor 6and brie%ly, thyratrom9 dimmers were introduced to solve some o% these problems. (ecause they use switching techni3ues instead o% potential division there is almost no wasted power, dimming can be almost instantaneous and is easily controlled by remote electronics.
+ 78 +
Triacs are used instead o% S*$ thyristors in lower cost designs, but do not have the surge handling capacity o% back+to+back S*$Rs, and are only suitable %or loads less than about /. !mps. The switches generate some heat during switching, and can cause inter%erence. &arge inducors are used as part o% the circuitry to suppress this inter%erence. When the dimmer is at 2.Z power the switches are switching their highest voltage 6N0.. C in Europe9 and the sudden surge o% power causes the coils on the inductor to move, creating bu>>ing sound associated with some types o% dimmerH this same e%%ect can be heard in the %ilaments o% the incandescent lamps as TsingingT. The suppression circuitry adds a lot o% weight to the dimmer, and is o%ten insu%%icient to prevent bu>>ing to be heard on audio systems that share the mains supply with the lighting loads. This development also made it possible to make dimmers small enough to be used in place o% normal domestic light switches.
CIRCUIT DIAGRA#: -
+ 7; +
TRIAC DRIVER #OC !0 1: DESCRIPTION: These devices consist o% a !l-a!s in%rared emitting diode optically coupled to a monolithic silicon detector per%orming the %unction o% a >ero voltage crossing bilateral triac driver. They are designed %or use with a triac in the inter%ace o% logic systems to e3uipment powered %rom ,,2 C!* lines, such as teletypewriters, *$Ts, solid+state relays, industrial controls, printers, motors, solenoids and consumer appliances, etc.
APPLICATIONS: -
P Solenoid'valve controls P &ighting controls P Static power switches P !* motor drives P Temperature controls P E.5. contactors P !* motor starters P Solid+state relays
FEATURES: P Simpli%ies logic control o% ,,2 C!* power P :ero voltage crossing P dv'dt o% /... C'[s typical, ,... C'[s guaranteed
+ 7< +
!.9 OPTOCOUPLER: Opto coupler is a device that uses a short optical transmission path to trans%er a signal between elements o% a circuit, typically a transmitter and a receiver, while keeping them electrically isolated \ since the signal goes %rom an electrical signal to an optical signal back to an electrical signal, electrical contact along the path is broken. ! common implementation involves a &E" and a phototransistor, separated so that light may travel across a barrier but electrical current may not. When an electrical signal is applied to the input o% the opto+isolator, its &E" lights, its light sensor then activates, and a corresponding electrical signal is generated at the output. Anlike a trans%ormer, the opto+isolator allows %or "* coupling and generally provides signi%icant protection %rom serious overvoltage conditions in one circuit a%%ecting the other. With a photodiode as the detector, the output current is proportional to the amount o% 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 with a %orward+ biased diode. The output current and voltage are dependent on the load impedance and light intensity. In photoconductive mode, the diode is connected to a supply voltage, and the magnitude o% the current conducted is directly proportional to the intensity o% light. !n opto+isolator can also be constructed using a small incandescent lamp in place o% the &E"H such a device, because the lamp has a much slower response time than a &E", will %ilter out noise or hal%+wave power in the input signal. In so doing, it will also %ilter out any audio+ or higher+%re3uency signals in the input. It has the %urther disadvantage, o% course, 6an overwhelming disadvantage in most applications9 that incandescent lamps have relatively short li%e spans. Thus, such an unconventional device is o% e4tremely limited use%ulness, suitable only %or applications such as science pro)ects. The optical path may be air or a dielectric waveguide. The transmitting and receiving elements o% an optical isolator may be contained within a single compact module, %or mounting, %or e4ample, on a circuit boardH in this case, the module is o%ten called an 14&1-%10)&1+ or 14&1--%10)&1+.
+ 8. +
The photosensor may be a photocell, phototransistor, or an optically triggered S*$ or Triac. Occasionally, this device will in turn operate a power relay or contactor.
FEATURES OF OPTOCOUPLER: P Inter%aces with common logic %amilies P Input+output coupling capacitance J ..2 #% P Industry Standard "ual+in line 7+pin package P 20.. C$5S isolation test voltage
PIN DIAFRA# OF OPTOCOUPLER: -
A440-3)&-18%:
• • • • • • !* mains detection $eed relay driving Switch mode power supply %eedback Telephone ring detection &ogic ground isolation &ogic coupling with high %re3uency noise re)ection
+ 8, +
!.10 LOADS: In this intelligent energy saving system we are using two loads, lamp and Fan. !ccording to the light intensity o% the particular room or cabin the &"$ will senses, depending on the &"$ output the lamp will be O 'OFF. This system is only applicable %or lamps and not applicable %or tube lights, because the starting voltage o% the tube lights is high compared to lamps. (y using Thermostat and "immer we can ad)ust the speed o% the Fan according to the changes o% the room temperature.
4. SOFTWARE DESCRIPTIONF +
1., F&OW *=!$TF +
Initiali>ation + 8/ + "immer,]dimmer/ o%%
False Is #I$on]&" $ &ow *ompliment "immer , on
$ead temperature
Is temp. /;NtJ0. 0.NtJ0/ 0/NtJ01 07Nt
Set %iring angle and switch on dimmer /
4.
SOURCE CODE: P+1;+)( 91+ PIC16F< : -
+ 80 +
L -830*.'M169< .5K L *%' .'0)$ C3013/F1 000000D L 9*%'% 5% E 81?.& E 4+1&'3& L *%' - 3C()%&'+E %.)FPINN34 E %30FPINN3!D L -830*.' [email protected] -8& &'(45 E &'(40 O -8&1 =F0 E $F0 O -8& ( O L .'9-8' J3. L .'9-8' 4-+ L .'9-8' 0.+ L .'9-8' .-( L -830*.' L -830*.' L -830*.' PINN)4 PINNB0 PINN) PINN)1
L .'9-8' .-(1 PINN)0 M&'(4'+)&*+'.3K M.-(('+1.3K M.-(('+ .3K
L INTNEXT V1-. ()-8C D P O*&4*&N01?C.-(1D O O*&4*&N01?C.-( D O XF0O YF0O
S'&*4N).3N41+&%C &'(4N-8&-&C D O 03.N-8&-&C D O LCDNPUTCCQR9 .'0)$N(%C 000D O W5-0'C1D P
NONANALOGS
D O>> A00 )+' .-;-&)0 180$
POWER
SAVERSD O
+ 81 +
I9 P
CT -84*&C4-+D D
1*&4*&N5-;5C.-(1D O W5-0'CT -84*&C4-+D DPU XFV= O LCDNPUTCCQR8 D'0)$N(%CA000D O U -9C=F F0D P I9C$F F1D P .'0)$N(%C 0000D O YF0 O U PIR ON QD O
1*&4*&N01?C.-(1D O 1*&4*&N01?C.-( DO LCDNPUTCCQR8 .'0)$N(% C!00DO U -9C=F F1D P $F1O + 82 + STAND BY QD O
&'(4N+'). C DO -9 C&'(40F F0=I0D &'(40FAO '0%' &'(40F0O 4+-8&9C03.N4*&3E SR8TE#P: W0 ..W. .3SE &'(45E&'(40D O -9C&'(45KF < XX @)3/ A: &'(45MF I D P -9C T -84*&CJ3.DD;1&1 @)3/ AO .'0)$N(%CADO > >?)-&-8; &1 ;'& J'+1 %&)+&
1*&4*&N5-;5C.-( DO @)3/ 6: -9C T -84*&CJ3.DD;1&1 @)3/ 6O 1*&4*&N01?C.-( DO .'0)$N(%CADO 1*&4*&N5-;5C.-( DO @)3/ <: -9C T -84*&CJ3.DD;1&1 @)3/ <O 1*&4*&N01?C.-( DO U -9 P @)3/ 0: -9C T -84*&CJ3.DD;1&1 @)3/ 0O + 87 + > >?)-&-8; &1 ;'& J'+1 %&)+& C&'(45KF 9 XX &'(45MF!1 D > >?)-&-8; &1 ;'& J'+1 %&)+&
.'0)$N(%CADO
>>
161
1*&4*&N5-;5C.-( DO @)3/!0: -9C T -84*&CJ3.DD;1&1 @)3/!0O 1*&4*&N01?C.-( DO > >?)-&-8; &1 ;'& J'+1 %&)+&
.'0)$N(%CADO 1*&4*&N5-;5C.-( DO @)3/! : -9C T -84*&CJ3.DD;1&1 @)3/! O 1*&4*&N01?C.-( DO U -9 P @)3/9: -9C T -84*&CJ3.DD;1&1 @)3/9O .'0)$N(%CADO >> 161 1*&4*&N5-;5C.-( DO @)3/10: -9C T -84*&CJ3.DD;1&1 @)3/10O 1*&4*&N01?C.-( DO .'0)$N(%CADO 1*&4*&N5-;5C.-( DO @)3/11: -9C T -84*&CJ3.DD;1&1 @)3/11O 1*&4*&N01?C.-( DO U -9 C&'(45K!! XX + 88 + &'(45MF!A D > >?)-&-8; &1 ;'& J'+1 %&)+& > >?)-&-8; &1 ;'& J'+1 %&)+& C&'(45K!1 XX &'(45MF!! D
P
@)3/1 :
-9C T -84*&CJ3.DD;1&1 @)3/1 O .'0)$N(%C!DO >> 161 1*&4*&N5-;5C.-( DO
> >?)-&-8; &1 ;'& J'+1 %&)+&
@)3/1!:
-9C T -84*&CJ3.DD;1&1 @)3/10O 1*&4*&N01?C.-( DO
> >?)-&-8; &1 ;'& J'+1 %&)+&
.'0)$N(%C!DO 1*&4*&N5-;5C.-( DO @)3/14: -9C T -84*&CJ3.DD;1&1 @)3/14O 1*&4*&N01?C.-( DO U -9 P @)3/1A: -9C T -84*&CJ3.DD;1&1 @)3/1AO .'0)$N(%C DO 1*&4*&N5-;5C.-( DO @)3/16: -9C T -84*&CJ3.DD;1&1 @)3/16O 1*&4*&N01?C.-( DO .'0)$N(%C DO 1*&4*&N5-;5C.-( DO > >?)-&-8; &1 ;'& J'+1 %&)+& > >?)-&-8; &1 ;'& J'+1 %&)+& C&'(45K!A XX &'(45MF!< D
+ 8; +
@)3/1<:
-9C T -84*&CJ3.DD;1&1 @)3/1<O 1*&4*&N01?C.-( DO U -9 -9 -9 U C&'(45K!<D 1*&4*&N5-;5C.-( D O
C-84*&C0.+D D1*&4*&N5-;5C.-(1D O CT I84*&C0.+D D1*&N01?C.-(1D O
U U
P+1;+)( 91+ &5'+(1%&)&:&'(4N-8-&CD P - 3N%&)+&CDO
+ 8< +
- 3N?+-&'C0=90DO>> .':-3' )..+'%% - 3N?+-&'C0=)3DO>> 318&+10 +';-%&'+ - 3N?+-&'C00DO>> ?+-&' (1.' - 3N%&14CDO .'0)$N(%C10DO - 3N%&)+&CDO - 3N?+-&'C0=90DO>> .':-3' )..+'%% - 3N?+-&'C0=''DO>> 318&+10 +';-%&'+ - 3N%&14CDO U &'(4N+').CD P - 3N%&)+&CDO - 3N?+-&'C0=90DO - 3N?+-&'C0=))DO - 3N%&)+&CDO - 3N?+-&'C0=91DO &'(45F- 3N+').CDO &'(40F- 3N+').C0DO - 3N%&14CDO U
+ ;. +
CHAPTER 6. CONCLUSION & FUTURE DIRECTIONS
CONCLUSION:
Intelligent Energy Saving System is not limited %or any particular application, it can be used any where in a process industries with little modi%ications in so%tware coding according to the re3uirements. This concept not only ensures that our work will be usable in the %uture but also provides the %le4ibility to adapt and e4tend, as needs change.
+ ;, +
In this pro)ect work we have studied and implemented a complete working model using a #I* microcontroller. The programming and inter%ering o% #I* microcontroller has been mastered during the implementation. This work includes the study o% energy saving system in many applications
FUTURE DIRECTIONS:
We e4cept that our ne4t generation will develop this energy saving system with wire less network. In our pro)ect we connected all the sensors to micro controller with the wires. This can be developed with wire less such that we can place di%%erent sensors in di%%erent places. This sensor will activate the micro controller with the signals instead o% using wires. This system can also be applicable to various loads like pressure, %orce and etc. by increasing the number o% ports o% the micro controller.
+ ;/ +
BIBLIOGRAPHY
BIBLIOGRAPHY
BOOKS REFERRED:
,9 !dler, $. (., !. *. Smith, and $. &. &onganiF ?Introduction to Semiconductor Physics,@ vol. ,, p. 8;, Semiconductor Electronics Education *omitee, ^ohn Wiley ] Sons, Inc., ew Uork ,,<71.
+ ;0 +
/9 Schade, O. =.F ?Analysis of Rectifier Operation@, proc. IRE, vol.0,, pp. 01,+ 07,, ^uly, ,<10. 09 Stout, 5. (.F ?Analysis of Rectifier Circuits”, Elec. En ., vol. 21, September, ,<02. 19 ^acob 5illman *hristos *. =alkias.F ?Electronic !e"ices And Circuits@, Tata 5c-raw+=ill #ublishing *ompany &td. Sep, /..0. 29 Fair, :. E.F ?Pie#oelectric Crystals in Oscillator Circuits@, $ell System %ech. &., vol./1, !pril, ,<12. 79 =akim, S. s.F@Open and Closed 'oop Response of (eed)ac* Amplifiers@, Electron. En ., October, ,<7/ 89 (ode, =. W.F ?+e ati"e (eed)ac* in Current Amplifier !esi n,@ ". Can ostrand *ompany, Inc., #rinceton, .^., ,<12. ;9 Sawhney, !.B.F ?Electrical and Electronic ,easurements and Instruments@, "hanpat $ai ] *o. /..0. <9 Uang, E.SF ?(undamentals of Semiconductor !e"ices@, chap. , 5c-raw =ill (ook *ompany, ew Uork, ,<8;. ,.9 Shive, ^. .F ?Semiconductor !e"ices@, chaps ;]<, ".Can ostrand Inc. #rinceton, .^., ,<2<. ,,9 5illman, ^.F ?,icroelectronics- !i ital and Analo Circuits and Systems@, 5c-raw =ill (ook *ompany, ew Uork, ,<8<. ,/9 $oger & Stevens F ?Serial Communications@, "ontrics, ,<<8 ,09 $obert TerusalimF ?Pro rammin in 'uo@ /+nd edition, ". Can ostrand *ompany, Inc., #rinceton, .^., ,<;8.
+ ;1 +
,19 ^an !4elsonF ?Parallel Port Complete@, 5c-raw =ill (ook *ompany, ew Uork, ,<;<. ,29 #eter =.!nderson, ?PIC C Routines copyri ht@, (altimore, 5", ov,D<< ,79 (ahadur, (.F ?'i.uid Crystals- Applications and /ses@, &itton Systems *anada, ,<</. ,89 5yke #redkoF ?Pro rammin and Customi#in PIC ,icrocontrollers@, !ma>on, ,<<;. ,;9 5yke #redkoF ?0and)oo* of ,icrocontrollers@, !ma>on, ,;;8.
Journa ! R"#"rr"$
,9 InnovationF 5aga>ine o% $esearch ] Technology,/... /9 International ^ournal o% $eliability, Yuality and Sa%ety Engineering6I^$YSE9 Editor+in+chie% =oang #ham "ept. o% Industrial Eng 09 ^ournal o% Electronics 5anu%acturing 6^E59 Editor+in+*hie% #aul #. *onway Wol%son School o% 5echanical ] 5anu%acturing Engineering 19 Foundations and Trends in Electronic "esign !utomation 6FTE"!9 Editor Gin+chie% Sharad 5alik, "ept.o% Electrical Eng., #rinceton Aniversity. 29 #rinted *ircuit "esign Online 65aga>ine9. 79 "esign 5aga>ine. 89 ^ournal o% Instrumentation 6^ IST9. ;9 5icrocontroller solutions.
+ ;2 +
DATA SHEETS:
,9 pic,7%8/ datasheets. /9 Optre4 &*" data sheet 09 I/*X(ASXS#E*IFI*!TIO X,<<2.pd%
+ ;7 +
doc_592584568.doc
Intelligent Energy Saving System can be used in places like where lighting is very important. The libraries will be well illuminated with many lamps. When people are not present at a reading place the lighting can be made OFF and when they are present, the lighting made O . !ll these can be done through by "imming circuit and #I$ sensor. I% a person entering to the monitored area, the #I$ sensors activates and sense the person, gives to the micro controller. The In%rared energy emitted %rom the living body is %ocused by a Fresnel lens segment. Then only the #I$ sensor activates. !%ter sensing the person &"$ checks the light intensity o% the monitored area, whether it is bright or dark. "epending on the &"$ output, the lamp may be O ' OFF by using "immer circuit. (y using this system we can ad)ust the speed o% Fan according to the room temperature measured by Thermostat, which is connected to the micro controller. To display the room temperature o% #I$ mode operation we are using the &*" display.
+,+
INDEX
#!-E O
,. INTRODUCTION ,., ,./ ,.0 ,.1 ,.2 Ob)ective o% the #ro)ect (lock "iagram #inciple O% Operation System Features E3uipments 9 ,. ,, ,/ ,0 ,2 6
/. DESCRIPTION OF THE PROJECT /., /./ /.0 0., 0./ 0.0 0.1 0.2 0.7 0.8 0.; 0.< 1. (lock "iagram "escription Schematic "iagrams Schematic E4planation
0. HARDWARE DESCRIPTION 5icrocontroller 6#I*,7F8/9 #assive In%rared Sensor &ight "ependent $esistor Thermostat 6"S,7/,9 :ero *rossing "etector #ower Supply &i3uid *rystal "isplay "immer Optocoupler
10
0.,. &oads SOWFTWARE DESCRIPTION 1., Flow *hart 64
1./ Source *ode
2. 7.
RESULT CONCLUSION AND FUTURE DIRECTIONS BIBLIOGRAPHY
+/+
LIST OF FIGURES
1. (lock "iagram /. Schematic "iagram 0. !rchitecture o% #I*,7F8/ 1. #in "iagram o% #I* ,7F8/ 2. Operation o% #I$ "iagram 7. Operation o% &"$ "iagram 8. &"$ *ircuit "iagram ;. #in "iagram o% "S,7/, <. Functional (lock "iagram o% "S,7/, ,.. :*" *ircuit "iagram ,,. :*" Output wave%orm ,/. #ower *ircuit "iagram ,0. #in "iagram o% &*" ,1. "immer *ircuit "iagram ,2. #in "iagram o% Opto*oupler
+0+
CHAPTER 1 INTRODUCTION
1. INTRODUCTION
+1+
Intelligent Energy Saving System, the aim o% the pro)ect is to save the energy. In this pro)ect we are using various sensors, controlling and display. =owever, in this pro)ect work the basic signal processing o% various parameters which are temperature, &"$, Smoke sensor. For measuring various parameters values, various sensors are used and the output o% these sensors are converted to control the parameters. The control circuit is designed using micro+ controller. The outputs o% all the three parameters are %ed to micro+controller. The output o% the micro+controller is used to drive the &*" display, so that the value o% each parameter can be displayed. In addition to the &*" display micro+controller outputs are also used to driver a relay independently. This relay energi>es and de+ energi>es automatically according to the condition o% the parameter.
1.1 OBJECTIVE OF THE PROJECT: The aim o% the pro)ect is to save the energy or power, used in places like libraries where lighting is very important %or the people who come to read books. So, the libraries will be well illuminated with many lamps. !t the same time when people are not present at a particular reading place the lighting can be made o%% by using "immer and when people come to that area, according to the &"$ lighting can be made su%%iciently brighter. (y using this system, we can also ad)ust the speed o% the Fan according to the room temperature using Thermostat and "immer.
1. PRINCIPLE OF OPERATION
+2+
*onsider a particular table in the library, which is connected with our e4perimental kit .When a person entering into that place the #I$ sensor absorbs the black body radiation emitted by that person and activates it. The &*" display will displays the ?#I$ O @. !%ter some time delay the light will glows %or some time by using the "immer circuit and with the help o% &"$ sensor it checks the room lightening , and it takes the condition when the light is su%%icient the lamp will be in OFF state and when light is insu%%icient the lamp will be in O state. With the help o% Thermostat sensor the room temperature is measured and the speed o% the Fan varies according to the temperature o% Thermostat. The &*" display will displays the room ?temperature in degree centigrade@. When a person is leaving that place, the #I$ sensor will activate again and %irstly the Fan will be OFF and a%ter some time delay the lamp also will be OFF. ow the &*" display is in stand by mode state. !nd the main supply power will be switched OFF.
+7+
1.! BLOC" DIAGRA#:
ZERO CROSSING DETECTOR
OPTOCOUPLER
PIR SENSOR LAMP
DIMMER1 POWER SUPPLY MICRO CONTROLLER PIC 16F72
DIMMER2
FAN
LDR CIRCUIT
LCD DISPLAY OPTOCOUPLER THERMOSTAT
1.4 S$%&'( F')&*+'%:
• • •
Easy operation *onvenient !%%ordable
+8+
R',*-+'. S/-00%:
• Anderstanding o% 5icro controller • Embedded * #rogramming • Anderstanding Inter%acing Techni3ues • Bnowledge on Sensors • "esign and Fabrication o% #*(
P+12'3& 45)%': • • • • • • • Schematic design and drawing o% #*( "esign and Inter%acing *ircuits %or 5icro controller #reparation o% #*( !ssembling and Testing o% Inter%acing *ircuits *ode %or the !pplication "ebugging and Testing #ro)ect $eport
1.4 E6UIP#ENTS: ? ? ? #rinted *ircuit (oard 5icro controller à #I* ,7F8/ 2C, ,/C "c #ower supply
+;+
? ? ? ? ? ? ?
I$ sensor à #assive In%rared Sensor &"$ à &ight "ependent $esistor Thermostat &*" à Optra4, / line by ,7 characters :ero *rossing "etector & Fan
+<+
CHAPTER .
DESCRIPTION OF THE PROJECT
+ ,. +
. DESCRIPTION OF THE PROJECT: .1 BLOC" DIAGRA# EXPLANATION: PIR SENSOR: ! #I$ detector is a motion detector that senses the heat emitted by a living body. These are o%ten %itted to security lights so that they will switch on automatically i% approached. They are very e%%ective in enhancing home security systems. The sensor is passive because, instead o% emitting a beam o% light or microwave energy that must be interrupted by a passing person in order to ?sense@ that person, the #I$ is simply sensitive to the in%rared energy emitted by every living thing. When an intruder walks into the detectorDs %ield o% vision, the detector ?sees@ a sharp increase in in%rared energy.
LDR: &"$Ds or &ight "ependent $esistors are very use%ul especially in light'dark sensor circuits. These help in automatically switching O 'OFF the street lights and etc., normally the resistance o% an &"$ is very high, sometimes as very high as ,...... ohms, but when they are illuminated with light, resistance drop dramatically. Electronic opto sensors are the devices that alter their electrical characteristics, in the presence o% visible or invisible light. The best+known devices o% these types are the light dependent resistor 6&"$9, the photo diode and the phototransistors.
7CD: ! >ero crossing detector literally detects the transition o% a signal wave%orm %rom positive and negative, ideally providing a narrow pulse that coincides e4actly with the >ero voltage condition.
THER#OSTAT: In this pro)ect we are making use "S ,7/, thermostat, itDs a non+ contact digital type temperature transducer suitable %or measuring room temperature.
+ ,, +
The word EthermistorD is an acronym %or thermal resistor, i.e., a temperature sensitive resistor. It is used to detect very small changes in temperature. The variation in temperature is re%lected through appreciable variation o% the resistance o% the device.
LCD DISPLAY: ! li3uid crystal is a material 6normally organic %or &*"Ds9 that will %low like a li3uid but whose molecular structure has some properties normally associated with solids. The &i3uid *rystal "isplay 6&*"9 is a low power device. The power re3uirement is typically in the order o% microwatts %or the &*". =owever, an &*" re3uires an e4ternal or internal light source. We are making use o% &*" in our pro)ect to display the #I$ mode and room temperature.
OPTOCOUPLER: Optocoupler is a device that uses a short optical transmission path to trans%er a signal between elements o% a circuit, typically a transmitter and a receiver, while keeping them electrically isolated. ! common implementation involves a &E" and a phototransistor, separated so that light may travel across a barrier but electrical current may not.
DI##ER: "immers are devices used to vary the brightness o% a light. (y decreasing or increasing the $5S voltage and hence the mean power to the lamp it is possible to vary the intensity o% the light output. !lthough variable+voltage devices are used %or various purposes, the term dimmer is generally reserved %or those intended to control lighting.
+ ,/ +
.
SCHE#ATIC DIAGRA#: -
+ ,0 +
.! SCHE#ATIC EXPLANATION: PORT A: #ort ! can acts as a both input as well as output port. It is having 7 pins 6!.+!29. In these !. is connected to "immer,, !, is connected to "immer/ and !1 is connected to :*" output.
PORT B: #ort ( can acts as a both input as well as output port. It is having ; pins 6(.+(89. In these (, connected to register selection pin6$'S9, (/ is connected to read'write6$'W9 and (0 pin is connected to enable pin.
PORT C: #ort * can acts as a both input as well as output port. It is having ; pins 6*.+*89. In these $*0 and $*1 connected to the thermostat pins. ,/5 => *rystal Oscillator is connected in between <th and ,.th pins o% micro controller. $eset pin is connected to the pin number, i.e., 5*&$'C##. ;th and ,<th pins are connected to ground 6Css9.
+ ,1 +
CHAPTER !. HARDWARE DESCRIPTION
!. HARDWARE DESCRIPTIONF +
+ ,2 +
0., #ICRO CONTROLLER: INTRODUCTION: 5icrocontrollers these days are silent workers in many apparatus, ranging %rom the washing machine to the video recorder. early all o% these controllers are mask programmed and there%ore are o% very little use %or applications that re3uire the programs to be changed during the course o% e4ecution. Even i% the programs could be altered, the in%ormation necessary to do so an instruction set, an assembler language and description %or the basic hardware is either very di%%icult to obtain or are in ade3uate when it came to the issue o% accessibility. ! marked e4ception to the above category is the #I*I7F8/ micro controller belonging to the #I* %amily. This microcontroller has %eatures that seem to make it more accessible than any other single chip microcontroller with a reasonable price tag. The #I*I7F8/, an ;+bit single chip microcontroller has got a power%ul *#A optimi>ed %or control applications. The #I*I7F8/ is an ; G bit single chip microcontroller. The ,7%8;88! provides a signi%icantly more power%ul architecture, a more power%ul instruction set and a %ull serial port. The #I*I7F8/ is a complete micro controller. crystal clock and provide a %ew timing and control signals. There are 1. pins
needed by the %ive+bidirectional ports. #ins provide power, allow you to connect a
The architecture includes the !&A, W register, the stackH a block o% registers. !ll these devices are connected to via internal ;+bit data bus.
+ ,7 +
Each I'O port is also connected to the ;+bit internal data bus through a series o% registers. These registers hold data during I'O trans%ers and control the I'O ports. The architectural block diagram also shows the #I*I7F8/ $O5 and $!5
C1(4)+-%18 19 (-3+14+13'%%1+ )8. (-3+1318&+100'+:
The di%%erence between 5icroprocessor and 5icro controller is 5icroprocessor can only process with the data, 5icro controller can control e4ternal device. That is i% you want switch ?O @ or ?OFF@ a device, you need peripheral I*s to do this work with 5icro controller you can directly control the device. &ike 5icroprocessor, 5icro controller is available with di%%erent %eatures. It is available with inbuilt memory, I'O lines, timer and !"*. The micro controller, which we are going to use.
A.

,. I% a system is developed with a microprocessor, the designer has to go %or e4ternal memory such as $!5, $O5 or E#$O5 and peripherals and hence the si>e o% the #*( will be large enough to hold all the re3uired peripherals. /. (ut the microcontroller has got all these peripheral %acilities on a single chip so development o% a similar system with a microcontroller reduces #*( si>e and cost o% the design. 0. One o% the ma)or di%%erence between a microcontroller and a microprocessor is that a controller o%ten deals with bits, not bytes as in the real world application, %or e4ample switch contacts can only be open or close, indicators should be lit or dark and motors can be either turned on or o%% and so %orth.
1.
The 5icrocontroller has two ;+bit timers' counters built within it, which
makes it more suitable to this application since we need to produce some accurate timer delays. It is even more advantageous that the timers also act as interrupt.
ABOUT PICI6F< :
The #I*I7F8/ is a low+power, high+per%ormance *5OS ;+bit microcomputer with /B bytes Flash programmable and erasable read only memory + ,8 +
6#E$O59. #I*I 7F8/ is a power%ul microcomputer, which provides a highly %le4ible and cost+e%%ective solution to many embedded control application.
FEATURES OF PIC 16F< : H-;5 4'+91+()83' RISC CPU:
• • • Only 02 single word instructions to learn !ll single cycle instructions e4cept %or program branches, which are two+cycle. Operating speedF "*+/. 5=: clock input ? ? ? • • • • "*+/.. ns instruction cycle Ap to /k 4 ,1 words o% program 5emory, Ap to ,/; 4 ; bytes o% "ata 5emory 6$!59
#inout compatible to #I* ,7*8/'8/! and #I* ,7F;8/. Interrupt capability. Eight+ level deep hard ware stack. "irect, Indirect and $elative !ddressing modes.
P'+-45'+)0 F')&*+'%:
• • • =igh Sink'Source *urrentF /2 m! Timer.F ;+bit timer'counter with ;+bit prescaler Timer,F ,7+bit timer'counter with prescaler, can be incremented during Cia E4ternal crystal'clock. • Timer/F ;+bit timer'counter with ;+bit period register, prescaler and postscaler • *apture, *ompare, #W5 6**#9 module + *apture is ,7+bit, ma4. resolution is ,/.2 ns • *ompare is ,7+bit, ma4. resolution is /.. ns
+ ,; +
• • • •
#W5 ma4. resolution is ,.+bit ;+bit, 2+channel analog+to+digital converter Synchronous Serial #ort 6SS#9 with S#II 65aster'Slave9 and I/*I 6Slave9 (rown+out detection circuitry %or (rown+out $eset 6(O$9
C#OS T'358101;$:
• • • • • &ow power, high speed *5OS F&!S= technology Fully static design Wide operating voltage rangeF /..C to 2.2C Industrial temperature range &ow power consumptionF J ..7 m! typical K 0C, 1 5=> /. L! typical K 0C, 0/ k=> J , L! typical standby current
S4'3-)0 #-3+1318&+100'+ F')&*+'%:
• ,,... erase'write cycle F&!S= program memory typical • #ower+ on $eset 6#O$9 • #ower+up Timer 6#W$T9 • Oscillator Start Gup Timer 6OST9 • • • • • • • Watchdog Timer 6W"T9 with its own on+chip $* oscillator %or
reliable operation. $* oscillator %or reliable operation #rogrammable code protection #ower saving S&EE# mode Selectable oscillator options In+*ircuit Serial #rogrammingI 6I*S#I9 via / pins #rocessor read access to program memory
+ ,< +
ARCHITECTURE OF PIC 16F< #ICRO CONTROLLER: The #I*,7F8/ belongs to the 5id+$ange %amily o% the #I* micro devices. The program memory contains /B words, which translate to /.1; instructions, since each ,1+bit program memory word is the same width as each device instruction. The data memory 6$!59 contains ,/; bytes. There are // I'O pins that are user con%igurable on a pin+to+pin basis. Some pins are multiple4ed with other device %unctions. T5'%' 9*83&-18% -830*.': -
• • • • • • • • •
E=&'+8)0 -8&'++*4& C5)8;' 18 PORTB -8&'++*4&% T-('+0 3013/ -84*& T-('+1 3013/>1%3-00)&1+ C)4&*+'>C1(4)+'>PW# A>D 318:'+&'+ SPI>I C L1? V10&);' P+1;+)((-8; I83-+3*-& D'@**;'+
+ /. +
ARCHITECTURE DIAGRA# OF PIC 16F< :
+ /, +
PIN DIGRA# OF PIC 16F< :
+ // +
PIN DESCRIPTION:
#CLR>VPP: 5aster *lear 6$eset9 input or programming voltage input. This pin is an active low $ESET to the device. RA0 - RAA: These are the bi+directional Input ' output #O$T! pins. $!,, $!/, are the analog inputs ,, analog input/. $!0 can also be analog input0 or analog re%erence voltage. $!1 can also be the clock input to the Timer. module. Output is open drain type. $!2 can also be analog input1 or the slave select %or the synchronous serial port. VSS: -round re%erence %or logic and I'O pins. OSC1>CL"1: Oscillator crystal input ' E4ternal clock source input. OSC >CL"O: Oscillator crystal output. *onnects to crystal or resonator in *rystal Oscillator mode. In $* mode, the OS*/ pin outputs *&BO, which has ,'1 the %re3uency o% OS*,, and denotes the instruction cycle rate. RC0 B RC<: These are the bidirectional Input ' Output #O$T* pins. $*.'T,OSO' T,*B. $*. can also be the Timer, oscillator output or Timer, *lock input.
+ /0 +
$*,'T,OSI is the Timer, oscillator input. $*/'**# is the *apture, input'*ompare, output' #W5, output. $*0'S*B'S*&. $*0 can also be the synchronous serial clock input'output %or (oth S#I and I/* modes. $*1'S"I'S"! is the S#I "ata In 6S#I mode9 or "ata I'O 6I/* mode9. $*2'S"O is e the S#I "ata Out 6S#I mode9. $*7 $*8. VDD: #ositive supply %or logic and I'O pins. RB0 B RB<: These are the bi+directional I'O #O$T( pins. #O$T( can be so%tware programmed %or internal weak pull+up on all inputs. $(.'I is the e4ternal interrupt pin. $(,, $(/, $(0 are the bi+directional pins. $(1 is the Interrupt+on+change pin. $(2 is the Interrupt+on+change pin. $(7'#-* is the Interrupt+on+change pin. Serial programming clock. $(8'#-" is the Interrupt+on+change pin. Serial programming data.
I > O PORTS:
Some pins %or these I'O ports are multiple4ed with an alternate %unction %or the peripheral %eatures on the device. In general, when a peripheral is enabled, that pin may not be used as a general purpose I'O pin. !dditional in%ormation on I'O ports may be %ound in the #I* micro 5id+$ange 5*A $e%erence 5anual, 6"S00./09. PORTA )8. &5' TRISA R';-%&'+: #O$T! is a 7+bit wide, bi+directional port. The corresponding data direction register is T$IS!. Setting a T$IS! bit 6M ,9 will make the corresponding #O$T! pin an input 6i.e., put the corresponding output driver in a =i+Impedance mode9. *learing a T$IS! bit 6M .9 will make the corresponding #O$T! pin an output 6i.e., put the contents o% the output latch on the selected pin $eading the #O$T! register, reads the status o% the pins, whereas writing to it will write to the port latch. !ll write operations are read+modi%y+write operations. There%ore, a write to a port implies that the port pins are read, this value is modi%ied + /1 +
and then written to the port data latch #in $!1 is multiple4ed with the Timer. module clock input to become the $!1'T.*BI pin. The $!1'T.*BI pin is an Schmitt Trigger input and an open drain output. !ll other $! port pins have TT& input levels and %ull *5OS output drivers. Other #O$T! pins are multiple4ed with analog inputs and analog C$EF input. The operation o% each pin is selected by clearing'setting the control bits in the !"*O , register 6!'" *ontrol $egister,9. Other #O$T! pins are multiple4ed with analog inputs and analog C$EF input. The operation o% each pin is selected by clearing'setting the control bits in the !"*O , register 6!'" *ontrol $egister,9. Other #O$T! pins are multiple4ed with analog inputs and analog C$EF input. The operation o% each pin is selected by clearing'setting the control bits in the !"*O , register 6!'" *ontrol $egister,9. The T$IS! register controls the direction o% the $! pins, even when they are being used as analog inputs. The user must ensure the bits in the T$IS! register are maintained set when using them as analog inputs.
PORTB )8. &5' TRISB R';-%&'+:
#O$T( is an ;+bit wide, bi+directional port. The corresponding data direction register is T$IS(. Setting a T$IS( bit 6M ,9 will make the corresponding #O$T( pin an input 6i.e., put the corresponding output driver in a =i+Impedance mode9. *learing a T$IS( bit 6M .9 will make the corresponding #O$T( pin an output 6i.e., put the contents o% the output latch on the selected pin9. Each o% the #O$T( pins has a weak internal pull+up. ! single control bit can turn on all the pull+ups. This is per%ormed by clearing bit $(#A 6O#TIO J8N9. The weak pull+up is automatically turned o%% when the port pin is con%igured as an output. The pull+ups are disabled on a #ower+on $eset. Four o% #O$T(Ds pins, $(8F$(1, have an interrupt+on+change %eature. Only pins con%igured as inputs can cause this interrupt to occur 6i.e., any $(8F$(1 pin con%igured as an output is e4cluded %rom the interrupt on change comparison9. The
+ /2 +
input pins 6o% $(8F$(19 are compared with the old value latched on the last read o% #O$T(. The ?mismatch@ outputs o% $(8F$(1 are O$Dd together to generate the $( #ort *hange Interrupt with %lag bit $(IF 6I T*O J.N9.
PORTC )8. &5' TRISC R';-%&'+:
#O$T* is an ;+bit wide, bi+directional port. The corresponding data direction register is T$IS*. Setting a T$IS* bit 6M ,9 will make the corresponding #O$T* pin an input 6i.e., put the corresponding output driver in a =i+Impedance mode9. *learing a T$IS* bit 6M .9 will make the corresponding #O$T* pin an output 6i.e., put the contents o% the output latch on the selected pin9. #O$T* is multiple4ed with several peripheral %unctions. #O$T* pins have Schmitt Trigger input bu%%ers. When enabling peripheral %unctions, care should be taken in de%ining T$IS bits %or each #O$T* pin. Some peripherals override the T$IS bit to make a pin an out+put, while other peripherals override the T$IS bit to make a pin an input. Since the T$IS bit override is in e%%ect while the peripheral is enabled, read+modi%y+write instructions 6(SF, (*F, OO$WF9 with T$IS* as destination should be avoided. The user should re%er to the corresponding peripheral settings. section %or the correct T$IS bit
C)4&*+' #1.':
In *apture mode, **#$,=F **#$,& captures the ,7+bit value o% the T5$, register when an event occurs on pin $*/'**#,. !n event is de%ined asF P Every %alling edge P Every rising edge P Every 1th rising edge P Every ,7th rising edge !n event is selected by control bits **#,50F**#,5. 6**#,*O J0F.N9. When a capture is made, the interrupt re3uest %lag bit **#,IF 6#I$,J/N9 is set. It must be cleared in so%tware. I% another capture occurs be%ore the value in register **#$, is read, the old captured value is overwritten by the new captured value.
C1(4)+' #1.':
+ /7 +
In *ompare mode, the ,7+bit **#$, register value is constantly compared against the T5$, register pair value. When a match occurs, the $*/'**#, pin isF P "riven =igh P "riven &ow P $emains Anchanged The action on the pin is based on the value o% control bits **#,50F **#,5. 6**#,*O J0F.N9. !t the same time, interrupt %lag bit **#,IF is set. The output may become inverted when the mode o% the module is changed %rom *ompare'*lear on 5atch 6**#45J0F.N M E,..,D9 to *ompare'Set on 5atch 6**#45J0F.N M E,...D9. This may occur as a result o% any operation that selectively clears bit **#45., such as a (*F instruction. When this condition occurs, the output becomes inverted when the instruction is e4ecuted. It will remain inverted %or all %ollowing *ompare operations, until the module is reset.
ANALOG-TO-DIGITAL CONVERTER CA>DD #ODULE:
The analog+to+digital 6!'"9 converter module has %ive inputs %or the #I*,7F8/. The !'" allows conversion o% an analog input signal to a corresponding ;+ bit digital number. The output o% the sample and hold is the input into the converter, which generates the result via successive appro4imation. The analog re%erence voltage is so%tware selectable to either the deviceDs positive supply voltage 6C""9 or the voltage level on the $!0'! 0'C$EF pin. The !'" converter has a uni3ue %eature o% being able to operate while the device is in S&EE# mode. To operate in S&EE#, the !'" conversion clock must be derived %rom the !'"Ds internal $* oscillator. The !'" module has three registersF P !'" $esult $egister!"$ES P !'" *ontrol $egister . P !'" *ontrol $egister , !"*O . !"*O ,
! device $ESET %orces all registers to their $ESET state. This %orces the !'" module to be turned o%% and any conversion is aborted. The !"*O . register, shown in $egister ,.+,, controls the operation o% the !'" module. The !"*O , register, shown in $egister ,.+/, con%igures the %unctions o% the port pins. The port pins can be con%igured as analog inputs 6$!0 can also be a voltage re%erence9 or a digital I'O. + /8 +
OSCILLATOR CONFIGURATIONS:
The #I*,7F8/ can be operated in %our di%%erent Oscillator modes. The user can program two con%iguration bits 6FOS*, and FOS*.9 to select one o% these %our 5odesF P &# &ow #ower *rystal P OT *rystal'$esonator P =S =igh Speed *rystal'$esonator P $* $esistor'*apacitor
RESET:
The #I*,7F8/ di%%erentiates between various kinds o% $ESETF P #ower+on $eset 6#O$9 P 5*&$ $eset during normal operation P 5*&$ $eset during S&EE# P W"T $eset 6during normal operation9 P W"T Wake+up 6during S&EE#9 P (rown+out $eset 6(O$9 Some registers are not a%%ected in any $ESET condition. Their status is unknown on #O$ and unchanged in any other $ESET. 5ost other registers are reset to a ?$ESET state@ on #ower+on $eset 6#O$9, on the 5*&$ and W"T $eset, on 5*&$ $eset during S&EE#, and (rown+out $eset 6(O$9. They are not a%%ected by a W"T Wake+up, which is viewed as the resumption o% normal operation. The TO and #" bits are set or cleared di%%erently in di%%erent $ESET situations, as indicated in Table ,,+1. These bits are used in so%tware to determine the nature o% the $ESET.
P1?'+-18 R'%'& CPORD:
! #ower+on $eset pulse is generated on+chip when C"" rise is detected 6in the range o% ,./C + ,.8C9. To take advantage o% the #O$, tie the 5*&$ pin to C"", ! ma4imum rise time %or C"" is speci%ied. When the device starts normal operation 6e4its the $ESET condition9, device+operating parameters 6volt+age, %re3uency, temperature,9 must be met to ensure operation. I% these conditions are not met, the device must be held in $ESET until the operating conditions are met.
+ /; +
P1?'+-*4 T-('+ CPWRTD:
The #ower+up Timer provides a %i4ed 8/ ms nominal time+out on power+up only From the #O$. The #ower+up Timer operates on an internal $* oscillator. The chip is kept in $ESET as long as the #W$T is active. The #W$TDs time delay allows C"" to rise to an acceptable level.
! con%iguration bit is provided to enable' disable the #W$T. The power+up time delay will vary %rom chip to chip due to C"", temperature and process variation.
O%3-00)&1+ S&)+&-*4 T-('+ COSTD:
The Oscillator Start+up Timer 6OST9 provides ,./1 oscillator cycles 6%rom OS*, input9 delay a%ter the #W$T delay is over 6i% enabled9. This helps to ensure that the crystal oscillator or resonator has started and stabili>ed. The OST time+out is invoked only %or OT, &# and =S modes and only on #ower+on $eset or wake+up %rom S&EE#.
B+1?8-1*& R'%'& CBORD:
The con%iguration bit, (O$E , can enable or disable the (rown+out $eset circuit. I% C"" %alls below C(O$ 6parameter "..2, about 1C9 %or longer than T(O$ 6parameter Q02, about ,.. Ls9, the brown+out situation will reset the device. I% C"" %alls below C(O$ %or less than T(O$, a $ESET may not occur. Once the brown+out occurs, the device will remain in (rown+out $eset until C"" rises above C(O$. The #ower+up Timer then keeps the device in $ESET %or T#W$T 6parameter Q00, about 8/ ms9. I% C"" should %all below C(O$ during T#W$T, the (rown+out $eset process will restart when C"" rises above C(O$, with the #ower+up Timer $eset. The #ower+up Timer is always enabled when the (rown+out $eset circuit is enabled, regardless o% the state o% the #W$T con%iguration bit.
P1?'+ C18&+10>S&)&*% R';-%&'+ CPCOND:
The #ower *ontrol'Status $egister, #*O , has two bits to indicate the type o% $ESET that last occurred. (it. is (rown+out $eset Status bit, (O$. (it (O$ is unknown on a #ower+on $eset. It must then be set by the user and checked on subse3uent $ESETS to see i% bit (O$ cleared, indicating a (rown+out $eset
+ /< +
occurred. When the (rown+out $eset is disabled, the state o% the (O$ bit is unpredictable. (it, is #O$ 6#ower+on $eset Status bit9. It is cleared on a #ower+on $eset and una%%ected otherwise. The user must set this bit %ollowing a #ower+on $eset.
W)&35.1; T-('+ CWDTD:
The Watchdog Timer is a %ree running, on+chip $* oscillator that does not re3uire any e4ternal components. This $* oscillator is separate %rom the $* oscillator o% the S*,'*&BI pin. That means that the W"T will run, even i% the clock on the OS*,'*&BI and OS*/' *&BO pins o% the device has been stopped, %or e4ample, by e4ecution o% a S&EE# instruction. "uring normal operation, a W"T time+out generates a device $ESET 6Watchdog Timer $eset9. I% the device is in S&EE# mode, a W"T time+out causes the device to wake+up and Timer time+out. continue with normal operation 6Watchdog Timer Wake+up9. The TO bit in the ST!TAS register will be cleared upon a Watchdog
P+1;+)( V'+-9-3)&-18>C1.' P+1&'3&-18:
I% the code protection bit6s9 have not been programmed, the on+chip program memory can be read out %or veri%ication purposes. ID L13)&-18%: Four memory locations 6/...h + /..0h9 are designated as I" locations, where the user can store checksum or other code identi%ication numbers. These locations are not accessible during normal e4ecution, but are readable and writable during program'veri%y. It is recommended that only the %our &east Signi%icant bits o% the I" location are used.
+ 0. +
I8-C-+3*-& S'+-)0 P+1;+)((-8;:
#I*,7F8/ microcontrollers can be serially programmed while in the end application circuit. This is simply done with two lines %or clock and data and three other lines %or power, ground, and the programming voltage. This allows customers to manu%acture boards with unprogrammed devices, and then program the micro controller )ust be%ore shipping the product. This also allows the most recent %irmware or a custom %irmware to be programmed.
INSTRUCTION SET SU##ARY:
Each #I*,7F8/ instruction is a ,1+bit word divided into an O#*O"E that speci%ies the instruction type and one or more operands that %urther speci%y the operation o% the instruction. The #I*,7F8/ instruction set summary in Table ,/+/ lists byte+oriented, bit+oriented, and literal and control operations. Table ,/+, shows the opcode %ield descriptions. For byte+oriented instructions, E%D represents a %ile register designator and EdD represents a destination designator. The %ile register designator speci%ies which %ile register is to be used by the instruction. The destination designator speci%ies where the result o% the operation is to be placed. I% EdD is >ero, the result is placed in the W register. I% EdD is one, the result is placed in the %ile register speci%ied in the instruction. For bit+oriented instructions, EbD represents a bit %ield designator which selects the number o% the bit a%%ected by the operation, while E%D represents the number o% the %ile in which the bit is located. For literal and control operations, EkD represents an eight or eleven+bit constant or literal value. The instruction set is highly orthogonal and is grouped into three basic categoriesF P (yte+oriented operations P (it+oriented operations P &iteral and control operations !ll instructions are e4ecuted within one single instruction cycle, unless a conditional test is true or the program counter is changed as a result o% an instruction. In this case, the e4ecution takes two instruction cycles, with the second cycle e4ecuted as a O#. One instruction cycle consists o% %our oscillator periods.
+ 0, +
Thus, %or an oscillator %re3uency o% 1 5=>, the normal instruction e4ecution time is , Ls. I% a conditional test is true, or the program counter is changed as a result o% an instruction, the instruction e4ecution time is / Ls.
I C PROTOCOL
HISTORY OF THE I C BUS
The I/* bus was developed in the early ,<;.Rs by #hilips Semiconductors. Its original purpose was to provide an easy way to connect a *#A to peripheral chips in a TC+set. IS* is a multi+master serial computer bus used to attach low+speed peripherals to a motherboard, embedded system, or cell phone. The name stands %or Inter+ Integrated *ircuit and is pronounced I-s3uared-C and also, I-two-C.
THE I C BUS PROTOCOL
The I/* bus physically consists o% / active wires and a ground connection. The active wires, called S"! and S*&, are both bi+directional. S"! is the Serial data line, and S*& is the Serial clock line. Every device hooked up to the bus has its own uni3ue address, no matter whether it is an 5*A, &*" driver, memory, or !SI*. Each o% these chips can act as a receiver and'or transmitter, depending on the %unctionality. Obviously, an &*" driver is only a receiver, while a memory or I'O chip can be both transmitter and receiver. The I/* bus is a multi+master bus. This means that more than one I* capable o% initiating a data trans%er can be connected to it. The I/* protocol speci%ication states that the I* that initiates a data trans%er on the bus is considered the B*% #)%&'+. *onse3uently, at that time, all the other I*s are regarded to be B*% S0):'%.
+ 0/ +
!s bus masters are generally microcontrollers, letRs take a look at a general Rinter+I* chatR on the bus. &etDs consider the %ollowing setup and assume the 5*A wants to send data to one o% its slaves.
OPERATION:First, the 5*A will issue a START condition. This acts as an R!ttentionR signal to all o% the connected devices. !ll I*s on the bus will listen to the bus %or incoming data. Then the 5*A sends the ADDRESS o% the device it wants to access, along with an indication whether the access is a $ead or Write operation 6Write in our e4ample9. =aving received the address, all I*Rs will compare it with their own address. I% it doesnRt match, they simply wait until the bus is released by the stop condition 6see below9. I% the address matches, however, the chip will produce a response called the AC"NOWLEDGE#ENT signal. Once the 5*A receives the acknowledge, it can start transmitting or receiving DATA. In our case, the 5*A will transmit data. When all is done, the 5*A will 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. We have had several states on the bus in our e4ampleF ST!$T, !""$SS, !*B OW&E"-E5E T, "!T! and STO#. These are all uni3ue conditions on the bus. (e%ore we take a closer look at these bus conditions we need to understand a bit about the physical structure and hardware o% the bus
+ 00 +
THE I C BUS HARDWARE STRUCTURE
!s e4plained earlier, the bus physically consists o% / active wires called SDA 6data9 and SCL 6clock9, and a ground connection. (oth S"! and S*& are initially bi+directional. This means that in a particular device, these lines can be driven by the I* itsel% or %rom an e4ternal device. In order to achieve this %unctionality, these signals use open collector or open drain outputs 6depending on the technology9. The bus inter%ace is built around an input bu%%er and an open drain or open collector transistor. When the bus is I"&E, the bus lines are in the logic =I-= state 6note that e4ternal pull+up resistors are necessary %or this which is easily %orgotten9. To put a signal on the bus, the chip drives its output transistor, thus pulling the bus to a &OW level. The Tpull+up resistorT in the devices as seen in the %igure is actually a small current source or even non+e4istent.
I/* (us EventsF The ST!$T and STO# conditionsF
#rior to any transaction on the bus, a ST!$T condition needs to be issued on the bus. The start condition acts as a signal to all connected I*Rs that something is about to be transmitted on the bus. !s a result, all connected chips will listen to the bus. !%ter a message has been completed, a STO# condition is sent. This is the signal %or all devices on the bus that the bus is available again 6idle9. I% a chip was accessed and has received data during the last transaction, it will now process this in%ormation 6i% not already processed during the reception o% the message9.
+ 01 +
START: The chip issuing the Start condition %irst pulls the S"! 6data9 line low, and ne4t pulls the S*& 6clock9 line low.
STOP: The (us 5aster %irst releases the S*& and then the S"! line.
•
! single message can contain multiple Start conditions. The use o% this so+ called Trepeated startT is common in I/*.
•
! Stop condition always denotes the E " o% a transmission. Even i% it is issued in the middle o% a transaction or in the middle o% a byte. It is Tgood behaviorT %or a chip that, in this case, it disregards the in%ormation sent and resumes the Tlistening stateT, waiting %or a new start condition.
I C BUS EVENTS: TRANS#ITTING A BYTE TO A SLAVE:
Once the %&)+& condition has been sent, a byte can be transmitted by the 5!STE$ to the S&!CE.
+ 02 +
This %irst byte a%ter a start condition will identi%y the slave on the bus 6address9 and will select the mode o% operation. The meaning o% all %ollowing bytes depends on the slave.
!s the I/* bus gained popularity, it was soon discovered that the number o% available addresses was too small. There%ore, one o% the reserved addresses has been allocated to a new task to switch to ,.+bit addressing mode. I% a standard slave 6not able to resolve e4tended addressing9 receives this address, it wonRt do anything 6since itRs not its address9. I% there are slaves on the bus that can operate in the e4tended ,.+bit addressing mode, they will !&& respond to the AC" cycle issued by the master. The second byte that gets transmitted by the master will then be taken in and evaluated against their address.
I C BUS EVENTS: RECEIVING A BYTE FRO# A SLAVE:
Once the slave has been addressed and the %0):' 5)% )3/81?0'.;'. this, a byte can be received %rom the slave i% the $'W bit in the address was set to $E!" 6set to R,R9. The protocol synta4 is the same as in &+)8%(-&&-8; ) @$&' &1 ) %0):' , e4cept that now the master is not allowed to touch the S"! line. #rior to sending the ; clock pulses needed to clock in a byte on the S*& line, the master releases the S"! line. The slave will now take control o% this line. The line will then go high i% it wants to transmit a R,R or, i% the slave wants to send a R.R, remain low.
+ 07 +
!ll the master has to do is generate a rising edge on the S*& line 6/9, read the level on S"! 609 and generate a %alling edge on the S*& line 619. The slave will not change the data during the time that S*& is high. 6Otherwise a S&)+& 1+ S&14 318.-&-18 might inadvertently be generated.) "uring 6,9 and 629, the slave may change the state o% the S"! line. In total, this se3uence has to be per%ormed ; times to complete the data byte. (ytes are always transmitted 5S( %irst
The meaning o% all bytes being read depends on the slave. There is no such thing as a Tuniversal status registerT. Uou need to consult the data sheet o% the slave being addressed to know the meaning o% each bit in any byte transmitted.
I C BUS EVENTS: GETTING AC"NOWLEDGE FRO# A SLAVE:
When an address or data byte has been transmitted onto the bus then this must be acknowledged by the slave6s9. In case o% an addressF I% the address matches its own then that slave and only that slave will respond to the address with an !*B. In case o% a byte transmitted to an already addressed slave then that slave will respond with an !*B as well.
+ 08 +
The slave that is going to give an !*B pulls the S"! line low immediately a%ter reception o% the ;th bit transmitted, or, in case o% an address byte, immediately a%ter evaluation o% its address. In practical applications this will not be noticeable.
This means that as soon as the master pulls S*& low to complete the transmission o% the bit 6,9, S"! will be pulled low by the slave 6/9. The master now issues a clock pulse on the S*& line 609. The slave will release the S"! line upon completion o% this clock pulse 619. The bus is now available again %or the master to continue sending data or to generate a stop condition. In case o% .)&) @'-8; ?+-&&'8 &1 ) %0):', this cycle must be completed be%ore a %&14 318.-&-18 can be generated. The slave will be blocking the bus 6S"! kept low by slave9 until the master has generated a clock pulse on the S*& line.
I C BUS EVENTS: GIVING AC"NOWLEDGE TO A SLAVE:
Apon +'3'4&-18 19 ) @$&' 9+1( ) %0):', the master must acknowledge this to the slave device. The master is in %ull control o% the S"! and the S*& line.
+ 0; +
!%ter transmission o% the last bit to the master 6,9 the slave will release the S"! line. The S"! line should then go high 6/9. The 5aster will now pull the S"! line low 609 . e4t, the master will put a clock pulse on the S*& line 619. !%ter completion o% this clock pulse, the master will again release the S"! line 629.The slave will now regain control o% the S"! line 679. I% the master wants to stop receiving data %rom the slave, it must be able to send a %&14 318.-&-18. Since the slave regains control o% the S"! line a%ter the !*B cycle issued by the master, this could lead to problems. &etRs assume the ne4t bit ready to be sent to the master is a .. The S"! line would be pulled low by the slave immediately a%ter the master takes the S*& line low. The master now attempts to generate a Stop condition on the bus. It releases the S*& line %irst and then tries to release the S"! line + which is held low by the slave. *onclusionF o Stop condition has been generated on the bus. This condition is called a !*BF ot acknowledge.
I C BUS EVENTS: NO AC"NOWLEDGE CFRO# SLAVE TO #ASTERD:
This is not e4actly a condition. It is merely a state in the data %low between master and slave.
+ 0< +
I%, a%ter transmission o% the ;th bit %rom the master to the slave the slave does not pull the S"! line low, then this is considered a o !*B condition. This means that eitherF
• • •
The slave is not there 6in case o% an address9 The slave missed a pulse and got out o% sync with the S*& line o% the master. The bus is TstuckT. One o% the lines could be held low permanently.
In any case the master should abort by attempting to send a stop condition on the bus.
APPLICATIONS
IS* is appropriate %or peripherals where simplicity and low manu%acturing cost are more important than speed. *ommon applications o% the IS* bus areF • • • • • • • $eading con%iguration data %rom S#" E#$O5Ds on S"$!5, ""$ S"$!5, ""$/ S"$!5 memory sticks 6"I559 and other stacked #* boards Supporting systems management %or #*I cards, through a S5(us /.. connection. !ccessing C$!5 chips that keep user settings. !ccessing low speed "!*s. !ccessing low speed !"*s. *hanging contrast, hue, and color balance settings in monitors 6"isplay "ata *hannel9. *hanging sound volume in intelligent speakers.
+ 1. +
• • • •
*ontrolling O&E"'&*" displays, like in a cell phone. $eading hardware monitors and diagnostic sensors, like a *#A thermostat and %an speed. $eading real time clocks. Turning on and turning o%% the power supply o% system components.
! particular strength o% IS* is that a microcontroller can control a network o% device chips with )ust two general+purpose I'O pins and so%tware. #eripherals can also be added to or removed %rom the IS* bus while the system is running, which makes it ideal %or applications that re3uire hot swapping o% components.
!.
PASSIVE INFRARED SENSOR CPIRD: ! #I$ detector is a motion detector that senses the heat emitted by a living
body. These are o%ten %itted to security lights so that they will switch on automatically i% approached. They are very e%%ective in enhancing home security systems.
The sensor is passive because, instead o% emitting a beam o% light or microwave energy that must be interrupted by a passing person in order to ?sense@ that person, the #I$ is simply sensitive to the in%rared energy emitted by every living thing. When an intruder walks into the detectorDs %ield o% vision, the detector ?sees@ a sharp increase in in%rared energy. ! #I$ sensor light is designed to turn on when a person approaches, but will not react to a person standing still. The lights are designed this way. ! moving person e4hibits a sudden change in in%rared energy, but a slower change is emitted by a motionless body. Slower changes are also caused by gradual %luctuations in the
+ 1, +
temperature o% the environment. I% the light were sensitive to these slower changes, it would react to the sidewalk cooling o%% at night, instead o% the motion o% a burglar. I% you have a #I$ light, you may notice that it is more sensitive on cold days than on warm days. This is because the di%%erence in temperature between the ambient air and the human body is greater on cold days, making the rise in temperature easier %or the sensor to detect. This has drawbacks, thoughH i% the sensor is too sensitive, it will pick up things you donDt want it to such as the movement o% small animals.
#assive in%rared sensor is an electronic device, which measures in%rared light radiating %rom ob)ects in its %ield o% view. #I$s are o%ten used in the construction o% #I$+based motion detectors. !pparent motion is detected when an in%rared source with one temperature, such as a human, passes in %ront o% an in%rared source with another temperature, such as a wall. !ll ob)ects emit what is known as black body radiation. This energy is invisible to the human eye but can be detected by electronic devices designed %or such a purpose. The term R#assiveR in this instance means the #I$ does not emit energy o% any type but merely accepts incoming in%rared radiation. In%rared radiation enters through the %ront o% the sensor, known as the sensor %ace. !t the core o% a #I$ is a solid state sensor or set o% sensors, made %rom appro4imately ,'1 inches s3uare o% natural or arti%icial pyroelectric materials, usually in the %orm o% a thin %ilm, out o% gallium nitride 6-a 9, caesium nitrate 6*s O 09, polyvinyl %luorides, derivatives o% phenylpyra>ine, and cobalt phthalocyanine. 6See pyroelectric crystals.9 &ithium tantalate 6&iTaO 09 is a crystal e4hibiting both pie>oelectric and pyroelectric properties. The sensor is o%ten manu%actured as part o% an integrated circuit and may consist o% one 6,9, two 6/9 or %our 619 Rpi4elsR o% e3ual areas o% the pyroelectric material. #airs o% the sensor pi4els may be wired as opposite inputs to a di%%erential ampli%ier. In such a con%iguration, the #I$ measurements cancel each other so that the
+ 1/ +
average temperature o% the %ield o% view is removed %rom the electrical signalH an increase o% I$ energy across the entire sensor is sel%+cancelling and will not trigger the device. This allows the device to resist %alse indications o% change in the event o% being e4posed to %lashes o% light or %ield+wide illumination. 6*ontinuous bright light could still saturate the sensor materials and render the sensor unable to register %urther in%ormation.9 !t the same time, this di%%erential arrangement minimi>es common+mode inter%erenceH this allows the device to resist triggering due to nearby electric %ields. =owever, a di%%erential pair o% sensors cannot measure temperature in that con%iguration and there%ore this con%iguration is speciali>ed %or motion detectors.
In a #I$+based motion detector, the #I$ sensor is typically mounted on a printed circuit board, which also contains the necessary electronics re3uired to interpret the signals %rom the chip. The complete circuit is contained in a housing, which is then mounted in a location where the sensor can view the area to be monitored. In%rared energy is able to reach the sensor through the window because the plastic used is transparent to in%rared radiation 6but only translucent to visible light9. This plastic sheet prevents the introduction o% dust and insects, which could obscure the sensorRs %ield o% view.
OPERATION OF PIR SENSOR:
! %ew mechanisms have been used to %ocus the distant in%rared energy onto the sensor sur%ace. The window may have Fresnel lenses molded into it. !lternatively, sometimes #I$ sensors are used with plastic segmented parabolic mirrors to %ocus the in%rared energyH when mirrors are used, the plastic window cover has no Fresnel lenses molded into it. ! %iltering window 6or lens9 may be used to limit the wavelengths to ;+,1 micrometers, which is most sensitive to human in%rared radiation 6<.1 micrometers being the strongest9. The #I$ device can be thought o% as a kind o% in%rared EcameraD, which remembers the amount o% in%rared energy %ocused on its sur%ace. Once power is
+ 10 +
applied to the #I$ the electronics in the #I$ shortly settle into a 3uiescent state and energi>e a small relay. This relay controls a set o% electrical contacts, which are usually connected to the detection input o% an alarm control panel. I% the amount o% in%rared energy %ocused on the sensor changes within a con%igured time period, the device will switch the state o% the alarm output relay. The alarm output relay is typically a Tnormally closed 6 *9T relayH also know as a TForm (T relay. ! person entering the monitored area is detected when the in%rared energy emitted %rom the intruderRs body is %ocused by a Fresnel lens or a mirror segment and overlaps a section on the chip, which had previously been looking at some much cooler part o% the protected area. That portion o% the chip is now much warmer than when the intruder wasnRt there. !s the intruder moves, so does the hot spot on the sur%ace o% the chip. This moving hot spot causes the electronics connected to the chip to de+energi>e the relay, operating its contacts, thereby activating the detection input on the alarm control panel. *onversely, i% an intruder were to try to de%eat a #I$ perhaps
+ 11 +
(y holding some sort o% thermal shield between himsel% and the #I$, a corresponding RcoldR spot moving across the %ace o% the chip will also cause the relay to de+energi>e unless the thermal shield has the same temperature as the ob)ects behind it. 5anu%acturers recommend care%ul placement o% their products to prevent %alse alarms. They suggest mounting the #I$s in such a way that the #I$ cannot RseeR out o% a window. !lthough the wavelength o% in%rared radiation to which the chips are sensitive does not penetrate glass very well, a strong in%rared source 6a vehicle headlight, sunlight re%lecting %rom a vehicle window9 can overload the chip with enough in%rared energy to %ool the electronics and cause a %alse 6non+intruder caused9 alarm. ! person moving on the other side o% the glass however would not be RseenR by the #I$. They also recommended that the #I$ not be placed in such a position that an =C!* vent would blow hot or cold air onto the sur%ace o% the plastic, which covers the housingRs window. !lthough air has very low emissivity 6emits very small amounts o% in%rared energy9, the air blowing on the plastic window cover could change the plasticRs temperature enough to, once again, %ool the electronics. #I$s come in many con%igurations %or a wide variety o% applications. The most common used in home security systems has numerous Fresnel lenses or mirror segments and has an e%%ective range o% about thirty %eet. Some larger #I$s are made with single segment mirrors and can sense changes in in%rared energy over one hundred %eet away %rom the #I$. There are also #I$s designed with reversible orientation mirrors, which allow either broad coverage 6,,.V wide9 or very narrow RcurtainR coverage. #I$s can have more than one internal sensing element so that, with the appropriate electronics and Fresnel lens, it can detect direction. &e%t to right, right to le%t, up or down and provide an appropriate output signal.
!.! LIGHT DEPENDENT RESISTOR: + 12 +
&"$s or &ight "ependent $esistors are very use%ul especially in light'dark sensor circuits. ormally the resistance o% an &"$ is very high, sometimes as high as ,... ... ohms, but when they are illuminated with light resistance drops dramatically. Electronic opto sensors are the devices that alter their electrical characteristics, in the presences o% visible or invisible light. The best+known devices o% this type are the light dependent resistor 6&"$9, the photo diode and the phototransistors. &ight dependent resistor as the name suggests depends on light %or the variation o% resistance. • &"$ are made by depositing a %ilm o% cadmium sulphide or cadmium selenide
on a substrate o% ceramic containing no or very %ew %ree electrons when not illuminated. The %ilm is deposited in a >ig >ag %ashion in the %orm o% a strip. The longer the strip the more the value o% resistance. • When light %alls on the strip, the resistance decreases. In the absence o% light the resistance can be in the order o% ,.B ohm to ,2B ohm and is called the dark resistance. "epending on the e4posure o% light the resistance can %all down to value o% 2.. ohms. The power ratings are usually smaller and are in the range 2.mw to .2w. Though very sensitive to light, the switching time is very high and hence cannot be used %or high %re3uency applications. They are used in chopper ampli%iers. &ight dependent resistors are available as discs ..2cm to /.2cm. The resistance rises to several 5ega ohms under dark conditions. The below %igure shoes that when the torch is turned on, the resistance o% the &"$ %alls, allowing current to pass through it is shown in %igure.
+ 17 +
The basic construction and symbol %or &"$ are shown in above %igures respectively. The device consists o% a pair o% metal %ilm contacts. Separated by a snakelike track o% cadmium sulphide %ilm, designed to provide the ma4imum possible contact area with the two metal %ilms. The structure is housed in a clear plastic or resin case, to provide %ree access to e4ternal light. #ractical &"$s are available in variety o% si>es and packages styles, the most popular si>e having a %ace diameter o% roughly ,.mm. practical &"$ is shown in below %igure.
S4'3&+)0 +'%418%':
The resistors are only light dependent over a limited range o% wavelengths. &"$s have their ma4imum response at about 7;.nm.
+ 18 +
T'(4'+)&*+' .'4'8.'83$:
Electrons can be e4cited not only by photons but also by thermal agitation. The dark resistance is there%ore not in%inite at normal temperatures. It increases with the ambient temperature coe%%icient is, however, very small and can be neglected.
R'31:'+$ +)&':
When an &"$ is brought %rom a certain illuminating level into total darkness, the resistance does not increase immediately to the dark value. The recovery rate is speci%ied in k ohm'second and %or current &"$ types it is more than /..k ohm'second. The recovery rate is much greater in the reverse direction, e.g. going %rom darkness to illumination level o% 0.. lu4, it takes less than resistance which corresponds with a light level o% 1.. lu4. &"$s are sensitive, ine4pensive, and readily available devices. They have good power and voltage handling capabilities, similar to those o% a conventional resistor. Their only sigini%icant de%ect is that they are %airly low acting, taking tens or hundreds o% &"$ include light and dark+activated switches and alarms, light beam alarms and re%lective smoke alarms etc. ! &"$ may be connected either way round and no special precautions are re3uired when soldering. • • "arknessF 5a4imum resistance, about ,5ohm. Cery bright lightF 5inimum resistance, about ,.. ohm. ,.ms to reach a
The &"$ is a variable resistor whose resistance decreases with the increase in light intensity. Two cadmium sulphide 6cds9 photoconductive cells with spectral response similar to that o% the human eye. The cell resistance %alls with increasing light intensity.
+ 1; +
LDR C-+3*-& D-);+)

F')&*+'%:
• • • • =igh reliability &ight weight Wide spectral response Wide ambient temperature range
A440-3)&-18%:
• • • • Smoke detection !utomatic lighting control (urglar alarm systems *amera 6electronic shutter9
+ 1< +
•
Strobe 6color temperature reading9
0.1 "igital Thermometer and Thermostat 6"S,7/,9F +
FEATURES: ? ? Temperature measurements re3uire no e4ternal components 5easures temperatures %rom +22V* to W,/2V* in ..2V* increments.
Fahrenheit e3uivalent is +78VF to /28VF in ..<VF increments ? ? ? ? ? ? Temperature is read as a <+bit value 6/+byte trans%er9 Wide power supply range 6/.8C to 2.2C9 *onverts temperature to digital word in less than , second Thermostatic settings are user de%inable and nonvolatile "ata is read %rom'written via a /+wire serial inter%ace 6open drain I'O lines9 !pplications include thermostatic controls, industrial systems, consumer products, Thermometers, or any thermal sensitive system ? ;+pin "I# or SO package 6,2.mil and /.;mil9 ABSOLUTE #AXI#U# RATINGS: Coltage on !ny #in $elative to -round Operating Temperature $ange Storage Temperature $ange DESCRIPTION: The "S,7/, "igital Thermometer and Thermostat provides <+bit temperature readings, which indicate the temperature o% the device. The thermal alarm output, TOAT, is active when the temperature o% the device e4ceeds a user+de%ined temperature T=F+ The output remains active until the temperature drops below user de%ined temperature T&, allowing %or any hysteresis necessary. +..2C to W7..C +22X* to W,/2X* +22X* to W,/2X*
+ 2. +
Aser+de%ined 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'%rom the "S,7/, over a simple /+wire serial inter%ace. PIN DESCRIPTION: PIN ASSIGNMENT S"! + /+Wire Serial "ata Input'Output. S*& + /+Wire Serial *lock - " + -round TOAT + Thermostat Output Signal !. + *hip !ddress Input "S,7/, ;+#I S.6,2. mil9
A1 - Chip Address Input !/ + *hip !ddress Input C"" + #ower Supply Coltage "S,7/, ;+#I "I# 60..mil9
OPERATION: #')%*+-8; T'(4'+)&*+':
The "S,7/, measures temperature using a band gap+based temperature sensor. ! delta+sigma analog+to digital converter 6!"*9 converts the measured temperature to a digital value that is calibrated in V*H %or VF applications, a lookup table or conversion routine must be used.
The temperature reading is provided in a <+bit, twoDs complement reading by issuing the $E!" TE5#E$!TA$E command. Table / describes the e4act relationship o% output data to measured temperature. The data is transmitted through
+ 2, +
the /+wire serial inter%ace, 5S( %irst. The "S,7/, can measure temperature over the range o% +22X* to W,/2X* in ..2X* increments.
DS16 1 FUNCTIONAL BLOC" DIAGRA#:
T5'+(1%&)& C18&+10: In its operating mode, the "S,7/, %unctions as a thermostat with programmable hysteresis as shown in Figure 0. The thermostat output updates as soon as a temperature conversion is complete. When the "S,7/,Ds temperature meets or e4ceeds the value stored in the high temperature trip register 6T=9, the output becomes active and will stay active until the
+ 2/ +
temperature %alls below the temperature stored in the low temperature trigger register 6T&9. In this way, any amount o% hysteresis may be obtained. The active state %or the output is programmable by the user so that an active state may either be a logic T,T 6C""9 or a logic T.T 6.C9. This is done using the #O& bit in the con%iguration register as e4plained in the Operation and *ontrol section o% this datasheet.
THER#OSTAT OUTPUT OPERATION: D6 CT5'+(1%&)& 1*&4*&E A3&-:' F H-;5D
OPERATION AND CONTROL: The "S,7/, must have temperature settings resident in the T= and T& registers %or thermostatic operation. ! con%iguration'status register also determines the method o% operation that the "S,7/, will use in a particular application, as well as indicating the status o% the temperature conversion operation. T5' 3189-;*+)&-18 +';-%&'+ -% .'9-8'. )% 91001?%:
Where DONE M *onversion "one bit. ?,@ M *onversion complete, ?.@ M *onversion in progress.
+ 20 +
THF M Temperature =igh Flag. This bit will be set to ?,@ when the temperature is greater than or e3ual to the value o% T=. It will remain ?,@ until reset by writing ?.@ into this location or removing power %rom the device. This %eature provides a method o% determining i% the "S,7/, has ever been sub)ected to temperatures above T= while power has been applied. TLF M Temperature &ow Flag. This bit will be set to ?,@ when the temperature is less than or e3ual to the value o% T&. It will remain ?,@ until reset by writing ?.@ into this location or removing power %rom the device. This %eature provides a method o% determining i% the "S,7/, has ever been sub)ected to temperatures below T& while power has been applied.
NVB M
onvolatile 5emory (usy %lag. ?,@ M Write to an E/ memory cell in
progress, ?.@ Mnonvolatile memory is not busy. ! copy to E/ may take up to ,. ms. POL M Output #olarity (it. ?,@ M active high, ?.@ M active low. This bit is nonvolatile. ,S=OT M One Shot 5ode. I% ,S=OT is ?,@, the "S,7/, will per%orm one temperature conversion upon receipt o% the Start *onvert T protocol. I% ,S=OT is ?.@, the "S,7/, will continuously per%orm temperature conversions. This bit is nonvolatile. X M $eserved. For typical thermostat operation the "S,7/, will operate in continuous mode. =owever, %or applications where only one reading is needed at certain times or to conserve power, the one+shot mode may be used. cycle when operating in one+shot mode. T5' DS16 1 ()$ 14'+)&' -8 &5' 91001?-8; &?1 (1.'%: ote that the thermostat output 6TOAT9 will remain in the state it was in a%ter the last valid temperature conversion
+ 21 +
,.
Slave receiver modeF Serial data and clock are received through S"! and
S*&. !%ter each byte is received an acknowledge bit is transmitted. ST!$T and STO# conditions are recogni>ed as the beginning and end o% a serial trans%er. !ddress recognition is per%ormed by hardware a%ter reception o% the slave address and direction bit. /. Slave transmitter modeF The %irst byte is received and handled as in the slave
receiver mode. =owever, in this mode the direction bit will indicate that the trans%er direction is reversed. Serial data is transmitted on S"! by the "S,7/, while the serial clock is input on S*&. ST!$T and STO# conditions are recogni>ed as the beginning and end o% a serial trans%er.
CO##AND SET:
To write to the "S,7/,, the master will issue the slave address o% the "S,7/, and the $'W bit will be set to ?.@. !%ter receiving an acknowledge, the bus master provides a command protocol. !%ter receiving this protocol, the "S,7/, will issue an acknowledge and then the master may send data to the "S,7/,. I% the "S,7/, is to be read, the master must send the command protocol as be%ore and then issue a repeated ST!$T condition and the control byte again, this time with the $'W bit set to ?,@ to allow reading o% the data %rom the "S,7/,. The command set %or the "S,7/, as shown in Table 0 is as %ollowsF
R'). T'(4'+)&*+' GAA5H: This command reads the last temperature conversion result. The "S,7/, will send / bytes, in the %ormat described earlier, which are the contents o% this register.
A33'%% TH GA15H: I% $'W is ?.@ this command writes to the T= 6=I-= TE5#E$!TA$E9 register. !%ter issuing this command, the ne4t / bytes written to the "S,7/,, in the same %ormat as described %or reading temperature, will set the high temperature threshold %or operation o% the TOAT output. I% $'W is ?,@ the value stored in this register is read back.
+ 22 +
A33'%% TL GA 5H: I% $'W is ?.@ this command writes to the T& 6&OW TE5#E$!TA$E9 register. !%ter issuing this command, the ne4t / bytes written to the "S,7/,, in the same %ormat as described %or reading temperature, will set the high temperature threshold %or operation o% the TOAT output. I% $'W is ?,@ the value stored in this register is read back.
A33'%% C189-; GAC5H: I% $'W is ?.@ this command writes to the con%iguration register. !%ter issuing this command, the ne4t data byte is the value to be written into the con%iguration register. I% $'W is ?,@ the ne4t data byte read is the value stored in the con%iguration register.
R'). C1*8&'+ GAI5H: This command reads the value *ountX$emain. This command is valid only i% $'W is ?,@.
R'). S014' GA95H: This command reads the value *ountX#erX*. This command is valid only i% $'W is ?,@.
S&)+& C18:'+& T GEE5H: This command begins a temperature conversion. o %urther data is re3uired. In one+shot mode the temperature conversion will be per%ormed and then the "S,7/, will remain idle. In continuous mode this command will initiate continuous conversions.
S&14 C18:'+& T G 5H: -
+ 27 +
This command stops temperature conversion.
o %urther data is re3uired. This
command may be used to halt a "S,7/, in continuous conversion mode. !%ter issuing this command, the current temperature measurement will be completed and the "S,7/, will remain idle until a Start *onvert T is issued to resume continuous operation.
!.A 7ERO CROSSING DETECTOR C7CDD: :ero crossing detectors as a group are not a well+understood application, although they are essential elements in a wide range o% products. It has probably
+ 28 +
escaped the notice o% readers who have looked at the lighting controller and the &inkwit> *osine (urst -enerator, but both o% these rely on a >ero crossing detector %or their operation. ! >ero crossing detector literally detects the transition o% a signal wave%orm %rom positive and negative, ideally providing a narrow pulse that coincides e4actly with the >ero voltage condition. !t %irst glance, this would appear to be an easy enough task, but in %act it is 3uite comple4, especially where high %re3uencies are involved. In this instance, even , k=> starts to present a real challenge i% e4treme accuracy is needed. The not so humble comparator plays a vital role + without it, most precision >ero crossing detectors would not work, and weRd be without digital audio, #W5 and a multitude o% other applications taken %or granted.
B)%-3 01? 9+',*'83$: The >ero crossing detector as used %or the dimmer ramp generator. !lthough it has almost >ero phase inaccuracy, that is largely because the pulse is so broad that any inaccuracy is completely swamped. The comparator %unction is handled by transistor Y, + very basic, but ade3uate %or the )ob. The circuit is also sensitive to level, and %or acceptable per%ormance the !* wave%orm needs to be o% reasonably high amplitude. ,/+,2C !* is typical. I% the voltage is too low, the pulse width will increase. $, is there to ensure that the voltage %alls to >ero + stray capacitance is su%%icient to stop the circuit %rom working without it.
+ 2; +
B)%-3 A0>60HJ 7'+1 C+1%%-8; D'&'3&1+ The pulse width o% this circuit 6at 2.=>9 is typically around 7..us 6..7ms9 which sounds %ast enough. The problem is that at 2.=> each hal% cycle takes only ,.ms 6;.00ms at 7.=>9, so the pulse width is over 2Z o% the total period. This is why most dimmers can only claim a range o% ,.Z+<.Z + the >ero crossing pulse lasts too long to allow more range. While this is not a problem with the average dimmer, it is not acceptable %or precision applications. For a tone burst generator 6either the cosine burst or a RconventionalR tone burst generator9, any inaccuracy will cause the switched wave%orm to contain glitches.
+ 2< +
7CD OUTPUT WAVEFOR#: -
+ 7. +
!.6 POWER SUPPLY:
#ower supply block consists o% %ollowing unitsF • • • • • • Step down trans%ormer. (ridge recti%ier circuit. Input %ilter. Coltage regulators. Output %ilter. Indicator unit.
S&'4 .1?8 &+)8%91+('+:
The step+down trans%ormer is used to step down the supply voltage o% /0.v ac %rom mains to lower values, as the various I*Ds used in this pro)ect re3uire reduced voltages. The trans%ormer consists o% primary and secondary coils. To reduce or step down the voltage, the trans%ormer is designed to contain less number o% turns in its secondary core. The outputs %rom the secondary coil which is center tapped are the ac values o% .v, ,2v and ,2v. The conversion o% these ac values to dc values to dc values is done using the %ull wave recti%ier unit.
R'3&-9-'+ U8-&:
! diode bridge is an arrangement o% %our diodes connected in a bridge circuit. That provides the polarity o% output voltage o% any polarity o% the input voltage. When used in its most common application, %or conversion o% alternating current 6!.*9 input into direct current 6".*9 output, it is known as a bridge recti%ier. The diagram describes a diode+bridge design known as a %ull wave recti%ier. This design can be used to recti%y single phase !.*. when no trans%ormer center tap is available. ! bridge recti%ier makes use o% %our diodes in a bridge arrangement to achieve %ull wave recti%ication. This is a Widely used con%iguration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally. For both positive and negative swings o% the trans%ormer, there is a %orward path through the diode bridge. (oth conduction paths cause current to %low in the same direction through the load resister, accomplishing %ull+wave recti%ication. While one set o% diodes is %orward biased, the other set is reverse biased and e%%ectively eliminated %rom the circuit. + 7, +
I84*& F-0&'+: *apacitors are used as %ilters. The ripples %rom the dc voltages are removed and pure dc voltage is obtained. The primary action per%ormed by capacitor is charging and discharging. It charges in positive hal% cycle o% the ac voltage and it will discharge in negative hal% cycle. So it allows only ac voltage and does not allow the dc voltage. This %ilter is %i4ed be%ore the regulator. *apacitors used here are o% the value ,...uF
R';*0)&1+ *8-&: $egulator regulates the output voltage to a speci%ic value. The output voltage is maintained irrespective o% the %luctuations in the input dc voltage. Whenever there are any ac voltage %luctuations, the dc voltage also changes, and to avoid this regulators are used.
R';*0)&1+% 3)8 @' 30)%%-9-'. )%: 1. P1%-&-:' +';*0)&1+E ?5-35 +';*0)&'% &5' 41%-&-:' :10&);'C<I0AE<I1 D
,. K input pin /. N ground pin 0. N output pin . N'


+ 7/ +
R';*0)&1+% *%'. -8 &5-% )440-3)&-18 )+'F +
8;.2 which provides 2v dc 8;,/ which provides ,/v dc 8<,/ which provides +,/,v dc
O*& 4*& F-0&'+: This %ilter is %i4ed a%ter the $egulator circuit to %ilter any o% the possibly %ound ripples in the output received %inally. *apacitors used here are o% value ,.F.
P1?'+ S*440$ C-+3*-& D-);+)

+ 70 +
!.< LI6UID CRYSTAL DISPLAY CLCDD: &*" is a type o% display used in digital watches and many portable computers. &*" displays utili>e to sheets o% polari>ing material with a li3uid crystal solution between them. !n electric current passed through the li3uid causes the crystals to align so that light cannot pass through them. &*" technology has advanced very rapidly since its initial inception over a decade ago %or use in lap top computers. Technical achievements has resulted in brighter displace, higher resolutions, reduce response times and cheaper manu%acturing process. The li3uid crystals can be manipulated through an applied electric voltage so that light is allowed to pass or is blocked. (y care%ully controlling where and what wavelength 6color9 o% light is allowed to pass, the &*" monitor is able to display images. ! backlight provides &*" monitorDs brightness. Over the years many improvements have been made to &*" to help enhance resolution, image, sharpness and response times. One o% the latest such advancement is applied to glass during acts as switch allowing control o% light at the pi4el level, greatly improving &*"Ds ability to display small+si>ed %onts and image clearly. Other advances have allowed &*"Ds to greatly reduce li3uid crystal cell response times. $esponse time is basically the amount o% time it takes %or a pi4el to ?change colors@, in reality response time is the amount o% time it takes a li3uid crystal cell to go %rom being active to inactive.
T5-% -% .*' &1 91001?-8; +')%18%: • • The declining prices o% &*"s. The ability to display numbers, characters and graphics. This is in contrast to &E"s, which are limited to numbers and a %ew characters.
+ 71 +
!n intelligent &*" display o% two lines, /. characters per line that is inter%aced to the pic,7%8/ microcontroller. Incorporation o% a re%reshing controller into the &*", thereby relieving the *#A to keep displaying the data. Ease o% programming %or characters and graphics. 5ost o% the &*" modules con%orm to a standard inter%ace speci%ication. ! ,1+ pin access is provided having eight data lines, three control lines and three power lines. The connections are laid out in one o% the two common con%igurations, either two rows o% seven pins, or a single row o% ,1 pins. One o% these pins is numbered on the &*"Ds printed circuit board 6#*(9, but i% not, it is 3uite easy to locate pin,. Since this pin is connected to ground, it o%ten has a thicker #*( track, connected to it, and it is generally connected to metal work at same point.
PIN DIAGRA# OF LCD: -
PIN DESCRIPTIONS: V33E V%% )8. V'': While Ccc and Css provide W2C and ground respectively, Cee is used %or controlling &*" contrast.
+ 72 +
RS R';-%&'+ S'0'3&: There are two very important registers inside the &*". The $S pin is used %or their selection as %ollows. I% $SM., the instruction command code register is selected, allowing the user to send a command such as clear display, cursor at home, etc. I% $SM,, the data register is selected, allowing the user to send data to be displayed on the &*".
R>WE +').>?+-&': $'W input allows the user to write in%ormation to the &*" or read in%ormation %rom it. $'W M , %or reading. $'WM . %or writing.
ENE '8)@0': The &*" to latch in%ormation presented to its data pins uses the enable pin. When data is supplied to data pins, a highGto+low pulse must be applied to this pin in order %or the &*" to latch in the data present at the data pins. This pulse must be a minimum o% 12. ns wide.
D0 B D<: The ;Gbit data pins, "O G "8, are used to send in%ormation to the &*" or read the contents o% the &*"Ds internal registers. To display letters and numbers, we send !S*II codes %or the letters !G:, a+> numbers .+< to these pins while making $SM,.
+ 77 +
There are also instruction command codes that can be sent to the &*" to clear the display or %orce the cursor to home position or blink the instruction command codes. We also use $S M . to check the busy %lag bit to see i% the &*" is ready to receive in%ormation. The busy %lag is "8 and can be read when $'WM, and $SM., as %ollowsF i% $'W M ,, $S M .. When "8M , 6busy %lag M ,9, the &*" is busy taking care o% internal operations and will not accept any in%ormation.
P+1&1&$4' 3-+3*-&: For a &*" module to be used e%%ectively in any piece o% e3uipment, a 5icroprocessor or 5icro controller is usually, re3uired to drive it. =owever, be%ore attempting a series o% switches to the pins o% the module. This can be a 3uite bene%ical step, i% even you are thoroughly conversant with the workings o% microprocessors.
!.I
DI##ER: "immers are devices used to vary the brightness o% a light. (y decreasing or
increasing the $5S voltage and hence the mean power to the lamp it is possible to vary the intensity o% the light output. !lthough variable+voltage devices are used %or various purposes, the term dimmer is generally reserved %or those intended to control lighting. 5odern dimmers are built %rom silicon+controlled recti%iers 6S*$9 instead o% potentiometers or variable resistors because they have higher e%%iciency. ! variable resistor would dissipate power by heat 6e%%iciency as low as ..29. (y switching on and o%%, theoretically a dimmer does not heat up 6e%%iciency close to ,..9. Thyristor 6and brie%ly, thyratrom9 dimmers were introduced to solve some o% these problems. (ecause they use switching techni3ues instead o% potential division there is almost no wasted power, dimming can be almost instantaneous and is easily controlled by remote electronics.
+ 78 +
Triacs are used instead o% S*$ thyristors in lower cost designs, but do not have the surge handling capacity o% back+to+back S*$Rs, and are only suitable %or loads less than about /. !mps. The switches generate some heat during switching, and can cause inter%erence. &arge inducors are used as part o% the circuitry to suppress this inter%erence. When the dimmer is at 2.Z power the switches are switching their highest voltage 6N0.. C in Europe9 and the sudden surge o% power causes the coils on the inductor to move, creating bu>>ing sound associated with some types o% dimmerH this same e%%ect can be heard in the %ilaments o% the incandescent lamps as TsingingT. The suppression circuitry adds a lot o% weight to the dimmer, and is o%ten insu%%icient to prevent bu>>ing to be heard on audio systems that share the mains supply with the lighting loads. This development also made it possible to make dimmers small enough to be used in place o% normal domestic light switches.
CIRCUIT DIAGRA#: -
+ 7; +
TRIAC DRIVER #OC !0 1: DESCRIPTION: These devices consist o% a !l-a!s in%rared emitting diode optically coupled to a monolithic silicon detector per%orming the %unction o% a >ero voltage crossing bilateral triac driver. They are designed %or use with a triac in the inter%ace o% logic systems to e3uipment powered %rom ,,2 C!* lines, such as teletypewriters, *$Ts, solid+state relays, industrial controls, printers, motors, solenoids and consumer appliances, etc.
APPLICATIONS: -
P Solenoid'valve controls P &ighting controls P Static power switches P !* motor drives P Temperature controls P E.5. contactors P !* motor starters P Solid+state relays
FEATURES: P Simpli%ies logic control o% ,,2 C!* power P :ero voltage crossing P dv'dt o% /... C'[s typical, ,... C'[s guaranteed
+ 7< +
!.9 OPTOCOUPLER: Opto coupler is a device that uses a short optical transmission path to trans%er a signal between elements o% a circuit, typically a transmitter and a receiver, while keeping them electrically isolated \ since the signal goes %rom an electrical signal to an optical signal back to an electrical signal, electrical contact along the path is broken. ! common implementation involves a &E" and a phototransistor, separated so that light may travel across a barrier but electrical current may not. When an electrical signal is applied to the input o% the opto+isolator, its &E" lights, its light sensor then activates, and a corresponding electrical signal is generated at the output. Anlike a trans%ormer, the opto+isolator allows %or "* coupling and generally provides signi%icant protection %rom serious overvoltage conditions in one circuit a%%ecting the other. With a photodiode as the detector, the output current is proportional to the amount o% 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 with a %orward+ biased diode. The output current and voltage are dependent on the load impedance and light intensity. In photoconductive mode, the diode is connected to a supply voltage, and the magnitude o% the current conducted is directly proportional to the intensity o% light. !n opto+isolator can also be constructed using a small incandescent lamp in place o% the &E"H such a device, because the lamp has a much slower response time than a &E", will %ilter out noise or hal%+wave power in the input signal. In so doing, it will also %ilter out any audio+ or higher+%re3uency signals in the input. It has the %urther disadvantage, o% course, 6an overwhelming disadvantage in most applications9 that incandescent lamps have relatively short li%e spans. Thus, such an unconventional device is o% e4tremely limited use%ulness, suitable only %or applications such as science pro)ects. The optical path may be air or a dielectric waveguide. The transmitting and receiving elements o% an optical isolator may be contained within a single compact module, %or mounting, %or e4ample, on a circuit boardH in this case, the module is o%ten called an 14&1-%10)&1+ or 14&1--%10)&1+.
+ 8. +
The photosensor may be a photocell, phototransistor, or an optically triggered S*$ or Triac. Occasionally, this device will in turn operate a power relay or contactor.
FEATURES OF OPTOCOUPLER: P Inter%aces with common logic %amilies P Input+output coupling capacitance J ..2 #% P Industry Standard "ual+in line 7+pin package P 20.. C$5S isolation test voltage
PIN DIAFRA# OF OPTOCOUPLER: -
A440-3)&-18%:
• • • • • • !* mains detection $eed relay driving Switch mode power supply %eedback Telephone ring detection &ogic ground isolation &ogic coupling with high %re3uency noise re)ection
+ 8, +
!.10 LOADS: In this intelligent energy saving system we are using two loads, lamp and Fan. !ccording to the light intensity o% the particular room or cabin the &"$ will senses, depending on the &"$ output the lamp will be O 'OFF. This system is only applicable %or lamps and not applicable %or tube lights, because the starting voltage o% the tube lights is high compared to lamps. (y using Thermostat and "immer we can ad)ust the speed o% the Fan according to the changes o% the room temperature.
4. SOFTWARE DESCRIPTIONF +
1., F&OW *=!$TF +
Initiali>ation + 8/ + "immer,]dimmer/ o%%
False Is #I$on]&" $ &ow *ompliment "immer , on
$ead temperature
Is temp. /;NtJ0. 0.NtJ0/ 0/NtJ01 07Nt
Set %iring angle and switch on dimmer /
4.
SOURCE CODE: P+1;+)( 91+ PIC16F< : -
+ 80 +
L -830*.'M169< .5K L *%' .'0)$ C3013/F1 000000D L 9*%'% 5% E 81?.& E 4+1&'3& L *%' - 3C()%&'+E %.)FPINN34 E %30FPINN3!D L -830*.' [email protected] -8& &'(45 E &'(40 O -8&1 =F0 E $F0 O -8& ( O L .'9-8' J3. L .'9-8' 4-+ L .'9-8' 0.+ L .'9-8' .-( L -830*.' L -830*.' L -830*.' PINN)4 PINNB0 PINN) PINN)1
L .'9-8' .-(1 PINN)0 M&'(4'+)&*+'.3K M.-(('+1.3K M.-(('+ .3K
L INTNEXT V1-. ()-8C D P O*&4*&N01?C.-(1D O O*&4*&N01?C.-( D O XF0O YF0O
S'&*4N).3N41+&%C &'(4N-8&-&C D O 03.N-8&-&C D O LCDNPUTCCQR9 .'0)$N(%C 000D O W5-0'C1D P
NONANALOGS
D O>> A00 )+' .-;-&)0 180$
POWER
SAVERSD O
+ 81 +
I9 P
CT -84*&C4-+D D
1*&4*&N5-;5C.-(1D O W5-0'CT -84*&C4-+D DPU XFV= O LCDNPUTCCQR8 D'0)$N(%CA000D O U -9C=F F0D P I9C$F F1D P .'0)$N(%C 0000D O YF0 O U PIR ON QD O
1*&4*&N01?C.-(1D O 1*&4*&N01?C.-( DO LCDNPUTCCQR8 .'0)$N(% C!00DO U -9C=F F1D P $F1O + 82 + STAND BY QD O
&'(4N+'). C DO -9 C&'(40F F0=I0D &'(40FAO '0%' &'(40F0O 4+-8&9C03.N4*&3E SR8TE#P: W0 ..W. .3SE &'(45E&'(40D O -9C&'(45KF < XX @)3/ A: &'(45MF I D P -9C T -84*&CJ3.DD;1&1 @)3/ AO .'0)$N(%CADO > >?)-&-8; &1 ;'& J'+1 %&)+&
1*&4*&N5-;5C.-( DO @)3/ 6: -9C T -84*&CJ3.DD;1&1 @)3/ 6O 1*&4*&N01?C.-( DO .'0)$N(%CADO 1*&4*&N5-;5C.-( DO @)3/ <: -9C T -84*&CJ3.DD;1&1 @)3/ <O 1*&4*&N01?C.-( DO U -9 P @)3/ 0: -9C T -84*&CJ3.DD;1&1 @)3/ 0O + 87 + > >?)-&-8; &1 ;'& J'+1 %&)+& C&'(45KF 9 XX &'(45MF!1 D > >?)-&-8; &1 ;'& J'+1 %&)+&
.'0)$N(%CADO
>>
161
1*&4*&N5-;5C.-( DO @)3/!0: -9C T -84*&CJ3.DD;1&1 @)3/!0O 1*&4*&N01?C.-( DO > >?)-&-8; &1 ;'& J'+1 %&)+&
.'0)$N(%CADO 1*&4*&N5-;5C.-( DO @)3/! : -9C T -84*&CJ3.DD;1&1 @)3/! O 1*&4*&N01?C.-( DO U -9 P @)3/9: -9C T -84*&CJ3.DD;1&1 @)3/9O .'0)$N(%CADO >> 161 1*&4*&N5-;5C.-( DO @)3/10: -9C T -84*&CJ3.DD;1&1 @)3/10O 1*&4*&N01?C.-( DO .'0)$N(%CADO 1*&4*&N5-;5C.-( DO @)3/11: -9C T -84*&CJ3.DD;1&1 @)3/11O 1*&4*&N01?C.-( DO U -9 C&'(45K!! XX + 88 + &'(45MF!A D > >?)-&-8; &1 ;'& J'+1 %&)+& > >?)-&-8; &1 ;'& J'+1 %&)+& C&'(45K!1 XX &'(45MF!! D
P
@)3/1 :
-9C T -84*&CJ3.DD;1&1 @)3/1 O .'0)$N(%C!DO >> 161 1*&4*&N5-;5C.-( DO
> >?)-&-8; &1 ;'& J'+1 %&)+&
@)3/1!:
-9C T -84*&CJ3.DD;1&1 @)3/10O 1*&4*&N01?C.-( DO
> >?)-&-8; &1 ;'& J'+1 %&)+&
.'0)$N(%C!DO 1*&4*&N5-;5C.-( DO @)3/14: -9C T -84*&CJ3.DD;1&1 @)3/14O 1*&4*&N01?C.-( DO U -9 P @)3/1A: -9C T -84*&CJ3.DD;1&1 @)3/1AO .'0)$N(%C DO 1*&4*&N5-;5C.-( DO @)3/16: -9C T -84*&CJ3.DD;1&1 @)3/16O 1*&4*&N01?C.-( DO .'0)$N(%C DO 1*&4*&N5-;5C.-( DO > >?)-&-8; &1 ;'& J'+1 %&)+& > >?)-&-8; &1 ;'& J'+1 %&)+& C&'(45K!A XX &'(45MF!< D
+ 8; +
@)3/1<:
-9C T -84*&CJ3.DD;1&1 @)3/1<O 1*&4*&N01?C.-( DO U -9 -9 -9 U C&'(45K!<D 1*&4*&N5-;5C.-( D O
C-84*&C0.+D D1*&4*&N5-;5C.-(1D O CT I84*&C0.+D D1*&N01?C.-(1D O
U U
P+1;+)( 91+ &5'+(1%&)&:&'(4N-8-&CD P - 3N%&)+&CDO
+ 8< +
- 3N?+-&'C0=90DO>> .':-3' )..+'%% - 3N?+-&'C0=)3DO>> 318&+10 +';-%&'+ - 3N?+-&'C00DO>> ?+-&' (1.' - 3N%&14CDO .'0)$N(%C10DO - 3N%&)+&CDO - 3N?+-&'C0=90DO>> .':-3' )..+'%% - 3N?+-&'C0=''DO>> 318&+10 +';-%&'+ - 3N%&14CDO U &'(4N+').CD P - 3N%&)+&CDO - 3N?+-&'C0=90DO - 3N?+-&'C0=))DO - 3N%&)+&CDO - 3N?+-&'C0=91DO &'(45F- 3N+').CDO &'(40F- 3N+').C0DO - 3N%&14CDO U
+ ;. +
CHAPTER 6. CONCLUSION & FUTURE DIRECTIONS
CONCLUSION:
Intelligent Energy Saving System is not limited %or any particular application, it can be used any where in a process industries with little modi%ications in so%tware coding according to the re3uirements. This concept not only ensures that our work will be usable in the %uture but also provides the %le4ibility to adapt and e4tend, as needs change.
+ ;, +
In this pro)ect work we have studied and implemented a complete working model using a #I* microcontroller. The programming and inter%ering o% #I* microcontroller has been mastered during the implementation. This work includes the study o% energy saving system in many applications
FUTURE DIRECTIONS:
We e4cept that our ne4t generation will develop this energy saving system with wire less network. In our pro)ect we connected all the sensors to micro controller with the wires. This can be developed with wire less such that we can place di%%erent sensors in di%%erent places. This sensor will activate the micro controller with the signals instead o% using wires. This system can also be applicable to various loads like pressure, %orce and etc. by increasing the number o% ports o% the micro controller.
+ ;/ +
BIBLIOGRAPHY
BIBLIOGRAPHY
BOOKS REFERRED:
,9 !dler, $. (., !. *. Smith, and $. &. &onganiF ?Introduction to Semiconductor Physics,@ vol. ,, p. 8;, Semiconductor Electronics Education *omitee, ^ohn Wiley ] Sons, Inc., ew Uork ,,<71.
+ ;0 +
/9 Schade, O. =.F ?Analysis of Rectifier Operation@, proc. IRE, vol.0,, pp. 01,+ 07,, ^uly, ,<10. 09 Stout, 5. (.F ?Analysis of Rectifier Circuits”, Elec. En ., vol. 21, September, ,<02. 19 ^acob 5illman *hristos *. =alkias.F ?Electronic !e"ices And Circuits@, Tata 5c-raw+=ill #ublishing *ompany &td. Sep, /..0. 29 Fair, :. E.F ?Pie#oelectric Crystals in Oscillator Circuits@, $ell System %ech. &., vol./1, !pril, ,<12. 79 =akim, S. s.F@Open and Closed 'oop Response of (eed)ac* Amplifiers@, Electron. En ., October, ,<7/ 89 (ode, =. W.F ?+e ati"e (eed)ac* in Current Amplifier !esi n,@ ". Can ostrand *ompany, Inc., #rinceton, .^., ,<12. ;9 Sawhney, !.B.F ?Electrical and Electronic ,easurements and Instruments@, "hanpat $ai ] *o. /..0. <9 Uang, E.SF ?(undamentals of Semiconductor !e"ices@, chap. , 5c-raw =ill (ook *ompany, ew Uork, ,<8;. ,.9 Shive, ^. .F ?Semiconductor !e"ices@, chaps ;]<, ".Can ostrand Inc. #rinceton, .^., ,<2<. ,,9 5illman, ^.F ?,icroelectronics- !i ital and Analo Circuits and Systems@, 5c-raw =ill (ook *ompany, ew Uork, ,<8<. ,/9 $oger & Stevens F ?Serial Communications@, "ontrics, ,<<8 ,09 $obert TerusalimF ?Pro rammin in 'uo@ /+nd edition, ". Can ostrand *ompany, Inc., #rinceton, .^., ,<;8.
+ ;1 +
,19 ^an !4elsonF ?Parallel Port Complete@, 5c-raw =ill (ook *ompany, ew Uork, ,<;<. ,29 #eter =.!nderson, ?PIC C Routines copyri ht@, (altimore, 5", ov,D<< ,79 (ahadur, (.F ?'i.uid Crystals- Applications and /ses@, &itton Systems *anada, ,<</. ,89 5yke #redkoF ?Pro rammin and Customi#in PIC ,icrocontrollers@, !ma>on, ,<<;. ,;9 5yke #redkoF ?0and)oo* of ,icrocontrollers@, !ma>on, ,;;8.
Journa ! R"#"rr"$
,9 InnovationF 5aga>ine o% $esearch ] Technology,/... /9 International ^ournal o% $eliability, Yuality and Sa%ety Engineering6I^$YSE9 Editor+in+chie% =oang #ham "ept. o% Industrial Eng 09 ^ournal o% Electronics 5anu%acturing 6^E59 Editor+in+*hie% #aul #. *onway Wol%son School o% 5echanical ] 5anu%acturing Engineering 19 Foundations and Trends in Electronic "esign !utomation 6FTE"!9 Editor Gin+chie% Sharad 5alik, "ept.o% Electrical Eng., #rinceton Aniversity. 29 #rinted *ircuit "esign Online 65aga>ine9. 79 "esign 5aga>ine. 89 ^ournal o% Instrumentation 6^ IST9. ;9 5icrocontroller solutions.
+ ;2 +
DATA SHEETS:
,9 pic,7%8/ datasheets. /9 Optre4 &*" data sheet 09 I/*X(ASXS#E*IFI*!TIO X,<<2.pd%
+ ;7 +
doc_592584568.doc