CẢM BIẾN NHỊP TIM - PULSE SENSOR
Dữ liệu nhịp tim có thể rất hữu ích lúc bạn thiết kế 1 lịch trình tập luyện thể thao, nhi!n c"u h#nh $%n ho&c m"c $% lo l'n hay $(n i)n l# l#m *#i bón $+n chp chp th-o nhịp tim c.a bạn /D 0ấn $ l# nhịp tim rất khó $ể $o $ạc2 3ay m'n thay, 4)m biến nhịp tim 5 6ul7- 8-n7or có thể i)i 9uyết *ấn $ n#y: 6ul7- 8-n7or l# c)m biến nhịp tim ;ạn c'm5l#5chạy
r;uino2 ?ó $@Ac 7B ;Cn bi EFc 7inh, 8inh *i!n, 0ận $%n *i!n, ?h# phGt triển "n ;Cn *# thiết bị ;i $%n 5 nhữn n@Hi muIn kết hAp nhịp tim thJc *#o ;J Gn m%t cGch ;K ;#n2 0 c( b)n thì nó bao Lm 1 c)m biến 9uan $Fc nhịp tim, 1 b% khuếch $ại *# khB nhiKu $@Ac kết nIi *i nhau l#m *iệc $Fc nhịp tim tr n!n nhanh chón *# $Gn tin cậy2 Mh!m *#o $ó, nó ti!u tIn ;Nn $iện chO Pm> Q0 n!n nó l# 1 Ai R tuyệt *Hi cho "n ;Cn ;i $%n2 S(n i)n chO cTn cTn kUp m&t c)m biến *#o $Tu nón tay *# c'm nó *#o V 5 Q0 c.a >r;uino, co;- *#i ;Nn, *ậy l# bạn $W 7Xn 7#n $Fc nhịp tim rLi $ấy: 4o;- M-7t/ YZ [\?E ]\^? S\^? M_ 86\D` -b7it-/ -b7it-/ Di-ntu7pi;-r Di-ntu7pi;- r2com [ic-n7-/ Mhi7 co;- i7 or 6ul7- 8-n7or >mp-; by do-l 3urphy an; eury eury fitman [`D chgn chgn 1V 7 chp nhGy th-o mi nhịp tim [`D chgn Q 7 7Gn5mH th-o nhịp tim ZY YY ]hai bGo biến int pul7-6in j chgn > c.a >r;uino int blink6in j 1V int a;-6in j Q int a;-at- j a;-6in
YY Dgy tín hiệu c.a 6ul7- 8-n7or nIi *#o YY [`D nhGy mi nhịp tim YY [`D a;- mi nhịp tim YY 7B ;Cn $ể a;- [`D *i 63 chgn
YY iến 0olatil- 7B ;Cn tron int-rrupt *olatil- int 63 YY 7I nhịp tim mi phút *olatil- int 8inal YY ;ữ liệu th *olatil- int \\ j YY thHi ian iữa cGc nhịp *olatil- bool-an 6ul7- j al7- *olatil- bool-an q8 j al7- *olatil- int rat-1s *olatil- un7in-; lon 7ampl-4ount-r j *olatil- un7in-; lon la7t-atMim- j *olatil- int 6 jQ1 *olatil- int M j Q1 *olatil- int thr-7h j Q1 *olatil- int amp j 1 *olatil- bool r7t-at j tru- *olatil- bool-an 7-con;-at j tru- *oi; 7-tup<= v pin3o;-
*oi; loop<= v 7-n;DataMo6roc-77in
*oi; 7-n;DataMo6roc-77in j | YY D\8>[` D\8>[ ` 63 w? D\f\M>[ 6\?8 V >?D 11, >?D fw \?Mw 4M4 3wD` M44 j | YY Dw?zM {w4` 4w36>`, Q 6`84>[` w4> j •€4 YY 8`M ME` Mw6 w{ ME` 4wx?M Mw 1P {w QE~ 8>36[` >M` M\38] j | YY `?>[` \?M`x6M w? 3>M 3>M4E `M``? M\3` >?D w4> w4> 7-i<= YY 3>]` 8x` f[w>[ \?M`x6M8 >` `?>[`D YY ME\8 \8 ME` M\3` \?M`x6M 8`0\4` wxM\?`2 YY Mim-r mak-7 7ur- that }- tak- a r-a;in -*-ry mili7-con;7 \8*-ct=v >*-ct=v YY tri-r-; }h-n Mim-r count7 to 1P cli<= YY ;i7abl- int-rrupt7 }hil- }- ;o thi7 8inal j analo-a;
}a*-
YY k--p track o hih-7t point in pul7-
YY ?w \Mz8 M\3` Mw [ww] {w ME` E`>M `>M YY 7inal 7ur-7 up in *alu- -*-ry tim- th-r- i7 a pul7i … Q=v YY a*oi; hih r-9u-ncy noi7i < <8inal … thr-7h= „„ <6ul7- jj al7-= „„ … <\\YQ=ZV= =v 6ul7- j tru- YY 7-t th- 6ul7- †a }h-n }think th-r- i7 a pul7;iitalrit-
YY 7hit ;ata in th- rat- array YY an; ;rop th- ol;-7t \\ *aluYY a;; up th- ‡ ol;-7t \\ *alu-7
rat-‡s j \\ YY a;; th- lat-7t \\ to th- rat- array runninMotal ‚j rat-‡s YY a;; th- lat-7t \\ to runninMotal runninMotal Yj 1 YY a*-ra- th- la7t 1 \\ *alu-7 63 j YrunninMotal YY ho} many b-at7 can t into a minut-‰ thatz7 63: q8 j tru- YY 7-t quanti-; 8-l †a YY q8 {[>f \8 ?wM 4[`>`D \?8\D` ME\8 \8
i <8inal ƒ thr-7h „„ 6ul7- jj tru-=v YY }h-n th- *alu-7 aroin ;o}n, th- b-at i7 o*-r ;iitalrit-
YY -nabl- int-rrupt7 }h-n your- ;on-:
M#i liệu * 6ul7- 8-n7or/ http7/YYpul7-7-n7or2comYpa-7Ypul7-57-n7or5amp-;5ar;uino5*1;ot1 Hear tBeatMoni t or i ngoverI nt er netusi ngAr dui noandThi ngSpeak
t Beat Det ect i on and I nt hi s pr oj ect we ar e goi ng t o make aHear Moni t or i ngSyst em usi ngAr dui no t hatwi l ldet ec tt hehear tbeatus i ngt he
Pu l s eSe ns o ra ndwi l ls h ow t h er e ad i n gsi nBPM ( Be at sPe rMi n ut e )o nt h e L CD c onnec t edt oi t .I twi l lal s os endt her eadi ngst o Thi ngSpeaks er v er usi ng t he Wi Fimodul eESP8266,sot hatHear tBeat scan be moni t or ed ngSpeaki f r om any wher ei nt hewor l dov ert hei nt er net .Thi sagr eats our c e
f ordi s pl a y i ngt hedat aonl i neandy ouc anac c es st hedat af r om Thi ngSpeak atan yt i meandatan ypl ac e. Weha v epr e vi ous l ybui l tas i mp l eHe ar tBe atMo ni t o r wi t houts ho wi ngdat a o nI n t er n et .Thi st i meweha v eu s edTh i ng Spe akt omoni t ort hes y s t e mo v er i nt er net ,andt hi swi l l putt hi spr oj ec ti nt oI OTc at egor y . Component sRequi r ed : •
Pul sesensor
•
Wi Fimodul eESP8266
•
Ar dui noUno
•
LCD
•
Br eadBoar d
•
10kpot ent i omet er
•
1kr es i s t or s
•
220ohm r es i s t or s
•
LED
•
Connec t i ngwi r es
Ci r c ui tDi a gr a ma ndEx pl a na t i on: t ht heAr dui no.ESP8266r Fi r s tofal lwewi l lc onnec tt heESP8266wi uns
on3. 3Vandi fy ouwi l lgi v ei t5Vf r om t heAr dui not heni twon’ twor kpr oper l y andi tmaygetdamage.Connectt heVCCandt heCH_PDt ot he3. 3Vpi nof Ar d ui n o.Th eRXp i no fESP8 26 6wo r k so n3 . 3 Va ndi twi l lno tc o mmu ni c a t e wi t ht heAr dui nowhenwewi l lc onnec ti tdi r ec t l yt ot heAr dui no.So,wewi l l hav et omak eav ol t agedi v i derf ori twhi c hwi l lc onv er tt he5Vi nt o3. 3V.Thi s c anbedonebyc onnec t i ngt hr eer es i s t or si ns er i esl i k ewedi di nt hec i r c ui t . Connectt heTXpi noft heESP8266t ot hepi n9oft heAr dui noandt heRX pi noft heESP8266t ot hepi n10ofAr dui not hr ought her es i s t or s .
cesst oWi Fiori nt er net ESP8 26 6Wi Fimo du l eg i v e sy o urp r o j e c t sac .I ti s
av er y cheap devi ce and make yourpr oj ect sv er y power f ul .I tcan c ommuni c at ewi t han ymi c r oc ont r ol l erandi ti st hemos tl eadi ngdev i c esi n t h eI OTpl at f or m.L ea r nmo r eab ou tu s i n gESP8 26 6wi t hAr d ui n oh er e. Thenconnectt hePul .Thec onnec t i onsoft he seSensorwi t ht heAr dui no p ul s es e ns o ra r ev e r ye as y .Pu l s es e ns o rh a st h r e ep i n s .Co nn ec t5 Va nd t hegr ou ndpi noft hep ul s es ens ort ot he5 V an dt heg r ou ndoft heAr du i no andt hes i gnal pi nt ot heA0ofAr dui no.
Thenconnectt heLED t opi n13ofAr dui no.Youdonothavet oconnecta r es i s t orwi t hbec aus et heAr dui nohasbui l ti nr es i s t oratpi n13. I nl as t ,wewi l l c o nn ec tL CD wi t ht h eAr d ui n o.Th ec o nn ec t i o nso ft h eL CD ar easf ol l ows •
Co nn ec tp i n1( VEE)t ot h eg r o un d.
•
•
•
•
•
•
Connectpi n2( VDDorVCC)t ot he5V. Co nn ec tp i n3( V0 )t ot h e mi d dl ep i no ft h e1 0K p ot e nt i o me t e ra nd c o nn ec tt h eo t h ert woe nd so ft h ep ot e nt i o me t e rt ot heVCC a ndt h eGND. Th ep ot e nt i ome t e ri su s ed t oc o nt r o lt h es c r e en c o nt r a s to ft h eL CD. Pot ent i omet erofv al uesot hert han10Kwi l l wor kt oo. Connec tpi n4( RS)t ot hepi n12oft heAr dui no. Con nec tp i n5( Rea d/ Wr i t e)t ot h e gr ou ndofAr du i no .Thi spi ni sno t of t enus eds owewi l l c onnec ti tt ot hegr ound. Con nec tp i n6( E)t ot h epi n11oft heAr du i no.TheRSan dEpi nar et he c ont r olpi nswhi c har eus edt os enddat aandc har ac t er s . Thef o l l o wi ngf o urpi nsa r eda t api n swhi c har eus e dt oc ommuni c at e wi t ht heAr dui no. Connec tpi n11( D4)t opi n5ofAr dui no. Connec tpi n12( D5)t opi n4ofAr dui no. Connec tpi n13( D6)t opi n3ofAr dui no. Connec tpi n14( D7)t opi n2ofAr dui no.
•
•
Con nec tpi n1 5t ot heVCC t hr o ught h e220oh mr es i s t or .Th er es i s t or wi l lbeus edt os ett hebac kl i ghtbr i ght nes s .L ar gerv a l ueswi l lmak et he bac kl i ghtmu chmor eda r k e r . Co nn ec tp i n16t ot h eGr o un d.
Thi ngSpeakSet up:
r o v i de sv e r yg ood t oo lf orI o T ba sed pr oj e ct s .By usi ng Thi ngSpeakp Th i ng Speaks i t e,wec a nmoni t o ro urd at aan dc ont r o lou rs y s t em o v ert h e I nt er net ,us i ng t he Channel s and webpages pr ovi ded by Thi ngSpeak. Col l ect s’t Thi ngSpeak‘ he dat a f r om
Anal yz e and t he s ens or s ,‘
Vi sual i z e’ Act s’ t hedat aand‘ b yt r i gger i ngar eac t i on.Wehav epr ev i ous l y
used Thi ngSpeaki nWe at he rs t at i o n pr oj ec tu s i ngRa s pber r yPi andus i ng Ar dui no,checkt hem t ol ear nmor eaboutThi ngSpeak.Her ewear ebr i efly o THe ar tBe atMoni t or i ngPr oj e ct . e xpl ai ni ngt ous eThi ngSpeakf ort hi sI gn Fi r s tofal l ,us erneedst oCr eat eaAc c ountonThi ngSpeak . c om,t henSi I na ndc l i ckonGe tSt a r t e d.
eat eanew channel Af t erc r eat i nganac c ount ,got oc hannel sandcr .Now
wr i t et henameo ft heCh ann ela ndna meo ft heFi e l ds .Al s ot i c kt hec hec k bo xf or‘ Mak ePubl i c ’opt i onbel o wi nt hef or m andfi nal l ySa v et heChannel . Nowyournew channelhasbeencr eat ed.
Af t ert hi sgot oAPIk ey sandc opyy ourWr i t eAPIk ey .Youwi l lneedt hi si n lCode t h ec o de .Ch ec kt h eFul att heend.
Wor ki ngExpl anat i on:
Fi r s twenee dt oat t ac ht hePul s eSens ort oa nyor g anofbo dywher ei tc an de t ec tt hepul s e eas i l yl i k efi nger ,c hec kt he v i deo bel ow.Then t he Pul s e Se ns orwi l lmeas ur et hec hangei nv ol umeofb l ood ,whi c ho c cu r swhenev e r y n vol ume ofbl ood t i me hear tpumps bl ood i nt he body.Thi schange i c aus esac ha ngei nt hel i ghti nt e ns i t y t hr ought hator gan.TheAr dui nowi l l
t h en c o nv e r tt h i sc h an ge i n t ot h eh ear tb ea tp ermi n ut e( BPM) .Th eL ED c onnec t edatpi n13wi l l al s obl i nkac cor di ngt heHear tBeat .
TheESP82 66wi l lt h enc o mmun i c at ewi t ht heAr dui noandwi l ls endt hed at a t oThi ngSpeak .TheESP8266wi l lc onnec tt hene t wor kofy ourr out ert haty ou wi l lpr ov i dei nt hec odeandwi l ls endt hedat aoft hes ens oronl i ne.Thi sdat a o nt h eTh i n gSp ea kwi l lb es h owni naGr a phf o r ms h owi n gt h ep as tr ea di n gs t ooandcanbeaccessedf r om anywher eoveri nt er net .TheLCD connect ed wi l l a l s os ho wy o ut h eBPM.
CodeExpl anat i on:
Fi r s tofal l ,addt hel i br ar i es .Sof t war es er i all i br ar yi sf orenabl i ngt heRXand TXa tp i n9a ndp i n1 0.Th ed ef au l tRXa ndTXp i n so fAr d ui n oar ep i n0a nd 1 buti fy ou wantt o enabl ei tato t herp i nst haty o u wi l lha v et o us et he s of t war e s er i al l i br ar y . Then i ni t i al i z e t he l i qui d c r y s t al l i br ar y Li qui dCr y st al . h) ( an dd ec l a r et h ep i n sa twh i c hy o uh av ec on ne c t e dt h eL CD.
#i nc l ude #defi neDEBUG t r ue Sof t war eSer i al es p8266( 9, 10) ; #i nc l ude
#i nc l ude Li qui dCr y st all c d( 12, 11, 5, 4, 3, 2) ; En t e rt h eWi Fin ame ,p as s wo r dan dI Pa dd r e s sofESP8 26 6.Th enen t e rt h e APIk e yf r om Thi ngSpeakt haty ous a v edear l i er . #defi neSSI D" YourWi fiName" #definePASS" YourWi fiPasswor d" # de fi neI P" 1 84 . 1 06 . 1 53 . 1 49 " St r i ngmsg=" GET/ updat e?ke y=9YS21NU0HY5YS1I KU" ; Thef ol l owi ngc odewi l ls t ar tt heL CD andwi l ls ett hebaudr at e.Ent ert he b au dr a t eac c o r d i ngt oy ou rESP8 26 6.Ev e r yESP8 266ha si t so wnbau dr a t e . Somehavebaudr at eof9600,somehave115200orot her . v oi ds et up( ) { l c d. begi n( 16,2) ; l c d. pr i nt ( " c i r c ui t di ges t . c om" ) ; del ay ( 100) ; l c d. s et Cur s or ( 0, 1) ; l c d. pr i nt ( " Connec t i ng. . . " ) ; Ser i al . begi n( 9600) ;/ / orus edef aul t115200. es p8 266. begi n( 9 600) ; Ser i al . pr i nt l n( " AT" ) ; es p8266. pr i nt l n( " AT" ) ;
del a y( 5000) ; i f ( es p8266. fi nd( " OK" ) ) { connec t Wi Fi ( ) ; } i nt er r upt Set up( ) ; } oi dupdat ebeat ( ) Fol l owi ngf unc t i onv wi l ls endt hedat aatt heI Paddr es st hat
wehav eent er edandal s owi l l s ett hedat ai nt hefi el dwes etf orhear tbeat . v oi dupdat ebeat ( ) { St r i ngc md=" AT+CI PST ART=\ " TCP\ " , \ " " ; c md+=I P; c md+=" \ " , 80" ; Ser i al . pr i nt l n( c md) ; e sp8266. pr i nt l n( c md) ; del a y( 2000) ; i f ( es p8266. fi nd( " Er r or " ) ) { r et ur n; } c md=ms g; c md+=" &fi e l d 1=" ; c md+=BPM;
. . . . .. . . . . . . . . . .. . . . . Thef ol l o wi ngc odewi l lc onnec tt heESP8266wi t ht heWi Finet wor kt haty ou ent er ed ear l i erand t hen i twi l lus et hi s ne t wor kt os end t he dat at ot he Thi ngSpeak. bool eanc onnec t Wi Fi ( ) { Ser i al . pr i nt l n( " AT+CWMODE=1" ) ; esp8266. pr i nt l n( " AT+CWMODE=1" ) ; del a y( 2000) ; St r i ngcmd=" AT+CWJAP=\ " " ; cmd+=SSI D; cmd+=" \ " , \ " " ; cmd+=PASS; c md+=" \ " " ; . . . .. . . . . . . . . .. . . . . Thef ol l owi ngc odewi l lr eadt hes ens orandwi l lc onv er tt heout putoft he s ens ori nt ohear tbeatpermi nut e( BPM) .I twi l lal s obl i nkt heLED c onnec t ed att hep i n1 3ac c or di ngt ot h eBPM. I SR( TI MER2_COMPA_v ec t ) { cl i ( ) ; Si gnal=a nal ogRead( pul s ePi n) ;
sampl eCount er+=2; i ntN=s ampl e Count e r-l as t Bea t Ti me; i f ( Si gnal ( I BI / 5) * 3) { i f( Si gnal
Œinclu;- ƒ8ot}ar-8-rial2h… Œ;-n- D`xf tru8ot}ar-8-rial -7pˆ<‡,1= Œinclu;- ƒ[i9ui;4ry7tal2h… Œinclu;- ƒ7t;lib2h… [i9ui;4ry7tal lc;<1,11,Q,P,V,= Œ;-n- 88\D eour i ?am- YY 88\D5i{inam- Œ;-n- 6>88 eour i 6a77}or; YY pa77}or; Œ;-n- \6 1ˆP2121QV21P‡YY thin7p-ak2com ip 8trin m7 j f`M Yup;at-‰k-yj‡e81?xEeQe81\]x YYchan- it }ith your api k-y lik- f`M Yup;at-‰k-yjeour >pi ]-y YY0ariabl-7 †oat t-mp int hum 8trin t-mp4 int -rror int pul7-6in j YY 6ul7- 8-n7or purpl- }ir- conn-ct-; to analo pin int blink6in j 1V YY pin to blink l-; at -ach b-at int a;-6in j Q int a;-at- j YY 0olatil- 0ariabl-7, u7-; in th- int-rrupt 7-r*ic- routin-: *olatil- int 63 YY int that hol;7 ra} >nalo in 2 up;at-;
-*-ry m8 *olatil- int 8inal YY hol;7 th- incomin ra} ;ata *olatil- int \\ j YY int that hol;7 th- tim- int-r*al b-t}--n b-at7: 3u7t b- 7--;-;: *olatil- bool-an 6ul7- j al7- YY Mru- }h-n h-artb-at i7 ;-t-ct-;2 {al7- }h-n not a li*- b-at2 *olatil- bool-an q8 j al7- YY b-com-7 tru- }h-n >r;uino n;7 a b-at2 YY -ar;7 8-rial wut6ut 55 8-t Mhi7 xp to your n--;7 7tatic bool-an 7-rial0i7ual j tru- YY 8-t to zal7-z by D-ault2 -5 7-t to ztru-z to 7-- >r;uino 8-rial 3onitor >84\\ 0i7ual 6ul7*olatil- int rat-1s YY array to hol; la7t t-n \\ *alu-7 *olatil- un7in-; lon 7ampl-4ount-r j YY u7-; to ;-t-rmin- pul7- timin *olatil- un7in-; lon la7t-atMim- j YY u7-; to n; \\ *olatil- int 6 jQ1 YY u7-; to n; p-ak in pul7- }a*-, 7--;-; *olatil- int M j Q1 YY u7-; to n; trouh in pul7- }a*-, 7--;-; *olatil- int thr-7h j QQ YY u7-; to n; in7tant mom-nt o h-art b-at, 7--;-; *olatil- int amp j 1 YY u7-; to hol; amplitu;- o pul7}a*-orm, 7--;-; *olatil- bool-an r7t-at j tru- YY u7-; to 7--; rat- array 7o }- 7tartup }ith r-a7onabl- 63 *olatil- bool-an 7-con;-at j al7- YY u7-; to 7--; rat- array 7o }- 7tartup }ith r-a7onabl- 63 *oi; 7-tup<= v lc;2b-in<1, = lc;2print<circuit;i-7t2com= ;-lay<1= lc;27-t4ur7or<,1= lc;2print<4onn-ctin222= 8-rial2b-in<‡= YYor u7- ;-ault 11Q2 -7pˆ2b-in<‡= 8-rial2println<>M= -7pˆ2println<>M= ;-lay
*oi; loop<=v lc;2cl-ar<= 7tart/ YYlab-l -rrorj lc;27-t4ur7or<, = lc;2print<63 j = lc;2print<63= ;-lay <1= lc;27-t4ur7or<, 1= YY 7-t th- cur7or to column , lin- ;-lay<1= up;at-b-at<= YY-7-n; i tran7mi77ion i7 not compl-t-; i <-rrorjj1=v oto 7tart YYo to lab-l 7tart ;-lay<1= *oi; up;at-b-at<=v 8trin cm; j >M‚4\68M>MjM46, cm; ‚j \6 cm; ‚j ,ˆ 8-rial2printlnM‚4\68`?Dj= -7pˆ2print<>M‚4\68`?Dj= 8-rial2printlnM‚4\64[w8`= -7pˆ2println<>M‚4\64[w8`= YY-7-n;222 -rrorj1
bool-an conn-cti{i<=v 8-rial2println<>M‚43wD`j1= -7pˆ2println<>M‚43wD`j1= ;-lay<= 8trin cm;j>M‚4d>6j cm;‚j88\D cm;‚j, cm;‚j6>88 cm;‚j 8-rial2println j | YY D\8>[` 63 w? D\f\M>[ 6\?8 V >?D 11, >?D fw \?Mw 4M4 3wD` M44 j | YY Dw?zM {w4` 4w36>`, Q 6`84>[` w4> j •€4 YY 8`M ME` Mw6 w{ ME` 4wx?M Mw 1P {w QE~ 8>36[` >M` M\38] j | YY `?>[` \?M`x6M w? 3>M4E `M``? M\3` >?D w4> 7-i<= YY 3>]` 8x` f[w>[ \?M`x6M8 >` `?>[`D \8*-ct=v YY tri-r-; }h-n Mim-r count7 to 1P cli<= YY ;i7abl- int-rrupt7 }hil- }- ;o thi7 8inal j analo-a;
}a* i<8inal … thr-7h „„ 8inal … 6=v YY thr-7h con;ition h-lp7 a*oi; noi76 j 8inal YY 6 i7 th- p-ak YY k--p track o hih-7t point in pul7}a*YY ?w \Mz8 M\3` Mw [ww] {w ME` E`>M `>M YY 7inal 7ur-7 up in *alu- -*-ry tim- th-r- i7 a pul7i … Q=v YY a*oi; hih r-9u-ncy noi7i < <8inal … thr-7h= „„ <6ul7- jj al7-= „„ … <\\YQ=ZV= =v 6ul7- j tru- YY 7-t th- 6ul7- †a }h-n th-ri7 a pul7;iitalrit-
runninMotal runninMotal Yj 1 YY a*-ra- th- la7t 1 \\ *alu-7 63 j YrunninMotal YY ho} many b-at7 can t into a minut-‰ thatz7 63: q8 j tru- YY 7-t quanti-; 8-l †a YY q8 {[>f \8 ?wM 4[`>`D \?8\D` ME\8 \8 i <8inal ƒ thr-7h „„ 6ul7- jj tru-=v YY }h-n th- *alu-7 aroin ;o}n, th- b-at i7 o*-r ;iitalrit-
Heartbeat Monitor Project using Arduino
Heart rate, bo;y t-mp-ratur- an; bloo; pr-77ur- monitorin ar*-ry important param-t-r7 o human bo;y2 Doctor7 u7- *ariou7 kin; o m-;ical apparatu7 lik- th-rmom-t-r or ch-ckin -*-r or bo;y t-mp-ratur-, 6 monitor or bloo; pr-77ur- m-a7ur-m-nt an; h-art rat- monitor or h-art rat- m-a7ur-m-nt2 \n thi7 proŽ-ct, }- ha*built an Arduino based eartbeat !onitor }hich count7 thnumb-r o h-artb-at7 in a minut-2 E-r- }- ha*- u7-; a eartbeat sensor !odu"e }hich 7-n7-7 th- h-artb-at upon puttin a n-r on th- 7-n7or2 Co!#onents 12 >r;uino 2 E-art -at 7-n7or mo;ulV2 1| [4D P2 6u7h button Q2 r-a; boar; 2 6o}-r €2 4onn-ctin }ir-7
$or%in& o' Heartbeat Monitor Pro(e)t orkin o thi7 proŽ-ct i7 9uit- -a7y but a littl- calculation or calculatin h-art rat- i7 r-9uir-;2 Mh-r- ar- 7-*-ral m-tho;7 or calculatin h-art rat-, but h-r- }- ha*- r-a; only *- pul7-72 Mh-n }- ha*- calculat-; total h-art b-at in a minut- by applyin thb-lo} ormula/
{i*-pu7l-tim-jtim-5tim-1 8inl-pul7-tim-j {i*-pu7l-tim- YQ rat-jY 8inl-pul7-tim-
}h-r- tim-1 i7 r7t pul7- count-r *alutim- i7 li7t pul7- count-r *alurat- i7 nal h-art rat-2 h-n r7t pul7- com-7, }- 7tart count-r by u7in tim-r count-r unction in ar;uino that i7 milli7<=2 >n; tak- r7t pul7- count-r *aluorm milli7<=2 Mh-n }- }ait or *- pul7-72 >t-r -ttin *- pul7-7 }- aain tak- count-r *alu- in tim- an; th-n }- 7ub7tarct tim-1 rom tim- to tak- oriinal tim- tak-n by *- pul7-72 >n; th-n ;i*i;- thi7 tim- by Q tim-7 or -ttin 7inl- pul7- tim-2 ?o} }ha*- tim- or 7inl- pul7- an; }- can -a7ily n; th- pul7- in onminut-, ;-*i;in m7 by 7inl- pul7- tim-2 at-j Y7inl- pul7- tim-2
\n thi7 proŽ-ct }- ha*- u7-; Heart beat sensor !odu"e to ;-t-ct E-art -at2 Mhi7 7-n7or mo;ul- contain7 an \ pair }hich actually ;-t-ct h-art b-at rom bloo;2 E-art pump7 th- bloo; in bo;y }hich i7 call-; h-art b-at, }h-n it happ-n7 th- bloo; conc-ntration in
bo;y chan-72 >n; }- u7- thi7 chan- to mak- a *olta- or pul7-l-ctrically2 Cir)uit *ia&ra! and E+#"anation
4ircuit o h-artb-at monitor i7 7ho}n b-lo}, }hich contain7 ar;uino uno, h-art b-at 7-n7or mo;ul-, r-7-t button an; [4D2 >r;uino control7 }hol- th- proc-77 o 7y7t-m lik- r-a;in pul7-7 orm E-art b-at 7-n7or mo;ul-, calculatin h-art rat- an; 7-n;in thi7 ;ata to [4D2 - can 7-t th- 7-n7iti*ity o thi7 7-n7or mo;ul- by inbuilt pot-ntiom-t-r plac-; on thi7 mo;ul-2
E-art b-at 7-n7or mo;ul-7 output pin i7 ;ir-ctly conn-ct-; to pin ˆ o ar;uino2 0cc an; f?D ar- conn-ct-; to 0cc an; f?D2 > 1| [4D i7 conn-ct-; }ith ar;uino in P5bit mo;-2 4ontrol pin 8, an; `n ar- ;ir-ctly conn-ct-; to ar;uino pin 1, f?D an; 112 >n; ;ata pin DP5D€ i7 conn-ct-; to pin7 Q, P, V an; o ar;uino2 >n; on- pu7h button i7 a;;-; or r-7-ttin r-a;in an; anoth-r i7 u7-; to 7tart th7y7t-m or r-a;in pul7-72 h-n }- n--; to count h-art rat-, }pr-77 7tart button th-n ar;uino 7tart countin pul7-7 an; al7o 7tart count-r or *- 7-con;72 Mhi7 7tart pu7h button i7 conn-ct-; to pin € an; r-7-t pu7h button i7 conn-ct-; to pin o ar;uino }ith r-7p-ct to roun;2
Pro&ra! *es)ri#tion
\n co;- }- ha*- u7-; ;iital r-a; unction to r-a; output o E-art -at 7-n7or mo;ul- an; milli7<= uction or calculatin tim- an; th-n calculat- E-art at-2
-or- thi7 }- ha*- initia~-; all th- compon-nt7 that }- u7-; in thi7 proŽ-ct2
an; h-r- }- ha*- pullup th- pu7h button lin- by u7in 7ot}arpullup2
Code, Œinclu;-ƒ[i9ui;4ry7tal2h… [i9ui;4ry7tal lc;<1, 11, Q, P, V, = int in j ˆ int -7-tj
int 7tartj€ int countj,ij,kj,rat-j un7in-; lon tim-,tim-1 un7in-; lon tim- byt- h-artˆs j v b, b11, b11111, b11111, b11111, b111, b1, b *oi; 7-tup<= v lc;2cr-at-4har<1, h-art= lc;2b-in<1,= lc;2print<E-art -at = lc;2}rit-<1= lc;27-t4ur7or<,1= lc;2print<3onit-rin= pin3o;-
v i<;iital-a;
IoT-Based Patient Monitorin& Sste! <7ourc-/ http7/YY}}}2hack7t-r2ioY7laahu;;inYiot5ba7-;5pati-nt5 monitorin57y7t-m5-a€abQ= Over vi ew
TheI nt er netofThi ngs( I o T)i sbec omi ngi nc r eas i ngl yi mpor t antf ort r affic moni t or i ng,s mar thomes ,s mar tpar k i ngmanagementandot heri ndus t r i al
appl i c at i ons .Wi t ht hec ont i nuousde v el opmentoft heI o T ,mor eandmor e “ t hi ngs ”wi l lbeabl et oac c es st ot heI o T.I nt hi spr oj ec t ,Ihav epr opos edan i nt el l i gentpat i ent smoni t or i ngs ys t em t omoni t ort hepat i entaut omat i c al l ywi t h t hehel pofI o T( mor es pec i fi cal l yc onnec t eds ens or snet wor k )t hatc ol l ec t st he s t at usi nf or mat i onwhi c hi nc l udepat i ent ' shear tr at e,ECG,SPO2,body t emper at ur e,humi di t y ,bl oodpr es s ur e,une xpec t edbodymo v ementet c .and s endst hes edat at ot hec l oud.Asar es ul t ,pat i ent ' sdoc t orandnur s esc ans ee hi scur r entheal t hc ondi t i on.I nc as eofemer genc yi ft hepat i ent ' sheal t h c ondi t i oni snots t abl e( c r i t i c al ) ,t hes ys t em aut omat i c al l ysendsapus h not i fi cat i ont odoc t or sandnur s es . Thi swoul dhel pt hedoc t ort omoni t orhi spat i entf r om an ywher easwel l as hel pst hepat i ent ' sr el at i v est ov i ewhi s( pat i ent )heal t hc ondi t i onr emot el y ( wi t h l i mi t edac ces s) . Wha ti sPa t i e ntMoni t or i ng
Con t i nu ousme as ur eme ntofpa t i en tp ar a me t er ss uc hashear tr at eand r hy t hm,r es pi r at or yr at e,bl oodpr es sur e,bl oodox y gens at ur at i on,andmany ot herpar amet er shav ebec omeac ommonf eat ur eoft hec ar eofc r i t i c al l yi l l pat i ent s .Whenac cur at eandi mmedi at edec i s i onmak i ngi sc r uc i al f oreffec t i v e pat i entc ar e,el ec t r oni cmoni t or sf r equent l yar eus edt oc ol l ec tanddi s pl ay phy si ol ogi c al dat a.I nc r eas i ngl y ,s uc hdat aar ec ol l ec t edus i ngnoni nv as i v e s ens or sf r om l es ss er i ous l yi l lpat i ent si nahos pi t al ’ smedi c al s ur gi c aluni t s , l aboranddel i v er ys ui t es ,nur s i nghomes ,orpat i ent s ’ownhomest odet ec t unex pec t edl i f et hr eat eni ngc ondi t i onsort or ec or dr out i nebutr equi r eddat a effic i ent l y . I nt e ns i v eCa r eUni t
Ani nt ens i v ec ar euni t( I CU) ,al s ok nownasani nt ens i v et her apyuni tor i nt ens i v et r eat mentuni t( I TU)orc r i t i c al c ar euni t( CCU) ,i sas pec i al depar t mentofahos pi t alorheal t hc ar ef ac i l i t yt hatpr ov i desi nt ens i v e t r eat mentmedi c i ne.I nt ens i v ec ar euni t scat ert opat i ent swi t hs ev er eandl i f et hr eat eni ngi l l nes sesandi nj ur i es ,whi c hr equi r ec ons t ant ,c l os emoni t or i ng ands uppor tf r om s pec i al i s tequi pmentandmedi c at i onsi nor dert oens ur e
nor malbodyf unc t i ons .The yar es t aff edbyhi ghl yt r ai neddoc t or sandnur s es whos pec i al i s ei nc ar i ngf orc r i t i c al l yi l l pat i ent s .I CUsar eal s odi s t i ngui s hed f r om nor malhos pi t alwar dsbyahi ghers t afft opat i entr at i oandac ces st o adv anc edmedi c al r es our c esandequi pmentt hati snotr out i nel yav ai l abl e el s e wh er e.Co mmonc ondi t i o nst h atar et r ea t edwi t hi nI CUsi nc l u deARDS, t r auma,mul t i pl eor ganf ai l ur eands eps i s .
Fi g. 1:Tr adi t i onalI CUuni t . Pat i ent smaybet r ans f er r eddi r ec t l yt oani nt ens i v ec ar euni tf r om an emer genc ydepar t menti fr equi r ed,orf r om awar di ft heyr api dl ydet er i or at e,or i mmedi at el yaf t ers ur ger yi ft hes ur ger yi sver yi nv as i v eandt hepat i enti sat hi ghr i s kofc ompl i c at i ons . Capaci t yandCost
I nt heUni t edSt at es ,upt o20% ofhos pi t al bedsc anbel abel l edasi nt ens i v ec ar ebeds ;i nt heUni t edKi ngdom,i nt ens i v ec ar eus ual l ywi l l c ompr i s eonl yup t o2% oft ot al beds .Thi shi ghdi s par i t yi sat t r i but edt oadmi s si onofpat i ent si n t heUKonl ywhenc ons i der edt hemos ts ev er el yi l l . I nt ens i v ec ar ei sanex pens i v eheal t hc ar es er v i c e.Ar ec ents t udyconduc t edi n t heUni t edSt at esf ound,hos pi t als t ay st hati nv ol v edI CUs er v i c eswer e2. 5 t i mesmor ec os t l yt hanot herhos pi t als t ay s .
•
$838perbedperda yf oraneonat al i nt ens i v ec ar euni t
•
$1, 702perbedperdayf orapedi at r i ci nt ens i v ec ar euni t
•
$1, 328perbedperda yf oranadul ti nt ens i v ec ar euni t
Fi g. 2:Thr eel ay erar c hi t ec t ur eofI o T
I nt er netofThi ngs TheI nt er netofThi ngs( I o T)i sanemer gi ngt ec hnol ogywhi c hwasfi r s t pr opos edt os t udyRFI Db yAs ht on,Pr of es s oroft heMI TAut oI DCent eri n 1999.I o Ti samaj ordr i v et os uppor ts er v i c ec ompos i t i onwi t hv ar i ous appl i c at i ons .I tenabl esobj ec t ssur r oundi nguswi t ht heabi l i t yt o c ommuni c at eeac hot hert hr ought heI nt er net .Thepopul arar c hi t ec t ur eof I o Ti si l l us t r at edi nFi g. 2.I tc ons i s t soft hr eel ay er s :Per cept i onl a yer , .Sens or s ,Ac t uat or s ,RFI Dt agsand Ne t wor kl a y era ndAppl i c at i onl a y er p c ept i on ot hers mar tt er mi nal sar ec onnec t edt ot heI o Tf r om t h e er l ay er t wor kl a y er .Ne i sr es pons i bl ef ort hec ommuni c at i onbet ween“ t hi ngs ”
andhumanb ei ngs .Abund antappl i c at i on sar epr o v i dedb yt heappl i c at i on . l ay er
Fi g . 3:Thebl oc kdi agr am oft hes y s t em.
Fi g . 4 :Th ePr o po s ed( DRY)Sy s t e m Pr oposedSyst em
Thebl oc kdi agr am oft h es y s t e ms ho wni nFi g. 3.Genu i no10 1( I o T Dev el opmentBoar d)i sus edasamai nc ont r ol l eroft hi ss ys t em.Al lt heot her s s ens or sar edi r ec t l yc onnec t edwi t hi t .AnEt her nets hi el di sus edf or c onnec t i ngt heboar dwi t ht hec l oud.Al l t hehar dwar ec omponent soft hi s
s ys t em ar el i s t edi n( t hi ngss ec t i on) .Thet hi nger . i oI o Tpl at f or mi sus edf orr eal t i medat as t r eami ngandv i s ual i z at i on.Fi g. 5s howst hemat hemat i c alnot at i on ofs ens or sandt hr es hol dl e v elandt hemat hemat i c al model f oremer genc yc al l oft hi ssy st em.
Fi g. 5:TheMat hemat i c alnot at i on Sof t wa r eandMobi l eAppl i c at i on
Ihav edev el opedaMobi l eappl i c at i on( Fi g.6)f ordoc t or s / nur s esf ormoni t or i ng t hepat i entbas edons ens or sdat a( t hedat ac ont ai nscur r entc ondi t i onoft he pat i ent )i nr ealt i me.I nc as eofemer genc y ,t hes ys t em aut omat i c al l ynot i fi es doc t or s / nur s est hr oughpus hnot i fi c at i onpr o vi dedt hat ,t heemer genc y c ondi t i oni sdet er mi nedbyt heequat i on( s howni nFi g. 5) .Ial s odev el oped anot herwebbas edappl i c at i onf orhos pi t al i nc har geper s onal f ormoni t or i ng t hepat i entc ons t ant l y( pos si bl et ous et het hi nger . i o das hboar df ort hi s p u r p o s e ) .
Fi g. 6:Mobi l eAppl i c at i onf orpat i entmoni t or i ngs ys t em.
TheMobi l eappl i c at i onoft hi spr oj ec thasdev el opedus i ngI nt elXDK.Ihav e us edThi nger . i oCl oudPl at f or mf orI o Tc l oud.Al l t hec odei swr i t t enus i ng Ar d ui n oI DE.
Necessar ysof t war er equi r ement •
Ar dui noI DE1. 6. 8orabo v e
•
I nt el XDK
•
Thi nger . i oAc c ount
•
k no wl ed geabou tMobi l eapp l i c at i onde v el opmen t
•
I nt er netConnec t i on
Procedure Pl ac eAr dui noEt her netShi el dont opofAr dui no101Br oad.Connec tt he Ar dui no' sGND pi nt oPowerSuppl y ' sGND pi n( s i nc eIus ede xt er nalpower s our c ef orpower i ngt hes ens or s ) .Pl eas epayat t ent i onwhi l ec onnec t i ng j umperc abl es .
8-n7or7 conn-ction }ith >r;uino 11 `4f 7-n7or 044 to Q0 f?D to f?D
Data to > <>r;uino 11= 6ul7- 8-n7or r;uino 11= 8D> to 8D> <>r;uino 11= 3`ˆ ?D M`36`>Mx` 8`?8w= 044 to V2V0 f?D to f?D 84[ to 84[ <>r;uino 11= 8D> to 8D> <>r;uino 11= loo; 6r-77ur- 8-n7or 044 to Q20 r;uino 11= 8D> to 8D> <>r;uino 11= `D [`D 044 to Q0 f?D to f?D D>M> to Dˆ <>r;uino 11= u~~-r 044 to 044 f?D to f?D D>M> to D€ <>r;uino 11= 0ibration 8-n7or M> to D <>r;uino 11=
6u7h utton <-m-r-ncy call option or pati-nt, i pati-ntz7 }ant= 044 to Q0 f?D to f?D D>M> to Dˆ <>r;uino 11= Pl eas ec onnec tal lt hes ens or scar ef ul l ywi t hAr dui no101boar d. Upl oadt heFi r mwar et ot heAr dui noBoar d
Downl oadal l t heAr dui nol i bandpl ac ei tont hel i br ar i esf ol der( Ar dui no' sl i b ,al f ol der ) l t hel i bandt hes our c ec odei sav ai l abl eonmygi t hubac count . •
dui no_ f r i mwa r e . i no Opent hear fi l eus i ngAr dui noI DE
•
t hi nger , i o) Paddr ess Puty ourc r edent i al s( andI oft heEt her nets hi el d
•
Upl oadi tt ot heAr dui noboar d.
•
Connec tt heEt her ne tc abl e( RJ 45J ac k )wi t hEt her ne tShi el d.
•
•
Openy ourThi nger . i oac c ountandc hec kwhet hert hede vi c ei s c onnec t ed( us edev i c et aborr ef ert het hi nger . i o do c ume nt a t i on ) I ti spos s i bl et obui l dt heRealTi meDas hboar donThi nger . i o ( pl eas e r ef ert hei rdoc ument at i on)
That ' sal l guy s , . . . . . . . . . . . . . .c heer s . No w,Runt hemobi l eappl i c at i onands eet her eal t i medat aony o urmobi l e. TheMobi l eappl i c at i ondev el opmenti sl i t t l ebi thar di fy ouar ebegi nner .Do s o meg oog l es e ar c ha ndl e ar nh owt oc o nn ec tAPIwi t hMo bi l e apps .Thi nger . i o i saRESTAPIEngi ne( pl e as er ef e rt hi nger . i o do c ume nt a t i o n f ormor edet ai l s ) . Concl usi on
Thepr opos eds y st em pr ov i desbet t ers ol ut i onov ert r adi t i onalmet hods .I t i nc r eas est hequal i t yofs er v i c easwel l ast hec apac i t yofI CUuni t .The appl i c at i onoft hi ssy st em i snotl i mi t edt oI CUuni t ,i tmayex t endasapor t abl e heal t hmoni t or i ngdev i c ef orol derpeopl e( whol i v esal one)aswel l as moni t or i ngbabi esandpeopl eha vi ngcar di ov as cul ardi s eas e.
Re f e r e nc e •
Whati sI nt ens i v eCar e?,ht t p: / / www. i c s. ac . uk
•
Whati sanI CU,ht t p: / / www. wi s egeek . or g
•
I nt ens i v ec ar euni t ,ht t ps : / / en. wi k i pedi a. or g
•
•
A.Wh i t mo r e ,A.Ag ar wa l ,a ndL .DaXu ,Th eI n t e r n eto fTh i n gs —A s ur v eyoft opi c sandt r ends , I nf or mat i onSy st emsFr ont i er s ,v ol .17,pp. 261274( 2015) S.Li ,L.D.Xu,andS.Zhao,Thei nt er netoft hi ngs :as ur v ey , I nf or mat i on Sy s t emsFr ont i er s ,v ol .17,pp.243259( 2015)
Appendi x •
•
•
•
I o Ti ns hor tofI nt er netoft hi ngs . SpO2s t andsf orper i pher alc api l l ar yox y gens at ur at i on,anes t i mat eof t hea mo un to fo x y ge ni nt hebl o od . El ec t r oc ar di ogr aph y( ECG orEKG* )i st hepr oc es sofr ec or di ngt he el ec t r i c al ac t i v i t yoft hehear tov eraper i odoft i meus i ngel ec t r odes pl ac edont hes ki n.Thes eel ec t r odesdet ec tt het i nyel ec t r i c alc hanges ont hes ki nt hatar i s ef r om t hehear tmus cl e' sel ec t r ophy si ol ogi cpat t er n ofdepol ar i z i ngdur i ngeac hhear t beat .I ti sav er ycommonl yper f or med c ar di ol ogyt es t . Das hboar d–ac ont r olpanel di s pl a yi ngv ar i ousdat a.
St epb ySt epv i deoGui del i ne Pl eas ec hec kt hegi t hubr epos i t or yf oral l s our c ec odei nc l udi ngmobi l eapps .
ht t ps : / / gi t hub. c om/ Mohammads al ahuddi n/ genui no_c ont es t . gi t
Conne)tion *ia&ra!
Code YZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ Z Mh- >r;uino 11 rim}ar- or \oM ba7-; 6ati-nt 3onitorin 8y7t-m Z Z author/ 3ohamma; 8alah x;;in Z Z -mail/ aka7h2banlamail2com Z Z [a7t up;at- / 1 3arch 1€ Z Z Z ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ ZY YYinclu;- all th- lib Œinclu;- ƒ86\2h… Œinclu;- ƒ`th-rn-t2h… Œinclu;- ƒMhin-r`th-rn-t2h… Œinclu;- ƒ3>•V16ul7-w|im-t-r2h… Œinclu;- ƒ>;aruit8-n7or2h… Œinclu;- ƒ>;aruit3`ˆ2h… YYMhin-r2io 4r-;-ntial 3` ewxx8`?>3` Œ;-n- D`0\4`\D ewxD`0\4`5\D Œ;-n- D`0\4`4`D`?M\>[ ewxD`0\4`4`D`?M\>[
YY0>\>[` Mw Ew[D ME` 8`?8w8 D>M> int bpm int 7po †oat t-mp YYth- 7-a l-*-l pr-7ur- in your r-ion [`0`[6`88x`E6> <1V= >;aruit3`ˆ bm- YY 3`ˆ 8-n7nor ;-claration un7in-; lon curr-nt3illi7 YYhol; th- curr-nt tim-
YYpul7- o|im-t-r tim- p-rio; 3`, D`0\4`\D, D`0\4`4`D`?M\>[= *oi; 7-tup<= v 8-rial2b-in<11Q= 8-rial2println<{<3`ˆ t-7t== 8-rial2println<\nitiali~in 3>•V1= YY \nitiali~- th- 6ul7-w|im-t-r in7tanc- an; r-i7t-r a b-at5;-t-ct-; callback
po|2b-in<= po|27-twn-atD-t-ct-;4allback,\?6xM= pin3o;-<ˆ,\?6xM= pin3o;-<,\?6xM= YY pin control -|ampl- == YY pu7h th- `4f 7-n7or7 ;ata thinbuttons …… output0alu-<;iital-a;<ˆ== YY pu7h th`m-r-ncy button call ;ata thint-mp-ratur-s …… s