 So next talk we have building next gen IoT solutions using Python and Cloud. The speaker for today's talk is Abhishek Narayan and Saurabh. Abhishek is a technical evangelist and has worked as a consultant for Microsoft and InfoGistics. Saurabh is a technical evangelist and has worked on technologies such as Azure, game development and client web development. Good morning. I mean, there's a lot of people. I expected a little more. Good morning, everyone. Good morning. Okay. Great to see this crowd. It's pretty awesome. And we'll try to keep up to your expectations as well. And as you see, this talk is mostly about Internet of Things. So just a quick hands up. How many of you have you tried with embedded programming or Internet of Things programming? Wow. And how many of you were there yesterday in the workshop? Okay. Cool. Yep. You were there. So in today's talk, what we'll do is we'll talk about Internet of Things, the whole scenario first. And then we'll take you through some interesting demos on Raspberry Pi, Zardinos and, you know, play around with those things. And it's going to be pretty basic and we'll use, of course, the language of the day, which is Python. And how many of you, just to understand, how many of you also work on Node.js? Pretty good. Okay. I can do something of a small server creation there as well. And then you guys should be able to ping that and then query a few stuff. So we'll do those crazy stuff based on the time that we have. So Internet of Things is nothing but physical objects, you know, network of physical objects that contain embedded technology. This was already there. People were using embedded all the time. Now with the better connectivity, we are able to connect these all together, pass the data somewhere, and then do more meaningful analytics on top of that. So this whole scenario is basically what people call that as Internet of Things. And core, four core aspects. Why Internet of Things is not just about doing a blinky on Raspberry Pi 2. It's because we've got to think about, yes, from the devices standpoint, and there are a lot of things like security of the data, because when we talk about Internet of Things, we are actually, for instance, reading a home sensor data value and putting it somewhere for analytics. And then this communication from this small device to somewhere else needs to be secured, because your data is at stake. Now a lot of things, privacy concerns can come up over there. So connectivity is a key important area in Internet of Things, which we'll talk about. And then, of course, analytics. The idea of Internet of Things is so that you can embed devices with there already. We can get some value out of those embedded devices and then figure out some patterns based on ML, machine learning. And then we can do some predictive analytics which can help business do better. So that's the core idea of what our enterprise would think about. So we'll talk about analytics as well. So these are the four key tenets which covers the Internet of Things. And some stats about Internet of Things. 50 billion devices and numbers. These are the numbers expected to be by 2020. It started with about 50 billion. Now it's up to 212 billion. And the market for that is going to be about 1.9 trillion. So these are just some of the facts to actually see why Internet of Things is a buzz right now. And there are multiple examples associated to that. So all of you would have heard of something or the other. I'll have to give you an example of agriculture where you can remotely control a farm from your place when you're sitting somewhere else and you can see whether you want to actually water that farm or not. And you can actually turn on the tap based on that sensor data as well. There are multiple examples of that. We'll see some more as we go along. And this is some example of how we can compute, how Internet of Things can really help us save money. This is one example in commercial aviation industry. One person of fuel consumption, if you save that one person, one person isn't that much. But somehow by automation or whatever, if we can kind of optimize that, it gives us savings over 30 billion dollars, over 15 years. Which is a huge number. 30 billion dollars is a huge amount. Similarly for other industries, we'll just quickly run through. This for energy and gas industry, one person plant efficiency gain equates to like 66 billion dollars. This for healthcare, 63 billion dollars. Similarly for freight transport, railways and so on. Oil and gas, 90 billion dollars. So there's a lot of money here. Why enterprises are pushing towards Internet of Things these days? And this is why we are talking here. So that all of us can actually focus on Internet of Things and then get started with building solutions on top of it. And this is Gartner hype cycle. So what you see on the top is Internet of Things. Very difficult to see from that far. Control 1 works. So no, it doesn't work there in that view. So this is Internet of Things which is like on the hype cycle top of it. This is the Gartner's hype cycle. So most hyped technology right now. And no wonder why we should be thinking about or we should be good at Internet of Things because it really helps us in the future. And then we'll talk about these industries. So these are those common use case scenarios of different industries. How they are using Internet of Things. We have a few customers we can talk about. You want to talk about? Actually we have one which we are working with closely. A company called Tyson Group. Has anyone heard of that? Okay, so they make escalators, lifts and all of those things. So even, hello. Yeah, so I need to be closer to the mic, sorry. So it's a company which makes escalators, elevators. And they are partnering with us to basically figure out when do you want to actually maintain, schedule a maintenance for the elevator. So consider, they have put up some sensors which can actually detect that say two weeks down the line this elevator will need some repair. And before anything fatal happens or before actually something manual happens and the technician comes and takes care of that. They are able to predict that beforehand. And they use machine learning and all of those things at the back end to just figure out some data, figure out some meaning out of that and take some action based on that. That's a live example. We have multiple based on that as well. We have smart building homes. Yep, so how many of you are wearing a wearable? Bands, smart bands, smart watches. Wear, Fitbit, band. Okay, so I mean that's one space where people think next, like the mobile boom is going to move towards that, wearables and so on with those technologies. And that is where IoT comes in straight away for consumers. Wearables is nothing but internal things, stuff for consumers. That's one example. Now the other stuff is one of the enterprise ones because there's more money there. One of the biggest diesel engine manufacturers in this world, they have used one solution which I know of. They have microcontrollers there in the engine. They have used various sensors in it which gives out values back to the mobile app using your Bluetooth connectivity system inside the car. And that helps like this mobile app analyzes that data, sends it back to the car manufacturer and also the service centers. So all of a sudden you will get to know a message or a call from service center saying your car needs maintenance because the break is 80% bad and your car needs maintenance, right? So these are the kind of things how internal things is really coming into picture in services industries and everything in services. So it is really awesome if someone tells your car is going to break down before it literally breaks down, right? So this is an app scenario of internal things. Well, before we get started, we got to know this. When we say internal things, we can use a server machine with sensors, sending data, all those things. It can be called as internal things, right? So there are basically four different types here. So one is the large one. Generally when you go to watch a movie, you have a kiosk, you tap on it, get your tickets printed and so on or on while you take a flight, you can do an online check-in using kiosks. So those are large devices. Then you have the mobile devices where you can use a, for instance, you buy something from Flipkart. They come up with a small device where you can swipe your card. That can pretty much be a mobile device running an industry-based operating system on it and then that can do all your secure transactions for your credit cards. Then you have a small device which is pretty much what we will show today and Raspberry Pi is part of that and all the embedded stuff comes in and then we have even smaller device, which we will also show. It's lying down there. It's Arduino Uno. It's mostly like a microcontroller. Microcontroller, microprocessor, there's a difference. It's a very, very tiny device with less memory, with a single thread running. So the programming there looks a little more challenging, especially for me, not coming from that space, because I always run out of memory. So these are those microcontrollers, but these are pretty cheap and very, very nice for doing one task or two tasks. Just keep doing that all the time. So reading things from the sensors, it helps us save a lot of cost. So the way you go up, the cost increases and while you talk about Internet of Things and millions of devices connected, your cost really goes up when you select something from the large. The programming becomes easier, but the cost goes really high. So these are some devices. Arduino Uno, microcontroller, Raspberry Pi. You have a Tesla board, JavaScript guys would love that. And then you have a few other things, Intel Edison stuff, which works with Linux. How many of you use Linux? Wow. So I was thinking of doing this whole IoT scenario using Windows IoT, but thank God, thank God. We have Linux ready. Yeah, we have Linux ready. It's all good, right? So Linux is pretty awesome for working on such hardware and we'll actually use that here and moving forward. Then comes the next part before we get into the demos is this part, which is more trivial. We can do processing locally. We can have, we can use absolutely use Python libraries here, but when we talk about millions of devices, of course it's got to be connected Internet of Things scenario or something on the server is more meaningful. I can still use our Python on the server side to do more meaningful analytics. And that's where the basic thing comes in, collection of data, because we know when the data is there in the store, I can run my stuff there, get the data. Collection is actually a big issue with Internet of Things devices. When we say one billion devices, like one billion devices, right? One billion devices can't do a rest call to an API and then at every second, I might not have a scalable enough API to be actually collecting that. So that is where we need some infrastructure, which can just blindly, any number of data per second, it can just collect. So we'll talk about that. Then analysis, we'll talk about those things. Consumption, of course, you have like information, like you have the data, which is not yet information. You run something over there, get the information, show it in beautiful dashboards. That's the whole thing looks like. Okay, predictive analytics. This is one key thing of Internet of Things. I mean, this is just one thing that IoT can be used for, but you can actually do a lot of predictions based on training your neural networks, or it's called machine learning here. So you can absolutely use that. And this is a little complex, but this is how enterprises use that. So you have smaller IoT devices. We talked about the lower end ones, the cheaper ones. These guys are cool. They can also somehow do HTTP calls, but they can't do that securely. If you want some protocol like the AQMP or MQTT, or some protocols which are in use in IoT for sending data, it might not support that. So the old legacy IoT devices and the low-power devices, like Arduino, should ideally be connected to some gateway. It can be a Raspberry Pi gateway, some server, something. And that channel communication is under you. So you secured that part. So when you're putting that there, because security is a concern, as I said, right? And it's very easy to leak data out of these lower devices because you can't run an encryption algorithm there and the small device encrypts data, sends it back, and so on. So you've got to be careful. Have a field gateway or something which collects the data, which scenario which will show you. And if you have IP-capable devices which can actually take care of the security, well and good, you can absolutely do that. Just like a mobile app can be a scenario. Mobile app can do that. So if you have an app running in IoT scenario which is syncing data from my variable to the mobile app, mobile app to that cloud works well with that IP-capable devices. And then internally, from the devices side, you have stream event processor. You get events, collect that events in events hub or you can use Kafka. You can use events hub, which is a managed service. And then you can give it to an event stream event processor. So in real, it's mostly like near real-time. So you can do a near real-time processing of the data which comes from different sensors. So you can monitor them in real-time. And then we'll go back to data visualization. Move on to the... Now there are certain architectural stuff here which will not go much in detail, which is mostly from how you create your solution. What kind of, it all depends on what kind of data analytics do you want to do? For instance, I want to store data of my temperature sensors somewhere, but I want to create a trigger alerts as well. So I will create two different streams of my data. One goes to my cheap storage stores over there. The other one, I can plug it into my event processor and check for alert conditions, like temperature when it goes above 30 degrees and then call some API to notify whoever the right guy is. So I can have a hot and a cold data store and similarly, it's mostly called as Lambda Architecturality. So we can create that absolutely. Now, so we have the app sending data or small device to Azure or Kafka. Then we have a stream event processor processing that guy. It can pass the data to ML service for training, machine learning and so on. Or finally, we can display that data to the dashboard. So ML can act as a trigger or stream analytics can act as a trigger, send it back to another event processor from where you will display the data into Kibana. You have a lot of options there. So let's get started with the scenario. This is what we will take you through. You have the sensors, sensors directly talking to this. It can be a mobile app with my Microsoft band sending data. It can be a sensor to a gateway. This would be a Raspberry Pi. It can be going all to the ingestion of the cloud, ingesting into the cloud. And then we'll use as much of analytics as we can in this and then we'll show that to you. So you want to switch stuff? Okay, so give us a quick minute before we switch different laptops. So what we do is, would you be able to keep this on the top? He shows you this stuff just to kind of confuse you guys a little bit more. Think of a scenario in an IoT. How would you be able to ping a small device? Like this device sending is pretty simple. How would I ping this device back from somewhere or the web? Like how I could do a ping to a server? I could do that on this small Raspberry Pi thing, right? So we'll see that a little later. But that is one scenario, you know, problem with Internet of Things these days. Generally it's not that you need a server there, but in case if you need, like imagine if I have to switch on switch off lights, right? I would need to, like, hit back to the server, give a message. So for that, we'll talk about it a little later. Right now? So how many of you have worked on some form of IoT before? Any board, any sensors? Okay, a good number that is. So how many of you have worked on Arduino? Excellent. So for all of those who have worked on this, they would be familiar with this environment. It is the Arduino IDE. So first of all, I'll give you an overview of what is happening here. This device right here, the red part is a sensor. It is called a weather shield sensor. This will just give me things like temperature, humidity, and light readings, and multiple others. If I put up some more modules onto it. Below this, I have just basically put this sensor on top of an Arduino. And Arduino is basically your microcontroller in which you can put some code and try to run some basic stuff onto it. The only, for those who have worked on, who have heard of Raspberry Pi or other things, consider this as a very, very basic form of a development board. Because I have an Arduino Uno with me right now, which means it will have some basic capabilities. So I can do some small things along with it. So for right now, what I've done is I've just basically taken my sensor and put this red thing on top of the Arduino board. The connections are made. I want to capture the temperature and the humidity from this sensor, and I want to display it on my screen right now. After a few minutes, what we'll do is we'll try to make some more meaning out of this. So instead of just viewing it here, we'll try to push this data to cloud. And from there, we'll try to fetch it. And once you get it to the cloud, you can play around with it a lot. If you have data, you can do analysis on top of it. You can create dashboards out of it. You can do multiple things. That is the real power where the IoT scenario will come into the picture. Because once you read the sensor data, you need to do some analysis on top of it to make some sense. Right now, I have this sensor connected with me. It's connected from this port. This is the USB port for this Arduino. It's connected to my laptop with a simple USB. The wire is A to B, so the smaller USB port is here. And the code I have right now, I'll just give you a basic overview of what's happening here. This is just taking the inputs from my sensor. It's written in C++. So for those who are familiar, they will be able to find this out. I'll share the link of where this is hosted as well. But this will just start giving you data, temperature, humidity, and light. So the first thing you see is the format is JSON. And the initial parameters are simply things which we are passing through our code. We are passing a grid. We are passing an organization name. I think displaying the grid is showing me the location. The thing which is of interest to me is these things. So I'm capturing temperature. It's showing me the values in Celsius. It's F written there, but I have converted that to Celsius. It's showing me light in lumens. And it's showing me humidity as well. So humidity will come as I scroll down. But the temperature right now is showing me 24.75. This is the current temperature of the room. And in fact, if you just want to check if things are working fine, yeah, you see that it is just auto-scrolling. It's just going down and down. And we have just set the timer to one second. So it's just starting showing me some more data. Basic serialization into JSON. The sensor says it's too cold here. Yeah, I mean, these days we have like so cool CPUs that, you know, it emits like cold air. Okay. Yeah, not coming. Okay. Okay. We'll have to. We'll just do this again while I talk. I'll talk to you. Okay. So this is, he'll just show what's happening here, but you got the idea. So this is what's happening. I'm getting data in JSON. The next part, the next part of this would be, I've deployed code to R, you know, and now to actually push it to cloud, I'll be using a gateway. And the gateway which I'm using is a Raspberry Pi. How many of you have done that? Raspberry Pi? Okay. So almost the Arduino guys have worked on Raspberry Pi as well, I believe. So this is a Raspberry Pi. For those who haven't seen this before, I won't be able to push it further because of the connections. But this is what it looks like. And this is a proper PC. So in fact, I've connected this to my keyboard, to my mouse. And let me just go ahead and connect this to the monitor as well. Hold on, hold on. You want to see data? No. Okay, okay. Okay, in the meanwhile, he does that. The next step I'll be doing is I'll take this Arduino, just plug it out from my laptop, the USB port, and put it right here. This has four USB ports. I utilize two, one for keyboard, one for mouse. It has a HDMI port. So I'll just display this to the monitor so that you guys are able to see the RASB and OS running there. Raspberry Pi, by default, you can run multiple OSes on top of it. RASB is a flavor of Linux. And we run RASB in there. We'll take the input which is coming from that Arduino in JSON. Take that input connected to cloud using something called Events Hub. So for those of you who have worked on Azure, they'd be familiar with something called an Events Hub, which is basically a service which lets you ingest millions of events per second. So consider this. If you're actually in an IoT scenario, you'll be having multiple sensors deployed across multiple locations. Each of them sending data probably at regular intervals. So just to facilitate that for massive data ingestion up to millions and millions of records, we are using something called Events Hub in which we'll integrate those events and put it and ingest it onto cloud. After that part is done, Events Hub, then we'll start analyzing the data, which means now this thing which we have captured, this can go to multiple things. So this can go to a job which can display it to a dashboard, something called a Power BI dashboard, if you've heard of that. Or we can just simply display it into a table. In a table format that whichever JSON values I want to read from this, I can go ahead and display it in the form of a table. So for today, we'll display it in the form of a table. We'll tell you something about how to go about with dashboards as well. And are you ready? Compiling, compiling. So sometimes you're going to trust in the God, so something will happen. Okay, let me just go to the Raspberry Pi. Yep, you can. In there, to read the value coming from the serial port. So in this code, if you see, if I were to show you here, we were using something called as a bot rate to sending data. So what happens here in serial communication is we've got to tell at what rate the data is coming here. So we will put that same guy in Raspberry Pi code itself to look out for which port to look out for and so on. So have you guys used the Raspberry Pi store? The people who have used Raspberry Pi? Okay, the store is pretty cool here. I have a few games which I keep playing all the while. So it's like a complete PC itself. Okay, so for those who haven't seen Raspbian OS before, this is what it looks like. This is the default view. I'm using the GUI because I've been used to that. And otherwise, you could just simply use the CLI and work and play around with that. I'm using the GUI. I can play around with all of these things. So I have Python already integrated into it. The thing which he was talking about is the Pi store. You go to internet. There are multiple things. It's simply you can use all of your commands here and get started. I installed Python on it. And once this thing is fixed, once we are able to get the serial output from the Arduino Uno, we'll take that output into Raspberry Pi. So just for that data to be collated and sent across to cloud, what we are using is we are using the SDK, Azure SDK for Python. So we guys usually work on Azure. So if you want, you can work on that. You can work on any other cloud, AWS, et cetera. But here what you're doing is you're basically using the SDK. So I installed the SDK first using PIP. Then I went ahead and wrote some about 12, 13 lines of code. So if I just show you, this is the thing. So first of all, it's a serial port, one bit at a time, one connection at a time. And then I am using something called events which I told you about, which is just basically used to ingest millions of events per second. For right now, per second, we'll be sending three items, humidity, temperature, and light. After interval of each second, we'll be getting three JSON records in our table, in our serial port. After that, if you see, I've basically initialized something. So I've initialized the key name, the key value, all of these things you'll get from the portal. So if you see the Azure portal, create an events hub there. Just to configure that, to use that in your code to connect to that. From Python, you just need to get those key names and key values. So you get that. And the configuration involves setting up a service bus. What is a service bus? A service bus is again a utility in which event hub is a part of it. The broader term is a service bus. Under that, there's something called events hub. We have topics, relays, multiple things along with that. But that's not the question right now. But to connect to that, I've given the name, I've given the key value, the things. And after that, if I just want to connect, send data, I've written a simple while-true loop. So this just goes on and on. I've taken the serial port input from ACM0. So if you would see, we can find out on which port it is connected. So if there are multiple Arduinos connected to your Raspberry Pi, you'll need to figure out on which data you want to get input from. And after that, you want to send that data to wherever you want to. Okay, I'll just show this once. So this will start sending the JSON data. And the data which is getting displayed is... So now this is working flashed again. Now this is giving out data once it starts. So it's not like it can run four, five apps. So you have to burn the stuff which we saw there into this. It's all working. Now what he would do is he would run the Python script here. And this is also talking. So it should get it from the serial port without error this time. Okay, just give me a minute. Yeah, this is a different thing. Yeah, yep, yep, yep. So he'll just change it in the code. So it either becomes one or zero, something not connected before. So it is ACM1. So, yep. And you see next to that is the board rate. So we have said that while programming this guy. No. Is this because this is... Does this have internet? Yeah, yeah. Is that working? That also can cause a problem. Which was on Arduino then? Yeah, this was working here. Okay, so I think the problem is with the internet. So this is failing. That error comes because of the internet thing. Let's just take this back here. Yeah, take that back here. So your internet of things is not complete if you don't have the internet. It becomes only your things. Yeah, yeah, so we'll put up the questions. We'll take the questions because I guess we are running short of time, but we'll still try to do this before we go. Yeah, and some of the things is once we send this to somewhere which can be a cloud or some storage, you can do any analytics you want. So that part is still left. Okay, about the microcontroller part. My question is now you are using Arduino for programming AVR. So generally earlier what we are doing is just use an editor and use the AVR GCC compiler and use AVR DUDE or something to upload it. So the environment like Arduino, how much advantage it gives by hiding all the details from us? Is it really going for Arduino or we should go for a simple approach of writing the C code and use the compiler and upload it? Arduino is basically mostly a prototyping device and it is very, very... So if you want to do a quick prototyping kind of thing, works very good, but your point is valid. If you want to go with traditional C, C++, in fact you don't want Arduino layer in between, you can absolutely do that. People do that when you have formulated your old device with architecture and you want to burn a SOC, system-on-chip, like the final device. Then I would think about even this guy had done something of that sort, like Corsi. Hello? My question is like the applications which you have shown, like so many cost saving in terms of dollars, 60 billion and so on. Do you have some application for India like where it is useful? I know of, consumer, there is a customer who worked with us called Zsense. They have done whole home automation in India. You can check out their website. So there are a lot of Indian customers coming in in pictures as well. So Zsense is one of them. There are customers, Cardio Labs, which are into healthcare. They have created those smart variables which patients use it to wear, the heart patients specially. So it kind of monitors that data, sends it to the cloud and the doctor is able to monitor them. Thank you. It was working very well. What are the data visualizations? Because we have the last set of data. So if you need to plot it on the client side of a web browser. So what do you use? Do you use WebGL or D3 with React, something like that? You can use anything, you can use React. Like especially that is not a problem. If my data is there on some storage, I can use anything to bind to it. More problem on the Azure side of things or IoT side of things is the analytics part of it. There is a lot of data coming to the client side and we have to show it real time. So what would be the best suited for it? You can absolutely use React. So your client can always fetch data from the cloud service and show it here for reducing the data or showing only the real important data. You can run some kind of analytics there, purchase storm to get only those important data and show it there in your UI. Like obviously you won't show 1 million devices data coming in, but only you will figure out those exceptional conditions and show it out there. For that you will need something like a purchase storm or stream analytics to get those exceptional data out and put it on your UI. For the UI part, we have a solution called Power BI. Power BI is a dashboard, UI-based dashboard all with JavaScript done. And you can actually select whatever data source you want to connect it to and it will show you a beautiful real time UI. So in fact we have this table for the output where when we captured the output JSON on cloud, we've used again something called tables in which we have inputted the exact format in which exact columns which we want. So if you see right here, it's giving me unit of measure value grid. So this is fetching data from Azure right now. My question was you said we will be able to ping devices, the sensors, so how do you do that? We'll take it offline. So I have a Node.js app running on the smaller device. Now this is not using the V8 engine traditionally. It uses the Chakra engine. So I have that you can run any node capability on this small device now. You can even, if you want for UI, you can use Express. So what I do is that is running on Windows IoT. So I didn't want to show that, but Windows IoT and it can run Node.js on top of it and I can ping it. So if you were to ping it and get the real-time values from the sensor, you can do it right now if we all are in the same network. My question is like I'm that programming type of guy and this nice easy stuff and I have a really problem with the synchronous and asynchronous thing that happens with Raspberry Pi and Arduino part. So that is a part where you guys can help us where do we start from that circuit thing. Okay. You are from electronic side? No, I'm from computer side. Okay, okay. So we'll take that offline. We'll be here in that desk. We can actually run through all the setup here. Right? Okay, next question there. Guys, any question? Okay. Sir, why are you using C++ instead of Python? We are using Python. This device over here, do you know? Yeah, so you know, all the libraries were meant for that. It uses C++. The runtime is based on that. So it works well. For this guy, see, Python is, like we would have to think about embedded Python in such scenarios, right? The whole Python might not run well on this small device. This is a very small device. I know it's a small device. But you know, you see also you are using in Arduino. Yeah. But why you don't use Python? It's just because it's more suitable for little bigger devices. It's awesome at doing data analytics and stuff like that. But for a 128 KB device, 256 KB device, I couldn't find a better solution. Yeah, this doesn't have much capability. Yeah, but if you look at bigger devices, Python is apt solution. That's why for all those other things, Python is sweet. Thanks, guys. That's it? Okay, thank you. Cool then. Thank you, guys. Thank you, guys. Thank you, guys. And we'll be sitting in the booth outside for some time. So if you want to see how this is done, catch up with us. Yeah, especially if you want to see how node thing works here, we can show you there right there.