You are on page 1of 48

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

CHAPTER 1 INTAODUCTION
Driving to save lives, time, and money in spite of the conditions around you and the actions of others.- This is the slogan for efensive riving! Vehicle accidents are "ost co""on if the driving is inade#$ate! These happen on "ost factors if the driver is dro%sy or if he is alcoholic! river dro%siness is recogni&ed as an i"portant factor in the vehicle accidents! 't %as de"onstrated that driving perfor"ance deteriorates %ith increased dro%siness %ith res$lting crashes constit$ting "ore than ()* of all vehicle accidents! B$t the life lost once cannot +e re,%inded! Advanced technology offers so"e hope avoid these $p to so"e e-tent! This project involves "eas$re and controls the eye +link $sing 'R sensor! The 'R trans"itter is $sed to trans"it the infrared rays in o$r eye! The 'R receiver is $sed to receive the reflected infrared rays of eye! 'f the eye is closed "eans the o$tp$t of 'R receiver is high other%ise the 'R receiver o$tp$t is lo%! This to kno% the eye is closing or opening position! This o$tp$t is give to logic circ$it to indicate the alar"! This project involves controlling accident d$e to $nconscio$s thro$gh Eye +link! .ere one eye +link sensor is fi-ed in vehicle %here if any+ody looses conscio$s and indicate thro$gh alar"! A car si"$lator st$dy %as designed to collect physiological data for validation of this technology! /ethodology for analysis of physiological data0 independent assess"ent of driver dro%siness and develop"ent of dro%siness detection algorith" +y "eans of se#$ential fitting and selection of regression "odels is presented!

CHAPTER 2
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 1

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

SYSTEM MODEL
2.1 GENERAL BLOCK DIAGRAM:

Discriptio
The Syste"s consist of AVR controller %hich is AT"ega34 fro" At"el l co"pany 'n this project %e are going to developed for a$to"atic detection of the eye +link The %hole set$p consists of /icro controller0 'R sensor and 25 The 'R sensor %o$ld +e $sed for sensing the eye +link! 6henever the 'R pair sensor senses the eye "ove"ent the +$&&er is on!
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 2

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

The 5rystal %ill +e $sed for clock fre#$ency 7eneration! The R5 net%ork circ$it %ill +e $sed to generate the po%er on reset for the "icrocontroller! The 25 is 348( $sed to display p$rpose! The relay driver is transistor %hich is $sed for +oosting the c$rrent and controlling the +$&&er

2.2 Circ!it Di"#r"$

CHAPTER % A&R MICROCONTROLLER


epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 3

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

%.1 I tro'!ctio O( A&R Microco tro))*r


/icrocontroller is the heart of this circ$it! The "icrocontroller $sed is AVR0 AT/E7A9( fro" AT/E2 co"pany! The /OS:ET 'R:((; %ill +e $sed as driver for driving 5 "otor! The sensing of speed for 5 "otor %ill +e done $sing optical encoder !The o$tp$t of sensor %ill +e given as feed+ack to the "icrocontroller! :or every one rotation of "otor one interr$pt signal %ill +e send to "icrocontroller! The re#$ired speed can +e entered thro$gh keypad! 25 re#$ired for the "icrocontroller! 34 8 ( or () -; %ill +e attached to "icrocontroller! The ./' %ill +e displayed on 25 !The crystal %ill provide

%.2 Histor+ o( A&R , ATMEGA%2The AVR is a /odified .arvard architect$re <,+it R'S5 single chip "icrocontroller =>5? %hich %as developed +y At"el in 3@@4! The AVR %as one of the first "icrocontroller fa"ilies to $se on,chip flash "e"ory for progra" storage0 as opposed to One,Ti"e Progra""a+le RO/0 EPRO/0 or EEPRO/ $sed +y other "icrocontrollers at the ti"e!

./+ A&R 0
AVRs have +een $sed in vario$s a$to"otive applications s$ch as sec$rity0 safety0 po%er train and entertain"ent syste"s! At"el has recently la$nched a ne% p$+lication AAt"el A$to"otive 5o"pilationA to help developers %ith a$to"otive applications! So"e c$rrent $sages are in B/60 ai"ler,5hrysler and TR6! Syste" Se"icond$ctor0 'nc prod$ces the /9))) /otor and /otion 5ontrol 5hip0 incorporating an At"el AVR 5ore and an Advanced /otion 5ontroller for $se in a variety of "otion applications! The Be% 9(,Bit AVRsC 'n ())4 At"el released "icrocontrollers +ased on the ne%0 9(,+it0 AVR9( architect$re! They incl$de S'/ and SP instr$ctions0 along %ith other a$dio and video processing feat$res! This 9(, $e to +it fa"ily of devices is intended to co"pete %ith the AR/ +ased processors! lot of feat$res in +$ilt it is very cost effective and easy to +$ild a controller!

%.% T*c/ ic") D*t"i)s O( A&R


epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 4

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

.igh,perfor"ance0 2o%,po%er AVRD <,+it /icrocontroller Advanced R'S5 Architect$re 393 Po%erf$l 'nstr$ctions E /ost Single,clock 5ycle E-ec$tion 9( - < 7eneral P$rpose 6orking Registers On,chip (,cycle /$ltiplier Bonvolatile Progra" and ata /e"ories 9(F Bytes of 'n,Syste" Self,Progra""a+le :lash End$ranceC 3)0))) 6riteGErase 5ycles 'n,Syste" Progra""ing +y On,chip Boot Progra" Tr$e Read,6hile,6rite Operation 3)(; Bytes EEPRO/H End$ranceC 3))0))) 6riteGErase 5ycles (F Byte 'nternal SRA/ Progra""ing 2ock for Soft%are Sec$rity ITA7 ='EEE std! 33;@!3 5o"pliant? 'nterface
Bo$ndary,scan 5apa+ilities According to the ITA7 Standard

E-tensive On,chip e+$g S$pport


Progra""ing of :lash0 EEPRO/0 :$ses0 and 2ock Bits thro$gh the ITA7 'nterface

%.1 P*rip/*r") 2*"t!r*s


T%o <,+it Ti"erG5o$nters %ith Separate Prescalers and 5o"pare /odes
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 5

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

One 34,+it Ti"erG5o$nter %ith Separate Prescaler0 5o"pare /ode0 and 5apt$re/ode Real Ti"e 5o$nter %ith Separate Oscillator :o$r P6/ 5hannels <,channel0 3),+it A 5 < Single,ended 5hannels Byte,oriented T%o,%ire Serial 'nterface Progra""a+le Serial USART /asterGSlave SP' Serial 'nterface Progra""a+le 6atchdog Ti"er %ith Separate On,chip Oscillator On,chip Analog 5o"parator Special /icrocontroller :eat$res Po%er,on Reset and Progra""a+le Bro%n,o$t etection 'nternal 5ali+rated R5 Oscillator E-ternal and 'nternal 'nterr$pt So$rces Si- Sleep /odesC 'dle0 A 5 Boise Red$ction0 Po%er,save0 Po%er,do%n0 Stand+y and E-tended Stand+y 'GO and Package ,9( Progra""a+le 'GO 2ines ;),pin P 'P0 ;;,lead TJ:P0 and ;;,pad J:BG/2: Operating Voltages
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 6

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

E E

(!K , L!LV for AT"ega9(2 ;!L , L!LV for AT"ega9(

Speed 7rades ) , < /.& for AT"ega9(2 ) , 34 /.& for AT"ega9( Po%er 5ons$"ption at 3 /.&0 9V0 (LM5 for AT"ega9(2 E E E ActiveC 3!3 "A 'dle /odeC )!9L "A Po%er,do%n /odeC N 3 OA

%.3 Pi Di"#r"$

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 7

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 8

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

%.4 Arc/it*ct!r*

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 9

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

%.5 Osci))"tor circ!it


Any "icro controller re#$ires circ$itry that generates the clock p$lses +y %hich all internal operations are synchroni&ed!

:ig! Oscillator circ$it :OR AVR3<:<4<L

'n AVR t%o pins =OS53G52F' 1 OS5(G52FO? are provided for connecting a resonant net%ork to for" an oscillator! A #$art& crystal is $sed %ith cera"ic capacitors as sho%n in a+ove
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 10

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

circ$it diagra"! The crystal fre#$ency is +asic internal fre#$ency of the "icrocontroller! The crystal that can +e connected to the "icrocontroller is 9(!K4< F.&! 6e have preferred to $se J$art& crystal +eca$se it is ine-pensive and readily availa+le! The capacitors 53 and 5( $sed are each of val$e (Kp:! The capacitors 530 5( are $sed for sta+le fre#$ency operation i!e! in the condition %here is high noise and h$"idity as in the case of factories! .igh noise and h$"idity can affect the oscillator fre#$ency! To avoid this effect0 the capacitors are $sed for sta+le fre#$ency!

%.6 R*s*t Circ!it


A Po%er,on Reset p$lse is generated on,chip %henever V rises a+ove a certain is ade#$ate for threshold! This allo%s the device to start in the initiali&ed state %hen V 3) kP? to V

operation! To take advantage of the POR circ$itry0 tie the /52R pin thro$gh a resistor =3 kP to ! This %ill eli"inate e-ternal R5 co"ponents $s$ally needed to create a Po%er, is specified =para"eter ));?! :or a slo% rise on Reset delay! A "ini"$" rise rate for V

ti"e0 see :'7! (!e! 6hen the device starts nor"al operation =i!e!0 e-its the Reset condition?0 device operating para"eters =voltage0 fre#$ency0 te"perat$re0 etc!? "$st +e "et to ens$re operation! 'f these conditions are not "et0 the device "$st +e held in Reset $ntil the operating conditions are "et! POR events are capt$red +y the POR +it =R5OBN3Q?! The state of the +it is set to )R %henever a Po%er,on Reset occ$rsS it does not change for any other Reset event! POR is not reset to 3R +y any hard%are event! To capt$re "$ltiple events0 the $ser "an$ally resets the +it to 3R in soft%are follo%ing any Po%er,on Reset!

:ig! Reset circ$it for AVR epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 11

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

Not* '! 3C E-ternal Po%er,on Reset circ$it is re#$ired only if the V slo%! The diode ''! helps discharge the capacitor #$ickly %hen V po%er,$p slope is too po%ers do%n!

(C R N ;) kP is reco""ended to "ake s$re that the voltage drop across R does not violate the deviceRs electrical specification!

'''!

9C R3 T 3 kP %ill li"it any c$rrent flo%ing into /52R fro" e-ternal capacitor 50 in the event of /52RGVPP pin +reakdo%n0 d$e to Electrostatic Overstress =EOS?! ischarge =ES ? or Electrical

CHAPTER 1 PARTS O2 SYSTEM

1.1 IR S* sor Mo'!)*


This infrared sensor "od$le is $sed for detecting reflecting s$rface! This sensor can +e $sed to detect reflecting silverG%hite strip0 o+stacle detection0 fla"e detection0 etc! These sensors are pri"ary re#$ire"ent of any si"ple line follo%er ro+o,car!
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 12

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

4. 1.1 Images

4.1.2 Technical Specification: 'R Based O+stacle etecter Adj$sta+le Range %ith POT Operating Voltage Lv Sesitivity $pto , 9)c",Adj$sta+le 2ogic o$tp$t ,3G) ,Lv Application , 'nd$strial safety devices! 4.1.3 Principle 'R 2E e"its infrared radiation! This radiation ill$"inates the s$rface in front of 2E ! epending on reflectivity of the s$rface0 a"o$nt of light

S$rface reflects the infrared light!

reflected varies! This reflected light is "ade incident on reverse +iased 'R sensor! 6hen photons are incident on reverse +iased j$nction of this diode0 electron,hole pairs are generated0 %hich res$lts in reverse leakage c$rrent! A"o$nt of electron,hole pairs generated depends on intensity of incident 'R radiation! /ore intense radiation res$lts in "ore reverse leakage c$rrent! This c$rrent can +e passed thro$gh a resistor so as to get proportional voltage! Th$s as intensity of
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 13

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

incident rays varies0 voltage across resistor %ill vary accordingly! This voltage can then +e given to OPA/P +ased co"parator! O$tp$t of the co"parator can +e read +y $5! Alternatively0 yo$ can $se on,chip A 5 in AVR "icrocontroller to "eas$re this voltage and perfor" co"parison in soft%are!

1.2 IR LED " ' IR s* sor

'R 2E

is $sed as a so$rce of infrared rays! 't co"es in t%o packages 9"" or L""!

9"" is +etter as it is re#$ires less space! 'R sensor is nothing +$t a diode0 %hich is sensitive for infrared radiation! This infrared trans"itter and receiver is called as 'R T8,R8 pair! 't can +e o+tained fro" any decent electronics co"ponent shop and costs less than 3)Rs! :ollo%ing snap sho%s 9"" and L"" 'R pairs! 5olo$r of 'R trans"itter and receiver is different! .o%ever yo$ "ay co"e across pairs %hich appear e-actly sa"e or even has opposite colo$rs than sho%n in a+ove pic and it is not possi+le to disting$ish +et%een T8 and R8 vis$ally! 'n case yo$ %ill have to take help of "$lti"eter to disting$ish +et%een the"! .ere is ho% yo$ can disting$ish +et%een 'R T8,R8 $sing // C 5onnect cathode of one 2E to Uve ter"inal of // 5onnect anode of the sa"e 2E to co""on ter"inal of // ="eans connect 2E s$ch that 't gets reverse +iased +y // ? Set // to "eas$re resistance $pto (/ Oh"! 5heck the reading! Repeat a+ove proced$re %ith second 2E ! 'n a+ove process0 %hen yo$ get the reading of the fe% h$ndred Filo Oh"s on indicated that 2E that yo$ are testing is 'R sensor! 'n case of 'R trans"itter //0 then it // %ill not
Page 14

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

sho% any reading! :ollo%ing snap sho%s typical

// reading o+tained %hen 'R receiver is

connected to it as "entioned a+ove! Second snap sho%s ho% sensorRs resistance increases %hen it is covered +y a finger! Bote that0 these are j$st ill$strative fig$res and they %ill depend $pon sensor as %ell as // that yo$ are $sing!

This /od$le has three pin! Vcc 7B O$tp$t 6hen the o+stacle is detected the o$tp$t is .igh else 2o%!

1.% R*sistors
A resistor is a t%o,ter"inal electronic co"ponent designed to oppose an electric c$rrent +y prod$cing a voltage drop +et%een its ter"inals in proportion to the c$rrent0 that is0 in accordance %ith Oh"Vs la%C V W 'R! The resistance R is e#$al to the voltage drop V across the resistor divided +y the c$rrent ' thro$gh the resistor! The pri"ary characteristics of resistors are their resistance and the po%er they can dissipate! Practical resistors can +e "ade of resistive %ire0 and vario$s co"po$nds and fil"s0 and they can +e integrated into hy+rid and printed circ$its! Si&e0 and position of leads are relevant to e#$ip"ent designersS resistors "$st +e physically large eno$gh not to overheat %hen dissipating their po%er!
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 15

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

1.1 Tr" sistor BC 315


'n electronics0 a transistor is a se"icond$ctor device co""only $sed to a"plify or s%itch electronic signals! A transistor is "ade of a solid piece of a se"icond$ctor "aterial0 %ith at least three ter"inals for connection to an e-ternal circ$it! A voltage or c$rrent applied to one pair of the transistorVs ter"inals changes the c$rrent flo%ing thro$gh another pair of ter"inals! Beca$se the controlled =o$tp$t? po%er can +e "$ch larger than the controlling =inp$t? po%er0 the transistor provides a"plification of a signal! The transistor is the f$nda"ental +$ilding +lock of "odern electronic devices0 and is $sed in radio0 telephone0 co"p$ter and other electronic syste"s! So"e transistors are packaged individ$ally +$t "ost are fo$nd in integrated circ$its!

How transistor works? The essential $sef$lness of a transistor co"es fro" its a+ility to $se a s"all signal applied +et%een one pair of its ter"inals to control a "$ch larger signal at another pair of ter"inals! This property is called AgainA! A transistor can control its o$tp$t in proportion to the inp$t signalS this is called an Aa"plifierA! Or0 the transistor can +e $sed to t$rn c$rrent on or off in a circ$it like an electrically controlled As%itchA0 %here the a"o$nt of c$rrent is deter"ined +y other circ$it ele"ents! The t%o types of transistors have slight differences in ho% they are $sed in a circ$it! A +ipolar transistor has ter"inals la+elled +ase0 collector and e"itter! A s"all c$rrent at +ase ter"inal can control or s%itch a "$chlarger c$rrent +et%een collector and e"itter ter"inals! :or a field,effect transistor0 the ter"inals are la+elled gate0 so$rce0 and drain0 and a voltage at the
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 16

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

gate can control a c$rrent +et%een so$rce and drain! The i"age to the right represents a typical +ipolar transistor in a circ$it! 5harge %ill flo% +et%een e"itter and collector ter"inals depending on the c$rrent in the +ase! Since internally the +ase and e"itter connections +ehave like a se"icond$ctor diode0 a voltage drop develops +et%een +ase and e"itter %hile the +ase c$rrent e-ists! The si&e of this voltage depends on the "aterial the transistor is "ade fro"0 and is referred to as V+e!

1.3 LED
A light,e"itting diode =2E ? is an electronic light so$rce! The 2E %as discovered in the early ()th cent$ry0 and introd$ced as a practical electronic co"ponent in 3@4(! All early devices e"itted lo%,intensity red light0 +$t "odern 2E s are availa+le across the visi+le0 $ltraviolet and infra red %avelengths0 %ith very high +rightness! 2E s are +ased on the se"icond$ctor diode! 6hen the diode is for%ard +iased =s%itched on?0 electrons are a+le to reco"+ine %ith holes and energy is released in the for" of light! This effect is called electrol$"ine scence and the color of the light is deter"ined +y the energy gap of the se"icond$ctor! The 2E is $s$ally s"all in area =less than 3 ""(? %ith integrated optical co"ponents to shape its radiation pattern and assist in reflection!

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 17

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

2E s present "any advantages over traditional light so$rces incl$ding lo%er energy cons$"ption0 longer lifeti"e0 i"proved ro+$stness0 s"aller si&e and faster s%itching! .o%ever0 they are relatively e-pensive and re#$ire "ore precise c$rrent and heat "anage"ent than traditional light so$rces! Applications of 2E s are diverse! They are $sed as lo%,energy replace"ents for traditional light so$rces in %ell,esta+lished applications s$ch as indicators and a$to"otive lighting! The co"pact si&e of 2E s has allo%ed ne% te-t and video displays and sensors to +e developed0 %hile their high s%itching rates are $sef$l in co""$nications technology! 4.5.1 T pes of !"#s 2E s are prod$ced in an array of shapes and si&es! The L "" cylindrical package =red0 fifth fro" the left? is the "ost co""on0 esti"ated at <)* of %orld prod$ction!Xcitation neededY The color of the plastic lens is often the sa"e as the act$al color of light e"itted0 +$t not al%ays! :or instance0 p$rple plastic is often $sed for infrared 2E s0 and "ost +l$e devices have clear ho$sings! There are also 2E s in S/T packages0 s$ch as those fo$nd on +linkies and on cell phone keypads!

1.4 LCD Disp)"+

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 18

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

An 25

consists of t%o glass panels0 %ith the li#$id crystal "aterial sand %itched in +et%een

the"! The inner s$rface of the glass plates are coated %ith transparent electrodes %hich define the character0 sy"+ols or patterns to +e displayed poly"eric layers are present in +et%een the electrodes and the li#$id crystal0 %hich "akes the li#$id crystal "olec$les to "aintain a defined orientation angle! One each polarisers are pasted o$tside the t%o glass panels! These polarisers %o$ld rotate the light rays passing thro$gh the" to a definite angle0 in a partic$lar direction 6hen the 25 %itho$t any orientation0 and hence the 25 thro$gh the 25 is in the off state0 light rays are rotated +y the t%o polarisers and the li#$id crystal0 s$ch that the light rays co"e o$t of the 25 appears transparent! 6hen s$fficient voltage is applied to the electrodes0 the li#$id crystal "olec$les %o$ld +e aligned in a specific direction! The light rays passing %o$ld +e rotated +y the polarisers0 %hich %o$ld res$lt in activating G highlighting the desired characters! The 25 Rs are light%eight %ith only a fe% "illi"eters thickness! Since the 25 Rs cons$"e less po%er0 they are co"pati+le %ith lo% po%er electronic circ$its0 and can +e po%ered for long d$rations! The 25 Rs donRt generate light and so light is needed to read the display! By $sing +acklighting0 reading is possi+le in the dark! The 25 Rs have long life and a %ide operating te"perat$re range! 5hanging the display si&e or the layo$t si&e is relatively si"ple %hich "akes the 25 Rs "ore c$sto"er friendly!

4.6.1.Introduction

Fig. LCD Display The 25 display consists of t%o lines0 () characters per line that is interfaced %ith the

P'534:K9!The protocol =handshaking? for the display is as sho%n in :ig! The display contains t%o internal +yte,%ide registers0 one for co""ands =RSW)? and the second for characters to +e displayed =RSW3?! 't also contains a $ser,progra""ed RA/ area =the character RA/? that can +e progra""ed to generate any desired character that can +e for"ed $sing a dot "atri-! To disting$ish +et%een these
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 19

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

t%o data areas0 the he- co""and +yte <) %ill +e $sed to signify that the display RA/ address ))h %ill +e chosen Port3 is $sed to f$rnish the co""and or data type0 and ports 9!( to 9!; f$rnish register select and readG%rite levels!

4.$.3.Pin #iagram The Pin diagra" for 25 also e-plained in Ta+le L!


GN D

is sho%n in the follo%ing fig L!K and the pin description is

+5 v

VD
D

15

16

2x16 Liquid Crystal Display


1.5 A)"r$ Circ!it
4.7.1Buzzer:
RS R/w En D0 D1 D2 D3 D4 D5 D6 D7 a$to"o+iles0 ww ho$sehold appliances s$ch as a "icro%ave oven0 or ga"e sho%s! 't "ost 0D wow 6 co""only consists of a n$"+er of s%itches or sensors connected to a control $nit that

A 7!88*r or 7**p*r is a signalling device0 $s$ally electronic0 typically $sed in

5 6

10 11 12 13 14

deter"ines if and %hich +$tton 0 %as p$shed or a preset ti"e has lapsed0 and $s$ally ill$"inates a light on the appropriate +$tton or control panel0 and so$nds a %arning in the for" of a contin$o$s or inter"ittent +$&&ing or +eeping so$nd! 'nitially this device %as +ased on an electro"echanical syste" %hich %as identical to an electric +ell %itho$t the "etal gong =%hich "akes the ringing noise?! Often these $nits %ere anchored to a %all or ceiling and $sed the ceiling or %all as a so$nding +oard! Another i"ple"entation %ith so"e A5,connected devices %as to i"ple"ent a circ$it to "ake the A5 c$rrent into a noise lo$d eno$gh to drive a lo$dspeaker and hook this circ$it $p to a cheap <,oh" speaker! Bo%adays0 it is "ore pop$lar to
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 20

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

$se a cera"ic,+ased pie&oelectric so$nder like a Sonalert %hich "akes a high,pitched tone! Us$ally these %ere hooked $p to AdriverA circ$its %hich varied the pitch of the so$nd or p$lsed the so$nd on and off!
4.7.2 Circuit description: The ci c!i" i# $e#i%ne$ "o con" o& "he '!((e ) The '!((e *N +n$ *,, i# con" o&&e$ '"he .+i o/ #wi"chin% " +n#i#"o # 012 5473) The '!((e i# connec"e$ in "he 42 " +n#i#"o co&&ec"o "e 5in+&) 6hen hi%h .!&#e #i%n+& i# %iven "o '+#e o/ "he 41 " +n#i#"o #7 "he " +n#i#"o i# con$!c"in% +n$ c&o#e "he co&&ec"o +n$ e5i""e "e 5in+& #o (e o #i%n+&# i# %iven "o '+#e o/ "he 42 " +n#i#"o ) 8ence 42 " +n#i#"o +n$ '!((e i# "! ne$ *,, #"+"e) 6hen &ow .!&#e i# %iven "o '+#e o/ " +n#i#"o 41 " +n#i#"o 7 "he " +n#i#"o i# "! ne$ *,,) Now 12v i# %iven "o '+#e o/ 42 " +n#i#"o #o "he " +n#i#"o i# con$!c"in% +n$ '!((e i# ene %i(e$ +n$ . o$!ce# "he #o!n$ #i%n+&)

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 21

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

Vo&"+%e / o5 92 o :2 1 0

T +n#i#"o *1 *N *,,

T +n#i#"o 42 *,, *N

T +n#i#"o *3 *,, *N

CHAPTER 3 PO.ER SUPPLY

3.1 Po9*r S!pp)+


The .owe #!..&- ci c!i"# '!i&" !#in% /i&"e #7 ec"i/ie #7 +n$ "hen vo&"+%e e%!&+"o #) S"+ "in% wi"h +n +c vo&"+%e7 + #"e+$- $c vo&"+%e i# o'"+ine$ '- ec"i/-in% "he +c vo&"+%e7 "hen /i&"e in% "o + $c &eve&7 +n$ /in+&&-7 e%!&+"in% "o o'"+in + $e#i e$ /i;e$ $c vo&"+%e) The e%!&+"ion i# !#!+&&- o'"+ine$ / o5 +n <2 vo&"+%e e%!&+"o !ni"7 which "+=e# + $c vo&"+%e +n$ . ovi$e# + #o5ewh+" &owe $c vo&"+%e7 which e5+in# "he #+5e even i/ "he in.!" $c vo&"+%e v+ ie#7 o "he o!".!" &o+$ connec"e$ "o "he $c vo&"+%e ch+n%e#) The '&oc= $i+% +5 o/ .owe #!..&- i# #hown in /i% 'e&ow)

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 22

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

AC I ! T +n#/o 5e Rec"i/ie ,i&"e Re%!&+"o >o+$

"l#$% diagra& #' p#()r supply

6hen %orking %ith electronics0 yo$ al%ays need one +asic thingC Po%er! 'n every electronic circ$it po%er s$pply is re#$ired! The proper %orking of each and every co"ponent0 the e-act a"o$nt of voltage and c$rrent to +e s$pplied to it! 'f the po%er e-ceed its li"it0 it can +e fatal! Belo% is the circ$it diagra" of po%er s$pply %hich gives o$tp$t of LV0 as only that "$ch is re#$ired for "icrocontroller! 'ts circ$it diagra" and designing calc$lation are given +elo%!

2i#. :3 & R*#!)"t*' Po9*r S!pp)+

The UL volt po%er s$pply is +ased on the co""ercial K<)L voltage reg$lator '5! This '5 contains all the circ$itry needed to accept any inp$t voltage fro" < to 3< volts and prod$ce a steady UL volt o$tp$t0 acc$rate to %ithin L* =)!(L volt?! 't also contains c$rrent,li"iting circ$itry and ther"al overload protection0 so that the '5 %onVt +e da"aged in case of e-cessive load c$rrentS it %ill red$ce its o$tp$t voltage instead! The advantage of a +ridge rectifier is yo$ donRt
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 23

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

need a centre tap on the secondary of the transfor"er! A f$rther +$t significant advantage is that the ripple fre#$ency at the o$tp$t is t%ice the line fre#$ency=i!e! L).&? and "akes filtering so"e%hat easier! The $se of capacitor c30c(0c9 and c; is to "ake signal ripple free! The t%o capacitor $sed +efore the reg$lator is to "ake ac signal ripple free and then later %hich %e are $sing is for safety0 if incase there is a ripple left after reg$lating0 then c9 and c; %ill re"ove it! 5.1.1 Transformer #esign 6e re#$ire LV at the oGp of the reg$lator! The drop o$t voltage of the reg$lator is (V As per the data sheet? Vdc W LU( W KV

So at the reg$lator inp$t0 the voltage applied sho$ld +e of KV! According to the for"$la0 Vdc W (V"GPi Ass$"ing there is no ripple 5apacitor fro" V"W Vdc !piG( WK - 9!3;?G( W3)!@@V

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 24

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

V"W 3)!@@V $ring one cycle 0 t%o diodes are cond$cting ! voltage of t%o diode W 3!;V Vi" W V"U 3!;V W3)!@@U3!;W 3(!9@V Vi"W3(!9@V Vr"s W Vi"Gs#rt=(? W 3(!9@Gs#rt=(? W <!K4V Vr"s W <!K4V So %e select transfor"er of @V! Si"ilarly '"W'dc - piG( '"W;))" - 9!3;G( W 4(<"A! 'r"sW '"Gs#rt=(? W 4(<"AGs#rt=(? W ;;;!)4"A 'r"s W ;;;!)4"A So %e select the transfor"er of c$rrent rating L))"A! 5onsidering the a+ove transfor"er rating! 6e take the transfor"er of ),@VGL))"A Transfor"er E ),@VGL))"A Stepdo%n transfor"er! 5.1.2 %ectifier #esign
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

rop o$t voltage of one diode W )!KV

rop o$t

Page 25

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

P'V of diode W V" W 3(!9@V '"W 4(<"A Bridge rectifier ,So0 %e select the +ridge '5 of 3A"pere rating! 5.1.3 &ilter 'apacitor #esign R W VdcG'dc W K G ;))" W 3K!LOh"s!

Vr W (=Vi" E Vdc? W (=3(!9@ E K? W 3)!K<V 5 W VdcG =:-R-Vr? W KG =3))-3K!L-3)!K<? W 9K3!)L$: So for Safe %orking %e select capacitor of 3)))$: 5 W 3)))$: G 9LV
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 26

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

53W 3)))$:G9LV Electrolytic 5apacitor! 5(05; W )!3$: 5era"ic 5apacitor! 59 W (()$:G(LV Electrolytic 5apacitor! So the po%er s$pply "ade fro" the a+ove "entioned co"ponents gives the o$tp$t of 3&. :or "aster P5B %e are taking s$pply fro" USB! Thro$gh USB %e get LV0 L))"A s$pply! This is given to P'5 and 2/93K! Using 2/ 93K %e can get 9!9 V o$tp$ts %hich are given to R: "od$le! :or the slave side %e are $sing @V +attery! The o$tp$t of +attery is @V gives 9!9V o$tp$t %hich is given to R: "od$le! 5 is given to K<)L %hich is given to P'5 controller! The o$tp$t of K<)L is f$rther given to the 2/93K %hich

3.2 &"ri"7)* R*#!)"tor


2/93K is the standard part n$"+er for an integrated three,ter"inal adj$sta+le linear voltage reg$lator! 2/93K is a positive voltage reg$lator s$pporting inp$t voltage of 9V to ;)V and o$tp$t voltage +et%een 3!(LV and 9KV! A typical c$rrent rating is 3!LA altho$gh several lo%er and higher c$rrent "odels are availa+le! Varia+le o$tp$t voltage is achieved +y $sing a potentio"eter or a varia+le voltage fro" another so$rce to apply a control voltage to the control ter"inal! 2/93K also has a +$ilt,in c$rrent li"iter to prevent the o$tp$t c$rrent fro" e-ceeding the rated c$rrent0 and 2/93K %ill a$to"atically red$ce its o$tp$t c$rrent if an overheat condition occ$rs $nder load! 2/93K is "an$fact$red +y "any co"panies0 incl$ding Bational Se"icond$ctor0 :airchild Se"icond$ctor0 and ST/icroelectronics! Altho$gh 2/93K is an
adj$sta+le reg$lator0 it is so"eti"es preferred for high,precision fi-ed voltage applications instead of the si"ilar 2/K<-- devices +eca$se the 2/93K is designed %ith s$perior o$tp$t tolerances! :or a fi-ed voltage application0 the control pin %ill typically +e +iased %ith a fi-ed resistor net%ork0 a Zener diode net%ork0 or a fi-ed control voltage fro" another so$rce! /an$fact$rer datasheets provide standard config$rations for achieving vario$s design applications0 incl$ding the $se of a pass transistor to achieve reg$lated o$tp$t c$rrents in e-cess of %hat the 2/93K alone can provide! 2/93K is availa+le in a %ide range of package for"s for different applications incl$ding heat sink "o$nting and s$rface,"o$nt applications! 5o""on for" factors for high,c$rrent applications incl$de TO,(() %ith part n$"+er 2/93KT and TO,9 %ith part n$"+er 2/93KF! 2/93K is capa+le of dissipating a large a"o$nt of heat at
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 27

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

"edi$" to high c$rrent loads and the $se of a heat sink is reco""ended to "a-i"i&e the lifespan and po%er,handling capa+ility! 2/99K is the negative voltage co"ple"ent to 2/93K and the specifications and f$nction are essentially identical0 e-cept that the reg$lator "$st receive a control voltage and act on an inp$t voltage that are +elo% the gro$nd reference point instead of a+ove it!

Vo$t range Vin , Vo$t difference Operation a"+ient te"perat$re O$tp$t '"a/ini"$" 2oad 5$rrent"a-

3!(LV , 9KV 9V , ;)V ) , 3(LM5 N3!LA 3)"A

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 28

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

CHAPTER 4 SO2T.ARE

4.1 Dip Tr"c* Co$p)*t* PCB D*si# S+st*$

P5B 2ayo$t , P5B design %ith easy to $se "an$al ro$ting tools and a$to ro$ter! Sche"atic , creates sche"atic and e-ports net list to P5B! 5O/ Edit , pattern editor!
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 29

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

Sche"e Edit , co"ponent editor! ra% parts and attach patterns to the"!

ipTrace provides the follo%ing feat$resC "as to learn (ser interface ) To design a sche"atic0 si"ply select and place co"ponents onto yo$r doc$"ent and connect the" together $sing the %ire and +$s tools! /$ltisheet design is s$pported! Then select the "en$ option VS%itch to BoardV to convert the sche"atic to P5B! 2ayo$t can +e $pdated fro" Sche"atic in a fe% clicks at anyti"e! 6hen yo$ create or edit design o+jects they are highlighted to i"prove yo$r %ork! Step,+y,step t$torial availa+le fro" %e+,site g$ides yo$ thro$gh the design process and allo%s to get started %ith ease! "as to (se man(al an* powerf(l a(tomatic ro(ting ipTrace P5B soft%are incl$des an advanced a$to"atic ro$ter that is a+le to ro$te single, layer and "$lti,layer +oards! 't is availa+le %ith a Vrip,$p and retryV algorith"! A$to ro$ter achieves high co"pletion rates +y going +ack and re,ro$ting nets to "ake space for connections that co$ld not +e ro$ted on a previo$s pass! 'ntelligent "an$al ro$ting tools allo% yo$ to create and edit traces +y @)0 ;L degree or %itho$t any li"itations! Thro$gh0 +lind or +$ried vias can +e $sed in a$to"atic and "an$al ro$ting! Unli"ited +oard si&e is s$pported!

4.2 A&R St!'io O;*r;i*9


AVR St$dio is a evelop"ent Tool for the AT@)S Series of AVR "icrocontrollers! This "an$al descri+es the ho% to install and $se AVR St$dio! AVR St$dio ena+les the $ser to f$lly control e-ec$tion of progra"s on the AT@)S 'n,5irc$it E"$lator or on the +$ilt,in AVR 'nstr$ction Set Si"$lator! AVR St$dio s$pports so$rce level e-ec$tion of Asse"+ly progra"s asse"+led %ith the At"el 5orporationVs AVR Asse"+ler and 5 progra"s co"piled %ith 'AR Syste"sR '55A@) 5 5o"piler for the AVR "icrocontrollers! AVR St$dio r$ns $nder /icrosoft 6indo%s@L and /icrosoft 6indo%s BT! AVR St$dio is delivered on t%o diskettes! Bote that in so"e cases0 the second diskette %ill not +e asked for +y the installation progra"! This is +eca$se
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 30

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

so"e of the files re#$ired to r$n AVR St$dio "ay already +e present in the syste"! 'n order to install AVR St$dio $nder 6indo%s@L and 6indo%s BT ;!) '! ''! '''! 'V! 'nsert the diskette la+eled AVR St$dio iskette 3 in drive AC Press the Start +$tton on the Task+ar and select R$n Enter [ACSETUP\ in the Open field and press the OF +$tton :ollo% the instr$ctions in the Set$p progra"

'n order to install AVR St$dio $nder 6indo%s BT 9!L3 '! ''! '''! 'V! 'nsert the diskette la+eled AVR St$dio iskette 3 in drive AC Select R$n fro" the :ile "en$ Enter [ACSETUP\ in the 5o""and 2ine field and press the OF +$tton :ollo% the instr$ctions in the Set$p progra" Once AVR St$dio has +een installed0 it can +e started +y do$+le clicking the AVR St$dio icon! 'f an E"$lator is the desired e-ec$tion target0 re"e"+er to connect the AVR 'n, 5irc$it E"$lator +efore starting AVR St$dio! These are the steps %e are $sing for coding!

CHAPTER 5
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 31

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

IMPLEMETION STEPS 2OR A&R


ST"P 1
Start the AVR St$dio progra" +y clicking onC Start,QProgra"s,QAT/E2 AVR Tools,QAVR St$dio ;

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 32

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

ST"P 2
5lick on the [Be% Project\ +$tton! 6elco"e dialog Bo-

'n this t$torial %e %ill "ake a si"ple progra" that increases the val$e of one of the PORT registers0 "aking a +inary co$nter! To create a ne% project0 click on A5reate Be% ProjectA on the 6elco"e Screen or go to the AProjectA "en$ and select ABe%A! The dialog +o- sho%n in the ne-t fig$re appears! 'n the ne-t dialog +o-0 choose the At"el AVR Asse"+ler as the project typeC
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 33

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

5hoose At"el AVR Asse"+ler Type in a project na"e and the initial file na"eC

Type Project and 'nitial file na"e 'n this dialog +o- yo$ sho$ld enter the project na"e! 6e choose the na"e led here0 +$t this co$ld of co$rse +e an ar+itrary na"e! Be-t yo$Vll have to select the project location! This is the location %here AVR St$dio %ill store all files associated %ith the project! 6e have $sed the location .CHco"p39))HpracsH as the folder! 'f the folder does not e-ist0 AVR St$dio %ill ask yo$ %hether to create it or not! Select AAt"el AVR Asse"+lerA as the project type! 5lick ABe-t QQA and yo$ %ill see a %indo% like the follo%ingC

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 34

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

Select AAVR Si"$latorA as the de+$g platfor" and AAT/E7A34A as the device to $se0 then click A:inishA! The "ain AVR %indo% %ill no% look like thisC

6e can no% enter the Asse"+ly code of the progra"! =AVR St$dio has opened an editor %indo% called led!as"?! Alternatively yo$ can add or create other asse"+ly lang$age files +y right clicking on AAsse"+lerA in the 6orkspace %indo%C

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 35

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

The led!as" file is a$to"atically "arked as AAsse"+ler Entry :ileA =the s"all red arro% on the icon ne-t to the filena"e sho%s this?! This indicates that the asse"+ler %ill start %ith this file %hen asse"+ling the project! The AAsse"+ler :ilesA gro$p can only contain one file "arked as an entry file!

ST"P 3
To assemble the code, we need to build the project. Select "Build" from the Project menu (or press <F !"#

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 36

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

ST"P 4
At this point %e have generated the files needed to si"$late the code! To start r$nning the code0 select AStart e+$ggingA fro" the A e+$gA "en$C

ST"P 5
Bo% %e %ant the progra" to co$nt down instead of $p! To "ake this change %eVll have to edit the so$rce code! Place the c$rsor in the so$rce vie%0 and change the inc to a dec instr$ction! 'f yo$ no% press N:LQ =7o? the follo%ing dialog +o- %ill appear! This +o- indicates that one of the so$rce files has +een changed0 and that the project sho$ld +e re+$ilt! Press A]esA!

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 37

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

ST"P $
Before e-iting AVR St$dio %e %ill save o$r project! AVR St$dio %ill re"e"+er %here the vie%s are placed and %ill $se this setting %hen opening the project later! To save the project select ASave ProjectA fro" the AProjectA "en$!

5.1 A';" t"#*s < Dis"';" t"#*s :


+.1.1 ,*-antages : :ast Resposne Bo /echanical sensor fitting re#$ired! 2o% voltage operation 2o% cost Easyly $pgrada+le +.1.2 #is,*-antages : The electric valve need to +e fitted in the pipe %hich is to +e c$tted Sensing istance of the sensor is li"ited +.1.3 &(t(re Scope: '! ''! '''! 7S/ /ode" can +e connected 0 %hich %ill +e $sed to send S/S 7PS syste"s can +e $sed %hich %ill give the location of the accident! The RT5 can +e connected %hich %ill +e $sed to display the date and ti"e of the 2eakage!

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 38

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

CHAPTER 6 CODES AND SYNTHESIS RESULT 6.1 LCD I t*r("ci #


^ifndef lcd_5 ^define lcd_5 ^incl$de NavrHio!hQ ^incl$de Nstdio!hQ ^incl$de N$tilHdelay!hQ ^incl$de Alcd!hA void lcd_config=void? ` /5U5SR aW )-<)S /5U5SR aW )-<)S R W)+333)))))S R5W)+3333))))S PORT 1Wb=3NNR6?S
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 39

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

c void lcd_init=void? ` lcd_config=?S _delay_"s=9)?S lcd_ni++le=)-)90)?S lcd_en_tgl=?S _delay_"s=L?S lcd_en_tgl=?S _delay_$s=34)?S lcd_en_tgl=?S _delay_"s=L?S lcd_ni++le=)-)(0)?S _delay_$s=34)?S lcd_c"d=)-(<?S _delay_$s=34)?S lcd_c"d=)-3)?S _delay_$s=34)?S lcd_c"d=)-)4?S _delay_$s=34)?S GGentry "ode W incre"ent GGc$rsor "ove 1 shift left GGset ;,+it "ode and ( lines d L-K GG ena+le ; +it "ode GG %ait after po%er $p GG send )9h 9 ti"es to initiali&e

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 40

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

lcd_c"d=)-)5?S _delay_$s=34)?S lcd_c"d=)-)3?S _delay_"s=(?S c void lcd_en_tgl =void? ` PORT aW=3NNEB?S PORT 1Wb=3NNEB?S c void lcd_c"d=$nsigned char letter? ` GG 5o""and :$nction GGThe RS is set to ) to signify this is a co""and $nsigned char te"pS te"pWletterS te"pWte"pQQ;S lcd_ni++le=te"p0)?S te"pWletterS te"pWte"p1)-):S lcd_ni++le=te"p0)?S _delay_$s=3)?S c void lcd_char=$nsigned char letter?
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

GGdisplay on , c$rsor +link on

GGclear display ra"

GGEna+le pin

GG te"p Varia+le GG"ove letter to te"p GGshift te"p to right +y ; GGsend o$t higher ni++le GG"ove letter to te"p GGsend o$t lo%er ni++le

Page 41

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

` GGT ata :$nction GGThe RS is set to 3 to signify this is a co""and $nsigned char te"pS te"pWletterS te"pWte"pQQ;S lcd_ni++le=te"p03?S te"pWletterS te"pWte"p1)-):S lcd_ni++le=te"p03?S _delay_$s=3)?S c void lcd_ni++le=$nsigned char ni+0$nsigned char reg_sel? ` if=reg_sel? PORT aW=3NNRS?S else PORT 1Wb=3NNRS?S ni+W=ni+NN;?S PORT5Wni+S _delay_$s=L?S lcd_en_tgl=?S R6_'B'T=?S %hile=+it_is_set=P'B50K??S lcd_config=?S c
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

GG te"p Varia+le GG"ove letter to te"p GGshift te"p to right +y ; GGsend o$t higher ni++le GG"ove letter to te"p GGsend o$t lo%er ni++le

GG Set RS Pin =defined in header file?

GG Toggle E pin =defined in header file? GG+$sy check GGreconfig$re lcd iGo pins

Page 42

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

void lcd_clr_line=$nsigned char line? ` GG clear line co""and! char tlineS char -S if=lineWW3? tlineW)-<)S if=lineWW(? tlineW)-5)S lcd_c"d=tline?S _delay_$s=34)?S for=-W)-))S-N)-3;S-UU? ` tho 34 are vie%a+le? lcd_char=)-()?S _delay_$s=34)?S c lcd_c"d=tline?S _delay_$s=34)?S c void lcd_string=$nsigned char esenpoint0 $nsigned char line? ` if=lineWW3? lcd_c"d=line3?S if=lineWW(?
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

GG The line to clear varia+le GG loop varia+le GG Set the varia+le val$e +ased on line GG 3 W 2ine 3 GG ( W 2ine ( GG Send co""and to j$"p to +eggining of line =3G(?

GG 2oop thro$gh all () chars of line =even GG Send Blank 5haracter

GG 7o +ack to +eggining of line

Page 43

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

lcd_c"d=line(?S %hile=esenpoint fW VH)V? ` lcd_char=esenpoint?S senpointUUS c c lcd_position_char=$nsigned char esenpoint0$nsigned char line0$nsigned char position? ` $nsigned char posS posWpositionS lcd_c"d=)-)9?S position if=lineWW3? lcd_c"d=line3?S if=lineWW(? lcd_c"d=line(?S %hile=posfW)? and last position is 3L ` lcd_c"d=)-3;?S pos,,S c %hile=esenpointfWVH)V? ` lcd_char=esenpoint?S senpointUUS c c
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

GG 6hile %e havent seen a H) =esc? go on GG Send 3st char to o$r char f$nction GG Send ne-t

GGret$rn

c$rsor

to

ho"e

GGfirst position or ho"e position is )

GG"ove to right

GG send the character to +e displayed

Page 44

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

^endif

6.2 E+* B)i =


^incl$de NavrHio!hQ ^incl$de N$tilHdelay!hQ ^incl$de Alcd!hA ^incl$de NavrHinterr$pt!hQ

^define :_5PU 3))))))U2 void inco"ing=void?S void o$tgoing=void?S static $nsigned char +$fferX34YS $nsigned char co$ntW)0hiW)0+iW)S int "ain =void? ` RA aW )-f)S PORTA W )-))S lcd_init =?S lcd_clr_line =3?S lcd_clr_line =(?S lcd_string =AAccident Prevention A03?S lcd_string =A Using A0(?S _delay_"s =()))?S
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 45

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

lcd_clr_line =3?S lcd_clr_line =(?S lcd_string =A Eye Blink Sensor _delay_"s =()))?S %hile =3? ` lcd_clr_line =3?S lcd_clr_line =(?S lcd_string =A Eye Blink Sensor A03?S lcd_string =A /onitoring if=+it_is_clear=P'BA0)?? ` lcd_string =A:irst 6arning lcd_string =A Scan _delay_"s=9)))?S if=+it_is_clear=P'BA0)?? ` %hile=3? ` lcd_string =A 6arning A03?S lcd_string =A Sleepy State A0(?S PORTA aW=3NN;?S c c c c ret$rn )S
epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

A03?S

A0(?S

A03?S

A0(?S

Page 46

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

CHAPTER 6 CONCLUSION
The further development of the visual driver monitoring system will be the improvement of the operating speed. Another idea is to include a separating part which will reduce the amount of processed data. Because our main measures are located to the eye regions we can train a classi_er directly for eye detection. The used face detection classi_er is trained for faces looking straight forward into the camera so our experimental results can be improved if we use a classi_er which is trained for pro_le images from faces. Another possible expansion could be the use of a stereo camera system, the Open ! library from "ntel and the #irect$how platform from %icrosoft are pre& pared for the use of two cameras. Our night vision experiments are at the beginning and we achieved auspicious results.

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 47

A Project Report On Vehicle Accident Prevention Using Eye Blink Sensor

RE2ERANCES
3! I$n /i$ra0 /otok$ni 'toh and ]oshiaki Shirai0 [To%ard Vision,Based 'ntelligent BavigatorC 'ts 5oncept and Prototype0\ 'EEE Transactions on 'ntelligent Transportation Syste"s0 vol! 90 no!(0 pp! 394,3;40 I$ne! ())(! (! I! 2y&nicki0 et al! [Sleepiness0 riving0 and /otor vehicle 5rashes0\ IA/A0 vol! (K@0 no! (90 3@@<0 pp 3@)<,3@39! 9! /! Berto&&i et al! [Stereo Vision,Based Vehicle etection0\ Proceedings of 'ntelligent Vehicles Sy"posi$"0 ear+orn0 /'0 ()))0 pp! 9@,;;! ;! .! I$la0 E! B! Fos"atopo$los0 and P! A! 'oanno$0 [5ollision Avoidance Analysis for 2ane 5hanging and /erging0\ 'EEE Transactions on Vehic$lar Technolog0 Vol! ;@0 Bo! 40 pp ((@L,(9)<0 Bov! ()))

epart"ent Of Electronics 1 Teleco""$nication Engineering r! Ba+asahe+ A"+edkar Technological University0 2onere!

Page 48

You might also like