You are on page 1of 9

ENGR499:WirelessECG

MichaelAtkinson
PatrickCousineau
JamesHollinger
ChrisRennie
BrianRichter

Introduction and Project History


Our499projectistodesignandbuildthehardwareandsoftwareforawireless
Electrocardiogramdevice,andtocreateacorrespondingAndroidapplication.Theenvisioned
endproductisonethatapersonwithknownheartproblemscanusefortwentyfourhourECG
monitoringandfeedback.
Thisprojectisbasedonseveral399projectsfromfall2012onedetailedthehardware,
andanotherthesoftwarespecificsforthisdevice.Wethinkthatthehardwareportionisgoingto
bestraightforward,andnotlargeenoughonitsowntobea499project,whilethesoftware
portioniscomplexenoughthatpiecescanbeworkedonindependentlyandinparallel.

Electrocardiograms
Electrocardiograms(ECGs)areusedbymedicalprofessionalstomonitortheheartofa
patient.Thesedevicesusuallyoperatewith12leadsconnectedtothepatientsskinina
prescribedpattern.AnECGcanbeusedtodetectabnormalcardiovascularsymptoms,
measureheartrates,andmonitorheartdiseases.Themostcommonnonmedicalapplicationof
anECGistomeasureaheartrateduringaworkout,however,theaimofthisprojectisto
prototypeadevicethatcouldaidremotemonitoringandfeedback.
ThemostimportantcomponentsoftheECGthatthedeviceneedstoreportincludeP
wave,QRSinterval,andtheTwave.Thesewaveformshavetheinherentissuethatthe
measurablesignalshaveamplitudesintherangeof0.1mVto10mV.Anotherissuewiththese
signalsisthatthesmallesttimecomponentslastaslittleas50ms(ThePRsegment),or80ms
(TheentireQRScomplex).Thisshorttimemeansthatthesamplespeedforthesignalneedsto
besignificantlylessthan25mstoensureadequatesampling.

Thedevicewillnotofferanymedicalopinions,butcouldvaluableinmonitoringfor
noncontinuousheartconditionsandheartconditiontriggersthatarenotreplicatedinahospital
orclinicalsetting.Asaresult,theuserwouldnotneedtocontinuouslymonitorthedevice,but
couldsaveandsendabnormalconditionsastheyareencountered.Thisfunctionalityhasnotyet
beenimplemented,butispartoffutureplans.

Hardware - building an ECG


Theoriginalhardwareproposalwastobuildthecircuitusingaseriesofamplifiersand
filters.Thefigurebelowshowstheproposedblockdiagramforthehardwarecomponents.

Leads
Thecurrentprototypehasathreeleadsystem.Theprototypeleadsweremadeby
solderingpenniesontoalongwiretocreateareceiverforthesmallsignalproducedbytheheart.
Pennieswereusedduetotheiravailability,lowcostandhighconductivity.Unfortunately,the
magnitudeofthesignalproducedbytheheartisinthe0.110mVrange,andisverysusceptible
tonoisefrommotion,otherbodyfunctions,andbackgroundnoise.Twooftheleadsare
connectedacrossthehearttodetectasignal,whilethethirdisplacedonthebodytocreatea
groundreference.

Amplifier
Thecurrentdesignusesasingleinstrumentationamplifierwithahighgain.An
instrumentationamplifierwaschosenbecausetheheartsignalhasafloatingreference.The
modelnumberofthechipusedistheTexasInstrumentsINA126P.Usingatotalgainofaround
1000,thesignalwillbeintherangeof100mVto1V.However,thissignalwillcontainalarge
amountofnoisethatneedstobefilteredout.Theprimarysourcesofnoisewillbe
highfrequencynoiseand60Hzpowerlineinterferenceduetoourlongleads.Thediagrambelow
showstheinternalconfigurationoftheinstrumentationamplifier.

High-Pass Filter
Thefirststageinthefilternetworkisapassivehighpassfilterwitha0.1Hzcorner
frequency.ThisfilterremovestheDCoffsetinoursignal,andthecornerfrequencyissetvery
lowduetooursignalcomponentsresidingnear1Hz.Thediagrambelowshowsthedesigned
highpassfilter.

Notch Filter
Thesecondstageisa60Hzpassivenotchfilter.Thisfilteriscrucialduetotheleads
usedbytheECG.Thesefunctionasantennasandpickupthe60Hznoisefrompowerlines.

Thediagrambelowshowsthedesignednotchfilter.

ThispassivefilternetworkmaybereplacedinthefuturewithanactivefiltertoincreasetheQ
factorofthefilter.

Low-Pass Filter
Thelowpassfilterisdesignedwithacornerfrequencyof400Hz.Thisremovesthe
unwantedhighfrequencynoisefromthewaveform.Aswell,removingunnecessary
highfrequencyportionsofthesignalwilldecreasesignalbandwidth.Apassivefilternetwork
waschosenasitissignificantlyeasiertoimplementthananactivefilter.Inthefuture,asecond
gainstagewilldirectlyprecedethislowpassfilter.Thisisbecausewedonotwanttoamplify
the60Hznoiseaswell.Thediagrambelowshowsthedesignedduallowpassfilter.

ADC
TheADCisacriticalcomponentoftheECGmodule.IttakesthereceivedECGsignal
fromtheelectrodecircuitryanddigitizesitfortransmissiontothemobilephoneapplication.At
thisstageoftheproject,wehavechosentouseaRaspberryPimicrocomputerinordertofillthe
rolesofADCandbluetoothmodules.RunningadistributionofDebianLinux,theRaspberryPiis
capableofboththeanaloginputanddigitalbluetoothtransmissioncomponentsoftheECG
system.Inthefuture,wewouldliketoutilizeanapplicationspecificmicrocontrollerforthis

portionoftheproject.Forourprototypingstage,however,theRaspberryPiiseasytouseand
implement.

Raspberry Pi

Bluetooth/Firmware
Atthisstageoftheproject,wechosetoutilizeaRaspberryPilinuxbasedcomputerin
ordertohandlethefirmwaresideoftheECG.UtilizingaPythonprogram,theRaspberryPiwill
pairwithandconnecttothephonebasedandroidapplicationusingaUSBbluetoothradio.

RTOS vs non RTOS


Standardoperatingsystemsfocusondoingasmuchcomputationintheshortesttime
whererealtimeoperatingsystemsputanemphasisonhavingapredictableresponsetimes.To
ensureapredictableresponsetimeintheECGitwouldbeidealtobeusingarealtimeoperating
system.Fortheprototypewearebuildingwewillbeusingastandardlinuxdistribution.Inlightof
this,theprototypeECG,runningoffofaRaspberryPi,shouldmeetanyrealtimeconstraintsthat
wehavesincetheprocessorisoverpoweredforourapplication.Webelievethattheoverhead
fromrunningalinuxdistributionshouldnotsignificantlyaffectthesamplingrate.

Why not Arduino?


Wedecidedagainstusingawidelyavailableprogrammablemicrocontroller(suchas
Arduino)becauseofbudgetingandcomplexityconcerns.Itcreatesalevelofcomplexitywhen
tryingtosenddataoverbluetooth.UsingtheRaspberryPiwithanattachedusbmoduleistrivial.
ThebluetoothlibrarycanbeinstalledontothePiwithasimplepackageinstallation.

Software Progress
TheAndroidapplicationportionoftheprojectisprogressingsteadily,althoughwehave
hadtodeviatefromthetimeline.ThetimelineputmajoremphasisontheBluetoothreading
softwarecomponent,asitblockedothertasksandcomponents.However,wewerenotableto
developahardwareprototypeasquicklyasweplanned,andthushadnodevicetotransmit
BluetoothtotesttheBluetoothserver.AnotherfalseassumptionwehadmadewasthatAndroid

wouldhaveaverysimpleBluetoothwrapperlibrarywhichwouldbeassimpleasAndroids
BluetoothAdapterobjectwithwhichwehadpreviousexperience.Unfortunately,theBluetooth
connectioninvolvessettingupalisteningBluetoothserver,andthenservicingtheconnection
andwhilethisisnotterriblydifficult,itwasmorethanwewereexpectingforthissegment,and
theincreasedcomplexitymeansmoretestingisrequiredoncewehaveaBluetoothdeviceto
test.Bluetoothbeingblockeddidnotstopworkonthewholeapplicationthough:withsome
sampleECGdatawecreatedmanuallyfromasignalgeneratorwewereabletoworkonthe
signalchartingcomponent,makingsubstantialprogress.

Deviation from original design


Asweputworkintothesoftware,itbecameapparentthatthethreeapplicationgoals
fromtheprojectsoutsetwerelargeinandofthemselves,letalonereadingtheBluetoothdata.
Wedecidedtofocusondisplayingthecharttotheuserandsavingthedata,andtonotfocuson
theusernotification/signalanalysisportion.Nogroupmemberisparticularlywellversedin
signalanalysis,orofECGanalysis,andtestingofthefeaturewouldbeinvolvesimulatingaheart
attackfromtheBluetoothdata.Thisfeaturemaybeaddedinthefuture,butfornowwewill
focusonjustthosetwogoals.
Wefeelbothgoalsaremanageable:savingthedatashouldbesimpleifBluetoothdata
canbereadproperly,thenitcanbestoredinatemporarydatastructureandsavedinparallel.
Displayingthechartgivesthemostfeedbacktoauser,butismoredifficultthansaving:how
realtimeshouldthedisplaychartbe?Whatamountoflagisacceptable?Shouldsensordata
morethanXsecondsoldbethrownout?Whatsamplingrateshouldthehardwareuseto
ensurethephonecanprocessitintime?Thesequestionswillhavetobeaddressedasthe
BluetoothreadingmoduleiscompletedandwecantesttheappwithanactualadjoiningECG
sensor.Also,sincethischartisthemostuserfacingsectionoftheapplicationtheUIwillhave
tobecarefullycraftedtogivethebestlookandfeelpossible.Thetoneddownprojectdesignis
reflectedintheadjoiningfigure.

Figure1.1AndroidApplicationdesignwithoutNotificationModule

Timeline
Date

Tobecompleted

March1,Friday

Lastmonth:timetoreevaluate
goals/progressandsetanewmeeting

scheduletomeetourneeds.
March6,Wednesday

ProgressMeeting,ECS124,18:0018:50
ProgressReport#2submittedtoSupervisor,
copiedtoCoordinatorandTA

March11,Monday

Software
Finishdatasavingmodule
AddalinkfromMainActivitytoviewdata
history.
SomeworkdonewithRaspberryPiand
Bluetoothreadingmodule
Hardware
Replacebrokeninstrumentationamplifier
anddebugcircuit

March13,Wednesday

Software
HaveBluetoothreadingmodulefinished
Hardware
insertamplifierstagebetweennotchand
lowpassfilterstage

March15,Friday

Software
Chartmoduleshouldbedisplayingstreaming
Bluetoothdata
Hardware
Duplicateamplificationandfilteringstagesto
ensure5leads

March20,Wednesday

FinalPresentation
Preliminarypresentationdesign
Software
UIandoveralllookandfeelshouldbe
acceptablequality.
Layout/transitionsshouldbefinalized.

March25,Monday

EquipmentLoanListforProjectDemoto
technicalsupportstaff
FinalPresentation
Posterdesigncompleted

March27,Wednesday

FinalPresentation
Posterprinting(atZAP?)

March29,Friday

PosterPresentationsstartsat16:00
EngineeringLabWingLobbySetupstartsat
13:00

April5,Friday

Lastdayofclasses,FinalReportsubmittedto
Supervisor(gradepenaltymaybeappliedto
latesubmissions),projectURLsubmittedto
theCoordinatorandTA

April11,Thursday

Coordinatorreceivesgradesfrom
SupervisorsforProgressReportsandFinal
ReportandWebsiteevaluationsfrompanelof
judges

You might also like