Вы находитесь на странице: 1из 42

P O Box

Utilizing a Microchip dSPIC30F2012 Digital Signal Controller

Product For Spon!or! Date B(

Pul!e Oxi"eter De!ign Conte!t 200# Microchip$Circuit Cellar Octo%er 1&' 200# M)22#*

INTRODUCTION
MO)I+,)IO, B./IF 0IS)O.1

THEORY HARDWARE
DI2I),3 SI2-,3 CO-).O33/.
d!PIC30F2012 S1S)/M C3OC4 )IM/. )1 )IM/. )2 I-PU) C,P)U./ 1 SPI MODU3/ U,.) MODU3/ DI2I),3 I$O DI2I),3 OU)PU)S DI2I),3 I-PU)

3/D D.I+/. CI.CUI)


3/D MODU3/ 05B.ID2/ BUFF/. ,MP3IFI/.S SPI5D,C DI2I),3 CO-).O3 BI)S

3I6UID C.1S),3 DISP3,1


.$78 I-PU) .S I-PU) /-,B3/

COMMU-IC,)IO-S PO.) S8I)C0 I-PU) 3)F S/-SO. 3/D /MI))/.S MOUS/ C,B3/ +/3C.O CO-S).UC)IO-

SOFTWARE
M/,SU./M/-) S).,)/21 3O8P,SS FI3)/. DIFF/./-)I,)O. 90I20 P,SS FI3)/.: DC ).,C4I-2 FI3)/. P/,4 FO33O8/. 0/,.)B/,)$SpO2 C,3CU3,)IOSIMP3/ MO+I-2 ,+/.,2/ FI3)/.

ASSEMBLY
1&5%it 2*5pin D/+/3OPM/-) BO,.D M/;;,I-I/ BO,.D 3CD ,SS/MB31 FI-,3 ,SS/MB31

OPERATIONS APPENDIX 1
).,-SMI)),-C/ ,BSO.B,-C/

APPENDIX 2
B//.53,MB/.) 3,8

APPENDIX 3
O<12/- S,)U.,)IO-

APPENDIX 4
OU)PU) D,), 2.OUP 1 2.OUP 2 2.OUP 3

APPENDIX 5
B3OC4 DI,2.,M

APPENDIX 6
SC0/M,)IC DI,2.,M

APPENDIX 7
M/;;,I-I/ BO,.D 3,1OU)

APPENDIX 8
BI33 OF M,)/.I,3 M/;;,-I-/ BO,.D S/-SO.

INTRODUCTION
)he purpo!e o= thi! paper i! t>o=old? to de"on!trate the concept o= Pul!e Oxi"etr( u!ing a Microchip d!PIC30F Digital Signal Proce!!or and a! an entrant into the 200# Microchip 1&5Bit /"%edded Control De!ign Conte!t !pon!ored %( Microchip and Circuit Cellar@ )he Pul!e Oxi"eter i! an in!tru"ent that i! >idel( u!ed in toda(A! "edical =ield@ )here are "an( di==erent "odel! aBaila%le %( di==erent co"panie!@ So"e unit! !uch a! tho!e utilized in ho!pital! are integrated into larger !(!te"! u!ed to "onitor other Bital !ign!@ Other !"aller "ore porta%le unit! can %e =ound in doctorA! o==ice!' clinic!' and nur!ing ho"e! and are al!o u!ed %( ho"e health5care pro=e!!ional!@ In the Oct$-oB 2000 i!!ue o= .) C )he Dournal =or .e!pirator( Care Practitioner!' an article titled E.ecent DeBelop"ent! in Pul!e Oxi"etr(F i! Guoted a! EPul!e Oxi"etr( i! o=ten con!idered the =i=th Bital !ign' a=ter heart rate' %lood pre!!ure' te"perature and re!pirator( rate@F Pul!e Oxi"etr( ha! !erBed a! an i"portant tool =or the clinician %( proBiding continuou! "onitoring o= the criticall( ill patientA! arterial ox(gen !aturation 9SaO2:' %( calculating an e!ti"ate o= the SaO2 9Hno> a! the SPO2: Bia and algorith"' and di!pla(ing a readout o= thi! e!ti"ation@F MO)I+,)IOOBer the pa!t nu"%er o= (ear! I haBe had experience >ith the nur!ing ho"e !etting !ince "( uncle had !pent t>o (ear! there@ It i! Ber( co""on =or %ed5ridden patient! to contract pneu"onia during the =lu !ea!on@ , pul!e oxi"eter i! nor"all( u!ed to deter"ine i= the patient i! haBing di==icult ti"e %reathing@ , particular nur!ing ho"e "( uncle >a! at had one !uch in!tru"ent@ During the >inter' he had contracted pneu"onia? I a!Hed the nur!e i= he could %e exa"ined@ )he( had to >ait =or the oxi"eter %ecau!e it >a! %eing u!ed in another part o= the %uilding@ Becau!e o= the in!tru"ent! high co!t' the nur!ing ho"e couldnAt a==ord a !econd or perhap! a third@ So"e ti"e earlier' >hen "( "other >a! ho!pitalized >ith >hat the doctor! though >a! pul"onar( =i%ro!i!' "( >i=e and I looHed =or a pul!e oxi"eter that >e could purcha!e that !he could u!e >hen !he ca"e ho"e =ro" the ho!pital@ )he( >ere all Ber( expen!iBe@ During our !earch' >e read an intere!ting article o= an indiBidual >ho >a! on the !a"e Gue!t@ 8ith hi! leBel o= the =i%ro!i! di!ea!e' he >a! a%le to exerci!e@ 0e >anted to "onitor hi! ox(gen leBel during hi! >orHout@ 0e couldnAt =ind a unit that he could a==ord@ 0i! Gue!tion >a! 5 doe! an(%od( "aHe oneI 8ith the lo> co!t and aBaila%ilit( o= "icrochip!' I canAt under!tand >h( the!e in!tru"ent! are !o expen!iBe and >h( the( are not aBaila%le at (our local drug!tore! liHe gluco!e "eter!@

, B./IF 0IS)O.1 )he concept o= Pul!e Oxi"etr( !tarted %acH in 1J3K >hen Carl Matthe! %uilt a deBice >hich u!ed t>o light !ource! o= di==erent >aBelength to "onitor %lood ox(gen !aturation in liBing ti!!ue@ )he deBice had certain li"itation!' >a! di==icult to cali%rate and a%!olute Balue! >ere not o%taina%le@ In 1JL0 a "ethod o= cali%ration %( co"pre!!ing ti!!ue to eli"inate %lood >a! deBeloped %( D@.@ SGuire@ Fro" 1J3J to 1JL2' 2len MilliHan concepted and de!igned a light>eight and practical earpiece u!ed to detect ox(gen !aturation in aBiator! during high altitude te!ting@ B( 1JL* a !i"ilar deBice >a! u!ed to control anoxe"ia during !urgical ane!the!ia@ During thi! ti"e 2len MilliHan coined the ter" Eoxi"eterF@ MilliHan! pro%e >a! not cali%rated and had to %e adMu!ted =or each u!e@ )he thicHne!! o= the !u%Mect! ear >a! al!o a Baria%le that had to %e co"pen!ated =or@ During the 1JK0A! at the Ma(o clinic' /arl 8ood utilized D@.@ SGuire! concept %( added a pneu"atic cu== to "ea!ure the light increa!e >hen the ear >a! !Gueezed@ During 1J&&' the 8alter! Co"pan( deBeloped the <53K0 oxi"eter %a!ed on /arl 8ood! >orH@ )hi! oxi"eter >a! the =ir!t to proBide a%!olute reading! o= ox(gen !aturation >ithout adMu!t"ent! to a Hno> concentration@ Starting around the (ear 1J#1' a Dapane!e engineer na"ed )aHuo ,a(ogi in hi! >orH identi=ied detecti%le pul!atile =lo>@ 8hile atte"pting to eli"inate the!e Bariation!' he di!coBered that the a%!or%enc( ratio! o= the!e pul!ation! at di==erent >aBelength! Baried >ith the ox(gen !aturation@ 8ith the !u%!eGuent deBelop"ent o= light e"itting diode!' photo detector! and "icroproce!!or! the pul!e oxi"eter >a! graduall( introduced into clinical practice@ It >a! thi! detection o= the pul!itile !ignal that heralded the deBelop"ent o= the "odern pul!e oxi"eter@ )he pul!itile change! in light tran!"i!!ion through liBing ti!!ue are due to change! in the %lood Bolu"e in the arterie!@ Mea!ure"ent and anal(!i! o= the!e pul!itile !ignal! can then %e u!ed to detect the ox(gen !aturation o= %lood@

THEORY
)he =unda"ental %a!i! =or Oxi"etr( i! that %lood ha! di==erent optical propertie! at di==erent leBel! o= ox(gen !aturation@ )hi! "ean! that i= "ultiple !ource! o= light at di==erent >aBelength! are u!ed to exa"ine the %lood' the( can %e co"pared algorith"icall( %( a co"puter to deter"ine the leBel o= ox(gen !aturation in the %lood@ )he %eaut( o= the concept i! that the exa"ination can %e "ade inBa!iBel( %( pa!!ing light through an extre"it( !uch a! a =inger' ear lo%e' etc@ )he light i! collected %( a light !en!itiBe !olid5!tate deBice !uch a! a photo5detector' phototran!i!tor or "ore recentl( a 3)F 93ight to FreGuenc(: conBerter@ Oxi"eter pro%e! are de!igned to haBe "ultiple light !ource! 93/D!: that are !>itched on$o== during the "ea!ure"ent pha!e o= the in!tru"ent@ )he ox(gen carr(ing co"ponent o= %lood i! called 0e"oglo%in@ It i! al!o the colored !u%!tance in (our %lood@ )he a"ount o= a%!orption o= Bi!i%le light change! >ith the leBel o= ox(genation@ On a "olecular !cale' there are t>o =or"! o= the he"oglo%in "olecule@ One i! called oxidized he"oglo%in 90%O2: and the other i! called reduced he"oglo%in 90%:@ Both o= the!e "olecular =or"! haBe di==erent optical characteri!tic!@ )he a%!orption o= %oth =or"! o= he"oglo%in can %e !een

%elo>@

FI2U./ 1 )he graph !ho>! the a%!orption !pectra o= %oth 0%O2 and 0%@ 0% ha! a higher a%!orption than 0%O2 at &&0n" 9.ed light:@ In the in=rared region' 0%O2 ha! a higher a%!orption@ )he point >ere the a%!orption o= the 0%O2 and the 0% are eGual i! called the i!o%e!tic point@ . I.

FI2U./ 2 Ba!ic Oxi"eter Sen!or Co"ponent!

3)F

,%oBe' illu!trate! t>o 3/D !ource! 9./D and I-F.,./D: that tran!"it light through a =inger@ )he light i! receiBed %( the 3)F 93ight to FreGuenc( !en!or:@ )he output o= thi! !en!or ha! a =reGuenc( that i! proportional to the inten!it( o= the light =or each !ource@ )he !ource! are ti"e "ultiplexed@ /ach !ource i! !>itched on =or a %rie= in!tant and the =reGuenc( i! "ea!ured@ 3ight i! a%!or%ed =ro" each !ource %( the ti!!ue a! >ell a! the %lood@ )he a%!orption i! di==erent in the ti!!ue =or each !ource@ ,! %lood =lo>! through the =inger a pul!itile co"ponent i! pre!ent@ )he pul!atile co"ponent repre!ent! the arterial =lo> o= the %lood >hich contain! J#O o= the ox(gen in the %od(@ )he con!tant or DC co"ponent that i! picHed up %( the 3)F repre!ent! the ti!!ue' Benou! and capillar( a%!orption@ Belo> !ho>! the pul!itile and DC co"ponent! =or each o= the !ignal!@ )he ./D trace repre!ent! the

./D !ource and the B3U/ trace repre!ent! the I. trace@ )he BlacH line repre!ent! the DC Balue =or each o= the !ource!@

FI2U./ 3 Blue )raceC I. 3ight $ .ed )race C ./D 3ight )he appendix o= thi! paper goe! into "ore detail on the theor( %ehind the eGuation! that goBern ho> >ith a =e> !i"ple "ea!ure"ent! the %lood ox(gen !aturation can %e o%tained =ro" the !ignal! a%oBe@ )he !(!te" "ea!ure! %oth the ,C and DC leBel! o%tained =ro" %oth !ource! and co"pute! the SPO2 %a!ed on the =ollo>ing eGuation
Rrms log R DC R= IRrms log IR DC
SpO2 = 10@0002 R 3 K2@**# R 2 + 2&@*1# R + J*@2J3

)he a%oBe eGuation i! a 3rd order pol(no"ial =it to the SpO2 graph giBen in re=erence PLQ@ )he graph i! !ho>n %elo> and al!o in appendix 3@

FI2U./ L Cali%ration curBe =or oxi"eter )he 0eart .ate i! deter"ined %( "ea!uring the elap!ed ti"e %et>een peaH! o= the I. !ignal@ )he heart rate i! then calculated u!ing the eGuation
BPM = &0 PeriodinSeconds

HARDWARE
)he heart o= the pul!e oxi"eter i! a Microchip d!PIC30F2012 Digital Signal Controller@ Since Microchip ha! !o"e Ber( nice tool!' it >a! Ber( practical to deBelop thi! concept utilizing one o= the "a( aBaila%le deBelop"ent Hit!@ )he Microchip CPU 91&5%it 2*5pin DeBelop"ent Board: >a! cho!en =or thi! ta!H@ Mini"al change! >ere reGuired to get thi! %oard to >orH >ith the !(!te"@ , !"all "ezzanine %oard >a! con!tructed to inter=ace to the !en!or and !erial port@ )he %oard al!o contained the nece!!ar( circuitr( =or thi! inter=ace along >ith an inexpen!iBe liGuid cr(!tal di!pla(@ DI2I),3 SI2-,3 CO-).O33/. d!PIC30F2012 )he Microchip d!PIC30F2012 digital !ignal controller >a! a nice choice =or thi! proMect %ecau!e o= it! excellent co"putational a%ilitie!' aBaila%le hard>are' it! lo> co!t and it! ea!e o= =ield progra""a%ilit(@ S1S)/M C3OC4 )he 1&5%it 2*5pin deBelop"ent %oard co"e! >ith an external #@3#2*M 0z cr(!tal@ )hi! >orHed out per=ect =or the application@ )he on5chip P33 >a! u!ed to %oo!t the operating =reGuenc( 1&x@ 8ith the in!truction clocH !et at R input clocH =reGuenc(' the operating =reGuenc( o= the clocH =or the !(!te" i! )c( S 2J@LJ12 M0z@ )IM/. )1

)1 i! a 1&5%it ti"er that act! a! a ti"e5%a!e generator >ith interrupt to i"ple"ent a !i"ple !tate "achine u!ed to control the !eGuencing o= eBent!@ )i"er )1 al!o !et! the !a"ple rate =or all !ignal proce!!ing@ )1 i! a t(pe5, ti"er >hich u!e! the 2J@L1J2 M0z internal clocH a! it! input@ , pre!caler i! u!ed to diBide the =reGuenc( %( 2K& to drop the )M.1 "odule input to 11K200 0z@ )he Period .egi!ter P.1 i! !et to K#& !o the ti"er proBide! an interrupt period o= K"!@ )IM/. )2 )2 i! al!o a 1&5%it ti"er that i! !etup to %e =ree5running >ith a 2J@L1J2M0z input to the )M.2 "odule@ )i"er )2 i! a t(pe5B ti"er %ut doe! not utilize an interrupt in it! operation@ It i! u!ed to "ea!ure the period o= the output =ro" the )ao! )S323K. 3)F deBice@ )he 3)F output period i! inBer!el( proportional to the inten!it( o= the light !triHing it! !ur=ace@ I-PU) C,P)U./ 1 i! connected to the output o= the ),OS 3)F deBice@ It i! !etup to trigger on each ri!ing edge o= it! input@ 8hen the IC1 eBent occur!' an interrupt i! produce and the Balue o= ti"er )2 i! copied@ ,n interrupt handler !aBe! thi! Balue@ On the !econd input capture eBent' the period o= the 3)F can %e deter"ined %( taHing the di==erence %et>een thi! Balue and the !aBed Balue@ )he period i! u!ed to co"pute a =reGuenc( >hich i! proportional to the inten!it( o= the light "ea!ured@ SPI MODU3/ )he SPI "odule i! ena%led =or u!e in co""unicating >ith the Microchip MCPL*22 !erial digital to ,nalog conBerter IC@ )he SPI i! !etup in "a!ter "ode to haBe a 1& %it !erial output at a clocH rate o= #@3#2*M0z@ Since the SPID,C deBice ha! 12 %it re!olution' the other L %it! are u!ed =or control@ )he SPI "odule !end! 3/D inten!it( co""and! =ro" the digital controller to the D,C IC@ U,.) MODU3/ , !erial output =ro" the !(!te" !end! data at a rate o= 11K'200 %it! per !econd to the deBelop"ent co"puter >ith an * %it data !ize' 1 !top %it' no5parit( and no =lo> control@ Since the data co"e! out o= the !(!te" in !erial =or"' a !pecial !cope progra" >a! >ritten and u!ed to anal(ze !(!te" operation during deBelop"ent@ U!ing the S81 input on the deBelop"ent %oard' one o= three diagno!tic !creen! can %e !elected@ DI2I),3 I$O )en pin! >ere u!ed a! digital output and a !ingle pin =or a digital input@ )he( are identi=ied %elo>

DI2I),3 OU)PU)S .B0 +I.on Signal to the 05Bridge to control the I. light !ource@ , 0igh !tate turn! I. 3/D on' a lo> !tate turn! the I. 3/D o==@ .B1 +.on Signal to the 05Bridge to control the ./D light !ource@ , 0igh !tate turn! the ./D 3/D on >hile a lo> !tate turn! the ./D 3/D o==@ .B3 .$78 Control! .ead$8rite input on the 3CD di!pla(@ , high !tate !et! di!pla( into ./,D "ode >hile a lo> !tate !et! di!pla( to 8.I)/@ .BL DL 3CD Data input line Bit L .BK DK 3CD Data input line Bit K .B& D& 3CD Data input line Bit & .B# D# 3CD Data input line Bit # .BJ PU3S/ Diagno!tic Bit u!ed during deBelop"ent .FL / /na%le 3ine input =or the 3CD di!pla(@ .FK .S .egi!ter Select line =or the 3CD di!pla(@ 0igh !tate !elect! the internal data regi!ter >hile a lo> !tate !elect! the co""and regi!ter@ DI2I),3 I-PU) .D* S81 Input connected to a "o"entar( !>itch >ith pull5up re!i!tor on the deBelop"ent %oard@ )hi! !>itch i! u!ed to toggle one o= thee data output! =ro" the !erial port@ )hi! >a! u!ed during deBelop"ent and "a( %e u!ed =or diagno!tic!@

3/D D.I+/. CI.CUI) 3/D MODU3/

)he !en!or i! %uilt u!ing an ,dBanced Photonix Inc@ 9,PI: PDI5/*32 2a,3,! 0igh Po>er Dual 3/D e"itter@ )he "odule ha! t>o parallel connected e"itter! that can conduct in %oth direction!@ One direction produce! photonic energ( at &&0n" 9./D: and the other produce! photonic energ( at J0Kn"@ )hi! "odule i! aBaila%le =ro" DigiHe( =or a%out 10 dollar!@ In order to driBe thi! "odule' a %ridge circuit >a! u!ed@ 8ith the %ridge circuit' the inten!it( o= each e"itter! a! >ell a! >hen to !>itch are controlled independentl(@

FI2U./ K /"itter a!!e"%l( !che"atic and di"en!ion!

05B.ID2/

In re=erence to the !che"atic located in ,ppendix &' the 3/D "odule i! driBen %( 9U2: an 05Bridge "odule con!i!ting o= a 1L pin DIP !ilicon co"ple"entar(5pair tran!i!tor pacHage aBaila%le =ro" Central Se"iconductor Inc@' P$- MP6&002@ )hi! circuit u!e! a J+ decoupled !uppl( to deliBer pul!ed po>er to the 3/DT! at Baria%le driBe current!@
BUFF/. ,MP3IFI/.S , Microchip MCP&0# dual op5a"p pacHage i! u!ed to driBe the %otto" hal= o= the 05Bridge circuit and i!olate it =ro" the SPID,C@ )he!e a"pli=ier! along >ith the current =eed%acH re!i!tor! .1 and .2 are u!ed to !et the current in each %ranch o= the 05Bridge circuit thu! !etting the 3/D inten!itie!@ /le"ent ULB control! the I. 3/D and UL, control! the ./D ele"ent@ SPI5D,C , Microchip MCPL*22' Digital to ,nalog ConBerter >ith SPI inter=ace and internal re=erence connect! the d!PIC30F controller to the %u==er a"pli=ier!@ )hi! deBice taHe! a 12 %it co""and oBer the SPI linH@ )he SPI i! !etup =or a 1& %it >ord tran!=er u!ing a #@3#2*M0z clocH@ )he %otto" 12 %it! o= the >ord are data and the upper ni%%le are control %it!@ One o= the!e control %it! i! u!ed to !elect one o= the t>o D,C circuit! in the deBice@ D,C output , 9pin *: control! the inten!it( o= the I. 3ed >hile D,C output B control! 9pin &:' the ./D e"itter@

DI2I),3 CO-).O3 BI)S )>o %it! =ro" the d!PIC30F deBice are u!ed to !>itch the 3/DT! on and o==@ )he upper hal= o= the 05Bridge i! controlled %( output pin! .BO and .B1@ )he!e pin! control tran!i!tor driBer! 62 and 61 >hich driBe the P-P tran!i!tor! in U2@ Pin .B0 >ill turn on the I. 3ed >hile pin .B1 >ill turn on the ./D 3ed@ )he !o=t>are >ill !>itch onl( one light !ource on at a ti"e@ Belo> are the code !eg"ent! =or SPI initialization and D,C Output@
$7.outine to !etup SPI hard>are7$ Boid SPIInit9Boid: U 3,)B VS 0x000L? SPI1S),)%it!@SPI/- S 1? SPI1CO- S 0x0K3/? W $7.outine to 8rite data out SPI port7$ Boid SPIOut9un!igned int data: U 3,)B XS 0xFFFB? SPI1BUF S data? )10u!9:? 3,)B VS 0x000L? W $7.outine to >rite data to !elected channel , or B 7$ $7channel S 1 ./D D,C Co""and in YdataZ 7$ $7 S0 I. D,C Co""and in YdataZ 7$ Boid D,COut9char channel'un!igned int data: U i=9channel: SPIOut9data V 0xJ000:? el!e SPIOut9data V 0x1000:? W $$Set 7SS1S1? 97CS S 1: $$/na%le SPI "odule 5 SC41' SDO1' SDI1' 7SS1 $$Di!a%le Fra"ed' /na%le 1& %it data >idth' ,ctiBe $$clocH to Idle clocH'actiBe !tate hi'Ma!ter Mode@ $$ena%led'Secondar( Pre!caler $1'

$$Set Chip Select 3O8 97CS S 0: $$Send data out SPI Port $$8ait =or 10 u! $$Set Chip Select 0I20 97CS S 1:?

$$I= channel S 1' $$8rite ./D D,C co""and'Output /na%led'2x gain@ $$I= channel S 0' $$8rite I./D D,C co""and'Output /na%led'2< gain

3I6UID C.1S),3 DISP3,1 )he !(!te" u!e! a 2 line %( * character di!pla( to proBide the SPO2 data a! >ell a! the heart%eat in=or"ation to the u!er@ , 0antronix 3iGuid Cr(!tal di!pla( >a! cho!en to do the Mo% %ecau!e it i! inexpen!iBe' ro%u!t and ea!( to >orH >ith@ )o reduce the nu"%er o= I$O pin! reGuired %( the "icrocontroller' a L %it data %u! >a! cho!en@ )here are three additional control line! that the "icro ha! to !uppl( to co""unicate >ith the di!pla(@ )he * %it data i! "ultiplexed into the di!pla( =ro" the "icro u!ing the upper ni%%le o= the lo>er %(te o= PO.)B@ One ni%%le i! loaded at a ti"e on the upper =our pin! o= the di!pla( %u! 9the di!pla( %u! i! an * %it %u! %ut ha! %oth "ode! o= operation:@ See the attached code !eg"ent on the next page =or detail! on ho> the di!pla( i! initialized and ho> data i! >ritten to the di!pla(@ .$78 I-PU)

)hi! i! an input to the di!pla( that allo>! the !o=t>are to !elect either a read or a >rite operation@ )hi! application u!e! onl( >rite! to the di!pla( and doe! not nece!!itate the u!e o= the read =unction@ .S I-PU) )hi! input to the di!pla( allo>! >riting to either the D,), regi!ter or the CO-).O3 regi!ter@ 8hen the input i! lo>' In!truction! can %e >ritten to the control regi!ter@ 8hen the input i! high' ,SCII data can %e >ritten to the di!pla(@ /-,B3/ B( appl(ing a pul!e on thi! input o= a%out K0u!' the data and control %(te! can %e >ritten to either the data or control regi!ter! re!pectiBel(@ SOF)8,./ )he =ollo>ing are !o"e code !eg"ent! that !ho> ho> the di!pla( i! initialized' and >ritten to@ )here are "ore routine! that can %e re=erenced %( exa"ining the code li!ting! =or thi! proMect@

$7Initialize Di!pla( =or L %it inter=ace@7$ Boid Initdi!p9Boid: U 3,)F XS 0xFF/F? 3,)F XS 0xFFDF? 3,)B XS 0xFFF#? )1K"!9:? 3,)B VS 0x30? toggle/9:? )K"!9:? toggle/9:? )100u!9:? toggle/9:? 3,)B S 93,)B X 0xFF0F: V 0x20? toggle/9:? toggle/9:? 3,)B S 93,)B X 0xFF0F: V 0x*0? toggle/9:? 3,)B XS 0x0F? toggle/9:? 3,)B S 93,)B X 0xFF0F: V 0x/0? toggle/9:? 3,)B XS 0x0F? toggle/9:? 3,)B S 93,)B X 0xFF0F: V 0x10? toggle/9:? 3,)B XS 0xFF0F? toggle/9:? 3,)B S 93,)B X 0xFF0F: V 0x&0? toggle/9:? 3,)B VS 0x*? W

$$Drop /na%le Pin lo> 9/ S 0: $$.e!et .S line lo> 9.S S 0: $$.e!et .$78 line 3O8 9>rite: 9.$78 S 0: $$8ait =or 1K"! $$Set =unction =or * %it $$)oggle / %it $$8ait =or "ore than L@1"! $$.epeat' then $$8ait an additional 100u! $$.epeat@ $$Set =unction =or L %it inter=ace $$)oggle / %it $$.epeat =unction =or L %it inter=ace 0I -i%%le $$Second -i%%le 92 line!: $$)oggle / %it $$)urn OFF di!pla( $$)oggle / %it $$)oggle / %it $$Clear Di!pla( $$)oggle / %it $$)oggle / %it $$Set /ntr( Mode 9Incre"ent: $$)oggle / %it $$)oggle / %it $$Set .$78 line 0I 9>rite: 9.$78 S 1:

$7.outine to appl( a 100u! pul!e to the / input o= the di!pla(@7$

Boid toggle/9Boid: U 3,)F VS 0x0010? )100u!9:? 3,)F XS 0xFF/F? W

$$Set / pin 9/ S 1: $$100 u! Dela( $$.e!et / pin 9/ S 0:

$7.outine to load CO-).O3 character into the di!pla( 9L %it %u!:@7$ Boid Di!pC"d9un!igned char data: U 3,)B XS 0xFFF#? $$.e!et .$78 line 3O8 9>rite: 9.$78 S 0: 3,)F XS 0xFFDF? $$.e!et .S line lo> 9.S S 0: 3,)B S 93,)B X 0xFF0F: V 9data X 0xF0:? $$3oad Upper -i%%le o= data toggle/9:? $$)oggle /53ine 3,)B S 93,)B X 0xFF0F: V 99data YY L: X 0xF0:? $$3oad 3o>er -i%%le o= data toggle/9:? $$)oggle /53ine 3,)B VS 0x000*? $$Set .$78 line 0I 9>rite: 9.$78 S 1: )K"!9:? $$8ait K"! W $7.outine to load D,), character! into the di!pla( 9L %it %u!:@7$ Boid Di!pDat9un!igned char data: U 3,)B XS 0xFFF#? 3,)F VS 0x0020? 3,)B S 93,)B X 0xFF0F: V 9data X 0xF0:? toggle/9:? 3,)B S 93,)B X 0xFF0F: V 99data YY L: X 0xF0:? toggle/9:? 3,)B VS 0x000*? W

$$.e!et .$78 line 3O8 9>rite: 9.$78 S 0: $$Set .S line high 9.S S 1: $$3oad Upper -i%%le o= data $$)oggle /53ine $$3oad 3o>er -i%%le o= data $$)oggle /53ine $$Set .$78 line 0I 9>rite: 9.$78 S 1:

COMMU-IC,)IO- PO.)
)he co""unication! port u!e! onl( a !ingle direction o= the U,.) MODU3/@ It >a! u!ed to collect data during the deBelop"ent o= the !o=t>are and can al!o %e u!ed to "onitor the heart%eat >aBe=or" =ro" %oth the I. and ./D !en!or! i= one >i!he!@ Input .DJ >hich i! connected to S81 on the de"o %oard i! u!ed to toggle %et>een three di==erent data output "ode!@ More >ill %e explained on thi! later@ )he U,.) pin o= the controller i! connected to IC5U1' a M,<232 9/I,5232 DriBer$.eceiBer: "anu=actured %( )exa! In!tru"ent@ U1 conBert! the output Boltage leBel o= the controller U,.) to tho!e nece!!ar( to connect to an .S5232 deBice@ )he output o= U1 goe! to the 35pin connector 9DCo": >hich "a( %e >ired to the .S5232 port o= a co"puter@ )he !o=t>are !et! up the U,.) MODU3/ to haBe the =ollo>ing para"eter! Baud .ate 11K200 Data Size * %it! Parit( -one Stop Bit! One Flo> Control -one )he code !eg"ent! u!ed to initialize and i"ple"ent the U,.) are !ho>n %elo>

$7Set! up the Serial Port U,.) hard>are >ith the =ollo>ing characteri!tic! $7B,UD.,)/ 11K200 $7D,),SI;/ * $7P,.I)1 $7S)OPBI) 1 $7F3O8 -O-/ Boid U,.)init9int B.28ord: U ).ISF S 0xC? U1B.2 S B.28ord? U1MOD/ S 0x*L00? U1S), S 0x0LL0? [U1.<IFS0? W $7Send a !ingle character out the U,.)7$ Boid SendChar9char data: U int i S 0? U1)<./2 S data? >hile 9 \U1S),%it!@).M) XX 9iY10000: : i]]? W $7Send a !tring out the U,.)7$ Boid SendString9char !PQ: U int i S 0? >hile9i Y BigString: U i=9 !PiQ SS T^0T : %reaH? SendChar9!Pi]]Q:? W W

7$ 7$ 7$ 7$ 7$ 7$ $$MaHe pin! U1.< and U1)< input! $$Calculate >ord =or Baud .ate .egi!ter $$/na%le U,.)' Set *5n51' U!e U1,.<$U1,)< $$.e!et !tatu! regi!ter and ena%le )< X .< $$Clear U,.) .< Interrupt Flag

$$Place data in tran!"it regi!ter@ $$8ait =or %(te to %e !ent or ti"eout@

$$Send each character to tra!"itter@ Stop at -U3 or large!t !tring@ $$ Guit on !tring ter"inator

S8I)C0 I-PU) Input .DJ >hich i! connected to S81 on the de"o %oard can %e u!ed to toggle %et>een three di==erent data output "ode!@ )he data that co"e! out the !erial port >ill %e ,SCII and utilize! a !pace character a! a !eparator@ )here are three di==erent group! o= !o=t>are5Baria%le! that "a( %e !elected@ )he( are a! =ollo>! 2.OUP 1 .Filt .[DC I.Filt I.[DC 2.OUP 2 I.Di== dI.Filt PeaH 2.OUP 3 BPM SPO2 5 5 5 5 5 5 5 5 5 3P Filtered ./D 3ed Mea!ured Inten!it( DC 3eBel =or ./D 3ed Mea!ured Inten!it( 3P Filtered I. 3ed Mea!ured Inten!it( DC 3eBel =or I. 3ed Mea!ured Inten!it( 3P Filtered' I. ,C !ignal Di==erentiated 3P Filtered I. data Output o= the PeaH Follo>er ,lgorith" 0eart .ate in %eat!5per5"inute Ox(gen Saturation in Percent

0(per5)er"inal can %e !etup to collect the data that i! !ent out the !erial port@ 0(per )er"inal i! a progra" that i! %undled >ith all Micro!o=t 8indo>! O@S@ 3)F S/-SO. )he !en!or cho!en to "ea!ure the light inten!it( o= %oth e"itter! i! a digital 3ight to FreGuenc( 93)F: deBice "anu=actured %( )exa! ,dBanced Optoelectronic Solution! 9),OS:@ It ha! a digital ))3 output in!tead o= a lo> leBel analog output that i! u!ed in "o!t oxi"etr( eGuip"ent@ )he adBantage! o= !uch a deBice are %etter noi!e i""unit( and no analog !ignal conditioning reGuired@ ,ll digital techniGue! "a( %e applied >ith one proce!!or@ )he 3)F cho!en i! the )D323K. %ecau!e o= it! !"all !ize and excellent !en!itiBit(@ It! internal >orHing! con!i!t o= a !ilicon photodiode and a current5to5=reGuenc( conBerter on a !ingle "onolithic CMOS integrated circuit@ )hi! "ean!' there i! a high5leBel !ignal out o= the !en!or that can traBel a di!tance oBer the ca%le and !till "aintain it! !ignal integrit(@ )he output i! a !Guare >aBe >ith a K0O dut( c(cle@ )he deBice allo>! direct inter=ace to a "icrocontroller !uch a! the Microchip d!pPIC30F =a"il(@ )he !"all !ize =it! the deBice into the oxi"eter pro%e Ber( ea!il( >ith three >ire! connecting %acH to the FI2U./ & in!tru"ent@ 3/D /MI))/.S )he ./D and I. !ource! u!ed in the oxi"etr( pro%e haBe %een de!cri%ed in the !ection on the 3/D driBer circuit@ )he !"all !ize o= the!e e"itter! along >ith the ),OS deBice "aHe an excellent ho"e5"ade pro%e@ MOUS/ C,B3/ )he e"itter and !en!or connection! %acH to the in!tru"ent >ere "ade >ith an old le=t oBer !erial "ou!e@ )he DBJ connector >a! alread( attached and the ca%le >a! per=ect >ith it! =lexi%ilit(@ )he "ou!e portion >a! di!carded@ )here >ere enough >ire! in the ca%le to acco"pli!h thi! connection 9onl( K needed:@ DonTt haBe to >orr( a%out !hielding >ith the 3)F !en!or' !o it >orHed great@ +/3C.O CO-S).UC)IO)he e"itter a!!e"%l( and the 3)F !en!or >ere %oth !oldered to a !"all !ection o= per=5%oard 9le=t oBer =ro" another proMect:@ )hi! per=5%oard ha! !older pad! to allo> !oldering the deBice! and >ire!@ Both %oard! need to %e a%out _` !Guare@ )he %oard! are !oldered to the "ou!e ca%le >ire!@ ,%out 2` o= ca%le >ere !tripped %acH to expo!e the indiBidual >ire!@ 8ire! need to %e dre!!ed a! !hort a! po!!i%le@

)>o hole! >ere punched into the +elcro !o that the( >ould %e on oppo!ite !ide! o= the index =inger@ )hi! i! the !o=t !ide o= the +elcro 9top !trip:@ )he %oard! >ere placed on the !ticH( !ide o= the +elcro 9!o=t !ide: in !uch a >a( that the light >ould go through one hole pa!! through the =inger and get detected on the oppo!ite hole@ )he !o=t !trip o= the +elcro >ill "aHe contact the =inger@ )he "ating !ide o= the +elcro 9hard !ide: i! attached to the !ide containing the !en!or! 9!o=t !ide:@ Be Ber( care=ul >ith the align"ent@ SticH( !ide to SticH( !ide@
SOF) S).IP

0,.D S).IP

Photograph 1 0ole! are punched into the !o=t +elcro !trip@ )he location o= the hole! corre!pond to the top and %otto" o= the index =inger@

Photograph 2 )he t>o !en!or! are placed into po!ition a=ter %eing !oldered to the >ire! o= the ca%le@ )he t>o +elcro !trip! are adhered together to =or" one =lexi%le piece@

Photograph 3 Sen!or a!!e"%l( i! co"plete@ , !"aller !ection o= tran!ition ca%le >a! %uilt to connect the DBJ !erial connector into the "ezzanine %oard@

SOFTWARE
M/,SU./M/-) S).,)/21 ,! di!cu!!ed in the 0,.D8,./ !ection o= thi! paper' )i"er )1 !et! up a K"! interrupt@ )he interrupt handler !et! up a !tate "achine >ith t>o !tate! and an initialization !tate that taHe! place in the "ain progra"@ )he !tate "achine ha! the =ollo>ing =lo> diagra" S),)/ S 51 /xecuted in Main Progra"
)urn OFF %oth 3/D! Set D,C Balue! Initialize )i"er )1

Interrupt )1 occur!

S),)/ S 0 )he !(!te" >ait! =or the next )1 interrupt K"! later@ During thi! ti"e' the IC1 interrupt get! center !tage@ M/,SU./ i! the !tate counter =or the IC1 interrupt@

Set PU3S/ S 0 9Diagno!tic: Set M/,SU./ S 0 Initialize )i"er )2 Initialized IC1 S),)/ S 1

Interrupt )1 occur!

S),)/ S 1 ,=ter K"!' the !econd )1 eBent Occur!@ )he "ea!ure"ent! haBe Been taHen and it i! ti"e to proce!! )he data@ )hi! occur! during thi! S),)/

Set PU3S/ S 0 9Diagno!tic: Per=or" 3P =iltering Per=or" 0P =iltering Per=or" DC tracHing Set PU3S/ S 1 9Diagno!tic: Calculate ,C !ignal +alue! S),)/ S 0

In the "ain progra"' at a pre!eta%le nu"%er o= !a"ple!' the progra" run! the auto[adM9: procedure >hich tune! the I. 3/D to "atch the inten!it( o= the ./D 3/D@ ,=ter thi! routine i! executed' the S),)/ counter i! !et to C1' ,-D )0/ B/,) 2O/S O-a During S),)/ S 0' the )1 handler !et! up the entr( point =or the IC1 interrupt@ )he !tate counter M/,SU./ S 0@ )he ./D D,C i! loaded and the ./D 3/D i! turned on@ )he IC1 interrupt >ill occur on the ri!ing edge o= each and eBer( ),OS output pul!e until the IC1 interrupt i! di!a%led@ )he interrupt occur! t>ice =or each e"itter "ea!uring the P/.IOD =ro" the ),OS deBice and calculating the !u%!eGuent I-)/-SI)1@
IC1 Interrupt 0andler .ead IC1 %u==er and !aBe )0 S IC1BUF M/,SU./ S 1

M/,SU./S0

IC1 Interrupt 0andler

M/,SU./S1

.ead IC1 %u==er Calculate ./D period Co"pute Inten!it( =or ./D 94$.Period: )urn OFF ./D 3ed )urn O- I. 3ed M/,S,U./ S 2

IC1 Interrupt 0andler

M/,SU./S2

.ead IC1 %u==er and !aBe )0 S IC1BUF M/,SU./ S 3

IC1 Interrupt 0andler

M/,SU./S3

.ead IC1 %u==er Calculate I. period Co"pute Inten!it( =or I. 94$I.Period: )urn OFF I. 3ed M/,SU./ S 0 handler proce!! the 3o> Pa!! Filter' 0igh Pa!! )he S),)/S1 o= the )1 interrupt Di!a%le IC1 Filter and DC )racHing =ilter algorith"! =or %oth the ./D and I. !ource!@ )he!e Di!a%le )2

algorith"! are %rie=l( de!cri%ed next@

3O8 P,SS FI3)/.I-2 )he Lth order 3P algorith" in ;5do"ain i! Fc S 3o> Pa!! Cuto== FreGuenc( )! S Sa"ple .ate
Wc = 2Fc
C= 1 WcTs tan 2
2K& 2& K00

M =

N=

3L11* 10000

N 0 =1 N1 = L N2 = & N3 = L N L =1

D0 = C L + MC 3 + NC 2 MC + 1 D1 = LC L 2 MC 3 + 2 MC + L D2 = &C L 2 NC 2 + & D3 = LC L + 2 MC 3 2 MC + L D L = C L MC 3 + NC 2 MC +1

N 0 + N 1 Z 1 + N 2 Z 2 + N 3 Z 3 + N L Z L Y 9 z : H L 9z: = = D0 + D1 Z 1 + D2 Z 2 + D3 Z 3 + DL Z L X 9 z :

)he coe==icient! o= the a%oBe =unction are deter"ined in the "ain progra" >hile the algorith" i! executed a=ter each !et o= .ed and I. !a"ple! are acGuired in the interrupt handler =or the )1 ti"er@ )hi! occur! eBer( 10"!@ DIFF/./-)I,)O. 90I20 P,SS FI3)/.: )he di==erentiator i! u!ed %( the peaH =ollo>er algorith" to detect an edge =or ti"ing o= the heart >aBe@ Fh S 0igh Pa!! Cuto== FreGuenc( )! S Sa"ple .ate
Wc = 2Fh
WcTs C = tan 2 K2 = 1 C 1 +C

1 K1 = 1+C

DC ).,C4I-2 FI3)/. ,Berage! the 3o> Pa!! output and re"oBe! the ,C !ignal@ )he output o= thi! algorith" i! the DC leBel =or each color 3/D@
1 2K&
Y 9 z: K = 1 X 9 z : 1 Z 91 K :

H H 9z: =

Y 9 z : K 1 1 Z 1 = X 9 z : 1 K 2 Z 1

K =

H T 9 z: =

P/,4 FO33O8/. )he PeaH Follo>er algorith" can %e =ound in the "ain progra"@ .e=erencing the code li!ting' (ou can !ee the !eg"ent o= code li!ted %elo> i! the "ain !tructure =or the peaH =ollo>er@
i=9dI.Filt Y S PeaH: PeaH S dI.Filt? Mea!ureFlag S 51? el!e U @ @

@ W

)he peaH =ollo>er algorith" u!e! the di==erentiated 3o>pa!! output !eGuence =ro" the I. !en!or a! it! input@ )he idea i! to allo> the PeaH Baria%le to =ollo> the!e di==erentiated peaH! and deca( at a Ber( !lo> rate@ It >orH! "uch liHe a =ilter capacitor in a po>er !uppl(@ It atte"pt! to =ollo> the peaH! and deca(! Ber( !lo>l( producing an enBelope that can %e u!ed to ti"e the heart>aBe that i! produce %( the I. !ignal@ )hi! I. !ignal >a! cho!en %ecau!e it! a"plitude i! greater that that o= the ./D !ource and it doe!nAt Bar( a! "uch a! the ./D !en!or doe!@ 0/,.)B/,)$SpO2 C,3CU3,)IO)he peaH =ollo>er i! u!ed to ti"e the period o= the heart >aBe and al!o !et up a period =or the .MS calculation o= the ,C portion o= the !ignal@ In the )1 handler' the ,C !ignal i! calculated %( taHing the di==erence %et>een the Filtered Sen!or output and the DC leBel 9=ro" the DC tracHing algorith":@ For exa"ple' the ,C !ignal =ro" the ./D !en!or i!
.di== S .=ilt C .[DC?

)he .MS Balue i! calculated =or each !a"ple o= the .di== and accu"ulated u!ing the !tate"ent
.!u" S .Di==7.Di== ] .!u"?

,=ter the period i! detected' the .MS Balue i! calculated and .!u" !et %acH to 0 ."! S !Grt9.!u"$period:? .!u" S 0? Once the .MS Balue i! calculated' the SPO2 i! calculated %( =inding the ratio .? . S .r"!$.DC $ Irr"!$I.DC )hen'
SpOs = 10@002 R 3 K2@**# R 2 + 2& $ *1# R + J*@2J3

SIMP3/ MO+I-2 ,+/.,2/ FI3)/. , !i"ple "oBing aBerage =ilter i! u!ed to !"ooth the heartrate and the ox(gen calculation! oBer 10 !a"ple!@ It =ollo>! the general =or"
Y = YK 1 + X K X K 1 N

8here'

- S 10

FI2U./ # ,%oBe !ho>! the re!ult! o= the di==erentiator 9%lacH: and the peaH =ollo>er enBelope 9%lue: on the I. >aBe=or" 9.ed:

ASSEMBLY
1&5%it 2*5pin D/+/3OPM/-) BO,.D )he onl( "odi=ication that need! to %e done to the deBelop"ent %oard i! the re"oBal o= the zero oh" Mu"per! .1L C .1#@ )he!e are not needed in thi! application@ M/;;,-I-/ BO,.D )he "ezzanine %oard i! "ounted atop the 1&5%it 2*5pin deBelop"ent %oard u!ing the exiting header and a connector@ U!e appendix * to order part! =or the %oard@ U!e appendix # to cut' drill and la(out the connector! =or the %oard@ .e=er to the !che"atic =or >iring o= the %oard@ Belo> i! a photograph o= the %oard a=ter it ha! %een >ired@ Photograph L Mezzanine %oard a=ter a!!e"%l(

3CD ,SS/MB31 )he 3iGuid Cr(!tal Di!pla( a!!e"%l( i! a!!e"%led %( adding the 1& pin connector to the 0antronix co"ponent@ .e=er to ,ppendix & =or connector part nu"%er! and ,ppendix # =or location o= the "ating connector on the "ezzanine %oard@ Belo> !ho>! a photograph o= the di!pla( a!!e"%l( >ith the connector added@

Photograph K )he di!pla( i! co"plete a=ter the connector i! !oldered in place@ @

Photograph & ,%oBe i! a photograph o= the co"pleted "ezzanine a!!e"%l( >ith the di!pla( re"oBed@ -otice that there are t>o %atter( clip! connected together@ )hi! giBe! the option o= u!ing a J+ >all5>art po>er !uppl( or a J+DC %atter( to po>er the unit@ FI-,3 ,SS/MB31 )he Mezzanine %oard i! care=ull( po!itioned a%oBe the Microchip 1&5%it 2*5pin DeBelop"ent Board' then the t>o are plugged together u!ing the connector$header in!talled@ )he Di!pla( %oard i! no> plugged into the "ezzanine %oard "atching the connector$header! in!talled@ Stando== po!t! >ere u!ed on %oth !ide! o= the "ezzanine %oard to !pace the %oard! =ro" each other a! >ell a! proBiding !upport >hen the %oard! are pre!!ed together@ )>o o= the !tando==! can %e !een in Photograph & atop the "ezzanine %oard and the "ounting !cre>! =or the other t>o can %e !een at the top o= the "ezzainine@ )he!e are "ounted at the %otto" o= the %oard@ O= cour!e' the!e need to %e in!talled %e=ore the %oard i! >ired@ )he approxi"ated location =or the hole! =or the!e !tando==! can %e =ound in appendix # 5 Mezzanine Board 3a(out@

Photograph # ,%oBe i! a photograph o= the co"pleted !(!te"@ )he "ezzanine %oard ha! %een connected to the Microchip %oard@ )he Di!pla( ha! %een connected to the "ezzanine %oard@ Both the .S5232 ca%le 9le=t !ide o= "ezzanine %oard: and the !en!or ca%le 9top !ide o= "ezzanine %oard: haBe %een connected@ -ote the !en!or located to the le=t o= the !(!te"@ Po>er to the unit i! through the >all5>art po>er adapter !upplied >ith the Microchip ICD52 tool@

OPERATIONS
8hen the !(!te" i! po>ered up' there >ill %e a %rie= pro"pt on the di!pla( a! that !ho>n %elo> in photograph *@ Photograph * Sho>! unit at po>er5up@ -otice di!pla( pro"pt@ )hi! >ill la!t =or a =e> !econd!@

,=ter the unit ha! gone through it! initial po>er up' it >ill di!pla( the pro"pt `8,I)I-2` a! !ho> in photograph #@ Place one o= (our index =inger! into the !en!or@ )he =ir!t ti"e (ou u!e the unit' (ou >ill haBe to >rap the !en!or around the =inger@ Photo # !ho>! the !en!or that ha! alread( %een =itted to "( =inger@ Once the controller detect! the place"ent o= the =inger' it >ill %egin taHing "ea!ure"ent!@ ,=ter a%out 10 !econd!' (ou >ill haBe a !ta%le reading o= %oth (our heart5rate 9BPM: and (our %lood ox(gen !aturation 9SP2:@ Belo> i! a photograph o= the !(!te" "ea!uring "( heart5rate at ## %eat!5per5"inute and "( SPO2 at JJO@ )he heart5rate >a! up !lightl( %ecau!e o= the !ucce!! o= the proMect@ Photograph J Sta%le "ea!ure"ent! a=ter a%out ten !econd!@ BPM S ## and SPO2 S JJO@

APPENDIX 1
).,-SMI)),-C/ Material! can a%!or% electro"agnetic radiation !uch a! light@ )he de=inition o= tran!"ittance through a "aterial >ith concentration C i! Io
Concentration C

T =

I Io

>here

I S Output Inten!it( Io S Input Inten!it(

,BSO.B,-C/ )he a%!or%ance %( the "aterial i! de=ined a! the log o= the inBer!e o= tran!"ittance
1 ! = log T

= log91: log9T :

= log9T :

I ! = log Io

APPENDIX 2
B//.53,MB/.) 3,8

, Io IiIizIz Iz I I Iz5dI I

; B

d;' dI

)he Beer53a"%ert "odel can %e deriBed =or a "aterial o= a%!or%ing !pecie!@ Fir!t con!ider the a%!orption dI' o= an in=inite!i"al cro!!5!ectional !la% o= "aterial o= thicHne!! d;@ )he total length o= the path o= the "aterial i! B >ith a total cro!!5!ection o= ,@ )he inten!it( i! Io at ;S0 and I at the =ull length o= the "aterial@ )he inten!it( at ; i! Iz@ )he inten!it( a=ter the a%!orption dI i! 9Iz C dI:@ Con!ider a "olecular cro!! !ection o= 9c"2:@ I= there i! a concentration o= - 9"ol$c"2: a%!or%er! in thi! "olecular cro!! !ection@ )hen the total a%!or%ed light on thi! in=inite cro!!5!ectional !la% >ould %e
7 - 7 , 7 d; 9c"2: 7 9b "ol$c"3: 7 9c"2: 7 9c": S b"ol7c"2

)he =raction o= photon! a%!or%ed acro!! thi! !ur=ace area , i!


7 - 7 , 7 d; $ , S 7 - 7 d; 9b"ol:

)he =raction o= the photon! a%!or%ed acro!! dz %eco"e!' 5 7 - 7 d; S dI$Iz

Integrating %oth !ide!'


1 dI = N dZ I 0 0 ln9 I : ln9 Io: = NB I ln = NB Io
I B

.e"e"%er that a%!or%ance i! eGual to the le=t !ide o= the eGuation' and then the eGuation %eco"e!

, S -B

Since - 9"olecule!$c"3: 791 "ol$&@023x1023 "olecule!: 7 1000 c"3$liter S c 9"ol$liter:

and 2@303 7 log9x: S ln9x: then' or'


I log = 7 9&@023 #10 20 $ 2@303: 7 c 7 " Io

! = "c

>here' S 7 9&@023 x 1020$2@303: S 7 92@&1 7 1020: So'


I ! = log = "c Io

Beer53a"%ert 3a>

APPENDIX 3
O<12/- S,)U.,)IO0e"oglo%in i! the pri"ar( co"ponent that carrie! ox(gen =ro" the lung! to the re!t o= the %od( Bia pa!!age! called arterie!' Bein! and capillarie!@ It i! a protein that i! %ound to the red %lood cell!@ Ox(gen i! che"icall( co"%ined >ith the he"oglo%in in!ide o= the red %lood cell! and "aHe! up nearl( all the ox(gen pre!ent in the %lood@ )he a%!orption o= Bi!i%le light at di==erent =reGuencie! %( he"oglo%in Barie! >ith ox(genation a! can %e !een in Figure 1 9)0/O.1 !ection:@ )>o =or"! o= the he"oglo%in "olecule are oxidized 90%O2: and reduced he"oglo%in 90%:@ )he ox(gen !aturation i! de=ined' a! SaO2 9SPO2: and ! a =unction o= the concentration o= the t>o =or"! o= he"oglo%in in the %lood
Ko Ko + Kr

S$O 2 =

8here' 4o S Concentration o= 0%O2 4r S Concentration o= 0%

,rterial SpO2 i! a para"eter "ea!ured >ith Oxi"etr( and i! nor"all( expre!!ed a! a percentage@ Under nor"al condition!' arterial %lood i! J#O !aturated >hile Benou! %lood i! #KO !aturated@ )he >aBelength range &00n" C 1000n" i! the range =or >hich there occur! the lea!t a"ount o= attenuation o= light %( %od( ti!!ue %ecau!e ti!!ue and pig"entation a%!or% %lue' green and (ello> light and >ater a%!or%! the longer in=rared >aBelength@ )he Ox(gen Saturation 9SPO2: o= the arterial %lood "a( %e deter"ined %( "ea!uring the tran!"itted light through the =ingertip or earlo%e at t>o di==erent >aBelength! and then co"pared ratio"etricall(@ )he t>o >aBelength! that %e!t !uit thi! t(pe o= "ea!ure"ent are ./D 9&&0n": and I-F.,./D 9JL0n":@ ,ccording to the Beer53a"%ert la> there i! a linear relation!hip %et>een the a%!or%ance and concentration o= each co"ponent o= the %lood at that particular =reGuenc( o= light@ ,l!o' the inten!it( o= the light >ill decrea!e logarith"icall( >ith the path length@

Io

; Suppo!e >e had a !ource o= length ; >ith incident light inten!it( Io and tran!"itted inten!it( o= I@ I= there >ere t>o !pecie! o= a%!or%er! called 0%O2 9./D: and 0% 9Blue: >ith the concentration! 4o and 4r re!pectiBel(@ )he!e are analogou! to ox(genated he"oglo%in and reduced he"oglo%in@ -o> !uppo!ed >e exa"ine the !peci"en u!ing t>o light !ource! 1 and 2@

U!ing Beer53a"%ert la>' at each >aBelength' >e get ,t 91: ,t 92 :


I1 = I 0110 9O1K O +r 1K r : Z I 2 = I 0210 9O 2 K O + r 2 K r : Z

8here 40 S concentration o= he"oglo%in 41 S concentration o= reduced he"oglo%in o1 S a%!orption coe==icient o= 0%O2 at 1 r1 S a%!orption coe==icient o= 0% at 1 o2 S a%!orption coe==icient o= 0%O2 at 2 r2 S a%!orption coe==icient o= 0% at 2 8riting %oth eGuation! in log =or"
I1 log I = 9O1 K O + r1 K r : Z 01 expre!! %oth =unction! a! the ratio 9.:@ I2 8e can log I = 9 O 2 K O + r 2 K r : Z 02

I1 log I K + K 01 r1 r R= = O1 O I 2 O2 KO + r 2 Kr log I 02

R ==

O1 K O + r1 K r O2 KO + r 2 K r

)hen !olBing =or 4r' Su%!tituting thi! into the eGuation =or SaO2 (ield!
Kr = KO R O 2 O1 r1 R r 2

S$O2 =

R r 2 r1 R9 r 2 O 2 : 9 r1 O1 :

8here

I1 log I 01 R= I2 log I 02

Belo> i! a graph o= the a%oBe eGuation !ho>ing the theoretical Balue!@ )he !econd trace !ho>! an actual cali%ration u!ing arterial %lood !a"ple!@ )hi! i! the curBe =or the 0P M11J0, pro%e@ )he di==erence ha! %een =ound to %e cau!ed "ainl( %( !cattering e==ect! and non5ideal light !ource!@

U!ing Matla%' anal(zing the graphical data a%oBe' data =ro" the real cali%ration curBe !ho>n a%oBe >a! extracted into Bector =or"@ )he data >a! input into Micro!o=t excel and =it to a 3rd order eGuation@ It i! thi! eGuation >hich expre!!e! SpO2 S = 9.: that >a! u!ed in thi! proMect@ )he graph o= thi! data and the =it eGuation are !ho>n %elo>@

APPENDIX 4 OUTPUT DATA


)he thee photograph! %elo> !ho> graph! o= the data that >a! collected =ro" the COM port@ In re=erence to S81 on the de"o %oard' each ti"e it i! pre!!ed' a di==erent group o= data i! !ent out the port@ )he data con!i!t! o= progra" Baria%le!@ 2.OUP 1 .Filt .[DC I.Filt 5 5 5 3P Filtered ./D 3ed Mea!ured Inten!it( 9red: DC 3eBel =or ./D 3ed Mea!ured Inten!it( 9%lacH: 3P Filtered I. 3ed Mea!ured Inten!it( 9%lue:

I.[DC

DC 3eBel =or I. 3ed Mea!ured Inten!it( 9red:

2.OUP 2 I.Di== dI.Filt

5 5

3P Filtered' I. ,C !ignal 9red: Di==erentiated 3P Filtered I. data 9%lacH:

PeaH

Output o= the PeaH Follo>er ,lgorith" 9%lue:

2.OUP 3 BPM SPO2

5 5

0eart .ate in %eat!5per5"inute 9red: Ox(gen Saturation in Percent 9%lacH:

APPENDIX 5

B3OC4 DI,2.,M
POWER ON/OFF
1 3

VB LM7805 VOLTAGE REGULATOR

LONG LIFE BATTERY

VDD

9V

MICOCHIP 16 B!" 28 P!# $"%&"'& B(%&) *TFRE+ , 7-3728MH. PLLMODE , 16 F/0 , *TFRE+1PLLMODE/2 , 29-2912MH3 CLOC4

R$ E R/1W DI$PLAY
2 LINE 6 8 A$CII CHARACTER P/N5 HDM08216H 3 $00$ MFG5 HANTRONI* INC-

RF2 RF5

O U T P U T $ DIGITAL I/O

RB3 O U T P U T $ RB7 RB6 RB5 RB2 RB1 VR(# VIR(# U1AT6 U1AR6 DATA TO PC
1 6 2 7 3 8 2 9 5 P1 $ERIAL R$ 232 57-64=N=8=1

D7 D6 D5 D2

RD9
$W1

INPUT

RB0

RC12

$ERIAL/UART0

RC13 PE1

29-2912MH3

/256 PRE$CALER

115-24H. $AMPLE CLOC4 9100 H.:

16 BIT TIMER T1

PR1 , 576

5;< I#"'&&78"

INPUT CAPTURE IC1

RD8/IC1

INTERRUPT ROUTINE READ$ TIMER

TRIGGER$ INTERRRUPT ROUTINE WHICH I$ $ET UP A$ A $TATE MACHTHI$ $TATE MACHINE MULTIPLE*E$ AND $E+UENCE$ THE LED LIGHT $OURCE$- IT AL$O $ET$ UP TIMER T2 AND INPUT CAPTURE IC1 TO MEA$URE THE TAO$ LTF OUTPUT IN THE FORM OF A PERIODTHE$E PERIOD$ ARE CONVERTED TO FRE+UENCIE$ WHICH ARE PROPORTIONAL TO THEIR CORRE$PONDING LED INTEN$ITYTHE PROGRAM U$E$ THE INTEN$ITY $AMPLE$ TO DETERMINE HEART RATE AND O*YGEN $ATURATION-

16 BIT TIMER T2

RF3/$DO1 RF6/$C41 RB2/1$$1

$ERIAL PERIPHERAL INTERFACE 9$PI:

DUAL LED EMITTER$ PDI E835 API

MICROCHIP MCP2822 DUAL 8BIT VOLTAGE OUTPUT DAC

MCP607 \ DUAL OP AMP APPENDIX 6 DRIVER$

MICRCHP

SC0/M,)IC DI,2.,M

CENTRAL $EMIMP+6002 +UAD PAC4 *I$TOR

IRED

RED

TAO$ T$L235R L/F $EN$OR FINGER

ON

OFF 3

ME33ANINE BOARD MICROCHIP INTERFACE


P2 1MCLR RB0 RB1 RB2/1$$1 RB3 RB2 RB5 GND RC13/U1AT* RC12/U1AR* VDD RD9/IC2 1 2 3 2 5 6 7 8 9 10 11 12 13 12 28 27 26 25 22 23 22 21 20 19 18 17 16 15 LM7805 RB6 RB7 RB8/OC1 RB9/OC2 RF2 RF5 VDD GND RF2 RF3/$DO1 RF6/$C41 RD8/IC1 FRONT C2 0-1 C3 1 C2 0-1 C1 1 VB VDD VO VI

$W1 EG2277 E$>!"/? BT1 9V 2324 4EY$TONE

G N D

U1 LM7805 FAIRCHILD

2N3902 BOTTOM

A$'# VDD @5V 1

RD8 V! G V( C B E VB R2 1-14 +2 2N3902 R5 54 R6 54

F(

FEMALE5 PPTC122LFBN RC MALE5 PEC12DAAN $ULLIN$ R8 1-24

0V

TO $EN$OR

RB0

VIR(#

LEDI R3 1-14

DI$PLAY
P1 104 *262R103 CT$ DI$P GND RB3 RB2 RB6 VL R/1W D2 D6 1 3 5 7 9 11 13 15 2 2 6 8 10 12 12 16 R$ E D5 D7 VDD RF5 RF2 RB5 RB7 RB1 VR(# R7 1-24 +1 2N3902

LEDR

2 HEADER5103361-3 AMP

1 2

1 3

1 2

1 1

1 0

VDD

U2 MP+6002 CENTRAL $EMI

C5 0-1 U2B MCP607 MICROCHIP 7

MALE5 PEC08DAAN FEMALE5 PPTC082LFBN RC $ULLIN$ 5 6 VDD U3 MCP2822 MICROCHIP RB2/1$$1 RF6/$C41 RF3/$DO1 1 2 3 2 C6 0-1 VDD 1C$ $C4 $DI VOA GND VOB 1LDAC 8 7 6 5

8 2 3 1 U2A MCP607 MICROCHIP 2

R1 20

R2 20

RC12/U1AR* RC13/U1AT* VDD C9 1 C7 1 C8 1 C10 1 U1 C1@ V@ C1 C2@ C2 V T2OUT R2IN MA*232 TI VCC GND T1OUT R1IN R1OUT T1IN T2IN R2OUT AC(;; 16 15 12 13 12 11 10 9 T6D R6D GND 1 2 3 HEADER5103361-1 AMP

1 2 3 2 5 6 7 8

R$232 COMM PORT

ENCLO$URE5 TBD $EN$OR CABLE


@5V A<'# 1 2 3 2 5 F( 2 0V LEDR LEDI BLOC45102221-3 TERM5876672 AMP EMT1 PDI E832 R) 660#; 1-8V 20;% IR 905#; 1-2V 20;% API GND T$L235R TAO$ 1

$EN$OR
U1 VDD FOUT 3

AC(;; 1 2 3 T6D R6D GND

R$ 232 CABLE

T6D R6D

BLOC45102221-1 TERM5876672 AMP

GND

1 6 2 7 3 8 2 9 5

I R6D T6D

VELCRO

NOTE$5

( R';(B' 0 (?; &'<!<"(& C7;8'&< R12 R17 D&(; ;!/&(8&(/'<<(& E(%&)( D!<8F%0 7<') !< H%#"&(#!6 P/N5 HDM08216H 3 $00$( A# E#/F(<7&' ?%< #(" 0'" E''# /?(<'# D(& "?!< 8&("("08'-

APPENDIX 7

GND R$232 17$DE09$ AMPHENOL

M/;;,I-I/ BO,.D 3,1OU)

0-2

1-9 3 1

2-72

0-6

3-2 0-2 0-2

DENOTE$ DRILL HOLE

APPENDIX 8
BI33 OF M,)/.I,3

M/;;,-I-/ BO,.D 6t( ./F P$MF2 555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 1 B)1 23L4 4/1S)O-/ 1 C1 1 2/-/.IC 1 C2 @1 2/-/.IC 1 C3 1 2/-/.IC 1 CL @1 2/-/.IC 1 CK @1 2/-/.IC 1 C& @1 2/-/.IC 1 C# 1 2/-/.IC 1 C* 1 2/-/.IC 1 CJ 1 2/-/.IC 1 C10 1 2/-/.IC 1 DISP M,3/ P/C0*D,,SU33I-S F/M,3/ PP)C0*23FB-5.C SU33I-S 1 DCo"" 0/,D/. 1033&1@1 ,MP 1 DSen 0/,D/. 1033&1@3 ,MP 1 P1 104 <2&2.103 C)S 1 P2 F/M,3/ PP)C1L23FB-5.C SU33I-S M,3/ P/C1LD,,SU33I-S 1 61 2-3J0L 2/-/.IC 1 62 2-3J0L 2/-/.IC 1 .1 20 2/-/.IC 1 .2 20 2/-/.IC 1 .3 1@14 2/-/.IC 1 .L 1@14 2/-/.IC 1 .K K4 2/-/.IC 1 .& K4 2/-/.IC 1 .# 1@24 2/-/.IC 1 .* 1@24 2/-/.IC 1 .S232 1#SD/0JS ,MP0/-O3 1 S81 /22L## /S>itch 1 U1 M,<232 )I 1 U1 3M#*0K F,I.C0I3D 1 U2 MP6&002 C/-).,3 S/MI 1 U3 MCPL*22 MIC.OC0IP 1 UL MCP&0# MIC.OC0IP

APPENDIX 7
BI33 OF M,)/.I,3 5 Continued

S/-SO. 6t( ./F P$MF2 555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 1 U1 )S323K. ),OS 1 /M)1 PDI5/*32 ,PI

Вам также может понравиться