Developer's Guide to Connecting Devices to Azure IoT



okay guys let's get started I still have three that's for keeping you in the room because I'm not sure you're gonna stay it's late beers are calling thanks guys for coming you want to have fun that's the session for that we're gonna have demos and what do you see right now you should see that soon yeah hello oh sorry that's me it's always me okay so we're gonna talk about as your IOT from the developers perspective and that's an introduction my role at Microsoft is I'm a PM so I'm the one to blame we never get credit to what he works devs do but basically I'm the PM in charge of all the developer as the case for azure IOT and you'll see what that means in a second I'm planning to do tons of demos if I run over someone gets me a beer and I continue anyways you have the boards you have to stay and so we'll see how many of these demos we can tackle before going into them as which will be in about 5-10 minutes max I want to kind of give you high-level pictures a picture of what a GRT is what we do and and why we do that as any of you gone to the previous session about the vision roadmap blah blah blah thingy cool so there were two of them right was the one about the Microsoft IOT vision and then there was one about the azure IOT vision okay so here we're talking about a sure not about the Microsoft global vision which at the end of the day is pretty the same so in order to do I owe tea and to offer IOT solutions to our customers we have two approaches the first one is to deliver services bunch of you know Lego blocks that our customers can grab aggregate configure and so forth as part of these services there are some of them that are really IOT specific one is called as your IOT hub and we'll see a bit about what it is how it works and so forth this is basically the core of the IOT scenario when it comes to connecting devices to the cloud and then you have other ones that are not especially IOT specific but can be used or are very much well designed for IOT scenarios as your functions is a good example of that and we'll try to make as your functions work well without a service during one of these demos but building a solution and you'll see some architectures and ideas what I'm talking about for very simple solutions that's not super easy you might be a guru in all as your remote resource manager templates and PowerShell and so on but our customers are not so what we want to do is deliver at the same time this bunch of services that it can go and do you know the iy type of projects but we also want to provision solutions that are pre-configured and this is what the azure IOT suite is about so if you confuse the bad as your IOT ru t hub IOT suite so azure IOT is the big name majority have is the service which is the gateway the devices to connect to the cloud and as your IT suite is a solution that's a commercial offer a bundle of services that people will be able to deploy on their subscription to build a IOT solution good and this IOT solution this IOT suite is a starting point right so the idea is there you have something pretty generic we have a couple now which is remote monitoring and predictive maintenance we're looking at anymore but this definitely is a starting point so people will be able to go there and and you know configure change the services replaced by the own open-source version of our stuff they can change the UI they can do whatever they want so this is a typical architecture for the azure IOT suite remote monitoring solution and the reason why I bring that up is because we've been like showing that demonstrating Nats I'm not gonna go through the a here is that to do ru t suite because you went to the keynote this morning and you saw the brilliant demo by Cameron Skinner our dev lead about RIT suite so right you went to the keynote right he got a the first one here that's for you it was first one throw it you guys are not fast enough still two to go so this is the architecture in a nutshell you have the idea of like the IT hub ingest data from devices streaming latest job there's going to be doing some filtering determining what type of data is coming from what device throwing that into a blob so that we can consume that data later that's what we call the cold path or throw that into something which is transmitting streams from one place to another one which is in that case Van Haaren could be something else we have a web job that could totally be an azure function now we publish that that will actually use to do something with the events that have been posted into the event hub okay okay yeah I'm not gonna stop here I still have two boxes to give away so we also use other services like Active Directory power bi for the UI and things like that let me not go into too many details the demo you saw this morning at the keynote with the shirt with actually based on that exact solution with some tricks some additions to it we added some Azure functions and logic apps you didn't see the logic apps part that ingested Twitter but will play with Twitter later during the demos you'll play with Twitter and basically you'll see how the function will trigger an action within the IOT suite using using some magic but here's an example a very like small example of how you can customize a pre-configured solution like remote monitoring so then if you don't want to do remote monitoring and a pre-configured solution you can do it yourself or you can start from one of our IOT starter kits not yet you can start from one of our samples so we have a bunch of samples out there and twin samples simple hello world samples for various type of devices from the service perspective from the device perspective this slides will be available so you can download and go to the all these links or you can start from scratch if you are one of these guys like hey I don't want to do it myself I want to write my compiler before writing code you can go there and some are like that right and so you can go to the portal of azure and start building things you can build your own arm template and you can look at our azure IOT SDKs once again so what's in these boxes and tools for you to get started because when you're a developer you don't want to get started from scratch the azure IOT hub service exposes recipe eyes and also supports some m2m protocols like AMQP or MQTT but you don't want to like do it yourself so we want to provide the tools for you to get started if you don't work on the other services address decays you know about them various languages and so on when it comes to azure IOT hub all our SDKs are open source from the service perspective when it comes to configuring the IOT hub adding devices in the registry reading messages out and so on we have three as the case 150 sharp one for Java and one for JavaScript we're looking at adding Python on the service side on the device side of thing we know it's very important that we tackle the millions billions of devices are out there and these devices are not running net they are not running big huge frameworks they're usually running see if not hasn't work so we have the C SDK which is our core we developed all the stacks all the communication protocols we have our own version of that optimized for tiny devices and for connecting to azure IOT hub we have a JavaScript SDK very useful not only for demos for prototyping and we know JavaScript is coming super hard in the IOT space on the device side of things we have Java because devices out there are running Java already right so it's important for us to be able to add our SDK to an existing solution we have C sharp happy that a Monday we published in the master branch are at PCL so you can use and I'm going to show you our c-sharp SDK to target Android and iOS at the same time as WinRT I know that's called go to all the credit for all of that anyways and we have Python since Monday as well we published on Monday can you imagine we are a developer team publishing on the Monday at the beginning of an event in order for your life to be even easier so you have all the code for only SDK so you can compile change whatever but we know it's easier using packages nougat npm apt-get maven all of these packages are available we don't cover all the platforms all the these shows of linux in the planet but try to be kind of exhaustive and a list of the things we cover and for the suite all the pre-configured solution remote monitoring and the other one are open source as well everything the arm template the code for the websites the code for the simulator is the code that is behind in a worker roles and so on everything is up there for you to play with and then there's two tools I'm going to show you which allow you to develop and manage and play with all of that it's never very easy to go to the portal it's kind of slow and if you want to do things like I'm heading that and monitoring what's going on my device and so forth it's very useful to have tools we have a command-line tool which is a cross-platform in the base on node and we have the windows tool shows device Explorer and we're looking at hat which has a UI and we're looking at having a cross-platform version of that UI tool soon let's go for demos yay ok let me switch to this guy here I think no one will get the tools kids don't get them for myself so what is the first thing I want to show you how to create an IKEA hub so you've seen the demo this morning about creating a full-blown IOT suite so let me go to the portal which is low my connection is okay yes I'm here and that's gonna be interesting okay I'm here so in that portal I'm logged in I have a subscription paying for but you are you should be careful about that I'm gonna go to new guess what intern are things and the first on top as your IOT hub I'm gonna put a name choose a resource group blahdy blahdy blah and then I'm gonna have my dear our resource group with my IT hub in there oh let me go here is gonna be faster Olivia hub demo it's a cool name right that one only had like few sources what you would see is just the first thing the idea hub on top here so this IOT hub here once it's been created you have various policies that you can define to access manage connect endpoints like devices or applications to it I want to go into the god mode and so I'm gonna go in there and I'm gonna pick the IOT hub owner policy I can do anything in there I can do what I please so this is like the you know a high-level view of how you create an IT hub obviously you want to create that with other tools when you become you know you go into production arm templates is how you would do that today we don't have a PowerShell support yet we don't have direct we do have in a way as your CLI tools support because you can use an arm template and spin it up with both power shell or the as your CLI tools but we're working on providing the right tools and api's and functions for you to do that from your favorite tools right we want to be able to scale and will allow you to scale we do have though all the api's for the service for you to productize the publication the provisioning of devices the monitoring of all the information and so on so that's in the box already so you don't have to do all right a add one device to device that three device retrieves a connection string that I'm gonna do today but that's just for demo purposes right so the couple of tools I mentioned I want you to know about one is a node one in school IOT hub Explorer so this guy has several commands and these commands allow you to create a new device ID to list what's existing in terms of device IDs to send a message to a specific device to monitor what's going on from a device right so that tool is very useful especially if you are if you love scripts if she loves you like types of tools command lines and so on that's great and I'm gonna maybe use it a little and the other tool is called device Explorer and that's a little application they can find on our github repo as an installer the code is also on the repo now when as a UI it looks ugly it's a developer tool but that's okay they're volunteer to help us make it look better oh I saw you well you sign up for doing development for me right good we have a kit at least one left so this is not super fun in terms of look and feel but I works so I could actually go in there face my connection string update and what I can do from here is look at the device IDs that are already registered in there I can let me actually scratch that one okay boom I can also monitor devices data behind removed all the devices obviously and you can send devices from the cloud to the device from the cloud I'm not sending from the device from the thing here I'm actually using api's of the service to send a message back to the device okay so let's connect a device well we have the tool here I have my little connection string from the hub to create identities so let me go in Visual Studio and do something there so you guys are all visit to your fans and users right oh yeah I'm having fun with that one you're gonna hate me but that's fine okay so let me create a new project and what I want to show you is a simple uwp app connecting to it yet because we are in Windows world it's fields I'm gonna create a new app I'm gonna call it uwp IOT device hopefully it will work and we have a fun thing that is been published by our friends from visual studio which is a connected service extension so that one you can find on the extensions library and you can use and it's a very simple thing to do now everything is loaded yeah okay I want to right click on references and do add connected service and here now we have azure IOT up because going through the portal is lame I know it Scott Hanselman stays light lot everyone laughs what I say it no one laughs it's lame I'm gonna get in trouble oh yeah hub seems to be a good one right so I think that's too want to just use so here what happened is that the tool looked at my subscriptions nest because I'm logged in and listed all the existing Azure I to help I could have clicked on create a new one but here I have an existing one it lists the device ID that are in there let me create a new one from the tool and let me call it u WP device for example okay from here I'm gonna say ok and what its gonna do is going to actually create a new file in my project with a very simple class to function send message receive message send message receive message and here you have a web page it gives you instruction on how to do things and now let's see if I remember what I wanted to do in here so in my app it's launched and what I want to do is actually start doing some stuff in there but that's not the page I want to do stuff in what I want to do stuff in is in my main page and it's coming hello people are waiting for the question to get the box I know you okay let me add a little button up there let me also add a little text box where's my text box text box or text block text block is good enough let's do that here okay and now what we're going to do is add a function here and when I click the button what I'm gonna do is insert little code snippet UWP and I'm gonna send a message right this guy actually will assign a message but obviously I will show you the class in a second I forgot to show you the class it's not fair so I know what's going on you don't we add that so this guy here I should have is a static class that has been added to my project here right so static class there's a device connection string has been retrieved from the idea by the tool by the extension a bunch of like really nice comments have been auto-generated and then I have this function device the cloud message and this one actually creates a device client using our c-sharp SDK so he broke in was nougat Ord will because I didn't build yet the right libraries and then I create a message right then I send it it's real lines of code to send a message to the cloud securely and the other one is about receiving and receiving is something you do asynchronously so basically same thing you create a client and you're ready to receive and then you wait a little so that you don't I J I Jack the CPU and so forth so here I have the send button let me actually also start the the receive Bart here and I'm gonna do receive right okay so there's a couple of things I need to add cuz you know the joy of developing for uwp where you're actually in tasks and you need to invoke the UI there you go everything right here so just pray for things to work compile and we'll see what happens so that's specific device I should now see it in this little guy right boom appeared here so what I'm gonna do is I'm going to monitor what's going here in this app and then I'm gonna start this uwp app on my Windows machine and hope for the best wow that's a UI and let me send boom Oh message arrived up there in the cloud you have to believe me because that's an app on my PC here but it's reading from the IOT hub like trust me you can try the same experience yourselves for sure with the device that's left here okay and if I want to send it to fly a message I'm gonna say hey yellow send that and the device is listening for that and boom I see the hello appeared here I'm a really good coder so then it has another hello at the end or cuz yeah whatever carriage returns something yes there you go so like few you know manipulations and Visual Studio is able to get a device to connect using that really nice extension so that's a way if we'd like to simplify your life so I was mentioning the PCL stuff now so let me go into the PCL stuff same thing I'm still developing four devices so I'm planning to have devices that will connect I will create a new device ID so that's what I'm gonna do actually is I'm going to copy that connection string here and I'm gonna show you how to do that here IOT hub Explorer login so I'm logging in like that and then I will say out here Explorer create and I'm gonna call that PCL device and I want to have the connection string read to me because now I'm gonna do some things manually so here is my connection string this is a unique connection string each of the devices that will connect you an idea hub they have their own connection string that generate a SAS token in order to connect to the hub I can go into details about that in the Q&A if we have time for that cross-platform application yehey I'm gonna create a PCL device here and I'm gonna see what happens I didn't break all my installations of videos to you all across well you should be good so here what it does is basically as you might know uses a marine in order to create a common code for various mobile devices I don't have a Mac I don't have the simulator I'm just gonna play with the Android version here so I didn't mess up the uwp one so hopefully I won't mess up this one either there we go so what I need to do here is to include a nougat package that's the way you are getting the library the SDK for as write your hub so I'm gonna browse for so don't make any typos on this search thing you might know cuz it doesn't work like if I don't spell it correctly it doesn't find it outrageous okay install and here what's going on is like it's getting all the negatives dependencies for my PCL app to be able to connect triage IOT hub all good in there what do I need to do here if I remember correctly I need to get some of my cheating code snippets yes I don't accept that so it's actually finishing the install here and maybe is gonna pop up for some other question but maybe I can code in behind come on in it okay cool so here I'm creating a device client I have a connection string I'm gonna use that you saw that I copy/paste the connection string earlier on from the ITF Explorer this is a unique connection string so here can someone tell me what the problem is there's a what is it no there's a problem down there awesome if I have like and we're talking about your tea right so everyone is say billions of devices and so I'm gonna have to go manually and deploy all of that no actually yes you do right no you don't there you go thanks that's the last one hey I have a cool demo with a robot arm I'm not giving it away so yes there's a problem here but this is a sample the way you would provision these connection strings would be using our nearly announced today device management feature in the hub so we announced a public preview to be honest it's really early early preview but the idea is here to provide tools that will be in a cloud that will allow you to generate device IDs and have a way to deploy them on your devices right so we're working that work in the very solutions because various devices on have the same way of connecting to the web of protecting data and so forth so that's coming we have that in mind so if you see damage with hard-coded connections freak don't freak out this is not the way you're gonna do it at the end of the day okay it's just for my own personal convenience I hope developers are not listening to that okay PCL I'm gonna actually now create that client in my class right I need to have a couple of maybe someone can educate me later on how to add I know there's a way to add the using statements in the snippets but yeah not I'm not good enough yet so here I initialize the class and what I'm gonna do if I remember correctly you have that I'm gonna initialize also the listening part right okay and that's here that's here let me see that looks good you ever start this task I never know what that thing appears right boom it's writing tasks and this one will wait forever for something to arrive will decode the message and will send a response back to the ITF we have a handshake mechanism that allows to make sure to make sure that from the cloud when you send a command it's well received and vice versa okay so that's the function for that and now what I should do because I have a class it knows how to create something when I instantiate that class what I want to do now you find the right is to add where am I where am I okay so that's my class this is this guy this is this guy I'm trying not to mess up the code here in here if I'm right I'm gonna had a function and this function will be about send I don't have any more devices no one responds my questions now that's not funny guys I feel alone here okay so here my class is ready certainly filled of bug I've not slept in three days so we'll see what happens and then you can't just like send me a big Wow if it works let me go into my Droid application and there's an uncreate as a button click here so eventually what I can do that on the oncreate is create the instance for the class right so I'm gonna create a little something here called my class I'm doing like live it's not compiled let's compile that and send yep boom you know I'm coming from the C C++ development world where when it builds you're happy right so here I'm just like you know this is advanced languages and just like yes and everyone's looking at me what built I'm sure people like share my pain and I'm gonna tell you about it anyways so here's my client when I create the guy here I'm gonna wait a little I'm gonna say hey hey closed knew my class I'm all good now yeah okay and here when I click I'm going to do client dot send message and how about we send something like that's okay massage number and I'm a dirty developer so I'm gonna do that okay good oh good it was good for you guys let's see if I can start the name leader I didn't start it before because I totally forgot but that's fine it's gonna come here so we have this nice emulator so I'm using for that case I'm using VirtualBox and the exam rain Android player because I like it because because it's Microsoft now yes true before I could say yeah here's the open-source community we love you and so on that's Microsoft I can't say any more that's fine it's still cool right so I I wouldn't do the same thing for iOS right so you've seen like all that development where this thing is starting here and hopefully will do something in the meantime what I can do naturally let's go here and say hey I want to monitor the events from that device right IOT hub Explorer I'm gonna actually there's something I need to do here that will not look very pretty but that's okay the monitor event in our ITF Explorer does not support the login method yet so we have to put that that's okay monitor events will remembers the name of that device yeah too late okay so that one is listening so you see command-line tool is listening to what's going on here this guy needs to be unlocked I guess any applications is here and here I've come in low my outputs let me try and send a message one click one message one click what message want to think one message one click okay one message and eventually I can send a message as well send boom and here in my output I should see oh hello okay back in force PCL application some code two lines right bit more lines and off you go you have a nice PCL application so that was for PCL note let me show you a little bit of note now but before I'm going into the note thing I want to show you a couple of things you can kill these guy don't need it what I want to show you is that's the fantastic azure IOT SDKs repo that's gonna be your home screen for your browser because it's beautiful you're like totally crazy the guy what is he talking about indeed it is beautiful here we have bunch of SDKs here are all the SDKs that we're building for azure IOT there's nothing else everything is in there we're not hiding things from you and actually if you look at the various branches you see work in progress yeah like typically we thought they would be cool to look into having a Java wrapper around our C library this is the way we developed the Python one was pretty straightforward and cool I'm gonna show you that real quick and the idea was a Java wrapper was to up is to optimize the the code base the quality and so on we do have a native Java SDK as well and so at this point in time we are at that place we're just like okay we have the two options obviously we don't want to maintain both so we're gonna ask all of you guys to participate in the discussions and you know voice your opinion on what we should do in there and that's that's true for all the rest we get a lot of traffic in our SDK we engage a lot with the partners with the customers was developers you can see here Archer is doing some stuff with zwp actually the stuff he's doing is actually adding more protocols to the uwp library which are today only supported HTTP while all the other ones support all protocols so this is our SDK and I want to bring your attention to to the node 1 for example because all of them have the same kind of things we have the code of the actual thing but you also have a bunch of samples here very like simple samples all the code that I wrote my snippets and so on everything is coming from here because real developers are doing the raw the work of giving you instructions on how to build things right so the documentation we have someone a sure the comm and so on but lots of the documentation is in here in the gate of repo and we have bunch of MD files as well to help you one that I kind of like also is a get started folder that one contains I think we added some about 85 Doc's 85 unique dogs they're not copy/paste not all of them that actually as you can see from the names are about running the simple on node using block or running on raspbian the C library etc etc it's a bit of a maze here but we're gonna have a nice tool to navigate through that set of documents so that's going to be your starting point for doing stuff like the Python for example here you have all the instructions the prerequisite on your machine what do you need to install how you prepare your machine how you replace the connection string in the code which is the back practice remember that practice don't put the connection string in the code just for samples and so forth so this is this is or our get of repo I wanted to show you real quick when you go back to visitors 2d once more and nothing that's the last time I going there Python developers in the room okay I don't have any more box but thanks for answering anyways let me create a new project Python where's Python somewhere down there right Python and I'm gonna go with a from existing Python code so I have a clone of the repo on my machine right here and I create I compiled the Python libraries there actually I remember you it wrapper around the c1 so native code and so on so I built that for Windows we have all the make files for you to build for Linux as well so you can use Python Linux for connecting a device there's going to be called Python device and what I'm gonna do is point it to the code which is in my folder here everything is called IOT online machine as your IT SDKs guess what Python device samples select folder next and that never works I don't know why let me select MQTT finish and I noticed that there's a bug in the tools because it actually selects another PI file as your starting point but that's fine no mine so here what I want to start is this guy so once again not exclude no start a step ok and this guy here is a full-blown sample that will do everything for me I'm gonna add a new device ID I like to add more I'm gonna call it guess what Python device create ok this is my python device I'm gonna copy the connection string here and then I'm gonna paste it where it tells me to paste it ok boom there you go and then is a 5 boring so basically nothing to do here it's supposed to send stuff let's see data I was not fast enough I think he's done with his six messages it's no sorry cancel now I wanna restart it just for the fun of it just to show I'm not lying but then you'll see actual data coming to the clown on websites not on my local app so you're gonna believe me when I say it's going up there let me start it again because I see you doubts just like everything on the PC we can't believe in boom all the messages are here so my Python application is actually sending data to IOT hub it is standing data to IOT hub right okay and you've noticed a pattern the the more we go on the left side code then that cool let me try and send it low to see if this guy recently a boom hello you read stats in the middle here so hard s would love brackets before and after I'm not sure why it must be a Python thing not a Python developer but anyways you got the idea I've got this Python thing all put together and working that's fantastic so song would know me some know me right something owe me some know me right there's a project called connect the dots of the i/o that I created a couple years ago last year something like that like time to slice this project don't go there right away it's using old stuff event hub and so on but there's work in progress here IT hub the secret branch in public when I'm working on updating all the connect the dots project to IT hub so that you're able to use the latest and greatest features I a measure so what is where we go in my Direct Connect so the only thing I work for now is node right and the website just like want to be plain honest with you guys and actually the sample called Intel Edison Grove and in there I have this nice empty file that tells you what to do and the reason I'm going there is because I'm lazy and what I'm gonna do is just copy paste at here right which tells me to download stuff so I'm gonna go on this little tiny device here I want to show you this little tiny device that's not the device that's the device can you recognize that no one answers I don't have any more gifts Intel Edison whoo one of them okay so this little device is connected using Wi-Fi I think it's connected we'll see and what I'm gonna try and do is develop an application a node application to pull on this guy and make it run to connect to connect the dots this time right so here's what I'm gonna do I'm gonna actually go into this really connect adults website that's my website it's here I will go into my come on can I do that site okay let's give it some time I'm gonna go into my resource group which is called connect the dots IOT hub and in there I will see that have this nice IOT hub there's a third way to get access to the Heidi's that is new from last week man will be interested to have your feedback on because it's a read-only way of dealing with device IDs for a IOT hub and this is in the portal and because you go to the portal because even though Olivier said it was lame sometimes you go there you can actually retrieve connections train it was actually whining last week to the other p.m. sorry yes yes well it's not it's totally useless don't do that like developers won't like it I have been using that feature since then maybe a dozen time already so it's not too bad to read-only so these is not the place to create device IDs this is the place to retrieve the connection strings for your device IDs so I'll I'll keep it like that and I'll try to stay focused a little here because I'm not I'm gonna copy that I'm gonna go into this little command shell here I'm on my device yes I'm gonna do a CD node app slot so for those we've been doing some Intel Edison there's a cool feature in there does that folder in root called no tab slots and they implements the ODA boot of whatever node project is in that folder when the device boots so you don't have to care about you know playing around with the stupid files here and there and this guy being connected what I'm gonna do is do that and copy three files I think it's three files from the connect-the-dots project which are related to the Intel Edison Grove sample because I have an Intel Edison with a growth kit on it with bunch of sensors and it's actually doing then an NPM install I'm gonna show you the way looks so the files are downloaded are these ones here so there is one called Intel Edison CTD j s 1 which is packaged up Jason and one of just settings Jason settings is the place I'm gonna put my connection string bit better right it's no longer in the code it's in the configuration file that I can provision getting there the package Jason defines the dependencies one of them is an NPM package called connect that's right I don't need to care about IOT Hut either I'm including that for you in there okay let's see how did know it's installing all the Galileo IO stuff it's gonna take a minute or so so while it's doing that let me introduce you to something else right okay with apps there's a robot arm here what I want to show you with that robot arm is something funny to do so let me start this app so this robot arm is controlled using IT hub it sends telemetry data it's using an embed device which is a C microcontroller here and this guy sends data out to IT hub I'm reading telemetry I'm showing in a connect-the-dots website and you'll see how it looks like and sorry for that and this is the guy it's called robot on demo da and from here I'll be able to see what's going on with that robot on here the idea of this demo is to say I've been aggregating a few things IOT hub to ingest a data stream analytics to apply rules on that data that push the data into an event hub this is where the alerts will be read right my connect adults website reads those from the IT hub for the real-time stream of data coming from the robot arm let me see yeah bring it back home so it will read the real-time telemetry data from all these servers here and I'm sweating cos I hope it's gonna connect and it's also reading the alerts from the event hub right and so it's gonna display charge so bad Oh what's going on here and it's going to display alerts because they've been posted to that event hub we also have a machine learning algorithm OLAP demo will be open source tonight if I can finish it but basically all the demo be open so for you to look into so we have a machine learning API that is called from a worker role to detect anomaly on temperature this is why you soda here dry your thingy I'm gonna try and trigger in an anomaly up there and the data the other data you see everything is coming from these servers pretty cool temperature voltage the angle the rotation and the load and the hereafter this website which is and they speed up net websites on the server side of things I'm using this service client for IT hub so that I'm able to send comments back to the robots so let's for example ask it to say hello and saying the wave command and this guy because we need the camera right where is the camera is here yeah I want to try that again all right you guys can see it you can see it yay obviously yes that's good this guy let's push it to left that we can see what's going on this is a load once again I'm gonna do a wave I'm gonna do a resume because this guy went into an anomaly yes and it's waving in okay cool so wait there's more so controlling a robot from the clamp that's not the smartest idea I don't think so it's cool for demos but I don't think it's the best idea what I want to show you here is something different so I have the robot doing something right it has it's fast it's my stop because of the anomaly and temperature so this thing has this task it has a real-time controller I'm gonna stop it manually the real-time controller is saying woo something is wrong let me stop the thing here but there's no operator in front of the robot it's kind of useless the beep so what it's doing right now it's actually sending a notification to the cloud so I have here that notification I'm showing it here in the in in the charts for the demo but you can imagine that this one is picked up by a worker role that uses logic apps you know logic apps very cool as your service allows you to trigger processes outside of your realm so typically if I want to send a tweet I bring logic app very simple setting Twitter account trigger the logic app and boom it's gonna send a tweet right you want to trigger an action like open a ticket in some you know customer relation management tool you can use logic app it's gonna trigger and dynamics whatever so you can have the robot arm its say I'm doing not good all right eventually here's my log for data and it's gonna trigger a process that will send someone to go fix that robot arm all right so that's the idea of that simple what's going up here is so this guy's stopped so I am here the operator the other side of the world I mean Germany and for example so yeah everything seems to be a right so what I'm gonna do is restart the robot and eventually have a camera because I'm an operator so I can see the camera I didn't think of that that's cool right the camera whatever and so I can resume the process and boom it restarts remotely okay so now let's try something more risky so machine learning is called based on the telemetry data and it's gonna continue doing that we'll see so machine learning is called for detecting anomalies on temperature so I'm gonna do something risky I've never tried it it's actually blow on the robot arm and try to make one of the temperature data go up it should go up hopefully and we'll see after some time it shouldn't be too long we shouldn't have anomaly detection triggering it didn't trigger just stop this routine so we'll see if it triggers it should be fast but I've been playing around with that so we'll see okay while it's doing your thing well actually everything it's free up okay I think the anomaly detection thing is a 10 or 15 seconds anyways we'll see that later on I'm sure it's gonna trigger let me go back to my node thing you remember node I was actually working I'm deploying something in there so this guy here let's keep it there I think it's fun to have it and I'll bring this guy up here right which is basically all the thing they've been doing deploying all the all the node modules and so on you can't imagine how hard it is to go back and forth anymore like that so I'm going to deserve that big beer let me see what's in there so we have the node modules the package Jason what I need to do is to edit the the settings of JSON file because this one is like blank right it's the default one it's coming from the connector Docs project but remember I was there and I picked the connect-the-dots anomaly detection is not detecting anomaly whatever well I'm not sure why so I was here where it was my ways right the Weisse idea is here and we need to reduce this guy here and I had this device ID here right okay let me go back to the state here I had this guy here and this is a nightmare of the windows okay let me go here and replace the code for the connection string that is like kind of weird because it's no longer the right size of screen and it went away all right let me just think no we do okay you got the love come in line editors I'll let me go there and say paste it's already doing strange things that's good I have no clue why just adding these kind of things here but I need to fix this guy I will definitely appreciate your patience don't go away there you go and the device ID is oh yes Collins thank you've got my French buddies here helping me they expect to have a device what was the name of this guy I grew up kit ok so that's what I need to do here and if everything went well I can actually start this guy pray I hope that all the sensors will turn on and that it's going to start sending data to IOT hub for then connected device ready connects this dot and sending data to this guy here yes come on oh hello oh that's not the right one is it always the same thing why not be on the right side yeah it's here hmm works yeah that's good stay seated that's fine so half like bunch of sensors here in that sample so you wanna play with temperature and humidity boom put my finger here goes up pretty much real time did you just blow stopped dammit that was a bad idea my bad no you're still yeah it's thinking about it I think it's the website that says more maybe not I won't see let me refresh that guy here and the other one yeah here normally detection remember okay so my robot on demo actually is not finished the other guy is sending his data I imagine I mean like the rest of the things like it's sending tons of stuff but I closed it yeah the site is like that so you imagine like you know like very simple to files from the repo J's files node runs pretty straightforward the one thing I want to show you real quick before I jump into the last part last time on some QA is and the most risky of all the demos you can't imagine or risky the last one is so I'm not sure it's a good teeth or either so what I wanted to do is start this uwp app this app actually is a web app running on my machine and you'll see if everything goes well if it starts it will show the same rubber on demo website right it's a website same the web app is running I just have this little guy here and what I'm gonna do so one can guess what I'm gonna do No hey Cortana robot control taps so what's going on here is anomaly anomaly yeah temperature anomaly that's fine let's resume this guy that continues waving because he's happy right and so me too like to sort of to them is a good almost there the last one and so what happened here is that my uwp app is actually interacting with Windows right so I can't send the control using Cortana and this guy the same way I had the bottom stair was able to send the commands to the robot right pretty cool pretty straightforward just took me a day two days to implement the Cortana implementation based on website because some stupid colleague told me yesterday why don't you add Crotona to your robot or lemma it's the vide you know that we'd okay so I hit him but now I love him because it works okay so you've seen the rubber arm demo pretty cool we can't have all this telemetry data you can see flowing real-time we can act on that data doing some analytics using stream oolitic but what I want to show you real quick now is the t-shirt and this is the scariest part because the device is beyond for ever and it might not work but that's fine so if I want to go back to my slides for a second I want to show you something real quick I promised myself this one so this one is say remark Mario a solution that we were planning to have first called goose keynote but got cards so I bring in back for the demo here so what good car is basically the custom UI that you will see in a second that I will ask for your participation once again this is a very risky demo and I told ask you to be indulgent I don't have any more devices anyways so it's just counting on you so what we have here is we have logic cats getting Twitter feed we have a function I want to show you in a second that gets triggered that it's called triggered by logic apps and it will send data into our solution through IOT hub so it will be like a device right so we'll see Twitter device sending Twitter account then I have my band was my windows phone here device that I hit because the Bluetooth connection to my Ben is terrible so you can only work but try and see what happens and this guy actually will send my vitals like hard bit hit super high now and skin temperature super high as well because I'm pretty hot now and we'll see that on this on the graphs and will interact you'll tweet on squat and we'll see what goes higher yes okay you want to do that and I'm gonna show the other function here so when stream on it is job based on the rules to find in a remote martyring IT solution will trigger an alert we have another function that's gonna read what's gonna happen in there and will send an event back to the shirt right through IET up make sense straightforward if it works so the tweet the hashtag is azure IOT I'm not kidding you should tweet you should tweet you should tweet you should tweet so that we can see the tweets going up otherwise I'm the only one here and you're not having fun okay so the website is here I'll actually show you so this is me this is me my vitals go squat it should go up I don't know how much I need to do that I could try the skin temperature I'm not easier that's hot I was gonna go up let's see how I get the bandy is for measuring skin temperature I'm good that's the work no effect on me Kevlar that's my skein actually right here but this like this really moves really comes from my bands we can't discuss about the accuracy of all of that I don't see tweets though it's kind of weird not sure why oh cool let me show you how that works and then will trigger the shirt because that's what you're all expecting so do you mean blowing out with that shirt and I want to go into the and you're actually mentioning me on Twitter as well that's cool thank you guys thank you you can follow me at oblak thank you I'm gonna get in trouble so there's an IOT hub resource group here and tweets go up 27 so that tweet number will reset at some points I'm not sure why that's a function thing it's it's not retaining the state out that variable you'll see that the code looks like so here I have my research I intend to publish all that code open source as well so you will be able to do the same and impress your boss with a shirt that lights up it works for me so the function apps anyone went to any of the Azure functions session cool can you come and do it we're gonna have few few ones here so the first one is this guy here this one is a trigger on HTTP so when it's GTP will be called by logic caps in that case I'm not showing logic app because it's boring it's like tweeter link alright so editing logic app is pretty straightforward and I'm running out of time anyway so the idea is that this function here will be triggered by logic apps it's using the node SDK code simple like plain sample to send an event and remember is going to send the event to the IOT hub right so Twitter Devon stand event so when I have a Twitter that comes in and actually you might be able to see your tweets here right tweet number 27 a GRT let's do this Roger IT doesn't work was that I have names okay you can hide okay so what we're gonna do is just very risky it is trigger the second one but before triggering it let me show what it looks like so the second one is triggered by event hub right so if I'm happy here I define the event hub which is the output of the suite and it's actually connecting to the IOT hub using the service as the k4note so in that sample you have both sides of the nodes as decay and it's gonna trigger the shirt number three one and two where for the keynote three it's me four is I'm not giving away a shirt well actually actually actually that's a good idea I have the the keynote the blue one that lead up trust it yeah okay Wow okay are you interested down there I heard like the virus yes okay let's do that Ashley this is not the one that we use for the demo but that's fine it's the Scott GU one I'm that cool sorry yeah it's not Q yeah it's not Q&A yet I talk you listen for now okay because we are there waiting for that shirt to light up but we don't know why it would light up yes actually you vent hub so I need to go back to this little guy here send a little prayer so the tweet count is at 35 let's see what you guys can do let me edit that rule and say that's when it's go and going up my over was 35 right 45 save the rule and let's enable this guy let's go back to the dashboard let's pray – bored come on so the count will come up hopefully and if you guys are doing a good job this shirt will light up and if not I have a plan B and a lot of sweat but that's ok come on guys tweet-tweet tweet-tweet tweet-tweet should I cheat and add more tweets than you're doing because I feel you're not very motivated by the tweets okay so let me go here Twitter let's see what account is in the logs takes time right boring as your tweet is – let me do that boom let me do it for you 36 I'm tweeting 37 38 41 41 that was 40 right something should happen 45 come on guys 4 here I'm not doing squats I'm not I promise oh he went down to 31 45 46 47 yes and no come on guys it should happen it should happen all my devices not connect anymore and it's real it's real it's real okay guys that was it so thanks very much so what do you learn today let me go back here you learn that going to sessions for i0t gives you a lot of presents you need to you need to fill in an evaluation before I forget right the shirts light up and I'm not giving that one away I'm keeping for myself these are like your call to actions why come and greet me first I forgot that one otherwise you can check out a blog article published last week which is a developer's introduction to IOT hub which actually is the that's funny part of that presentation that I did but more in depth talking about security protocols what you need to know learned whatever and all the resources links for you to get started the github repo build sessions it will be at channel 9 if you want to see me on fire again and there's other sessions to look at but you know them and there's an azure clinic I've been told like you guys should go if you have an azure problem they're gonna sort out your problem for real and then you need to fill in that evaluation snapping that and then I'll show you they'll get a beer or you can get some questions question for the robot arm I'm using the freedom cases if RF yes yeah I can show you the tub for the suite by default you have IOT hub stream analytics there are several jobs actually and they are stirring into blobs for the what we call the cold path that other services can later on come back and read the blobs and do power Bri analytics or not and we at the same time push into different event hubs based on the type of data if it's a metadata message coming from on a device it goes into a certain event hub if it's and another blob ash which is not a cup of blocks so we have the two out of the IOT hub through stream analytics yeah valid so the question is why do we go with stable storage versus blobs good question I don't know I mean this is certainly that the scenario that was like the easiest to deal with at the time we developed the suite we're gonna like kind of like change all of that with the functions edition and actually external contributions like feedback like this one's totally we could took this architecture is a sample is a start point for you it's your boilerplate right if you want so go change it that will not impact what you pay for if you pay for the suite it's time like that the way it is calibrated you can change things and it will still be the same price another question you all want to go away thank you oh good night

3 Comments

  1. Ali Master said:

    how to connect to the TwinCat 3 to Azure IoT ???

    June 28, 2019
    Reply
  2. Manny Hernandez said:

    Ok, I appreciate the information, but this could have been done in half the time.

    June 28, 2019
    Reply
  3. Ahmad Kharsah said:

    awesome demos and useful information.

    June 28, 2019
    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *