iot software platforms - politecnico di...
TRANSCRIPT
o IoT isaboutDATA sensedandtransmittedfromOBJECTS
o Howmuchdata?n IPV6coverseveryatomon100+earthsn Recentestimates:4.4zettabytes(10^21B)of
IoT dataproducedby2020n That’s1stackof128GBIpad Airreachingthe
moon!o Howtomanageit? Gotothecloudwithan
IoT platform!
Whythecloud?
o Theterm“platform”canreferto:n Hardwarearchitectures(ARM,Arduino,etc…)n Softwareframeworkstoprogramsmartthingsn Cloud-basedmiddlewareplatforms tomanage
IoT dataanddeviceso Wewillfocusonthelastpoint
IoT platforms
3
o IoT platformsworldisgrowingfastn 70+platformsavailableonline(+40%w.r.t 2014)
o Theyaregettingmoreandmorematureandstablen Notonlystartups,alsobigplayers(Microsoft,IBM)
o Keyvaluepropositionn reducecostsandtime-to-marketforIoT solution,
reducemanagementcomplexityo But:alotofconfusionforusers!
IoT platforms
4
o OldGiantsn IBM:Bluemix IoT Cloud,Node-REDn Microsoft:AzureIoT Suiten Amazon:AWSIoTn Google:CloudIoT +Brillon Intel:IoT platform
o Startupsn Xively,Thingspeak,FreeBoard,ThingWorx….
Solutions
o Devicemanagementn Connectdevicestothecloud,configure
devices,updatefirmware,monitordevices…o Datamanagement
n Storeandretrievedata,manageevents,visualizeandsharedata
o Dataanalysis/automationn Statisticalanalysis,datamining,machine
learning,etc…o Security
Desiredfeatures
Data Analytics &
BI
Device management
Security
Data management
Automation
Specialized platforms:only one feature is
implemented
AutomationDevice
management
Datamanagement
Data Analytics & BI
Security
Generalized platforms: many features are
implemented
Twotypesofplatforms
Specialized platforms
8
o Maybedifficulttolinktoaparticularfeaturen E.g.“DeviceManagement”canbeveryspecific
(dependingonthedevice)o Security(device&data)is growing
importance
Generalized platforms
9
o Two main approachesn NativeIoT platforms:former specialized
platforms that evolved withtheaddition ofnewfeatures (e.g.,datamanagement)
n Cloud-based IoT platforms:traditional cloud-based solutions that evolved withspecializedfeatures (e.g.,device management)fortheIoT
o Strengths:n Excellent datamanagementandinterface with
corporateITsolutions
How to choose?o Specialized
n Connectivitymanagement
n Deviceconfiguration
n OtA firmwareupdate
o Generalizedn Datamining&
machinelearningn Datafusionn Eventprocessingn Rulesengine
10
o It depends ontheparticular IoT application!
Distinctive Features
11
o DeviceSDK:n Firmwareprogramming,APIdocumentation
o Cloud SDK:n APIn Graphic programming tools (Node-RED)n Built-infunctional blocks
o Generalfeaturesn Languageagnosticity (C,Java,Python)n Communities (Arduino,mbed,launchpad)
o Many IoT platforms available
o Both startups and big IT players
o Different solutions / services for different users
o In general, quite a complex scenario
Summary
16
o AnIoT cloudplatformfor:n Real-timedatacollectionandstoragen Dataanalyticsandvisualization(integrated
withMATLAB)n AlertsandSchedulingn DeviceCommunication,OpenAPI
ThingSpeak
19
o CarCountern Keepingtrackofcarsinabusyhighwayto
analyzetrafficpatternso WeatherStation
n Arduino-basedtocollect,storeandanalyzeweatherdata
o TideLevelAlertsn Real-timetidepredictionsandwaterlevels
monitoring
ThingSpeak featuresprojects
o ThingSpeak useschannelstostoredatasentfromdevicesorapps
o Basicoperationn Create/list/view/update/delete
o Channelsettingsn ID,name,descriptionn Upto8fields(datastreams)n Public/privaten Location,Metadata,etc…
ThingSpeak channels
21
Operating on a channel
22
o OperationscanbedonefromthewebinterfaceorthroughtheRESTAPI:n SendanHTTPPOSTto:
https://api.thingspeak.com/channelsn Withparameters
o api_key=XXXXXXXXXXXXXXXo name=MyNewChannel
API Key
23
o Whenperforminganoperation,yourAPIkeyisrequired
o Keyscanberegeneratediftheuserfeelsthattheyarecompromised
Channel fields
24
o Eachchannelsupportsupto8fieldso Eachfieldrepresentsanindividualsensor
streamandisassociatedtoachartn e.g.,temperature,humidity,numberofparked
cars,etc…o Field/Chartparameters:
n Title,xaxis,yaxis,appearance,etc…
Channel field update
25
o Likechannels,fields canbeupdated viaHTTPrequests:n POSTversion
o POSThttps://api.thingspeak.com/update.jsonapi_key=XXXXXXXXXXXfield1=73
n GETversiono GEThttps://api.thingspeak.com/update?
api_key=API_KEY&field1=73
Practical exercise
26
o StartstheIOTVirtualMachine(pwd:user)o CreateanaccountonThingSpeako Createachannelcalled“Test”withonlyone
fieldcalled“Randomvalue”(we’lluseitlater)
o VisualtoolforwiringtheInternetofThingso Canberunonavarietyofplatforms:
n Edgedevices:RaspberryPI,BeagleBone blackn Cloud:IBMBluemix,AmazonAWS,Azure
o Theusercreatesflowsbywiringtogetherdifferentnodes:n I/O(serialport,tcp sockets,http,mqtt,files)n Functions(builtinorcustomJSfunctions)n Advanced (executeprograms,postatweet)
Node-RED
28
o Openaterminalandtypenode-redo Openthebrowserandgotolocalhost:1880o Thenode-redconsoleappears
The“HelloWorld”flow
29
o Insertaninject node,afunction nodeandadebug node.Wirethemtogether.
o Modifythefunctionblockasitfollowsmsg.payload = "Hello World!";return msg;
o ClickonDeploy andthenontheinjectbutton
The“HelloWorld”flow
30
A working example
31
o Let’screateaflowinNode-REDthat:n Generatesrandomdataperiodicallyn UploadtherandomdataontheThingSpeak
channelcreatedbeforeo Weneed:
n Injectnoden Functionnoden HTTPrequestfunctionnoden Debugnode
o Modifythefunctionblockasitfollowsvar API_KEY = ”YOUR_API_KEY”;var data = Math.random()*10;msg.url = "https://api.thingspeak.com/update?api_key=" + API_KEY + "&field1=" + data;return msg;
o Modifytheinjectblocktorunperiodicallyevery10seconds
o WhathappensonyourThingSpeak page?
Randomdatageneration
32