Tải bản đầy đủ - 0 (trang)
The Final Project – a Remote Home Monitoring System

The Final Project – a Remote Home Monitoring System

Tải bản đầy đủ - 0trang

Chapter10.TheFinalProject–aRemote

HomeMonitoringSystem

Itisnowtimetocombineeverytopicthatwelearnedinthepreviouschaptersintoa

projectthatcombinesArduinoprogramming,PythonGUIdevelopment,MQTT

messagingprotocol,andaPython-basedcloudapplication.Asyoumighthavealready

figuredoutfromthechaptertitle,wearegoingtodeveloparemotehomemonitoring

systemusingthesecomponents.

Thefirstsectionofthechaptercoverstheprojectdesignprocess,includinggoals,

requirements,architecture,andUX.Oncewearedonewiththedesignprocess,wewill

jumpintotheactualdevelopmentoftheproject,whichisdividedintothreeseparate

stages.Next,wewillcovercommontroubleshootingtopicsthatareusuallyfacedwhile

workingwithlargeprojects.InoureffortstodeveloputilizableDIYprojects,thelater

sectioncoverstipsandfeaturestoextendtheproject.Asthisisquitealargeproject

comparedtootherprojectsinthebook,wearenotgoingtojumpstraightintotheactual

developmentprocesswithouthavinganystrategy.Let’sstartbygettingourselvesfamiliar

withthestandarddesignmethodologyforhardwareprojects.



ThedesignmethodologyforIoTprojects

Theprocessofdevelopingacomplexproductthattightlycoupleshardwaredeviceswith

high-levelsoftwareservicesrequiresanadditionallevelofplanning.Forthisproject,we

willexerciseaproperproductdevelopmentapproachtohelpyougetfamiliarwiththe

processofcreatingreal-worldhardwareprojects.Thismethodcanthenbeusedtoplan

yourownprojectsandtakethemtothenextlevel.Thefollowingdiagramdescribesa

typicalprototypedevelopmentprocess,whichalwaysbeginsbydefiningthemajorgoals

thatyouwanttoachievewithyourproduct:



Onceyouhavedefinedthesetofmajorgoals,youneedtobreakthemdownintoproject

requirementsthatincludeeverydetailofthetasksthatyourprototypeshouldexecuteto

achievethesegoals.Usingtheprojectrequirements,youneedtosketchouttheoverall

architectureofthesystem.ThenextstepincludestheprocessofdefiningtheUXflowthat

willhelpyoutolayouttheuserinteractionpointsforyoursystem.Atthisstage,youwill

beabletoidentifyanychangesthatarerequiredinthesystemarchitectureandthe

hardwareandsoftwarecomponentstostartthedevelopment.

Asyouhavedefinedtheinteractionpoints,nowyouneedtodistributetheentireproject

developmentprocessintomultiplestagesanddelegatethetasksbetweenthesestages.

Onceyouhavecompletedthedevelopmentofthesestages,youwillhavetointerface



thesestageswitheachotheraccordingtoyourarchitectureanddebugthecomponentsifit

isneeded.Attheend,youwillhavetotestyourprojectasawholesystemand

troubleshootminorproblems.Inhardwareprojects,itisverydifficulttoworkonyour

electriccircuitsagainafterthecompletionofcomplexdevelopmentprocesses,asthe

changescanhaverecurringeffectsonallothercomponents.Thisprocesswillhelpyouto

minimizeanyhardwarereworkandsubsequentsoftwaremodifications.

Nowthatyouhavelearnedaboutthemethodology,let’sbeginwiththeactual

developmentprocessforourremotehomemonitoringsystem.



Projectoverview

Thesmarthomeisoneofthemostwell-definedandpopularsubdomainsoftheIoT.The

mostimportantfeatureofanysmarthomeisitscapabilitytomonitorthephysical

environment.Fortunately,theexercisesandprojectsthatwecoveredintheprevious

chaptersincludecomponentsandfeaturesthatcanbeusedforthesamepurpose.Inthis

chapter,wearegoingtodefineaprojectthatwillutilizetheseexistingcomponentsand

programmingexercises.InthemidtermprojectofChapter7,TheMidtermProject–a

PortableDIYThermostat,wecreatedadeployablethermostatwiththeabilitytomeasure

temperature,humidity,andambientlight.Ifwewanttoutilizethismidtermproject,the

nearestIoTprojectthatwecanbuildontopofitistheremotehomemonitoringsystem.

TheprojectwillhaveArduinoasthemainpointofinteractionbetweenthephysical

environmentandthesoftware-basedservices.WewillhaveaPythonprogramasthe

middlelayer,whichwillbridgethesensorinformationcomingfromArduinowiththe

user-facinggraphicalinterface.Let’sstartbydefiningthegoalsthatwewanttoachieve

andtheprojectrequirementstosatisfythesegoals.



Theprojectgoals

TheNestthermostatprovidesanideaofthetypeoffeaturesthataproperlydesigned

remotemonitoringsystemwithprofessionalfeaturesshouldhave.Achievingthislevelof

systemcapabilitiesrequiresalotofdevelopmenteffortfromalargeteam.Althoughitwill

bedifficulttoincludeeachofthefeaturesthataresupportedbyacommercialsystemin

ourproject,wewillstilltrytoimplementthecommonfeaturesthatcanbeincorporatedby

aprototypeproject.

Thetop-levelfeaturesthatweareplanningtoincorporateinthisprojectcanbedescribed

bythefollowinggoals.

Observethephysicalenvironmentandmakeitaccessibleremotely

Providebasiclevelcontrolstotheusertointeractwiththesystem

Demonstrateaprimitivelevelofbuilt-insituationalawareness



Theprojectrequirements

Nowthatwehavedefinedthemajorgoals,let’sconvertthemintodetailedsystem

requirements.Onthecompletionoftheproject,thesystemshouldbeabletosatisfythe

followingrequirements:

Itmustbeabletoobservephysicalphenomenonsuchastemperature,humidity,

motion,andambientlight.

Itshouldprovidelocalaccesstosensorinformationandcontroloveractuatorssuch

asabuzzer,abuttonswitch,andanLED.

Themonitoringshouldbedonebyaunitthatisdevelopedusingtheopensource

hardwareplatform,Arduino.

Themonitoringunitshouldbelimitedtocollectsensorinformationandcommunicate

ittothecontrolunit.

Thecontrolunitshouldnotcompriseofadesktopcomputerorlaptop.Instead,it

shouldbemadedeployableusingaplatformsuchasaRaspberryPi.

Thecontrolunitshoulddemonstrateaprimitivelevelofsituationawareness

capabilitybyutilizingthecollectedsensorinformation.

Thecontrolunitshouldhaveagraphicalinterfacetoprovidethesensor’sobservation

andthecurrentstateofthesystem.

ThesystemmustbeaccessibleviatheInternetusingcloud-basedservices.

Thewebapplicationthatprovidesremoteaccessshouldhavethecapabilitytodisplay

thesensor’sobservationsthroughawebbrowser.

Thesystemshouldalsoprovidebasiccontroloftheactuatorstocompletetheremote

accessexperiencebyusingthewebapplication.

Asthemonitoringunitcanbeconstrainedbycomputationresources,thesystem

shouldusehardware-orientedmessagingprotocolstotransferinformation.

Althoughtherearemanyotherminorrequirementsthatcanbepartofourproject,they

havebeenskippedinthisbook.Ifyouhaveanyadditionalplansforyourremotehome

monitoringsystem,thisisthetimethatyoumustdefinetheserequirementsbeforeyou

jumpintodesigningthearchitecture.Anyfuturechangestotherequirementscan

significantlyaffectthedevelopmentstageandmakehardwareandsoftwaremodification

difficult.Inthelastsectionofthechapter,wehavelaiddownanumberofadditional

featuresthatyoumaywanttoconsiderimplementingforyourfutureprojects.



Designingsystemarchitecture

Continuingfromprojectgoals,first,youneedtosketchoutahigh-levelarchitectureofthe

system.Thisarchitecturalsketchshouldincludemajorcomponentsthatenablethesystem

topassoninformationbetweenthesensorsandtheremoteusers.Thefollowingfigure

showsanarchitecturalsketchforourproject:



Accordingtothegoals,theusershouldbeabletoaccessthesystemusingtheInternet;this

meansthatweneedcloudcomponentsinthearchitecture.Thesystemalsoneedsto

monitorthephysicalenvironmentusingaresource-constraineddevice,andthiscanbe

executedusingArduino.Themiddlelayer,whichconnectsthecloudserviceandthe

sensorsystem,canbebuiltusingaRaspberryPi.Inthelastproject,weconnectedArduino

andtheRaspberryPiusingaserialconnection,butwewanttomoveawayfromserial

connectionsandstartusingourhome’sEthernetnetworktomakethesystemdeployable.

Hence,theArduino-basedunitisconnectedtothenetworkusingEthernetwhilethe

RaspberryPiusesWi-Fitoconnecttothesamenetwork.

Inordertolayouttheoverallsystemarchitecture,let’sutilizethesketchthatwedesigned,

whichcanbeseenintheprecedingfigure.Asyoucanseeinthenextfigure,wehave

convertedtheoverallsystemintothreemainarchitecturalunits:

Monitoringstation

Controlcenter

Cloudservice

Inthisfigure,wehaveaddressedeachandeverymajorcomponentthatwearegoingto

utilizeintheprojectalongwiththeirassociationtoeachother.Inthefollowingsections,

wearegoingtodefinethesethreemainunitsbriefly.Thecomprehensivedescriptionand

implementationstepsfortheseunitsareprovidedlaterinthechapterunderseparate

sections.



Themonitoringstation

Weneedaresource-constrainedandrobustunitthatwillcommunicatewiththephysical

environmentperiodically.ThismonitoringunitcanbebuiltusingArduinosincelow-level

microcontrollerprogrammingcanprovideuninterruptedstreamofsensordata.Theusage

ofArduinoatthisstagewillalsohelpustoavoidthedirectinterfacingofbasiclow-level

sensorswithcomputersthatarerunningoncomplexoperatingsystems.Thesensorsand

theactuatorsareconnectedtoArduinousingdigital,analog,PWM,andI2Cinterfaces.



Thecontrolcenter

Thecontrolcenterbehavesasthemainuserinteractionpointbetweenthesensor

informationandtheuser.Itisalsoresponsibleforconveyingthesensorinformationfrom

themonitoringstationtothecloudservices.Thecontrolcentercanbedevelopedusing

yourregularcomputerorasingle-boardcomputersuchasaRaspberryPi.Wearegoingto

utilizeaRaspberryPisinceitcanbeeasilydeployedasahardwareunitanditisalso

capableenoughathostingPythonprograms.Wewillreplaceacomputerscreenwitha

smallTFTLCDscreenfortheRaspberryPitodisplaytheGUI.



Thecloudservices

ThemainpurposeofthecloudservicesistoprovideanInternet-basedinterfaceforthe

controlcentersothattheusercanaccessitremotely.Beforewehostawebapplicationto

performthisoperation,wewillneedanintermediatedatarelay.Thissensordatarelay

worksasahostbetweenthecloud-basedwebapplicationandthecontrolcenter.Inthis

project,wewillbeusingXivelyastheplatformtocollectthissensordata.Theweb

applicationcanbehostedonanInternetserver;inourcase,wearegoingtouseAmazon

AWSduetoourfamiliaritywithit.



DefiningUXflow

Now,althoughweknowwhatthearchitectureoftheoverallsystemlookslike,wehaven’t

definedhowtheuserisgoingtointeractwithit.Thisprocessofdesigninguserinteraction

foroursystemwillalsohelpustofigureoutdataflowbetweenmajorcomponents.

Let’sbeginwiththecomponentsthatareoperatinglocallyatyourhouse,thatis,the

monitoringstationandthecontrolcenter.Asyoucanseefromthefollowingfigure,we

haveourfirstuserinteractionpointatthecontrolcenter.Theusercanobservethe

informationoractuponitifthesystem’sstatusisanalert.Theuseractiontodismissthe

alertpromptsmultipleoperationstotakeplaceatthecontrolcenterandthemonitoring

station.Werecommendyouthoroughlyexaminethefiguretobetterunderstandtheflow

ofthesystem.



Similarly,theseconduserinteractionpointislocatedatthewebapplication.Theweb

applicationdisplaystheobservationsandsystem’sstatusthatwecalculatedatthecontrol

centerandprovidesaninterfacetodismissthealert.Inthisscenario,thedismissaction

willtravelthroughXivelytothecontrolcenterwheretheappropriateactionsforthe

controlcenterwillremainthesameasinthepreviousscenario.However,intheweb



application,theuserhastoloadthewebbrowsereverytimetorequestthedata,whichwas

happeningautomaticallyatthecontrolcenter.Takealookatthefollowingfigureto

understandtheUXflowforthewebapplication:



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

The Final Project – a Remote Home Monitoring System

Tải bản đầy đủ ngay(0 tr)

×