Conversational IoT€¦ · These books are meant to increase your understanding of the subject....

28

Transcript of Conversational IoT€¦ · These books are meant to increase your understanding of the subject....

Page 1: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter
Page 2: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter
Page 3: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

ConversationalIoT

ByArtGarcia

©2017ConversationalGeek®

Page 4: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

ConversationalIoTPublishedbyConversationalGeek®Inc.

www.conversationalgeek.com

Allrightsreserved.Nopartofthisbookshallbereproduced,storedinaretrievalsystem,ortransmittedbyanymeans,electronic,mechanical,photocopying,recording,orotherwise,withoutwrittenpermissionfromthepublisher.Nopatentliabilityisassumedwithrespecttotheuseoftheinformationcontainedherein.Althougheveryprecautionhasbeentakeninthepreparationofthisbook,thepublisherandauthorassumenoresponsibilityforerrorsoromissions.Norisanyliabilityassumedfordamagesresultingfromtheuseoftheinformationcontainedherein.

TrademarksConversationalGeek,theConversationalGeeklogoandJ.theGeekaretrademarksofConversationalGeek®.Alltermsmentionedinthisbookthatareknowntobetrademarksorservicemarkshavebeenappropriatelycapitalized.Wecannotattesttotheaccuracyofthisinformation.Useofaterminthisbookshouldnotberegardedasaffectingthevalidityofanytrademarkorservicemark.

WarningandDisclaimerEveryefforthasbeenmadetomakethisbookascompleteandasaccurateaspossible,butnowarrantyorfitnessisimplied.Theinformationprovidedisonan“asis”basis.Theauthorandthepublishershallhaveneitherliabilitynorresponsibilitytoanypersonorentitywithrespecttoanylossordamagesarisingfromtheinformationcontainedinthisbookorprogramsaccompanyingit.

AdditionalInformationForgeneralinformationonourotherproductsandservices,orhowtocreateacustomConversationalGeekbookforyourbusinessororganization,pleasevisitourwebsiteatConversationalGeek.com

PublisherAcknowledgments

Allofthefolksresponsibleforthecreationofthisguide:

Author(s): ArthurA.,Garcia

ProjectEditor: J.PeterBruzzese

CopyEditor: JohnRugh

ContentReviewer: KarlaReina

Page 5: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

NotefromtheAuthor

Greetings,andwelcometoConversationalInternetofThings.

I’mArtGarcia,along-timedeveloperandrecentlyatravelingspeaker.I’manavidbikeriderand,wheneverIcan,anAppalachiantrailhiker.I’vebeendevelopingcodesinceVB6.Forthosewhodon’trecognizetheacronym,it’sVisualBasic6.IownedaPCwithDOS3.0andevenaTRS-80.I’vebeenworkingintheDevOpsspaceforthelast5yearsandrecentlygotintotheIoTspace.Istartedmycollegecareerasanelectricalengineeringmajor,butranintoaroadblockcalledcalculusandswitchedtoamoresoftwaredevelopmentrole.

NowI’mworkingonIoTdevicesandsmall,low-powerelectronics,andlearningaboutresistorsandthemathassociatedwiththem.Funnyhowthingsseemtorunincircles.HereIambackinelectrical.MygoalforthisbookistohelpyouunderstandthelandscapethatmakesupIoT.Iguaranteeyouwillnotbecomeanexpertafterreadingthis,butyouwillatleastunderstandthepartsandsomeofthepracticalapplicationsofIoT.Iwillalsoexplainsomeofthedevicesandhowtheywork.Ihopethatwhenyouaredone,youhaveabetterunderstandingofwhatIoTisandhowitaffectsourlives.

Itshouldbealotoffun!

ArtGarcia

Page 6: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

The“Conversational”Method

Wehavetwoobjectiveswhenwecreatea“Conversational”book:First,tomakesureit’swritteninaconversationaltonesoit’sfunandeasytoread.Second,tomakesureyou,thereader,canimmediatelytakewhatyoureadandincludeitinyourownconversations(personalorbusiness-focused)withconfidence.

Thesebooksaremeanttoincreaseyourunderstandingofthesubject.Terminology,conceptualideas,trendsinthemarket,andevenfringesubjectmatterarebroughttogethertoensureyoucanengageyourcustomer,team,co-worker,friendandeventheknow-it-allBestBuygeekonalevelplayingfield.

“GeekintheMirror”Boxes

Weinfusehumorintoourbooksthroughbothcartoonsandlightbanterfromtheauthor.Whenyouseeoneoftheseboxes,it’stheauthorsteppingoutsidethedialogtospeakdirectlytoyou.Itmightbeananecdote,itmightbeapersonalexperienceorgutreactionandanalysis,itmightjustbeasarcasticquip,butthese“geekinthemirror”boxesarenottobeskipped.

WithintheseboxesIcansharejustaboutanythingonthesubjectathand.Read’em!

Page 7: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

InternetofThings

AwhilebackIwasexcitedwhenIwasapproachedtowriteupatalkaboutInternetofThingsorIoT.Ithought‘howhardcanitbetoputdownonpaperwhatI’vebeenworkingonforthelastfewyears?’Thenitdawnedonmewhatahugesubjectitreallywas.WellafterIstoppedhyperventilating,IfiguredoutIcanbreakthisdownintoafewkeyareas.Thosearewhat,how,andwhy.

FirstistheWhat.WhatisthisthingcalledIoT?Ifyoudoasearchyougetaboutasmanydefinitionsastherearebeersonthewallata“WorldofBeer”.EverythingfromthesupergeekdefinitionIfoundonWikipediatoaskingmynotsotechyfriend

Page 8: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

overabeer.So,letmetrytodefineitsowehavesomethingtodiscussorargueabout.

Simplyput,IoTisabunchofdevicesthatcansensetheirsurroundings,processtheinformation,andsharethatinformationwiththeworld.Thingsinteractingandcollaboratingwithotherthings.GoingonestepfurtherwiththeparaphrasedWikipediadefinitionofIoTwe’retolditistheinter-networkingofphysicaldevices(akasmartdevices)embeddedwithsensors,softwareandconnectivitywhichenablesthesedevicestocollectandexchangedata.

It’snotacoincidencethat‘data’isinthedefinition.Dataisthekey.Thedevicescollectandactontheirsurroundings,butit’sthedatatheygeneratethat’simportant.So,taketheexampleofasensorIhavesittingonmylanaicollectingtemperatureandhumidity.Soundslame,butifyoutakethatdataandsendittoaweatherservice,nowwehaveaweatherstationreportingrealtimedataandsavingthatdatatohelpinforecasting.Suddenly,mytemperaturesensorisanIoTdevice,helpingmyneighborsdecidehowhotitmaygetthisweek.That’sbecauseI’vebeencollectingdataformonths,andwecananalyzethedataandmakepredictions.See,thedataisthekey.

BensonHouglandgaveaTedtalkaboutIoTandhesaidtheInternethasbeenaroundfor

alongtime…butit’sbeenmoreofanInternetofpeople.Thedataismadeby

peopleforpeople.IoTtakestheInternettoawholenewlevel.TodaytherearemorethingsontheInternetthanpeople.

Ok,that’senoughwiththetechnicaldefinition.Nowhowaboutasimplerdefinition?IliketothinkoftheInternetofThingsintwoparts.FirsttheIOpartandthentheThingspart.

Page 9: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

TheIOpartistheinputandoutput.It’stheexchangeandcollectionofdatafromadevice.It’smydistancesensortellingmewhenIamgoingtohitthecurbwhileparkingthecar.It’sthesensorontheboardcollectingdata.It’stheWiFichipsendingthatdatatothecloud.

TheThingspartismytemperaturesensor.It’saGPScollaronDaisythefarmcowtellingmewhensheisinafamilyway(akapregnant).It’saPHsensoralertingsomeonethePHistoohighoutonthefarm.Ifyoustartthinkingaboutit,Thingsthatsharedataareallaroundus.Somemaybenewdevicesthataredesignedtoshareonanetwork.OthersarepreexistingitemsthatarebeingrefittedwithorredesignedtoincludeIoTfeatures.Likethescalethattakesmyweightandsendsittomyfitnessapp.OrmyrefrigeratorthatcantellmeIneedtogobuymilkandeggs.Ithasasensorthatseeswhenthingsaremissingandactsonthatinformation.Itcollectsandprocesses.SuddenlymyrefrigeratorisaSmartDevice!Adevicethatcollectsandforwardsdatatobeanalyzedandactedupon.

SohowlonghavetheseIOthingsbeenaround?Ithinkit’sinterestingtoknowtheyhavebeenaroundlongerthanyouthink.Theconceptofasmartdevicehasbeenaroundsince1982.AmodifiedCokemachineatCarnegieMellonUniversitywasthefirstconnectedapplianceabletoreportitsinventoryandwhetherthenewlyloadeddrinkswerecold.Between1993and1996wesawsolutionslikeMicrosoft’sAtWorkandNovell’sNest.

ConnectingaCokemachinetotheInternetismorethan“cool”,especiallyin1982.ImaginehowvendingmachinesconnectedtotheInternetcouldhelpthevendorthrough

inventoryanalysis,usagetrendsandmore.

Page 10: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

TheProtocolsandTransportMethodsBehindIoT

SonowthatwehaveadefinitionofInternetofThings,let’slookatwhatsomeofthepartsarethatmakeitup.WeneedtodiscusshowIoTdevicestalkusingsomethingcalledaprotocol.Aprotocolisasystemofrulesthatdefinehowsomethingistobedone.Incomputerterms,aprotocolisusuallyanagreed-uponorstandardizedmethodfortransmittingdataand/orestablishingcommunicationsbetweendifferentdevices.Justasweneedacommonlanguagetotalktooneanother,devicesneedacommonlanguageaswell.Ratherthanspenddaysdiscussingeveryprotocolinthisspace,letsconcentrateonthedataprotocols.UnderstandthereareprotocolsrelatedtoeverylayeroftheOSImodel,butwearegoingtoconcentrateonthemorepopularonesforthisconversation.ThemostpopularprotocolstouseforIoTcommunicationareasfollows:

MQTT–MessageQueuingTelemetryTransportAMQP–AdvancedMessageQueuingProtocolHTTPs–HypertextTransferProtocolwithSecureSocketsLayer

Theseareonlyafewofthemanyprotocolsavailable.Iampickingthesebecausetheyarethemostprevalent.Theyeachhavetheiradvantagesandshortcomings,andIwilltrytoexplaineachenoughforyoutobeabletodiscussthematthewatercooler.

MQTTandAMQP

Thesetwoprotocolsareverysimilar.Theyarebothalightweightpublisher/subscribermessagingprotocol.Theybothallowfortwo-waycommunicationbetweenthesubscriberandthepublisher.So,what’sapublisherandsubscriberanyway?Ifwethinkofitinsimpletermsitmaymakebettersense.Everyoneisfamiliarwithabookpublisher,right?Itissomeonethatmakesabook,inourcasedata,availabletoallwhowanttoreadorconsumeit.

Page 11: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

Asubscriberissomeonewhowantstoreadthatbookorwantstoconsumethatdata.Andasinanypublisherorsubscriber,thereisalwaysabackandforthexchangeofdata.TheMQTTandAMQPprotocolsarebasedonthesameprincipal.Theybothallowforthebackandforthexchangeofdatabetweendevicesandthecloud.MQTTisdesignedtominimizenetworktrafficanddeviceresourceswhilestillattemptingtoensurereliabilityandsomedegreeofdeliveryassurance.ThemajoradvantagesofMQTTisthepublish-subscribemessagequeueandthemany-to-manybroadcastcapabilities.Sendingmessagesoflimitedbandwidthbackandforthissimpleandstraightforward.Ithasbeenaroundsince1999whenitwasdesignedbysomeverysmartguysfromIBMandofEurotech.

AMQPdiffersinthatit’ssomewhatmorecomplexwhenyoustartlookingunderthecovers.ThewaythemessagesarereceivedandhandleddiffersfromMQTT.Itwasdesignedwiththefinancialindustryinmind,sothemessagehandlingneedstobemorecomplexandreliable.NottosaythatMQTTisnotreliable.AMQPhasafewmorewaysofdistributingthemessagesbyusinganexchange,messagequeuesandtopics.

Page 12: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

HTTPs

HTTPSwillencryptdatasentandreceivedoveraSecureSocketLayer(SSL).ItdiffersfromnormalHTTPinthatHTTPsendsallitsdatainplaintext.NotsosecureifIcanreadyourdataasitcomesoverthewire.ThemoresecuremethodtoimplementHTTPistoincludeonlyaclientinyourIoTdevice,notaserver.Inotherwords,itissafertobuildanIoTdevicethatcanonlyinitiateconnections,notreceive.Afterall,youdonotwanttoallowoutsideaccesstoyourlocalnetwork.ThetypicalIOTscenariosendsthedata,butdoesnotreceive.Thisismoresecure,butnotideal.

Thesearejustafewoftheprotocolsavailable.Trustmetherearemore,butthisissupposedtobeaconversation,notathesis.So,whichonedoyouuse?Wellitdependsontheapplicationandtheenvironmentthedevicewillbedeployedin.Ifyoujustneedonewayfromthedevicetothecloud,thenHTTPSislightweightenoughandwilldoagoodjob.Ifyouneedtobothsendandreceive,thenMQTTorAMPQarethewaytogo.MaybeyourscenarioiscompletelydifferentthanwhatIhaveoutlined,inthatcasetherearemultipleoptions.

So,wetalkedabouttheprotocolorhowthedevicestalk,whataboutthetransportmethod?It’sgreatthatwehaveaprotocol,butweneedsomewaytomovethesepacketsaround.Tomovethisdata,wehaveafewoptionsandmostareagainbasedonthesituation.ThepopularmethodstotransportdataintheIoTspaceareasfollows:

• WiFi• BluetoothLowEnergy• LoRaWan-isaLowPowerWideAreaNetwork

(LPWAN)• GSM,3G,LTE,4G• Zigbee• NFC

Page 13: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

• RFID• 6LoWPAN-IPv6overLow-powerWirelessPersonal

AreaNetworks

So,theonesIseethemostinmytravelsareWiFi,Bluetooth,LoRaandLTE.Ofthese,WiFiandBluetoothseemtobethemostwidelyused.Insituationswhereyouneedlongrangecommunicationandhavelimitedpower,thenLoRaisthelogicalchoice.Ithasarangethatexceed15KMandaverylowpowerconsumption.Inothersituations,WiFiorevenBluetoothcommunicationtoamobiledevice,maybethewaytogo.

Thecloudiswheremostofthemagichappens.Itswherewestore,connectand

analyzetheIoTdata.

IoTandtheCloud

So,nowwehavedefinedwhatthisInternetofThingsis.Wehavediscussedthedifferentwaysittalksandhowthedatagetsaround.Nowlet’slookatthecloudpartofthisequation.IfyoutalkaboutIoT,youmustdiscussthecloud.Thecloudiswherewewillaggregatetheinformation,analyzeitandactupontheresults.Althoughthedeviceiswhateveryonetalksabout,it’sreallythedatatheycollectthat’sthekeytothis.So,Iknowit’s82degreesonmylanai,sowhat?What’simportantisthatIhavebeencollectingthatdataandIcanmakepredictionsonwhatthetemperaturewillbe.ThatisifyouarenotinFloridainAugust.Allthetechnologyintheworldisnotgoingtochangethefactthatit’sjustplainHOT.

Ok,enoughabouttheFloridaheat.Let’smovethisdiscussiontoahigherplane.TheCloud!Inthisspacetherearemany

Page 14: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

players,butforthisdiscussionIwillconcentrateonthebigthree.Microsoft,Amazon,andGoogle.NottosaythatserviceslikeRackspaceandothersdon’thaveofferingsintheIoTspace,it’sjustthatIwanttokeepthisdiscussionbrief.Wecouldspendtheremainderofourtimejusttalkingaboutthedifferentofferings,andIstillhavealotmoretotellyouabout.ThelistisinnoparticularorderasIdon’twanttocomeacrossasplayingfavorites.

Ionlydiscussthetopthreecloudproviders.IfIdiscussedallofthemthiswouldbelike

tryingtowriteWar&Peace(whichisareally,reallylongbook–1225pages!)

GoogleCloudIoTisasetoffullymanagedandintegratedservicesthatallowyoutoeasilyandsecurelyconnect,manage,andingestIoTdatafromgloballydisperseddevicesatalargescale,processandanalyze/visualizethatdatainrealtime,andimplementoperationalchangesandtakeactionsasneeded.

ItstartswithCloudIoTCorewhichisafullymanagedservicethatallowsyoutoeasilyandsecurelyconnect,manage,andingestdatafrommillionsofgloballydisperseddevices.DevicedatacapturedbyCloudIoTCoregetspublishedtoCloudPub/Subfordownstreamanalytics.YoucanthendoadhocanalysisusingGoogleBigQueryandtheneventuallyapplymachinelearningwiththeCloudMachineLearningEngine.YoucanalsovisualizetheIoTdatainreportsordashboardsusingtheGoogleDataStudio.Theplatformsupportsawidevarietyofembeddedoperatingsystems,worksseamlesslywithAndroidThings,andprovidesout-of-boxsupportfordevicesfromleadingmanufacturerslikeIntelandMicrochip.Youcantriggerchangestodevicesbasedonreal-timeeventsusingCloudFunctionsworkflows.Googlehasdoneagoodjobof

Page 15: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

providinganend-to-endsolutionfromdevicetovisualizationandanalytics.

In2014GooglepurchasedNestLabs(makerofIoTthermostatsandsmokedetectors)for$3.2billiondollars.CompanieslikeGoogle,AmazonandMicrosoftobviouslybelievethereismoneytobemadeinthisspace.

ThenextvendorthathasanIoTcloudofferingisAmazon.Amazon’sIoTofferingconsistsofthreemainparts.FirstthereisAWSGreengrass.Thisissoftwarethatletsyourunlocalcompute,messaging,datacaching,andsynccapabilitiesforconnecteddevicesinasecureway.WithAWSGreengrass,connecteddevicescanrunAWSLambdafunctions,keepdevicedatainsync,andcommunicatewithotherdevicessecurely–evenwhennotconnectedtotheInternet.AWSGreengrassalsoallowsdevicestoseamlesslyactontheirlocaldatawhilestillusingthecloudtomanagethem.AWSGreengrassactsasahubthatcancommunicatewithotherAWSIoTdevices.OnecoolfeatureofAWSGreengrassisthatifadevicelosesconnectiontothecloud,devicesintheGreengrassGroupcancommunicatewitheachotheroverthelocalnetwork.

Theyalsohaveagreatwaytomanagemultipledevices.TheycallitAWSIoT.AWSIoTisamanagedcloudplatformthatletsconnecteddeviceseasilyandsecurelyinteractwithcloudapplicationsandotherdevices.Itcansupportbillionsofdevicesandtrillionsofmessages.Itcankeeptrackofyourdevices,eveniftheyarenotconnected.

AmazonalsohassomethingcalledtheAWSIoTButton.It’saprogrammablebuttonbasedontheAmazonDashButtonhardware.It’sasimpleWiFidevicedesignedfordeveloperstogetstartedwithAWSIoT.ThebuttoncanbeusedasaremotecontrolforNetflix,aswitchforyourPhilipsHuelightbulb,a

Page 16: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

check-in/check-outdeviceforAirbnbguests,orawaytoorderyourfavoritepizzafordelivery.

MicrosoftalsohasaveryrobustandsecureIoToffering.TheirIoTSuiteofproductsconsistoftheIoTHub,IoTEdge,EventHubs,StreamAnalytics,MachineLearning,NotificationHubsandjustrecentlyaddedTimeSeriesInsight.Let’sstartwiththeIoTHub.TheIoTHubisallowingyoutosecurelyandeasilyconnectyourIoTassets.Itusesbothdevice-to-cloudandcloud-to-devicemessagingtoreliablyreceiveandsendmessagestodevices.Rememberthepartaboutprotocols,thisiswhatthismessagingisallabout.Devicemessagesaresentinadurablewaytoaccommodateintermittentlyconnecteddevices.IoTHuballowsyoutosetupindividualidentitiesandcredentialsforeachmachine.WiththenewdevicemanagementcapabilitiesinIoTHub,administratorscanremotelymaintain,update,andmanageIoTdevicesatscalefromthecloud.Youwon’tneedaseparatecustommanagementsolutiontomanagedevices,itcanallbedonewithIoTHub.

MicrosoftalsojustannouncedIoTEdge.IoTEdgedeliverscloudcapabilitiestothedevices.Itprovideseasyorchestrationbetweencodeandservices.Youcandevelopservicesandcomponentsinthecloudandtheneasilydeploythemtothedevicesthemselves.Thiscutsdownonresponsetimeandincreasesefficacy.Sayyouhadamachinethatwasfailing.IfitwasconnectedtoAzureitwouldsenddataandthensomefunctionwouldrespondandsendamessagetoshutdownbeforeitdestroyedthemachine.WithEdge,thatprocesscouldrunonthedeviceitself,cuttingoutthelagtimetosendandreceivethemessage.

AzureEventHubsisahyper-scaledataingestionservicethatcollects,transformsandstoresmillionsofevents.EventHubshasaCapturefeaturewhichallowsasinglestreamtosupportreal-timeandbatch-basedpipelines.EventHubsisafullymanagedservice.Thatmeansthereisnoservertomaintainor

Page 17: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

softwarelicensetoobtainandthepricingisverysimple.EventHubsusesAdvancedMessageQueuingProtocol(AMQP)toenableinteroperabilityandbinarycompatibilityacrossplatforms,whilealsosupportingHTTPSfordataingressaswell.IthasnativeclientsforbothJavaand.NET,andit’sveryeasytogetitrunning.

So,yougetthedatathruIoTHub,nowweneedtoanalyzethisdata.MicrosofthasStreamAnalyticstohandlethatjob.Youcancreatereal-timeanalyticsusingverysimpledeclarativeSQL-likelanguage.Anextensivearrayofout-of-the-boxconnectors,advanceddebuggingandjobmonitoringcapabilitieshelpkeepcostsdownbysignificantlyloweringthedeveloperskillsrequired.IthassupportforcustomcodewithJavaScriptUserDefinedfunctionsthatfurtherextendthestreaminglogicwritteninSQL.CalloutstoAzureMachineLearninghelpswithpredictivescoringonstreamingdata.AzureMachineLearningisMicrosoft’sdatascienceenginethatallowscomputerstouseexistingdatatoforecastfuturebehaviors,outcomes,andtrends.Usingmachinelearning,computerslearnwithoutbeingexplicitlyprogrammed.

MachineLearning!IjustwishIcouldlearnasfastasAzureMachineLearning.You’veseenmygeek-in-the-mirroravatar.I’dlovetobeAzure’s7of9.(It’saStarTrekreferencefor

thoseofyouwhoareJedi-only).

So,todisseminatethisinformationMicrosofthastheAzureNotificationHub.ThisserviceisamassivelyscalablemobilepushnotificationengineforquicklysendingmillionsofnotificationstoiOS,Android,Windows,orKindledevices.ItworkswithAPNs(ApplePushNotificationservice),GCM(GoogleCloudMessaging),WNS(WindowsPushNotificationservice),MPNS(MicrosoftPushNotificationservice)andmanymore.It’sflexibleenoughtoplugintoanyback-endsystemlike

Page 18: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

.NET,PHP,Java,andNode.js,anditworkswithbothon-premisesandcloudenvironments.

AnewserviceMicrosoftjustannouncedisTimeSeriesInsight.It’safullymanagedanalytics,storage,andvisualizationservicethatmakesitsimpletoexploreandanalyzebillionsofIoTeventssimultaneously.Itgivesyouaglobalviewofyourdata,lettingyouquicklyvalidateyourIoTsolutionandavoidcostlydowntimetomission-criticaldevicesbyhelpingyoudiscoverhiddentrends,spotanomalies,andconductroot-causeanalysesinnearreal-time.YoucanconnectTimeSeriesInsighttoyourAzureIoTHubinminutesandgeneratenearrealtimegraphsanddashboards.TimeSeriesInsightscanreceivedatafrom100sofmillionsofsensoreventsperdayandmakesyourtime-seriesdataavailabletoquerywithinoneminute.Thiswillallowyoutospottrendsandanomaliesfast,whichallowsyoutoconductroot-causeanalysesandavoidcostlydowntime.

ThatisasmallsamplingofthevendorsthatprovideanofferingintheIoTspace.Welookedattheircapabilitiesandhighlightedhowtheyoffersolutions.So,isonevendorbetterthantherest?Ithinkitdependsonmanyfactors.Yourbackground,theenvironmentyouareworkingin,thedevicesallplayaroleindecidingonavendor.Let’sjustsaythereareafewverygoodoptions.

ProgrammingandIoTSo,wehavedefinedwhatIoTis,wehavediscussedtheprotocolsIoTusestocommunicate.Wehavediscussedhowthedataistransported,andwehavediscussedthevendorsthatprovideIoTsolutionsinthecloud.WehaveNOTdiscussedhowyouprogramthesedevicesandsomeofthereal-worldapplications.

AsfortheprogrammingpartofIoT,therearemanyoptions.SomeofthemostpopularareC,C#,Python,Node.JSandPHP.Eachhastheirgoodandbadtraits.Cismoreofalowlevel,

Page 19: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

talkingtothedevicelanguage.Itproducesasmallcodefootprintandisfast.Ifyouarenewtoprogramming,IwouldsuggestPHP,Python,C#oranythingelse.Cnotforthefaintofheart.

C#isverypopularandwillrunonsomeofthehobbyistdevicesliketheRaspberryPi3,butsowillsomeoftheothersaswell.WhatIhavefound,ifyouaretryingtogetintotheIoTspace,isthatCorC#arethewaytogo.Yes,IknowIsaidCisnotfortheweak,butthenumberofexamplesandprojectswritteninCalmostoutweighthelearningcurve.Asforthedevelopmentenvironment,thereistheArduinoIDEandnowtheMicrosoftVisualStudioIDE.TheVisualStudiohastheadvantagethatithasIntelliSense.Thiswillhelpwithcodecompletionandfiguringoutthemethodsandfunctionsyouarecalling.Ifoundthisveryhelpful,especiallyasIwaslearningC.MostofthedevicesonthemarkettodaywillacceptallthelanguagesImentioned.Itjustdependswhatyouarecomfortablewritingin.

Let’ssayIhavesparkedyourinterestenoughthatyouwanttogetintotheIoTarena.Whatexactlydoyouneedandwhatisoutthere?Thelistismassive.YoucangotheRaspberryPIrouteforexample.ThePIisacreditcardsizecomputerthatyoucanplugintoyourTVandkeyboard.Theycurrentlyhavesixversions.ThePiModelA+,PiModelB+,Pi2ModelB,Pi3ModelB,PiZero,andthePiZeroW.ThePi3ModelBwillrunaversionofWindows10.MyfirstventureintoIoTwasusingaPi3.IloadedWindows10onitandwroteC#applicationusingXamlasthefrontend.Itshoweddataonmymonitorandwasquiteeasytogetrunning.AsaC#developer,Ifoundthisagreatintro.Youcanalsoloadaplethoraofoperatingsystemsbasedonyourpreference.UbuntuandPi’sownRaspbainoperatingsystemsarethemostpopularandwillrunonallversions.ThePi3istheonlyoneIknowofthatwillrunWindows10.

Page 20: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

Gotowww.rasberrypi.orgtolearnmoreaboutit…buyone…orlearnreally,reallycool

IoTtrickslikehowtomodanerfgun.

YoucangotheArduinorouteaswell.Theyhaveprocessorssmallerthanacreditcardandsomeyoucanevenwear.TheyarebasedontheATmegafamilyofprocessorliketheAdafruitFeather,theAdafruitMetroortheESP8266processorliketheHUZZAH.Thereisevenoneassmallas27x15mmcalledtheTrinket.TheydifferfromthePiinthatsincetheyaresmallertheydon’thaveanoperatingsystemintheconventionalsense.Youwriteyourcodedirectlyontothechipontheboard.Youarenolongerwritingaprogramthatrunsonthecomputer,youareprogrammingthechiptorunjustyourapplication.

IliketheArduinoplatform,becauseitkeepsthingsimple.IcanwriteafewlinesandIhaveadevicethatistellingmethedistancemyrobotisfromthewall,orthetemperatureofmypool.TheArduinodoeshaveitslimitationsandchallengesaswell.Youneedtoprogramdowntothechipandthesensors.Youneedtomakesureyouhavethecorrectlibraryandthatyouhavethesensorswiredcorrectly.Fortunately,theInternetcomestotherescuehere.Therearemillionsofexamplesanddiagramsshowingjustabouteverysensorandchipimaginable.

TheIoTtraditionalistwillwanttobuildhis/herowndevice.Youneedtogetthesensor,wireittothechipandmaybeifyouarehardcore,solderthemalltogether.Believeme,comingfromsomeonewhohasdoneitandhasthesolderburnstoproveit,it’snoteasy.So,whatifyouarenotuptobuildingacircuitandallthatthisentails?Welldon’tdespair,Microsofthascometotherescue.InMayatBuild2017,Microsoftannouncedaneasywaytogetintothegame.It’stheMXChipIoTDevKitortheDevKitforshort.ThisisacreditcardsizeIoT

Page 21: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

deviceyoucanusetolearnaboutnotonlydevicesandsensors,butAzureaswell.It’sanall-in-onedevicewithWi-Fi,ascreen,twobuttonsandaheadphoneandmicrophonejack.Asforsensors,it’sjampackedwithmotion,magnetometer,pressure,humidityandtemperaturesensors.Oh,IalmostforgotitalsohasanRGBLedandevenanIRsensor.Funnything–it’sArduinobased.Microsoftrealizesthisplatformistheeasiesttogetinto,andthecommunitysupportisalreadythere.TheyhavemadeitworkwithVisualStudioCode,oryoucanusetheArduinoIDEaswell.IwasevenabletoprogramitwithmyVisualStudio2017EnterpriseeditionwhenIaddedtheArduinoextensions.WithbothVSCodeandthefullblownVisualStudioIDEyougetallthebenefitsoftheIDEwehavegrowntoknowandlove.

YoucangetstartedwiththeMXChipIoTDevKitbygoinghere:https://microsoft.github.io/azure-iot-developer-kit/

MXChipIoTDevKit

Thegreatestpartofthisboardisthatnowallyouneedisthisboardtogetstarted.Youcanquicklycreateanapplicationthattellsyouthedirectionyouaremovingin(magnetometer).Youcandosimpletemperature,pressureandhumiditymeasurements,andwiththepressuresensoryoucouldevendeterminealtitude.IthasWi-Fibuiltinandtheabilityto

Page 22: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

connecttoyourAzuresubscription.Thisisagreatboardforsomeonewhowantstogetintothegameandforthoseofuswhowanttobuildgreatapplications.IamplanningonusingittodesignanapplicationwhereIcanusethemicrophonetosendcommandstothechip.Ihaveabouttenotherideas,butthisissupposedtobeaconversation,notmytodolist.SufficeittosaythisisagreatwaytogetintoIoT,andifyouwanttoaddothersensorstoit,youcandothataswell.Ithasaninterfaceyoucanpurchasethatwillletyouwiresensors,motors,lights,andmaybeevenacamera.

RealWorldIoTinActionSo,IwanttoconcludethisbookletwithafewrealworldexamplesofIoTinaction.Therearemorethanyoucanimagine,butIwillhighlightjustafewIfoundinteresting.

ThereisafarmingcompanyinSouthFloridathatisusingIoTtohelpthemmonitortheircrops.Apparently,plantswillnottellyoutheyaresickuntilit’stoolate.ThePHinthewaterbeingfedtotheplantsiscrucialtotheirsurvivalandgrowth.TheoptimalPHlevelisessentialforpropernutrientuptake.Increasednutrientuptakedirectlyaffectsyields,inturndrivingimprovedrevenueperplantharvested.Onthecostside,it’sexpensivetocheckthePHbyhand.MicrosoftpartneredwiththisgrowerandpilotedanIoTdevicethatreadthePHofthewaterfedtotheplants.IfthePHfelloutsideoftheoptimalrange,theyusedAzureFunctionstosendanalerttoatechnician’sphonesotheycouldreact.ThiswasdonewithasmallArduinodevice,aPHsensorcapableofworkingwiththeArduino,AzureIoTHub,AzureStreamAnalytics,AzureFunctionsandamessagingAPI.Thissolutionsavedthemlaborcostsandincreasedplantgrowingefficacy.

Abio-medicalcompanyisusingIoTtohelpearlypredictionofAlzheimer’sdisease.Theyfoundthatmanybrainrelateddiseaseshadathermaldynamicproperty.Theycoulduseatemperaturesensortoreadthebraintemperature.Theyused

Page 23: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

AzureIoThub,AzureStreamAnalytics,andmachinelearningtohelppredictearlyonsetofAlzheimer’sdisease.

Anappliancecompanyhasdevelopedanewsmartrefrigerator.Thedevice'smostinterestingfeatureisanembeddedcamerakeepinganeyeonwhat'sinthefridge,accessiblethroughremoteappsorthetouchscreentabletbuiltintothefridge'srightdoor.Thefridgealsohassophisticatedhumidityandtemperaturesensors,whicharealsoaccessiblethroughthefridge'snetworkhub.Thecameraisdesignedtohelpmonitorspoilage,lettingyoueyeabowlofleftoverswithoutopeningthedoor.Thefridgecanhookintoyoursmartphoneortheonboardtablet.

WhenwinterhitsScandinaviaandtemperaturesfallwiththesnow,havingplentyofhotwaterisarealtreat.It’salsoabigexpense—typicallyanapartmentbuilding’sNo.3energyexpenseafterheatingandcooling.Whilenoonewantstopaymorethannecessaryforanyutility,fewapartmenttenants(ortheirlandlords)haveawaytomonitortheirindividualresourceconsumption.InSweden,aworldleaderinrenewableenergyandsustainability,anewInternetofThings(IoT)solutionisseizingtheopportunitytomakeapartmentsmoreefficient,conservenaturalresourcesandsavemoney.ASwedishpropertymanagementcompanyisouttochangethewaybuildingownersandtenantsconsumeresources.TheyworkedwithEniga,aproviderofintelligentcloudsolutions,toconnecttheapproximately250buildingsand10,000apartmentunitsitoperatestoMicrosoftAzureIoTtechnology.Theybeganbytrackinghotwaterusage,whichaccountsforabout20percentoftheenergybillinsingle-familyhomes—andmuchmoreinapartmentbuildings.Theresultoftheircollaborationisabuilding-as-a-serviceofferingthatwillsavethepropertyownersanestimated$42millioninhotwatercostswithin10years.

Page 24: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

SmartCities

WecanevenusethisIoTtechnologytomanagethingsasbigascities.HereareafewexamplesofhowcitiesareusingIoTtosavemoney,energyandkeeppeoplesafe.

SilverSpringNetworksiscarryingoutasmartstreetlightcontrolprogramforJamaicaPublicServiceCo.(JPS).JPSisanintegratedelectricutilitycompanyandthesoledistributorofelectricityinJamaicaservingover600,000customers.JPSwillextenditsexistingplatformtoconnectupto110,000smartLEDstreetlightsinpopulationcentersaroundtheisland.ThesmartstreetlightcontrolsprovidedbySilverSpringwillhelpdriveadditionalenergyefficiency,whichiscrucialforhigh-cost,petroleum-basedislandenergygridsliketheoneinJamaica.Smartstreetlightcontrolscanhelpincreasecitizensafetybyalertingautilitytolightfailuresandallowingforquickerrepair.

BarcelonahasalsodesignedanewbusnetworkbasedondataanalysisofthemostcommontrafficflowsinBarcelona,utilizingprimarilyvertical,horizontalanddiagonalrouteswithmanyinterchanges.Integrationofmultiplesmartcitytechnologiescanbeseenthroughtheimplementationofsmarttrafficlightsasbusesrunonroutesdesignedtooptimizethenumberofgreenlights.Inaddition,whereanemergencyisreportedinBarcelona,theapproximaterouteoftheemergencyvehicleisenteredintothetrafficlightsystem,settingallthelightstogreenasthevehicleapproachesthroughamixofGPSandtrafficmanagementsoftware,allowingemergencyservicestoreachtheincidentwithoutdelay.

TheUSgovernmentevengotinthegamein2015.Checkouttransportation.gov/smartcity.TheylaunchedtheSmartCityChallenge,”askingmid-sizedcitiesacrossAmericatodevelopideasforanintegrated,first-of-its-kindsmarttransportationsystemthatwouldusedata,applications,andtechnologytohelppeopleandgoodsmovemorequickly,

Page 25: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

cheaply,andefficiently.”ColumbusOhiowonthechallenge.Theywerepickedfromalistof78cities.

Theirplanaddressedchallengesinresidential,commercial,freight,anddowntowndistrictsusinganumberofnewtechnologies,includingconnectedinfrastructure,electricvehiclecharginginfrastructure,anintegrateddataplatform,autonomousvehicles,andmore.Columbusplanstoworkcloselywithresidents,communityandbusinessleaders,andtechnicalexpertstoimplementtheirplan.Oneoftheirprojectswasasystemthatusescameratechnologythatwillspotpotentialhuman-buscollisionsandalertbusdriverstoit.Thatmakesneighborhoodssaferintheshortrun,andthedatacapturedshapesbussystemroutedecisionsinthelongrun.

TheBigTakeawaysIoTdevicesareeverywhere.Fromtherefrigeratorthatcantellyouifyourchickensaladisspoiledtothethermometerthatcanpredictbraindiseases.Wehavelookedatwhatmakesupthelandscapeofthesedevices,thecommunication,thevendors,andeventheprogramminglanguage.

WhenwetalkabouttheInternetofthings,wedon'tjustmeanconnectingadevicetotheInternet.Itinvolvesthedatawecollectandwhatwedowithit.DataisthekeytoIoT.Butgathering,analyzingandactingondatawegetfromthesedevicesmatterstoo,notjustthedataitself.Thecloudisthehomeanddestinationofthedata.Itaddsintelligencethroughdataanalyticssoftware.

MypurposeforthisstorywastoexplainthepartsofIoT,howthingscommunicateandwherethedataisstored.Ihopetheexamplesgaveyousomeinsightastothepossibilitiesnowandinthefuture.So,nowyoushouldhaveenoughinformationtoboldlygotothewatercoolerandhaveaconversationaboutIoT.

Page 26: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter

NOTES

Page 27: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter
Page 28: Conversational IoT€¦ · These books are meant to increase your understanding of the subject. Terminology, conceptual ideas, trends in the market, and even fringe subject matter