You are on page 1of 25

Vehicle Collision Avoidance System

by Alan Bull and Ta-Mao Hwang ECE 345 Senior Deign TA: Shao Hsia 5 ! "##! $ro%e&' (!)

Abstract
The *ur*ose o+ 'his *a*er is 'o *resen' 'he design *ro&ess used in ,a-ing a .ehi&le &ollision a.oidan&e sys'e,/ 0e will gi.e design de'ails and show a s'e*-by-s'e* *ro&edure o+ how 'he +inal *rodu&' was designed1 *rodu&ed and 'es'ed/ The *ro%e&'2s ,ain goal is 'o aler' a dri.er when his or her .ehi&le &o,es 'oo &lose 'o ano'her ob%e&' or when 'he ob%e&' is a**roa&hing a' a high ra'e o+ s*eed/ An 3CD dis*lay shows 'he dis'an&e be'ween 'he .ehi&le and 'he +oreign ob%e&'/ The *ro%e&' has 'he abili'y 'o ,odi+y dis'an&e &al&ula'ions based on 'he a,bien' 'e,*era'ure/ Many o+ 'he &hallenges 'ha' arose while wor-ing on 'his *ro%e&' will be dis&ussed1 as will 'he s*e&i+i&s o+ 'he Basi& S'a,* 44 ,i&ro&on'roller1 our &ir&ui' design1 and 'he ul'rasoni& sensors used/

ii

Table of Contents
!/ $age 4n'rodu&'ion555/55555555555555555555555/5! !/! 6un&'ionali'y and blo&- diagra,5555/5555555555555//! !/" $er+or,an&e .ariables and s*e&i+i&a'ions55555555555555//! !/3 Ma%or Design Co,*onen's55555555555555555555! "/ Design $ro&edure55555555555555555555555/553 "/! Sensors5555555555///555555555555555553 "/" Cir&ui's555555555555555555555555555///3 "/3 BS44 Mi&ro&on'roller5555555555555555555555//3 "/4 7ser 4n'er+a&e5555555555555555555555555/4 3/ Design De'ails55555555555555555555555555//8 3/! Sensors555555555555555555555555555///8 3/" 9s&illa'or5555555555555555555555555558 3/3 Trans,i''er55555555555555555555555555/8 3/4 :e&ei.er555555555555555555555555555//8 3/5 ;ol'age5555555555555555555555555555< 3/) Te,*era'ure Sensor Cir&ui'55555555555555555555< 3/8 7ser 4n'er+a&e5555555555555555555555555//< 3/< BAS4C S'a,* 44555555555555555555555555///= 4/ Design ;eri+i&a'ion555555555555555555555555!! 4/! Sensor ;eri+i&a'ion5555555555555555555555//!! 4/" Cir&ui' ;eri+i&a'ion5555555555555555555555//!! 4/3 En'ire $ro%e&' ;eri+i&a'ion5555555555555555555///!! 5/ Cos's55555555555555555555555555555///!3 5/! 3abor5555555555555555555555555555!3 5/" $ar's and Su**lies55555555555555555555555!3 5/3 To'al Cos'55555555555555555555555555/!3 )/ Con&lusions55555555555555555555555555////!4

A**endi> !555555555555555555555555555555!5

iii

1. Introduction
1.1 Functionality and block diagram 6igure !/! shows 'he blo&- diagra, o+ 'he .ehi&le &ollision a.oidan&e sys'e, and 'he +ollowing is a brie+ des&ri*'ion o+ 'he +low o+ 'his design/ 6igure !/! &an be +ound a' 'he end o+ 'he &ha*'er/ !/ A,bien' 'e,*era'ure is 'a-en by 'e,* *robe and sen' 'o 'he ,i&ro&on'roller ?Basi& S'a,* 44@ whi&h uses 'he in+or,a'ion 'o &al&ula'e 'he s*eed o+ sound "/ The BS44 ini'ialiAes 'he 3CD dis*lay ?whi&h 'a-es abou' ! se&ond@/ 3/ BS44 'ells 'he 'rans,i''er &ir&ui' when 'o send ou' a 4#-HA signal1 *rodu&ed by 'he 4#-HA os&illa'or1 'hrough 'he 'rans,i''er &ir&ui'1 'o dri.e 'he sensors a' 'he a**ro*ria'e +reBuen&y/ 4/ 0hen 'rans,i''er sends 'he *ulse1 'he BS44 s'ar's 'i,ing/ 5/ 0hen 'he *ulse is re&ei.ed1 i' is a,*li+ied 'hrough logi& &ir&ui'ry and sen' 'o 'he BS441 a' whi&h *oin' 'he 'i,ing s'o*s/ )/ BS44 'hen &al&ula'es 'he dis'an&e based on 'he Ti,e o+ 6ligh' ?T96@ and 'he .elo&i'y o+ 'he a**roa&hing ob%e&'/ 8/ :esul's are dis*layed on 'he 3CD and 'he s*ea-er sounds a warning 'one i+ 'he ob%e&' is wi'hin 'he s*e&i+ied dis'an&e ?rear@ or 'he s*e&i+ied a**roa&h s*eed ?+ron'@/ </ $ro&ess re*ea's 1.2 erformance Variables and S!ecifications Se.eral .ariables *er'ain 'o 'he *er+or,an&e o+ 'his *ro%e&'/ They are 'he s*eed a' whi&h sound 'ra.els1 'he dis'an&e +ro, 'he sensors 'o 'he ob%e&'1 'he ob%e&'2s abili'y 'o re+le&' sound1 and 'he 'i,e i' 'a-es 'he BS44 'o &al&ula'e and dis*lay all in+or,a'ion/ The s*eed a' whi&h sound 'ra.els is .aried based on 'he a,bien' 'e,*era'ure1 a&&ording 'o 'he +ollowing eBua'ion: Temp K ?eBua'ion !/!@/ S*eed &ould also .ary based on hu,idi'y and Velocity = 3"#m s C "83 o'her e>'ernal +a&'orsD howe.er 'hey ha.e a .ery li,i'ed e++e&' on 'he s*eed1 and sin&e 'he BS44 doesn2' ,a-e +loa'ing *oin' &al&ula'ions ?i' is only able 'o do in'eger ,a'h@1 'hese would no' &hange 'he &al&ula'ed s*eed o+ sound/ The dis'an&e +ro, 'he sensor 'o 'he ob%e&' is 'he ,os' i,*or'an' .ariable1 and is wha' our *ro%e&' was designed 'o as&er'ain/ The range a' whi&h we were able 'o ge' reasonable resul's was 8&,-"5#&,/ The 'i,e i' 'a-es 'he BS44 'o &al&ula'e and dis*lay da'a was .ery ,ini,al and had no e++e&' on our &al&ula'ed dis'an&e and resolu'ion/ The ob%e&'2s abili'y 'o re+le&' sound was no'i&ed when we 'es'ed .arious ob%e&'s and in one &ase go' di++ering resul's/ 0e +ound 'ha' our *ro%e&' wor-ed bes' wi'h ,e'al ob%e&'s1 'ha' *las'i& and wood ob%e&'s were .ery &lose 'o ,e'al1 and 'ha' a&&ura&y was wors' wi'h hu,an beings/ 1." #a$or %esign Com!onents There are +our ,a%or design &o,*onen's used in 'his *ro%e&'/ They are 'he sensors1 'he &ir&ui's1 'he BS44 ,i&ro&on'roller1 and 'he user in'er+a&e/ The user in'er+a&e &onsis's o+ an 3CD dis*lay and an audio warning/ There are +i.e di++eren' &ir&ui's used1 'he .ol'age regula'ion &ir&ui'1 'he 'e,*era'ure sensor &ir&ui'1 'he 4#-HA os&illa'or &ir&ui'1 'he 'rans,i''er &ir&ui'1 and 'he re&ei.er &ir&ui'/ Mu:a'a Ele&'roni&s dona'ed 'he sensors +or 'his *ro%e&'/ They are 'he MA4#B<: S/ A da'a shee' abou' 'he sensors &an be +ound a' h''*: www/,ura'a/&o, ,ura'a weblibrary/ns+ *d+ &!< E+ile ,a4#/*d+/ The BS44 was 'he las' ,a%or &o,*onen' o+ 'he *ro%e&' 'ha' we had 'o de.elo*/ 4' was si,*ly a ,a''er o+ wri'ing &ode 'o

,a-e sure i' did wha' we wan'ed i' 'o/ 4n+or,a'ion abou' 'he BS44 &an be +ound a' h''*: www/*aralla>in&/&o, /

Ultrasonic Transmit

!ront

Ultrasonic Receive

Receiver Signal Conditioning

peration Mode Inp"ts

Transmitter Amplifier

40kHz scillator

BASIC Stamp II Microcontroller

#$%& 'C( (ispla) "tp"t

Speaker "tp"t

Receiver Signal Conditioning A*(

Ultrasonic Transmit

Rear

Ultrasonic Receive

Temp Sensor

6igure !/!/ Blo&- Diagra, o+ ;ehi&le Collision A.oidan&e Sys'e,

"

2. %esign rocedure
2.1 Sensors 0e &hoose 'o use ul'rasoni& sensors al'hough ,any 'y*es o+ sensors are a.ailable 'ha' would do 'he -ind o+ de'e&'ion 'ha' we need/ 9'her 'y*es o+ sensors 'ha' we &ould ha.e used in in&lude laser and in+rared sensors/ The ,ain reason 'ha' we &hoose ul'rasoni& sensors is 'ha' 'hey are .ery &hea* in &o,*arison 'o o'her sensors on 'he ,ar-e'/ 9'her reasons +or using ul'rasoni& sensors were 'ha' 'hey ha.e a +airly good range ?u* 'o "/5, +or us@1 'hey wor- in a wide .arie'y o+ &ondi'ions1 and 'hey are +airly a&&ura'e ?we were able 'o ge' !&, o+ resolu'ion +ro, our *ro%e&'@/ 6igure "/!1 +ound a' 'he end o+ 'his &ha*'er1 shows 'he sensors we used/ The sensors 'ha' we used were +ro, Mu:a'a Ele&'roni&s and &a,e as a 'rans,i''er re&ei.er *air 'ha' needed 'o be dri.en a' 4#-HA/ 0e also 'es'ed so,e sensors +ro, Fa,eCo Ele&'roni&sD howe.er1 'hey did no' wor- as well as 'he o'hers/ 4n+or,a'ion abou' 'he Fa,eCo sensors &an be +ound a' h''*: %a,e&o/&o, Fa,e&o $rodu&'s $rodDS !3))53/$D6/ The sensors we used were .ery sensi'i.e 'o +reBuen&y1 i+ we were ,ore 'han 5 HA o++1 no signal would be de'e&'ed/ 6or 'his reason we had 'o de.elo* a 4#-HA os&illa'or &ir&ui'1 be&ause 'he BS44 &ould no' *rodu&e 'his e>a&' +reBuen&y/ $lease see se&'ion "/" +or in+or,a'ion abou' &ir&ui's/ 2.2 Circuits As ,en'ioned in 'he in'rodu&'ion1 we de.elo*ed +i.e di++eren' &ir&ui's +or 'his *ro%e&'/ They were 'he 'e,*era'ure sensor &ir&ui'1 'he re&ei.er &ir&ui'1 'he 'rans,i''er &ir&ui'1 'he 4#-HA os&illa'or &ir&ui'1 and .arious .ol'age regula'ion &ir&ui's/ All 'hese &ir&ui's will be dis&ussed in ,ore de'ail in &ha*'er 'hree/ Three .ol'age regula'ion &ir&ui's were used/ 9ne was used 'o &on.er' !"-.ol' 'o 5-.ol'/ This is ne&essary be&ause a &ar ba''ery is !" .ol's1 bu' ,os' o+ 'he logi& 'ha' we used needed 5-.ol's 'o o*era'e/ The se&ond .ol'age regula'ion &ir&ui' 'ha' we used was +or 'he &o,*ara'or 'ha' was used in 'he 'rans,i''er &ir&ui'/ 0e %us' needed 'his &ir&ui' 'o *rodu&e a "/5-.ol' re+eren&e signal so we &ould ge' a logi& ou'*u' +ro, 'he 'rans,i''er/ The +inal .ol'age regula'ion &ir&ui' 'ha' we designed was +or 'he re&ei.er &ir&ui'/ 4' was ne&essary 'o ,a-e 'his a de&aying .ol'age 'o 'ry 'o eli,ina'e &ross'al- be'ween 'he 'rans,i''er and re&ei.er when a *ulse is +irs' sen' ou'/ The 'e,*era'ure sensor &ir&ui' was designed 'o 'a-e 'he a,bien' 'e,*era'ure a' whi&h 'he sensors were o*era'ing and send i' 'o an A D/ The A D &on.er's 'he 'e,*era'ure sensor reading 'o binary .alues 'ha' &an be read by 'he BS44/ The os&illa'or &ir&ui' was used 'o dri.e 'he sensors a' 'he desired +reBuen&y o+ 4# -HA/ 4' ou'*u's a 5 ; *ea--*ea- sBuare wa.e 'ha' is used by 'he 'rans,i''er &ir&ui'/ The 'rans,i''er &ir&ui' was used 'o send ou' an ul'rasoni& *ulse 'ha' is re+le&'ed by 'he ob%e&' ba&- 'o 'he re&ei.er/ The 'rans,i''er &ir&ui' &onsis's o+ a .ol'age &o,*ara'or 'ha' ser.es 'o a,*li+y 'he sBuare wa.e +ro, 'he os&illa'or &ir&ui'/ This is ne&essary 'o ge' a s'rong signal and 'here+ore i,*ro.e 'he range a' whi&h we &an sense ob%e&'s/ The re&ei.er &ir&ui' re&ei.es 'he e&ho +ro, 'he 'rans,i''ed *ulse/ 4' 'hen a,*li+ies 'he signal and &o,*ares i' 'o a re+eren&e .ol'age/ The &o,*ara'or ou'*u's a TT3 &o,*a'ible signal 'ha' is used by 'he BS44/ 2." &SII #icrocontroller 3

0e de&ided 'o use 'he BS44 ,i&ro&on'roller +or one ,ain reason1 i's ease o+ use/ Al'hough 'he Mo'orola HC!" has a lo' ,ore &a*abili'ies1 we +el' 'ha' we &ould do e.ery'hing we needed wi'h 'he BS44 and saw no reason 'o add ano'her le.el o+ &o,*le>i'y 'o our *ro%e&'/ The BS44 &on'rols all 'he logi&al o*era'ions o+ our design as well as 'he user in'er+a&e/ 6igure "/" shows 'he o*era'ion +low o+ 'he BS44/ This +igure &an be +ound a' 'he end o+ 'he &ha*'er/ The +ollowing is a brie+ des&ri*'ion o+ 'his +low&har'/ !/ The 3CD is ini'ialiAed ?'a-es abou' ! se&ond@/ "/ The a,bien' 'e,*era'ure is 'a-en/ 3/ 7ser de&ides wea'her 'o dis*lay 'e,*era'ure or dis'an&e/ 4+ 'e,*era'ure is &hosen1 'his in+or,a'ion is sen' 'o 'he user in'er+a&e1 'hen loo*s 'o s'e* 'wo/ 4/ 0hen dis'an&e ,ode is sele&'ed1 'he user ne>' has 'o de&ide whe'her 'o 'a-e readings +ro, 'he +ron' or rear sensors/ 5/ A 4# -HA *ulse is 'rans,i''ed/ )/ The e&ho is re&ei.ed 8/ Dis'an&e is &al&ula'ed based on 'he 'i,e o+ +ligh'/ </ Dis'an&e and .elo&i'y in+or,a'ion are sen' 'o 'he user in'er+a&e/ =/ $rogra, loo*s ba&- 'o s'e* 'wo/ 2.' (ser Interface The user in'er+a&e &onsis's o+ an 3CD dis*lay and an audio aler'/ Bo'h are &on'rolled by 'he BS44/ 0e de&ided 'o use an 3CD so 'ha' 'he user &an de'er,ine 'he e>a&' dis'an&e 'ha' s he is away +ro, 'he ob%e&'/ 0e &onsidered using 3EDs o+ di++ering &olors +or .arious dis'an&es bu' de&ided 'ha' i' would be be''er +or 'he user 'o be able 'o 'ell 'he e>a&' dis'an&e hersel+/ The audio aler' sounds when 'he ob%e&' is a**roa&hing a' a ra*id ra'e +ro, 'he +ron'1 or i+ 'he ob%e&' is wi'h !5&, in 'he rear/ 0e +el' 'ha' a user &ould 'ell how +ar an ob%e&' was away +ro, 'he, in 'he +ron'/ 4' is1 howe.er1 i,*era'i.e 'ha' users -now whe'her or no' an ob%e&' is a**roa&hing a' a high ra'e o+ .elo&i'y +ro, 'he +ron' so 'hey &an ,a-e 'he ne&essary dri.ing ad%us',en's/ Howe.er1 i' is ,u&h ,ore unli-ely 'ha' dri.ers will see ob%e&'s a' 'he rear o+ 'he .ehi&le1 whi&h is why 'he audio aler' goes o++ a' a s*e&i+ied dis'an&e in 'he rear/

6igure "/!/ Sensors ?le+' are Fa,eCo sensors1 righ' are Mu:a'a sensors@

Intialize 'C(

Take temperat"re reading

(ecide temperat"re mode or distance mode

(ecide front or rear sensors

Send 40kHz p"lse

Receive +c,o

Calc"late distance from T !

(ispla) information

6igure "/"/ Mi&ro&on'roller 6low Char'

". %esign %etails


".1 Sensors The sensors are +airly easy 'o use/ The only reBuire,en' is 'ha' 'he 'rans,i''er ,us' re&ei.e a 4#-HA signal in order 'o 'rans,i'/ Al'hough sligh' .aria'ions in +reBuen&y are allowed1 'hey &an degrade sensor *er+or,an&e/ The da'ashee' ?h''*: www/,ura'a/&o, ,ura'a weblibrary/ns+ *d+ &!< E+ile ,a4#/*d+@ s*e&i+ies 'ha' 'he signal &an ha.e a ,a>i,u, *ea--'o-*ea- .ol'age o+ 4#;/ ".2 )scillator The 4#-HA os&illa'or &onsis's o+ a 3M555 'i,er 4C and 'he ne&essary resis'ors and &a*a&i'ors/ The &ir&ui' used is sugges'ed by Ga'ional Se,i&ondu&'ors in 'he 3M555 da'ashee' a' h''*: www/na'ional/&o, ds 3M 3M555/*d+/ The 3M555 is &on+igured +or s'able o*era'ion in our i,*le,en'a'ion1 whi&h ,eans i' will send ou' a &on'inuous os&illa'ion/ A&&ording 'o *age < o+ 'he da'ashee'1 'he resis'or and &a*a&i'or .alues &an be &al&ula'ed +or a &er'ain +reBuen&y/ The eBua'ion is
f = !/44 ?eBua'ion 3/!@ ? R a + " Rb @ C C

The &o,*le'e &ir&ui' diagra, is shown in A**endi> 4 +igure A!/!/ "." Transmitter The 'rans,i''er &ir&ui' &onsis's o+ a DM84#< AGD ga'e and a 36358 o*-a,*/ The *ur*ose o+ 'he AGD ga'e is 'o a&' as a swi'&h +or a&'i.a'ing 'he 'rans,i''er/ 9ne in*u' o+ 'he AGD ga'e is &onne&'ed 'o 'he BS44 while 'he o'her is &onne&'ed 'o 'he ou'*u' o+ 'he os&illa'or/ Thus 'he 4#-HA sBuare wa.e genera'ed by 'he os&illa'or will no' a&'i.a'e 'he 'rans,i''er &ir&ui' unless ins'ru&'ed 'o do so by 'he BS44/ The ne>' &o,*onen' o+ 'he 'rans,i''er &ir&ui' is 'he 36358 o*-a,*/ 4's ,ain +un&'ion is 'o a&' as a &o,*ara'or/ The 36358 is *owered by a !"; s*li' .ol'age su**ly/ The 363582s *osi'i.e in*u' is &onne&'ed 'o 'he ou'*u' o+ 'he AGD ga'e and i's nega'i.e in*u' is &onne&'ed 'o 'he "/5; re+eren&e .ol'age/ The .ol'age +ro, 'he AGD ga'e ou'*u' is 'hen &o,*ared wi'h 'he re+eren&e .ol'age/ 4+ 'he .ol'age o+ 'he AGD ga'e is higher 'han 'he re+eren&e ?5; *ea- o+ sBuare wa.e@ 'hen 'he ou'*u' o+ 'he 36358 will swing 'owards 'he *osi'i.e su**ly ?H!";@/ 4+ 'he *osi'i.e in*u' is lower 'han 'he re+eren&e ?#; o+ sBuare wa.e@ 'hen 'he o*-a,* ou'*u' will swing 'owards 'he nega'i.e su**ly ?-!";@/ This in e++e&' a,*li+ies 'he original TT3 sBuare wa.e 'o a "#;** sBuare wa.e/ The 36358 was sele&'ed be&ause i' *ro.ides a .ery high slew ra'e1 whi&h is i,*or'an' in genera'ing a signal wi'h large *ea--'o-*ea- .ol'ages/ The 'rans,i''er &ir&ui' and i's ou'*u' are shown in A**endi> 4 +igures A!/" and A!/3/ ".' *eceiver The re&ei.er signal &ondi'ioning &ir&ui' &onsis's o+ an a,*li+ier and a &o,*ara'or/ The a,*li+ier &onsis's o+ a 3M35< o*-a,*/ The AC a,*li+ier &ir&ui' is si,ilar 'o 'he one sugges'ed in 'he 3M35< da'ashee' a' h''*: www/na'ional/&o, ds 3M 3M35</*d+/ The nega'i.e in*u' is &onne&'ed 'o a "/5; re+eren&e/ This ser.es 'o in'rodu&e a DC &o,*onen' 'o 'he re&ei.ed signal 8

and &en'er i' a' "/5;/ The *osi'i.e in*u' is &onne&'ed 'o 'he ul'rasoni& re&ei.er 'ransdu&er/ The ou'*u' o+ 'he 'ransdu&er is essen'ially a 4#-HA sine wa.e wi'h ,a>i,u, a,*li'udes o+ u* 'o 3##,;/ This AC signal is a,*li+ied by 'he o*-a,* wi'h a gain o+ !#!/ Thus 'he ou'*u' o+ 'he a,*li+ier &ir&ui' will be a sine wa.e &en'ered a' "/5;/ The ou'*u' o+ 'he a,*li+ier was &onne&'ed 'o 'he *osi'i.e in*u' o+ 'he &o,*ara'or1 a 3M3=3/ The 3M3=3 is &hosen be&ause i' is &a*able o+ ou'*u''ing TT3 &o,*a'ible signals/ The o*era'ion o+ 'he &o,*ara'or is si,ilar 'o 'ha' o+ 'he one des&ribed in 'he 'rans,i''er &ir&ui'/ The di++eren&e is 'ha' ins'ead o+ a&'ing as an a,*li+ier1 'he &o,*ara'or will genera'e a TT3 &o,*a'ible signal &a*able o+ being read by 'he BS44/ The &ir&ui' and wa.e+or,s are shown in A**endi> 4 +igures A!/41 A!/51 and A!/)/ ".+ Voltage There are 'hree -ey .ol'ages genera'ed in 'his design/ The +irs' is a H5; used 'o *ower logi& de.i&es/ This .ol'age is genera'ed using a .ol'age regula'or1 'he MC8<#51 whi&h 'a-es in 'he !"; su**ly .ol'age and regula'es i' 'o 5;/ Two re+eren&e .ol'ages are genera'ed +ro, 'he 5;/ The +irs' is a "/5; re+eren&e .ol'age genera'ed si,*ly by using a .ol'age di.ider/ This .ol'age is used in 'he 'rans,i''er and re&ei.er &ir&ui's des&ribed abo.e/ The se&ond re+eren&e .ol'age is 'he de&ay re+eren&e used by 'he &o,*ara'or in 'he re&ei.er &ir&ui'/ The *ur*ose o+ 'he de&ay re+eren&e is 'o eli,ina'e 'he &ross'al- e++e&' be'ween 'he sensor *airs/ The re&ei.er ,igh' inad.er'en'ly *i&-u* *ulses dire&'ly +ro, 'he 'rans,i''er ins'ead o+ de'e&'ing an e&ho when 'he 'rans,i''er is sending *ulses/ There+ore when 'he 'rans,i''er sends a *ulse 'he *ulse .ol'age also &harges 'he &a*a&i'or in 'he de&ay .ol'age &ir&ui'1 whi&h raises 'he .ol'age ou'*u' o+ 'he re+eren&e ,u&h higher 'han "/5;/ 9n&e 'he *ulse ends 'he ou'*u' will slowly de&ay 'o "/5; as 'he &a*a&i'or dis&harges/ By raising 'he re+eren&e .ol'age 'o 'he &o,*ara'or we &an in e++e&' blan- ou' 'he re&ei.e signals +or a shor' *eriod o+ 'i,e/ Co,*aring +igures A!/5 and A!/< shows 'he blan-ing e++e&'/ 4n 'his design 'he blan-ing signal las's +or abou' ",s be+ore de&aying down 'o "/5;/ This &orres*onds 'o 'he 'i,e o+ +ligh' o+ abou' 8&,1 whi&h is our ,ini,u, range/ The &ir&ui's +or genera'ing 'hese .ol'ages are shown in A**endi> 4 +igure A!/8/ The de&ay .ol'age is shown in A!/</ "., Tem!erature Sensor Circuit The 'e,*era'ure &ir&ui' &onsis's ,ainly o+ a 3M335 'e,*era'ure sensor and an ADC#<3! A D &on.er'er/ The 3M335 'e,*era'ure sensor is &a*able o+ de'e&'ing 'e,*era'ure in 'he 4#C 'o H!##C range/ 4' is essen'ially a Aener diode wi'h a brea-down .ol'age 'ha' &orres*onds 'o 'he 'e,*era'ure in degrees Iel.in/ Thus a .ol'age o+ 3/##; ,eans 'he 'e,*era'ure is a' 3##I1 or "8C/ A&&ording 'o 'he da'ashee' ?h''*: www/na'ional/&o, ds 3M 3M!35/*d+@ 'he 'e,*era'ure sensor is a&&ura'e 'o abou' !C wi'hou' any ad%us',en's and has !#,; .ol'age in&re,en's/ The .ol'age ou'*u' +ro, 'he 'e,*era'ure sensor is +ed in'o 'he analog in*u' o+ 'he A D &on.er'er/ The ADC#<3! is an <-bi' serial &on.er'er/ Thus i' is &a*able o+ "5) resolu'ions/ The .ol'age resolu'ion &an be de'er,ined by se''ing 'he re+eren&e .ol'ages/ 6or e>a,*le se''ing 'he re+eren&es a' H5; and ground will resul' in a resolu'ion o+ ?5-#@ "5) J #/!=5,;/ Sin&e 'he ,a>i,u, 'e,*era'ure sensor ou'*u' is around 3/83;1 'he u**er re+eren&e .ol'age is se' 'o 3/83; wi'h a *o'en'io,e'er/ This gi.es a resolu'ion o+ abou' !5,;/ <

The CS signal on 'he ADC is used 'o signal 'he ADC 'o begin and end &on.ersion/ The C3I signal is used +or &on'rolling 'he serial da'a ou'*u'/ These 'wo signals1 as well as 'he serial ou'*u'1 are &onne&'ed 'o 'he BS44/ 6or ,ore in+or,a'ion see 'he da'ashee' a' h''*: www/na'ional/&o, ds AD ADC#<3!/*d+/ The &ir&ui' is shown in A**endi> 4 +igure A!/

".- (ser Interface The user in'er+a&e &onsis's o+ D4$ swi'&hes1 an 3CD dis*lay1 and a s*ea-er/ The design is .ery s'raigh'+orward/ The D4$ swi'&hes are &onne&'ed dire&'ly 'o 'he BS44/ 0e did no' in&or*ora'e a deboun&ing &ir&ui' +or 'he swi'&hes sin&e we did no' no'i&e any ad.erse e++e&'s/ The 3CD dis*lay already in&or*ora'es a ,odule 'o *ro&ess and dis*lay 'he da'a/ Sin&e 'he ,odule re&ei.es da'a serially1 only one da'a line is needed 'o &onne&' 'he 3CD 'o 'he s'a,*/ Go e>'ernal &ir&ui's are needed e>&e*' +or 'he *ower and ground &onne&'ions/ The serial da'a 'rans+er will be des&ribed wi'h 'he BAS4C S'a,* &ode/ The s*ea-er is dri.en *assi.ely by 'he BS44/ The ou'*u' *in o+ 'he BS44 is &a*able o+ dire&'ly dri.ing a s,all s*ea-er/ A si,*le &ir&ui' +ound on *age !"4 o+ 'he BAS4C S'a,* 44 ,anual is used/ The BS44 is res*onsible +or genera'ing 'he sound wa.e 'one/ ".. &ASIC Stam! II The BAS4C S'a,* 44 ?BS44@ is res*onsible +or all o+ 'he logi&al o*era'ions/ The .arious 4 9 *or's are &onne&'ed 'o 'he 'rans,i''er &ir&ui'1 'he re&ei.er &ir&ui'1 'he 'e,*era'ure sensor &ir&ui'1 and 'he user in'er+a&e/ The BS44 is *rogra,,able 'hrough $aralla>2s de.elo*,en' en.iron,en' wi'h $BAS4C1 a .arian' o+ 'he BAS4C *rogra,,ing language/ The sour&e &ode +or 'he *rogra, is in&luded in A**endi> 4/ A' *ower-u*1 'he BS44 +irs' ini'ialiAes 'he .arious .ariables and &ons'an's and de+ine 4 9 *ins/ Then i' ini'ialiAes 'he 3CD dis*lay1 whi&h &an be done %us' on&e/ Co,,uni&a'ing wi'h 'he 3CD is e>'re,ely easy wi'h 'he SE:97T &o,,and1 whi&h 'a-es &are o+ 'he serial &o,,uni&a'ion/ Ge>' 'he *rogra, en'ers 'he ,ain loo*1 whi&h is res*onsible +or de'er,ining user de&isions and &alling 'he .arious subrou'ines/ The subrou'ines will be des&ribed in de'ail la'er/ The ,ain loo* +irs' &alls 'he 'e,*era'ure reading subrou'ine ?Te,*era'ure@1 whi&h de'er,ines 'he a,bien' 'e,*era'ure and s*eed o+ sound a' 'his 'e,*era'ure/ This &all is done a' 'he beginning o+ ea&h loo* be&ause 'he 'e,*era'ure reading is used by o'her +un&'ions in 'he *rogra,/ Ge>' 'he *rogra, reads 'he *in on 'he D4$ swi'&h ?*in!@ 'ha' de'er,ines whe'her 'he user wishes 'o see 'he &urren' 'e,*era'ure or see 'he dis'an&e dis*lay/ Here 'he *rogra, bran&hes in'o 'wo *a'hs/ 4+ 'he user wishes 'o see 'he 'e,*era'ure1 'he *rogra, &alls ShowTe,* and a+'er 'he subrou'ine &o,*le'es loo*s ba&- 'o 'he beginning o+ 'he ,ain loo*/ 9'herwise 'he *rogra, *ro&eeds 'o de'er,ine whe'her 'o dis*lay 'he +ron' or rear dis'an&e by reading ano'her D4$ swi'&h/ 9n&e 'he dire&'ion is es'ablished 'he *rogra, &alls $ing 'o &al&ula'e 'he dis'an&e1 Cal&;elo&i'y 'o +ind 'he rela'i.e ra'e o+ a**roa&h 'o an ob%e&'1 and Dis*lay 'o 'hese da'a on 'he 3CD/ 6inally 'he *rogra, loo*s ba&- 'o 'he beginning o+ 'he ,ain loo* and begins 'he &y&le again/ The Te,*era'ure subrou'ine a&&o,*lishes 'wo 'as-s: i' re&ei.es 'he 'e,*era'ure reading +ro, 'he 'e,*era'ure A D &on.er'er1 and i' &al&ula'es 'he s*eed o+ sound wi'h a' 'his 'e,*era'ure/ A serial 'rans+er is used 'o ge' 'he 'e,*era'ure reading +ro, 'he A D/ The A D is +irs' rese' by ,a-ing CS high/ Then CS is asser'ed low 'o ini'ia'e A D da'a a&Buisi'ion/ A series o+ *ulses 'o =

'he A D &lo&- *in is used 'o shi+' in 'he <-bi' binary .alue/ 9n&e 'he <-bi' .alue is ob'ained i' needs 'o be &on.er'ed sin&e 'he .alue is rela'i.e 'o 'he A D re+eren&es/ The 'e,*era'ure in degrees Iel.in &an be ob'ained by:
Tk = Vref ?,a>@ C ADCvalue ?eBua'ion 3/"@ "5)

The ShowTe,* subrou'ine ,erely &on.er's 'he 'e,*era'ure in'o degrees Cel&ius by sub'ra&'ing "83 and 'a-es in'o a&&oun' nega'i.e 'e,*era'ures/ Then i' dis*lays 'he 'e,*era'ure on 'he 3CD/ The $ing subrou'ine is res*onsible +or &o,,anding 'he 'rans,i''er &ir&ui' 'o send ou' a series o+ *ulses/ The $73S97T &o,,and allows abou' !) os&illa'ions +ro, 'he os&illa'or &ir&ui' 'o en'er 'he 'rans,i''er &ir&ui'/ A :CT4ME &o,,and is issued i,,edia'ely a+'er 'he *ulse is sen'/ :CT4ME ,easures 'he a,oun' o+ 'i,e i' 'a-es +or 'he re&ei.e e&ho *in 'o &hange s'a'e +ro, # 'o !/ 9n&e 'his 'i,e o+ +ligh' is &oun'ed1 'he dis'an&e &an be +ound by using 'he dist = velocity C time +or,ula/ Go'i&e how 'he +or,ula is ,odi+ied +or our i,*le,en'a'ion 'o a&&o,,oda'e 'he BS44/ S*eed is re*resen'ed as us &, be&ause :CT4ME re&ords 'i,e in "us &oun's/ The Cal&;elo&i'y subrou'ine si,*ly &o,*ares 'he &urren' dis'an&e wi'h a *re.ious dis'an&e and +inds 'he di++eren&e 'o a**ro>i,a'e a ra'e o+ a**roa&h 'o an obs'a&le/ The Dis*lay subrou'ine ou'*u's 'he dis'an&e as well as 'he a**ro>i,a'e ra'e o+ a**roa&h1 whi&h is re*resen'ed in bar gra*h +or,1 'o 'he 3CD dis*lay/ The dis*lay subrou'ine also de'er,ines whe'her 'here is a need 'o sound an audio warning/ 4+ +ron' sensors are used an audio warning is issued i+ 'he ra'e o+ a**roa&h 'o an ob%e&' is grea'/ 6or rear sensors 'he warning sounds i+ an ob%e&' is de'e&'ed wi'hin !5&,/ The Sound subrou'ine is &alled 'o dri.e 'he s*ea-er ou'*u'/

!#

'. %esign Verification


'.1 Sensor Verification To .eri+y 'ha' our sensors were wor-ing &orre&'ly1 we hoo-ed 'he 'rans,i''er u* 'o a +un&'ion genera'or and 'he re&ei.er 'o an os&illos&o*e 'o be sure 'ha' we were sending and re&ei.ing signals/ The Mu:a'a *ar's wor-ed wi'h ou' di++i&ul'y1 al'hough 'here was a li''le &ross'albe'ween 'he *air o+ de.i&es/ The Fa,eCo *ar's did no' wor- as well1 as 'here was a lo' o+ &ross'al-1 and ob%e&'s were hard 'o *i&--u*/ Bo'h *rodu&'s ga.e us .ol'ages in 'he range o+ 5#"5#,;/ 6or 'his reason1 we de&ided 'o use 'i,e-o+-+ligh' ?T96@ ins'ead o+ .ol'age 'o de'er,ine 'he dis'an&e o+ ob%e&'s/ To ,easure 'he T96 we had 'o use 'he BS441 so we were unable 'o 'es' 'his *ar' o+ 'he sensors wi'hou' 'he BS44/ '.2 Circuit Verification 0e 'es'ed ea&h o+ 'he +i.e &ir&ui's se*ara'ely 'o .eri+y 'ha' 'hey were wor-ing &orre&'ly be+ore we hoo-ed 'he, 'oge'her/ 6or 'he a,*li+ier &ir&ui's in 'he 'rans,i''er and re&ei.er1 we hoo-ed 'he in*u' u* 'o a &ons'an' .ol'age and 'hen hoo-ed 'he ou'*u' u* 'o an os&illos&o*e/ 0i'h 'he 'rans,i''er &ir&ui'1 we .eri+ied 'ha' we were sending ou' a "#-; *ea--*ea- signal so 'ha' we would re&ei.e a s'rong e&ho/ This was a,*li+ied +ro, 'he 5 ; *ea--*ea- 'ha' we were in*u''ing/ $lease see +igure A!/" in a**endi> !/ The re&ei.er &ir&ui' was 'es'ed in 'he sa,e ,anner 'o be sure 'ha' we were sending ou' a 5 ; sBuare wa.e 'ha' &ould be used by 'he BS44/ $lease see +igure A!/5 in a**endi> !/ To 'es' our .ol'age regula'ion &ir&ui's1 we used a .ery si,ilar *ro&ess/ 0i'h 'he re+eren&e .ol'age 'ha' was used +or 'he 'rans,i''er &ir&ui'1 we ,ade sure 'ha' 'he &ir&ui' was ou'*u''ing a &ons'an' "/5 ; signal 'ha' &ould be used by 'he &o,*ara'or/ The re+eren&e .ol'age 'ha' was used +or 'he re&ei.er &ir&ui' needed 'o be a de&aying re+eren&e .ol'age so 'ha' i' would hel* 'o eli,ina'e &ross'al-/ This was dis&ussed *re.iously in se&'ion +i.e o+ 'he design de'ails &ha*'er/ Also1 +igure A!/8 +ound in a**endi> ! shows 'he de&aying re+eren&e .ol'age/ 6or .eri+i&a'ion o+ our 'e,*era'ure sensor &ir&ui'1 we needed 'o hoo- i' u* 'o 'he BS44 so we &ould 'ell i+ i' was ou'*u''ing 'he &orre&' 'e,*era'ure/ The 'e,*era'ure sensor was dis&ussed in se&'ion si> o+ 'he design de'ails &ha*'er/ The 'e,*era'ure sensor was sur*risingly a&&ura'e and res*onded 'o 'e,*era'ure &hanges .ery Bui&-ly/ To 'es' our os&illa'or &ir&ui' we hoo-ed i' u* 'o an os&illos&o*e 'o be sure 'ha' i' was genera'ing a *ulse a' 4#-HA/ '." /ntire ro$ect Verification To .eri+y 'ha' our design was wor-ing as e>*e&'ed1 we 'es'ed 'he o.erall *ro%e&' on a .arie'y o+ di++eren' ,a'erials/ 4n&luded below in 'able 4/! and 4/" are 'he da'a 'ha' we re&orded +or ,e'al and *las'i& ob%e&'s/ 0hen we 'es'ed our *ro%e&' on wood1 we go' .ery si,ilar resul's 'o 'hose lis'ed below/ The only 'es's in whi&h we ob'ained di++eren' resul's were 'es's on hu,ans/ Be&ause &lo'hes si' a' .arying angles on a *erson2s body1 'hey 'end no' 'o re+le&' 'he sound wa.e ba&- 'o 'he re&ei.er as well as wi'h o'her ob%e&'s/ 6or 'his reason we were only abou' 'o ge' abou' one ,e'er o+ range when we 'es'ed on hu,ans/

!!

Table 4/!/ Measured dis'an&e &o,*ared 'o a&'ual dis'an&e using a ,e'al ob%e&' A&'ual Dis'an&e ?&,@ Measured Dis'an&e ?&,@ Error ?K@ 5# 48 ) !## =< " !5# !48 " "## !== #/5 "5# "48 !/" Table 4/"/ Measured dis'an&e &o,*ared 'o a&'ual dis'an&e using a *las'i& ob%e&' A&'ual Dis'an&e ?&,@ Measured Dis'an&e ?&,@ Error ?K@ 5# 48 ) !## =8 3 !5# !48 " "## !=< ! "5# "4= #/4 As &an be seen +ro, 'ables 4/! and 4/"1 bo'h *las'i& and ,e'al wor-ed .ery well a' re+le&'ing 'he ul'rasoni& wa.e ba&- 'o our re&ei.er/ 4' &an also be seen 'ha' 'he error *er&en'ages gradually de&reased1 al'hough 'he resolu'ion re,ained abou' 'he sa,e/ 0e 'ried 'o ge' an o++se' inside o+ 'he BS441 bu' 'hese .alues were 'he bes' 'ha' we &ould do/ So,e o+ 'he di++i&ul'ies *robably were &aused by all 'he rounding 'ha' 'he BS44 ,us' do be&ause i' does only in'eger ,a'h/ The &loses' we were able 'o ge' 'o 'he sensors and s'ill ge' a&&ura'e readings was abou' 8&,/ The reason +or 'his was dis&ussed in se&'ion eigh' o+ 'he design de'ails &ha*'er/

!"

+. Costs
+.1 0abor1 The &os' o+ labor +or bo'h *eo*le is: "C?E5#C<#C"/5@ J E"#1###/## +.2 arts and Su!!lies art 2 MC8<#5CT 3M335AH ADC#<3!CCG 335"0-!-!#3 MA4#:<S MA4#:<: 36358G 3M555G DM84#<-GD 3M35< 3M3=3G BS"-4C B$4-"!)G 5"-!"5 8)SB#4 D!G=!4 %escri!tion H5; .ol'age regula'or Te,*era'ure sensor 4C <-bi' A D &on.er'er $o'en'io,e'er !#I Mu:a'a ul'rasoni& sender Mu:a'a ul'rasoni& re&ei.er 9*-A,* 4C Ti,er 4C AGD La'e 4C Dual 9*-A,* 4C Co,*ara'or 4C $aralla> BAS4C S'a,* 44 ">!) 3CD dis*lay S*ea-er <-9h, D4$ Swi'&h 4-*osi'ions Diode Ca*a&i'or !#u6 Ca*a&i'or #/#!u6 Ca*a&i'or #/#!5u6 Ca*a&i'or #/33u6 Ca*a&i'or #/!u6 :esis'or !##I :esis'or 3I :esis'or !M :esis'or !#:esis'or !/":esis'or 33oh,s 3uantity ! ! ! 3 " " ! ! ! ! ! ! ! ! ! ! 3 !# ! ! ! 5 " ! ! " ! rice E#/3# E</!! E"/!8 E!/#" E5/") E5/") E!/)! E#/3" E!/#3 E#/3! E#/54 E4!/)5 E45/## E!/=3 E#/<< E#/!# E#/3< E#/!4 E#/!5 E#/!5 E#/!5 E#/#" E#/#" E#/#" E#/#" E#/#" E#/#5 Subtotal E#/3# E</!! E"/!8 E3/#) E!#/5" E!#/5" E!/)! E#/3" E!/#3 E#/3! E#/54 E4!/)5 E45/## E!/=3 E#/<< E#/!# E!/!4 E!/4# E#/!5 E#/!5 E#/!5 E#/!# E#/#4 E#/#" E#/#" E#/#4 E#/#5 E!3!/3!

Total
+." Total Cost 3aborH$ar's: E"#1###/##HE!3!/3! J E"#1!3!/3!

Total Cost 4 52671"1."1

!3

,. Conclusions
The .ehi&le &ollision a.oidan&e sys'e, is .ery use+ul in 'oday2s so&ie'y/ 4' ,a-es dri.ers ,ore aware o+ 'heir surroundingsD 'here+ore i' will be easier +or 'he, 'o a.oid &ollisions/ 0i'h *ar-ing lo's be&o,ing ,ore and ,ore &rowded and wi'h ,ore *eo*le dri.ing larger .ehi&les 'ha' are hard 'o ,aneu.er1 a de.i&e li-e 'his be&o,es al,os' essen'ial/ The i,*le,en'a'ion +or our *rodu&' was .ery su&&ess+ul1 wi'h no real *roble,s +ound/ 0e were able 'o i,*le,en' ea&h o+ 'he +our ,a%or sub*ro%e&'s wi'hou' 'oo ,u&h di++i&ul'y/ Changing 'he o++se' a li''le ,ore ,igh' allow us 'o ge' *er+e&' dis'an&e readings1 bu' being o++ only a &ou*le o+ &en'i,e'ers is no' o+ ,u&h &on&ern/ 4+ we were 'o *rodu&e 'his *rodu&' &o,,er&ially1 we would use a ,ore so*his'i&a'ed ,i&ro&on'roller 'ha' would allow us 'o eli,ina'e 'he rounding *roble,s and would 'here+ore ,a-e +or near *er+e&' dis'an&e readings/ Also1 we would ha.e 'o +ind and use lower &os' *ar's in order 'o ,a-e so,e'hing li-e 'his +easible +or a &o,*any 'o *rodu&e and 'o sell 'o a &ar ,anu+a&'urer/ 6or real world i,*le,en'a'ion o+ 'his de.i&e1 a +ew 'hings would need 'o be ironed ou'/ The +irs' *roble, is 'ha' we would need an array o+ sensors on bo'h 'he +ron' and 'he ba&- o+ 'he .ehi&le1 *ossibly on 'he &orners o+ 'he bu,*ers +or 'he *rodu&' 'o be +ully use+ul/ 4' ,ay also be ad.an'ageous 'o add sensors 'o 'he sides o+ 'he .ehi&le 'o allow +or de'e&'ion in 'hose dire&'ions/ 0e would also need 'o do 'es'ing wi'h 'he higher .elo&i'ies a' whi&h .ehi&les 'ra.el 'o be sure 'ha' 'he sensors &ould de'e&' 'he,/ The +inal 'hing 'ha' &ould be &onsidered +or real world i,*le,en'a'ion is 'o add an au'o,a'ed res*onse 'o 'he sys'e,/ 4+ 'he sensor saw 'ha' 'here would be a &ollision wi'hou' an i,,edia'e res*onse1 i' &ould a**ly 'he bra-es +or 'he user/ This ,igh' be hard 'o i,*le,en'1 bu' i' grea'ly in&reases sa+e'y in 'he .ehi&le1 whi&h &ould be a big selling *oin'1 es*e&ially 'o +a,ilies wi'h &hildren/

!4

A!!endi8 I

6igure A!/!/ 9s&illa'or Cir&ui'

6igure A!/"/ Trans,i''er Cir&ui'

!5

6igure A!/3/ Trans,i''er Cir&ui' 9u'*u'

6igure A!/4/ :e&ei.er Cir&ui'

!)

6igure A!/5/ :e&ei.er Cir&ui' A,*li+ier 9u'*u'

6igure A!/)/ :e&ei.er Cir&ui' Co,*ara'or 9u'*u' 'o BS44

!8

6igure A!/8/ :e+eren&e ;ol'ages 5;1 "/5; de&ay1 "/5;

6igure A!/</ "/5; De&ay :e+eren&e

6igure A!/=/ Te,*era'ure Sensor and A D Cir&ui'

!<

BS44 Code
' { $STAMP BS2 } ' ' ' ' ' ' ' ' ' ********** ultra.bs2 For use on Parallax BASIC Stamp II Ta-Mao !an"# Alan Bull $C$ %&' (n)*ers)t+ o, Ill)no)s at (rbana-C-ampa)"n T-)s pro"ram .r)*es t-e ultrason)/ trans.u/er transm)tter an. re/e)*er

' ********** ' PI0 Ass)"nments 1(TP(T 2 'PI02 output ,or 3C4 1(TP(T 5 'PI05 output ,or pulse I0P(T 2 'PI02 )nput ,ront e/-o I0P(T % 'PI0% )nput rear e/-o I0P(T & 'PI0& )nput ,or .)re/t)on sele/t)on 1(TP(T 6 'PI06 output ,or spea7er I0P(T 8 1(TP(T 9 'PI09 A4C CS 1(TP(T : 'PI0: A4C C3; I0P(T 52 'PI052 A4C 41(T I0P(T 5% 'PI05% )nput ,or soun. on<o,, I0P(T 5& 'PI05& )nput ,or mo.e sele/t)on ' ********** ' Constants 02&22 0&922 0:622 3PI0 C=>AM I C3> 3I0$5 3I0$2 35?C52 C10 32?C52 C10 @I4T MAABA> C10 F(3BA> C10 BASBA> C10 ' ********** ' Car)ables bars bal pa. balF /nt ro! /-ar >CP)n T)me 4)st Meter 4Meter CA> Soun.Spee. Celo/)t+ Pre*4)st TempIn CA> Temp; TempC 0 4ete/t CA> ' ********** ' Ma)n Pro"ram

C10 C10 C10 C10 C10 C10 C10 C10 C10 5%9 222 C10 @I4T % 2

56892 'Bau. rate ,or ser)al 3C4 .)spla+ 56'82 56&69 2 '3C4 ser)al output p)n 6& '3C4 /-ara/ter "enerat)on >AM a..ress 2'& '3C4 /omman. /-ara/ter 5 '3C4 /lear s/reen /omman. 529 5:2 '3C4 pla/e /ursor at l)ne 2 '3C4 pla/e /ursor at l)ne 5 /-ara/ter 6 '3C4 pla/e /ursor at l)ne 2 /-ara/ter 6 55 '3C4 bar "rap- max !).t* % 'MAABA> /ounts '3C4 bar "rap- BBB ASCII /-ara/ter '3C4 bar "rap- blan7 /-ara/ter

CA> CA> CA> CA> CA> CA> CA> CA> CA> CA> CA> BDT$ CA> CA> CA> @1>4 CA> CA> CA> BIT

BDT$ BDT$ BDT$ BIT bars bal pa. BDT$ @1>4 @1>4 BDT$ @1>4 @1>4 @1>4 'stores temperature )nput @1>4 'stores temperature )n ; @1>4 'stores temperature )n C BDT$ 'stores t)me /ounter *alue 'stores /al/ulate. .)stan/e *alue

!=

Ma)nE

'setup 3C4 .)spla+ PA(S$ 2222 S$>1(T 3PI0# 02&22# FI#C3>G =1S(B 3oa.B)tPats Pre*4)st H 2

Ma)n3oopE 4ete/t H 5 '"et temperature an. *elo/)t+ =1S(B Temperature '.eterm)ne mo.e IF I05& H 2 T $0 4)stMo.e =1S(B S-o!Temp =1T1 Ma)n3oop 4)stMo.eE '.eterm)ne !-et-er to use ,ront IF I0& H 5 T $0 P)n">ear S$>1(T 3PI0# 02&22# FI# 3I0$5G S$>1(T 3PI0# 02&22# FI4)stJFKE >CP)n H 2 =1T1 StartP)n" P)n">earE S$>1(T 3PI0# 02&22# FI# 3I0$5G S$>1(T 3PI0# 02&22# FI4)stJ>KE >CP)n H % StartP)n"E =1S(B P)n" IF >CP)n H % A04 4)st L 52 T $0 Cal/CelE =1S(B Cal/Celo/)t+ 'output to user )nter,a/e =1S(B 4)spla+ =1T1 Ma)n3oop ' ********** ' Subrout)nes ' P)n" ' - Sen.s out a pulse an. /ounts t)me ,or e/-o to return ' - /al/ulate .)stan/e ,rom measure. t)me an. spee. o, soun. P)n"E 31@ 6 'sen. pulse an. /ount t)me o, ,l)"-t P(3S1(T 5# 222 >CTIM$ >CP)n#2#T)me 4)stan/eE '/al/ulate .)stan/e 'spee. o, soun. at 22 .e" C H %&%m<s H %&%22/m<s H 2:us</m 'ta7e )nto a//ount roun.tr)p e/-o H '9us</m '!e /oul. "et a!a+ !)t- us)n" 2:us</m be/ause >CTIM$ store t)me )n 2us un)ts 4)st H T)me < Soun.Spee. 4)st H 4)st M 8 ',ormat .)stan/e Meter H 4)st < 522 4Meter H 4)st << 522 >$T(>0 ' Celo/)t+ ' - /al/ulate approx)mate rate o, approa/- b+ /ompar)n" /urrent .)stan/e *alue !)t- past .)stan/e *alue Cal/Celo/)t+E 'approx)mate rate o, approa/IF 4)st LH Pre*4)st T $0 Celo/)t+Nero Celo/)t+ H Pre*4)st - 4)st or rear sensors IG

IG

Cal/Cel

"#

=1T1 Celo/)t+4one Celo/)t+NeroE Celo/)t+ H 2 Celo/)t+4oneE Pre*4)st H 4)st >$T(>0 ' 4)spla+ ' - output to user )nter,a/e 4)spla+E '.)spla+ results IF 4)st H 8 T $0 0o4ete/t S$>1(T 3PI0# 02&22# FI#35?C52G S$>1(T 3PI0# 02&22# F4$C Meter#I.IG IF 4Meter LH 52 T $0 4M4)sp5 '/-e/7 to see ), -a*e to a.. 2 to ,ront S$>1(T 3PI0# 02&22# FI2I# 4$C 4Meter# Im IG =1T1 Cel=rap4M4)sp5E S$>1(T 3PI0# 02&22# F4$C 4Meter# Im IG IF >CP)n H % T $0 Soun.@arn)n" Cel=rap-E S$>1(T 3PI0# 02&22# FI#3I0$2#ICelOI#I#228#ILIG S$>1(T 3PI0# 02&22# FI#5:6G S-o!=rap-E bars H JJCelo/)t+K MAA MAABA>K < % bal H JJCelo/)t+K MAA MAABA>K << % pa. H 55 - JbarsMbalFK S$>1(T 3PI0# 02&22# Frep F(3BA> Pbars# rep JbalMBASBA>K PbalF# rep I I Ppa.G Soun.@arn)n"E IF >CP)n H 2 T $0 @arnFront IF 4)st L 5' T $0 4)sp4one =1S(B Soun. =1T1 4)sp4one @arnFrontE IF bars O 8 T $0 4)sp4one =1S(B Soun. =1T1 4)sp4one 0o4ete/tE 4ete/t H 2 S$>1(T 3PI0# 02&22# FI#35?C52G S$>1(T 3PI0# 02&22# FI*****IG IF >CP)n H 2 T $0 4)sp4one =1S(B Soun. 4)sp4oneE >$T(>0 ' Soun. Soun.E IF I05% H 5 T $0 Soun.4one F>$R1(T 6# 522# 2'22# %222 Soun.4oneE >$T(>0 Q), spea7er output .)sable. b+ user

'S-o!Temp ' - s-o! temperature an. spee. o, soun. S-o!TempE PA(S$ '22 S$>1(T 3PI0# 02&22# FI#3I0$5G S$>1(T 3PI0# 02&22# FITempE IG '/al/ulate temperature )n C IF Temp; L 28% t-en TempCPos)t)*e TempC0e"at)*eE TempC H 28% - Temp; S$>1(T 3PI0# 02&22# FI-I# 4$C TempC# 22%# IC

IG

"!

=1T1 S-o!Soun.Spee. TempCPos)t)*eE TempC H Temp; - 28% S$>1(T 3PI0# 02&22# FIMI# 4$C TempC# 22%# IC S-o!Soun.Spee.E S$>1(T 3PI0# 02&22# FI#3I0$2#I S-o!Temp4oneE >$T(>0 IG

IG

' Temperature ' - "et temperature rea.)n" ,rom A4C ' - temperature /ompensat)on ,or spee. o, soun. )n a)r ' - / H %22m<s * sSrtJT7 < 28%K TemperatureE 1(T9 H 5 1(T: H 2 1(T9 H 2 =1S(B C3; 'ma7e CS -)"- -L no aSu)s)t)on 'ma7e C3; lo! ')n)t)ate A4C aSu)s)t)on b+ pull)n" CS lo!

's-),t )n t-e 9-b)t temperature rea.)n" ,rom A4C TempIn H 2 F1> 0 H 2 T1 8 =1S(B C3; TempIn H JTempIn OO 5K B I052 0$AT 'turn o,, A4C a/Su)s)t)on 1(T9 H 5 '/al/ulate temperature )n ; 'temperature )s %8'; * A4C *alue < 2'6 ' about %8& * TempI0 < 2'6 Temp; H J598 * TempIn < 529K '/al/ulate *elo/)t+ Soun.Spee. H J%5 * SR>J28%KK < SR>JTemp;K Temp4one >$T(>0 ' C3; ' C3;E

- /lo/7 os/)llator ,or A4C ser)al trans,er 1(T: H 5 1(T: H 2 >$T(>0 'os/)llate /lo/7 ,or A4C

' 3oa.B)tPats ' - loa. b)t patterns t-at ma7e up bars ,or bar"rap- .)spla+ ' - *ert)/al bar JBK /ons)sts o, b)t pattern o, 8 T52222 ' JBBK )s T52522 ' JBBBK )s T52525 3oa.B)tPatsE S$>1(T 3PI0# 02&22# FI#C=>AMG F1> /nt H 2 to % 311;(P /nt# F2#T52222#T52222#T52525G#/-ar 'loo7up t-e % b)t patterns F1> ro! H 2 to 8 S$>1(T 3PI0#02&22# F/-arG '!r)te b)t pattern )nto 3C4's C=>AM 0$AT 0$AT >$T(>0

""

You might also like