An Intro to IoT Protocols: MQTT, CoAP, HTTP & WebSockets • A. Almeida & J. Berciano • GOTO 2017

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Check out this 53 minute talk from GOTO Amsterdam 2017 by Antonio Almeida, Developer, Product Evangelist & Tech Docs PO and Jaime González-Arintero Berciano, Developer Evangelist. The full talk abstract can be found below:

IoT is a buzzword. As a developer, I’m sure you’ve heard it many times - so many times that you probably tune it out as background noise at this point. Don’t let that phase you. IoT is nothing but a name for a set of ideas that you as developer should consider seriously. In this talk we'll take a practical - with demos - tour into application protocols for IoT.

👍︎︎ 2 👤︎︎ u/goto-con 📅︎︎ Oct 03 2019 🗫︎ replies
Captions
[Music] so let's start so this presentation about IOT protocols I'm Antonio this is Jaime from relayer I would just like to know how many people here at work with our UT protocols and I'm talking something different from HTTP or WebSockets how many people here have worked with protocols like MQTT or co-op okay a few persons okay and how many people heard about these protocols although they never worked with it okay a few more okay so we're going to focus very much on MQTT in coop the other ones these protocols that they've been around for some time HTTP and WebSockets and we're going also to check to show you something which you as a software engineer and this is mostly software engineers and software developers conference usually don't see which is industrial devices and it's a totally different world from the world you are used to when you work in software so remember to use the app to rate the session and also to ask questions and we're going to go really fast okay this is the first thing so where this all started so this is the original paper that for the internet from Licklider where they were thinking about creating this network that would connect that which be able to share information using computers so the computer used as a communication device this is a 1962 the original paper then another paper 1968 and this here you have the evolution of the ARPANET so in the beginning was just something in the West Coast and later the west coast in the u.s. connected to the East Coast and then you start can start having other types of networks and more networks connected so but we already have a lot of internet protocols why do we need more internet protocols this is the issue well because first we're going to have a totally different order of magnitude in terms of the number of connected devices right now in the beginning yet just as you see in that slide about the ARPANET with just hundreds thousands when you had the mobile phones to start having a couple of billions but now we're going to have much more than this and this is some projections from the MIT Technology Review and this is the number of devices that will join the internet so and this is projections from multiple companies somewhere research companies others of software and hardware companies so boss says that by 2020 there be fourteen billion connected devices Cisco 50 billions Gartner it's a research company they say there will be three hundred and nine billion in supplier revenue the economic value added will be one point nine trillion and another research company IDC says there will be seven point one trillion so there's a lot of revenue to be had there and on the other hand what we see the different trends which is the cost of hardware is going down so right now you can buy things extremely cheap like like this like this so this is the device that is manufactory in China's call esp8266 it cuts this thing costs two and a half dollars you can buy exact word with the chip is about the microcontroller as a Wi-Fi chip you can work even as an access point the first thing that you need to be careful with is you know buy this thing from Chinese manufacturers developed by Chinese company it is when they put the FCC logo there to say this certify it's really not certified so if you want to develop an inertial product with us we had this experience in our company be really careful this is good as a prototyping thing but if you want to really make an industrial-strength product that you want to have on the market that needs to be certified maybe you should think twice okay and maybe use a more common manufacturer like Ti or any other videos the manufactures but this is the type of thing this is already very cheap and you can do a lot of things GP iOS as a very very rudimentary analog to digital converter yes it has a USB to TTL the adapter and it has also power supply so you just power it from the from from your USB you can also use a battery that's a battery shield at all of so you can 80 megahertz actually pretty I mean it's powerful enough to run most of the things yeah this this is a couple of years old they have a new one could now call the SP 32 this one the SP 32 is also bluetooth and it has also crypto capability so it you can encrypt the flash you can have the boot be secure with the bootloader the question is right now the software stack is very behind so unless you want to work with the stuff that Express if it's a company that manufactures this puts out there which is C which is RTOS think stuff you have to wait a little bit more or you just have to code it yourself but this is an example or very cheap device that you can have so that really confirms this trend so what's the constraint device okay so constrained device what type of constraints do they have one they have limited processing power so they don't have a lot of CPU power they cannot do very expensive computations and they have also limited memory so so you see this thing here there's a couple of megabytes you don't have a lot of memory you cannot store a lot of data and you cannot do you cannot do really complex Kripa for instance right now the support for TLS there if you want to do mqtt we're going to talk about this later mqtt TLS not all cipher suites are supported and it's kind of sketchy the support for there it's a hack yeah it's kind of a hack so if you want to connect the way wsit for example it's really not the nicest way nice things yeah it's not officials not the nicest things also the networking networking it's really heavy and it was developed for big machines right for clients that are quite powerful and for servers so when you run on this type of devices the network is also unreliable imagine that this is powered from batteries and the battery runs out and now there's there's no network there's something that was sending data in your network and now it's no longer there so the networking is unreliable and also it you want to use low power so for example there's there's a radio standard called developed by a chemical sick folks and it's a thing that works in the is M band so eight three three megahertz here in Europe 915 in u.s. and this thing uses very low power has a very low data rate you cannot send a lot of messages I no no no number by heart a lot of messages per per minute but this can be used for instance for detecting leakage in water pipes so what you want to do you have to dig up something on the street and put the leakage detector there and you want this to last for a long time so you cannot drain a lot of power so you have to having this requirement of using low power it's really important and this makes it a very constant it's one of the big constraints you have so this for these three types of constraints is the constraints you have when you work in the IOT of course Raspberry Pi is also you can use also an IOT device it's a constraint device if you compare it with a server but you compare it with some this leakage detectors sensor it's much more powerful also its joins much more power so the internet what is internet basics is the network that connects different types of networks this was the beginning that was ARPANET it was bit net and the Internet connected these different types of networks so now you will bring other things into your net Internet and this is what you're going to talk about so one of the things here is industrial protocol so there's a thing that is been existing for years and years 50 years almost which is operational technology which is used in factories right so you have industrial automation and then intertia automation started initially we think it's work-related manually then they put some smarter relays and they went from there and start adding computers but this is something that develop Lee totally separated from the IT world and the IP world something totally separated but now with the Internet of Things you want to bring these things into the internet right so you want to have all these interconnected so this new type of networks will be here so this is for the factory if you work in buildings you have an other type of protocol so I imagine this building uses a system like this a building management system that uses this kind of this kind of protocols so these protocols were generally developed by a particular company and then the other manufacturers started using it so it is compatible and so they made some standard some of these specs are proprietary some are kind of proprietary you have to pay to have access to them but this is this is how this industry developed so mostly closed and while the internet and IP it's mostly open because was a research project at the beginning so there's two there's one very important thing with the Internet of Things it's which is that in the beginning there was not the beginning of the Internet there was not a big difference between what was what was a client and what was a server in terms of the capabilities but then as things progressed we see now with the mobile phones that the client has much less capabilities than the server with the Internet of Things the edge computing the thing the edge is back in in the game so H is extremely important and you will see that the cloud is still important but the most important thing will happen at the edge so imagine if you want to control some machine in a factory what you want to be able to control this machine in a factory is to have a quick response time right if it's a press and you want to stop the press because there was a problem you want to do that quickly you cannot have the luxury of expecting saying a message to a cloud somewhere and if they're worried the round-trip time ok all the round-trip time and you will get a response to order to act on this machine this has to be done immediately as quickly as possible so latency is a very important issue which means that you have to do a lot of computation on the edge and in fact most of the computation will be done on the edge or Internet of Things and the cloud will still play a role for instance if you have a machine learning model that you can only run on big machines because it's very computationally intensive you will run it on the cloud but you want to use the results of this model in some downloadable way and then run it on the edge because this will do implement for instance your control loop for controlling this machine like the mechanical press or hydraulic press so there are devices that are on the edge and then there's a gateway if you want to connect to the cloud you have this gateway and this gateway basically it was example is a connection from the term to different type of networks which is the hedge network which could be for instance in your factory and the cloud in this gateway can be many things from a simple raspberry pi or even a device like this can act as a gateway because using the Wi-Fi you connect couldn't connect the right click to turn to the Internet of course you will have to live with the latency you will have there or if you have a 3G or 4G or GSM whatever you have to live with it latency so a gateway is only is defined by this aspect of being able to connect to different type of networks but they Skateway can be a rack of servers it can be your own local center that you have in your factory that can do a lot of computation and intensive tasks also so there's really no one-size-fits-all in terms of the Gateway depends on the type of application you have and how how comfortable are you with your data traveling across public networks so devices are not gateways and this is the main thing it's like devices talk to other devices okay northbound northbound and southbound gateways talk to the cloud northbound and they talk to other devices southbound so unfortunately I had an accident when I was coming to Amsterdam someone stole my backpack with my laptop and so I cannot do this demo here so this is a kind of this is a device from a company called sawatya and this is a very low power device and it uses a standard from IIE I Triple E it's called 802 dot 15.4 it's it was developed for low-power radios and what happens is this you can run IP here but the packets are really small they'd 127 bytes so it's in this is ipv6 so you have to fragment that so what the IETF the internet Engineering Task Force this is they developed a standard which allows you to run and adapt IP here on these devices so what you need to have if you want to connect to a normal IP network you need to have what they call the border router which is in the border of this specific 6lowpan network which is has its own specific things and the normal IP network so this the border router will act as a gateway because we'll connect these two types of devices of course this is you can run this as a device in the end connected to a sensor and then you can run this also as a border router we will see will talk of a little bit more about the role these things can play when we go to co-op so you can have device to device D to D and you can have device to cloud and you can also have cloud to cloud so the first part of call we're going to talk about this is probably the most popular one has been used for a long time and in the beginning in Internet of Things was quite powerful devices so most of the stuff was device to clock and you will see that the MQTT particularly useful in that regard so it's a pub/sub protocol it's there's a standard so it was initially developed by IBM from sorts some automation project but in later they they open the protocol they open sourced it and now it's maintained by the Eclipse Foundation it's a small code footprint it can work well in constrained environments it's data agnostic is one of the things that MQTT is here is that there's no way for you when you send a message to know which step which which type of data is inside so the client and the server have to be in agreement ahead of time what I have update is being sure it's not like HTTP where you send okay this is JSON oh this is XML or this is text you send this content description content type in the in the header here you don't have that so it it's it's land out of out-of-band in terms of the protocol so this is how it works so there's a there's a there's a broker there there's publisher and their subscribers so it's a pub/sub protocol and the broker manage the interaction between the publishers and the subscribers okay so what it has it has readings and it has commands reading this for instance telemetry data from a sensor and commands could be something to change the sampling frequency of the sensor or to control a machine like the it rolling press I talked about so you already see that this thing here is a problem which is why I think this this protocol is not really well suited if you want to work in a more generic IOT network device to device because it has the broker the broker is quite heavy in terms of so it you cannot run it for instance on this device but on that one there the broker is quite heavy so which requires some computational power and also this uses TCP so the networking is is it's kind of demanding for this type of thing it uses TCP so the broker is also a single point of failure if the broker is down nothing will work so this is all the all the messages you have here very simple as you see it's a very simple protocol you can go if you can look into understand there's a lot of information online about this see we type of messages you have so it's it's a pretty simple protocol so what you do you publish something to a topic you define the topic what is the topic it's some sort of data it's some sort of organization of my data which I'm interested in so here what you have here is for reason something which is publishing to this topic one and in fact is the temperature value okay it's valuable temperature I will talk about a little bit more later about this kos quality of service and retaining so this is an example of publishing a message so so what do you have here you can organize the topics in multiple ways usually two ways to organize the topics you can organize semantically that we have here which means that your is kind of a directory file system structure or you were all structure if you want where you organize it says here I want to get the telemetry data on my house from the ground floor on the kitchen and give me the temperature this is semantic because you look here and you can see exactly what this means in terms of the data you're getting okay you can also have a type of organization that is called logical of course you see the problem here this doesn't scale if you have thousands of devices you're going to get you're going to run out of names for this thing so you can have something naming similar used for instance a UUID and this is called logical you just have a device such as a UID 128 thing I think and you just use that to identify your device and there you don't you don't really care just have a mapping that says that says how does your device how does what is your data corresponds to this device with this UID so also it has wild cards as you can see here this is a one level wild card which means give me all the temperatures on the ground floor or you can have a multi-level out card to give me all the telemetry data on the ground floor which means not only temperature can be temperature could be pressure could be humidity whatever you want to help there you're measuring there so there's quality of services here initially was just quality of service zero and this means far and forget although is TCP means fire-and-forget TCP just a way for the the broker and the client they keep changing an acknowledgment to know their the clients is still there and the broker is still there so with zero means that there's no state okay there's no state the client sends the publisher sends the temperature is 32 point five the broker says I got it but if for some reason the value doesn't reach the subscriber that is interested in in this immersion is something with the temperature is air-conditioning in a room so you want to know the temperature so it can in act on their on the temperature on the room through the air-conditioning so if there was some problem in the network the subscriber the publisher publishes the temperature but then the air conditioning would never do which is the subscriber will never get this value okay with quality of service one you guarantee that the message is delivered there's a mistake now the message is delivered mate it may be delivered multiple times we'd call it your message quality of service to you guarantee that the message is delivered exactly once no and this is the last revision 33.3 dot one whether you understand that where they introduce this this this quality of service to another interesting thing it has is last will and testament what this means is if your temperature sensor it's going to die when he connects to the broker says if something happens to me please send this message is my last will and testament to all the subscribers that are receiving my data that aren't in my data so this is what less will a message means Oh another thing also that it's not here it is a retain and this means a retain means that there is a value you if you ever worked with a WSI you did everything go call the device shadow a retain is an implementation is the thing of divide shadow it's a value it says it's a flag that is set by the client by the publisher to the broker and it says if any subscriber new subscriber connects to you and wants to get my data please send them this value immediately okay imagine that you read the only every hour but you polish a temperature now but in 15 minutes you're going to you're going to have air conditioner that is going to connect to the broken and says tell me what's the temperature in the room of course the publisher it doesn't the temperature session as in published any new value but since it was marked as a retain the value that was there before which will be immediately sent to the air conditioning and he can do something with this value so there's MPT T or org which is like the Canonical's canonical site for this type of protocol this is the recommended implementation in c mosquito all this is managed by the cliffs foundation there's another one for java there are multiple languages RabbitMQ also supports MQTT so there's this is see if you want to use power java there's power there's a lot of good tutorial so it's a pretty standard protocol there's a lot of usage cases out there people with a lot of experience have used it okay the mont I need mo okay now we didn't have a small demo more time so just really quick guys I'm gonna I'm gonna run a nap here the basically accessing keyd client and then we will see how the messages are coming to first we broke it and then they are aggregated in a platform so sorry gonna go back oh right so my device online yes this so all right you can see that's actually my phone and all these messages are coming as you can see for example I'm gonna try to you can see the luminosity there so if I tap it will probably go to zero to reload now you can see it the luminosity values over there seventeen that tiny which it over there and then basically the messages are I mean basically the client is publishing as you can see and not sure if it's big enough you can see here how they how the packets or messages are are coming and this is basically this is the accelerometer right the phone has that's how it the phone is capable of rotating on the images when you put it in Arizona and there's actually pretty fast for in GDG I mean because you know I don't think I mean this is polishing like five times per second it's actually I don't think the protocol was actually designed for really fast polishing but this has a warning that says if you use the accelerometer sensor if you make it publish to the cloud it will run out your battery really fast exactly sending a lot of data but if you move the phone very now sorry now the network crash or something but you get the point yeah right also you could send commands can you try to make it play or turn on the flashlight let's see yeah it should be yeah exactly because now we're publishing but the there is my phone response to the yeah you can make it sound by yourself obviously right you can click on you know how to use a Mac man no nerds now I just basically now will have sound base because it's yeah so you can turn the flashlight off yeah so yeah it's this basically this this device has to be listening to those commands so if this device if the basically if messages receive from the broker and this device has no clue what's going on nothing will happen so the command is actually prank here so it's acting both as a publisher sending the data that you get from the sensors that are on the phone my accelerometer and the luminosity sensor and as subscriber it's a subscriber it's adding the commands from the client that is running here on the this is the web client that is running here on the cloud and it's getting the commands that say turn on the light turn off the light play a sound vibrate which I clink both as the publisher is subscriber which means that any device can have these two roles okay so let's go to co-op then so co-op is constrained short for constrained application protocol and the idea was with a lot of people out there software developers didn't know how to use HT DB why not try to bring all this big success running success that was HTTP in the world of internet of things so that was the the thinking behind specifying coop defining coop is a new protocol so collapse constrained application protocol so it's kind of a lightweight HTTP okay so it doesn't use TCP uses EDP so there's the reliability in terms of the messaging is done at the application at the protocol application layer it's no longer than below at the transport layer so you have to do this yourself but it's it's it uses the same principles as HTTP it's a restful interface all these kind of things it was developed for manipulating resources and crostini networks also HTTP which was developed kind of organically there's a lot of things that were never put there one of them now with HTTP 2 was brought into focus again it's a synchronous messaging right well coop is a synchronous message since the beginning as we will see so here usually also another thing is that since this is supposed to work to be in the same type of line line in terms of protocols as HTTP in the in the standard there is a specification for a proxy between co-op and HTTP so in the in the in the cloud usually have HTTP things talking HTTP among themselves and talking HTTP Tulip to the to the proxy and this translation is transparent this translation between coop and HTTP transparent so of course it's a binary protocol coop it's not text like the HTTP 1.1 there's not as much headers as there are possibilities of having headers as you have in HTTP but the proxy does this translation in a transparent way you don't have to do anything so this is the normal HTTP request is TCP 3-way handshake please give me the value of this light resource the server responds ok 200 ok status code we also have status codes here but since what the message around are smaller the status codes are also different it's four or five usually the value that corresponds to 200 in HTTP and then you get the response and you get determination determination message from TCP so how does it work with co-op when you have an HTTP client on one side gate goes to a proxy and you have the co-op server on the other side so it is something what we'll see is that co-op has one very interesting feature which is there is no big difference between running a server or running a client which didn't happen with mqtt where the server is the broker it's quite heavy from a computational point of view and with with co-op that's not the case it's really really very wait in fact you can run it on this device okay or even on this device if they had an implementation for it that was not half broken like they have right now but with this device you can have an implementation that is really good using a embedded operating system called contiki and you can run this as a server and you will see what's interested in it so here what it does it gets requests gave me the value of the light the proxy translates this talks talks to the server that is running here it sends this that so this you see 2:05 it's the value corresponds to two hundred in HTTP and it returns here in this case as a XML which is not the best of formats you will see that specific formats were developed by the IETF for coop and it goes there then it returns the value and also you can have caching this is another very important thing mqtt has no caching but since HTTP caching and it's quite good the way it works since co-opt is just kind of HTTP for constraint devices all the caching is you also have it here all the caching of HTTP all the strategies you can have it here also okay so this is a very interesting aspect and you have here just to see have an idea about the order of magnitude of the objects that are involved so here is in the cloud you have HTTP object okay and you can have here this implementation the security the security of the socket there top of the socket layer here you have an HTTP TLS here you have thing called D TLS which means data gram TLS okay so for instance these implementations it they are lacking and so for instance contiki doesn't have a good implementation for the TLS there's some other implementations some other operating systems there's a new one called riot OS which you very new so not a lot of ships are supporting and this is has a better support for DTLS so that's how you do data gram TLS you can you can do security here of course the top of IP and they have co-op any of the object there and this this is in the proxy and this is a device that is on the connected to the for his get telemetry data from the sensor you have here this thing here so tens of bytes hundreds of bite in here thousands of bites just ever idea of the size of the messages so what we have resources are specified by a URI you have get post put delete all the verbs you used to in HTTP you have content type support you have XML yep JSON and you have this new thing called C board which is concise binary object representation so if you ever heard of a serialization format called message pack see board is about as compact as message packed it just said a coder the codec the encoder and decoder are easier to code much shorter so much more amenable to running constrained devices but basically it's the same thing it's a binary format um it has multi-cat support this is really important why well if you have m ki GT there's no multicast ok so if I imagine this lights here are running as an MQTT client they're subscribing to some broker that is going to publish something and you press a button on the on the switch on the wall and it turns on and off the lights which means that each light will have to run the subscription client right so there's no way that I can send a single message and all these things will get notify at the same time if you have multicast a single message can be sent when a particular interface can't be sent to multiple devices at the same time so for lighting co-op is really interesting because you just need to send a message is you can turn on and off the lights with a single message there's the synchronous message Cystic changes this is really important because imagine that the device imagine that the device for instance as a problem with the networking or the battery or something happen because it's done really valuable devices so you are not obliged to get the message immediately also usually you run this in sort of low power cycles you know where you turn off the device for most of the time you just wake it up in specific specified times and you send a message so it can be that Mara makes a request but the device is off so I can't get the immediate value either you have it I have it cache it on a proxy on the Gateway or I have to to wait I'll get the message to reach by later the response later it's also designed to be extensible like HTTP so it is an example Java request response typical HD like HTTP there's the temperature here I want to get that the client says the server give me the temperature and sends it sends you the value of the temper so this is the frame how it looks like so I'm not going to very particularly it is you can check the RFC there they are there there's also some books around it already published this couple of limitations I'll give you a place aside where you can go and you can get all the information about coop so there's one thing here which is this there's a message ID so each matches as a message ID which is the thing that this increase incrementally where you can do that you can you can associate a request with the response and there's this token in this token each what allows you to have a synchronous responses because this token when you make a request but you don't get immediate reply there's this token so that when you get to reply this token is sent back on the reply on the response and you can say okay this is the response to this request I made some time ago so this is this is the new thing here that you don't have in HTTP so this is a this is a confirmable message means please confirm that I got the response back so this is piggyback this mean once I get the acknowledgement I also get the response or it can be separate I make the request the server says yeah I get your response I will send it to you once I have it and you have it here then the client says okay I got the response thank you this is this is a confirmable message so what you have here is non comfortable this is your Farland forget is usually UDP so all the reliability that is done here it's done application layer this is UDP know TCP there's no guarantee the message will be delivered so you have here you just make non confirm all this is a flag that is sent on the on the packet non confirmable and I get here the reply in here I get the same type of Nava farewell but I get the neck non-judgement also from the client if I get the response from the server so again you can also reset okay you can also reset this so that when the client makes a request there's some crash on the client then the the the server can send can send the message you reset it and start from scratch since you're a pion can go resent it and start from scratch the the messaging request/response sequence so the message reliability is the application layer so it's EEP if that if you make a request in you go and try to reply there's a mechanism some real mentoring mechanism for congestion control so that you can not pile on making requests until you get the response so there's there's an exponential increase up to a maximum 247 seconds if you can't get a response after - for 247 seconds means that you're never going to get it they are doing better congestion control mechanism and much more developed and this simple one and if your speed is your goal I just want you just want to go as fast as possible you can just disable all these features so yeah so this is this is the question about reliability that you have here so I make a connection I couldn't get the response there's a timeout and now increases the time I make a new connection I make a new request and I get the response so after they define a coop which basically was like HTTP but adapt for constraint devices they said okay that's things that are missing here which is like a pub/sub kind of thing we would like to have otherwise how we're going to compete and sell these to people in - that are now using MQTT and say hey use this because they say ok but you don't have a pub/sub mechanism so they added something a new era of C later two years after the initial standard was published and it's a RFC was published for for co-op they added this thing called the observer pattern and the observer pattern is kind of a pops up okay so what matters is that this device here can work as a server and there are clients they can connect to this device and say hey I'm interested imagine this is reading a temperature I'm interested in this temperature value wherever you want whatever you have an update please send it to me so this is how the observer pattern works so let's see how exactly how that goes here's an example this is from the RFC so what you first the first thing it does it's this is mark as an observe that there's a header there there's an option in that you send on a packet that says this is an observer make a request and say I'm interested in getting the temperature values when you have updates please send it to me so your reducers here on the so remember this device not with the server and the client is somewhere outside can be even on the cloud going through the proxy using HTTP translate didn't go up and goes into the sensor network so it goes here and you know here this is the value and you see the observer this thing here keeps incrementing say this is different values that I'm getting cue could be for instance the seconds that have elapsed or the minutes it have elapsed since you make this initial request so you get here emitted in this valve and with this special get request marking this and observe and I get the values updated as this moves along and there's the values change and the server keeps sending the data so this is a very interesting thing as you can see you have here basically the same thing that mqtt provides but without having the need have this broker thing running in fact the server is so lightweight you can run it in very constrained devices so this was related other added to the co-op's back later another thing it can have block transfer so if you have a very big response you can split it and then can be reassembled at the other end also one of the things I realized is that UDP is interesting and it's really adequate for constraint devices but you know sometimes you're connected to networks like in a factory so an industrial Internet we'll talk about this it's a cat what it is is basically TCP over Ethernet so you would like to have something that talks TCP because will be easier to integrate and this type of network so right now they are drafting co-op over TCP which when people say yeah but you kind of doing HTTP they say you know it's still co-op it's just that they have to adapt because these situations you find out there on the field also they are working on authentication and authorization so the crypto capabilities of these devices are really limited so which may which means that this this thing on the edge will be devices that have multiple roles you will have an authentication and authorization server that will be when when you need to access some resources you will make a request there and this will tell if you can access the request you can asset SS that resource or no and the same way they were inspired by the HTTP to define co-op they're also using the ideas that behind all off and the JSON web token translating into the world of constrained devices so this is a place you can go to get everything about co-op while all the implementations you can even play with it there's a Firefox extension like you can install and this allows you to make co-op free URL requests and basically the only thing between difference between co-op and HTTP yet it has co-op colon slash slash instead of having HTTP colon slash slash or coop as if it's co-op with the TLS so it's very interesting you can play with it there's a couple of test servers that have like the reference implementations unique ACR to work how it works jobs every pattern split split messages with the block part splitting the messages in blocks etc so now some demo about something totally different so intermission so okay guys so obviously I mean the protocols were like right and keyd go up then HTTP and WebSockets but we're not gonna talk too much about the HCP because actually you know you probably had enough in your life so but what's funny is that lots of these protocols actually including HTTP they they got into industry already which makes it really interesting because I'm for instance I'm a field I'm an electronics guy I started with PLC's and all these devices like wedding you know it's more like an for you would be like more like an electrician probably and the thing is that you know you always have to use like really heavy tools like these TS of where in siemens only runs in Windows and then you know you have like and the protocols are totally closed like demons as their own their own PLC director Sumati the seven service but it's quite obscure actually there is there is a C++ C implementation some guys that reverse engineer it just using a packet sniffer that's how we did sure it's not guaranteed by demons it might work it might not work you're on your own they don't care so yeah that's pretty normal in industry I mean like really I mean this Windows 95 for for no use Windows XP for submarines or something anyway like is used in and yeah industry you have things like from the 70s running so anyway we'll have some pictures later but first of all what's a fieldbus antonia showed you guys this picture before so here basically an industry with yeah we talk about protocols we talk about filled buses and we talk about industrial Ethernet so what's the field bus F inverse is an industrial digital bus used for real-time distributed control mainly used in manufacturing so almost all devices that we find in a factory in the shop floor are connected with field buses and connects instruments instruments namely sensors actuators as well and have different topologies so this is actually pretty like you know state of the art industry so normally was all cereal and stuff like that so controllers were connected via serial so in my in the cable the cable salads and the field bus solves that so and it's really cost-effective because one thing you want to do in industries to save save money of course and so yeah they're different standards we're gonna explain some of them real quickly not probably you heard about Modbus Modbus RTU is a serial it's freaking old like from 1979 so it's pretty cool Motors is returning now I'm gonna make a quick demo with Modbus transfer anymore but from a bus to HTTP actually usually we use most modest TCP which is a reader net that is like profibus that's a it's also serial it's like another field bus PROFINET which is actually internet standard and then you have kin which is the one and I think the first keynote yesterday was explained how they hacked the can the can bus right and on the car so they're different standards in a car like this can there's lean there's the support that if you lift the the how you color the ashtray you will find a port and I support that you can connect an obd device there which is a device that basically sniffs all the data from the can and yeah you can actually have like a connected car would like for less than 200 bucks actually with a cellular module so all right I'm gonna go really fast so anyway either car device Network bug net alright that's the normal PLC a PLC is a programmable logic controller these things you find them in factories the pills is actually that thing with a screener only the other things are they input and output modules and these things perform really basic functions like then the pump on when that activate that sensor is released do this when this happens do that every time minutes stuff like that and I will have PFCs which is a programmable field bass controlling so basically they support different field buses so all these protocols without before they support them all they're expandable they have input and output modules that you can buy and you can slide them and build your own custom system and now they're running operating system so I means that you can you can run Linux in most of these devices I will show you this later but anyway and the thing is that manufacturers give is the case in different languages so you don't need to use this this basically software suits they were really heavy and more and more of these devices have a HTTP API so this device that we're gonna show later this is IP IP 67 which means it's a really high production range you can basically throw this from a 7th floor will be ok you can spill water you can do heavy stuff with that and it has an HTP API so you can pull data from the sensors via HTTP so it's really interesting for several developers I think and and they have a web server so you can ping that device you can go to the IP address of that device and it will open a website that you can configure and change stuff with no programming skills and yeah basically that's a PFC that's an SD card slot you can even create your own custom image like we did already with the Yocto for instance and install it there they have different network interfaces anyway different like input or output modules 3G connectivity everything so I like to talk really quickly about IO link I'm gonna prepare them already this is an idling device this is interesting for you guys because this is the state of the art in in automation actually so these sensors have a important thing I mean you can read the rest of the specs really fast they have a descriptive file so that means that a when this sensor is kaput when the sensor is dead you can just change it and once the sensor is dead you just push a descriptive file from a remote server and the file will arrive to a sir in the sensor will get the calibration and if you connect new sensors in these ports the sensors will out indicate themselves so the sensors will say hey I am a temperature sensor my manufacturer use this and my mom is that basically the sensor will start sending data immediately so it's been amazing they're not cheap they like two hundred bucks each this is like 200 300 but that's cheap actually industrially that's affordable so that's an example of a topology and you can see that the computer we talked before the the PFC the programmable field bus controller then you will have a surveyor that is pulling the data because someone from the managers they want to know what's going on on the shop floor and you have your i/o link devices or the sensors can be sending data directly to the to the PFC because there are modules that understand.i link that's another example of a nailing master in our office actually and that's that that thing talks HTTP Modbus which is really old and Ethernet IP which is on the protocol and you can see those those slots with the screws you have to wire the sensors this is really you know those USB things you know that doesn't exist we'd really have to wire it so so I'm gonna yeah some subtle product placement of course so if Anthony helps me out here just all this thing so I'm gonna connect this thing and I'm gonna show you guys how easy is actually to use the built-in hcp api so first of all i'm gonna try is a sensor replies me because this body okay this body has an IP address because i know it and know so let me configure this sorry you know it happens it's a life live demo good all right yeah there is so the device is replying basically to my requests the only thing I'm gonna do is to run a super simple Python script that I'm gonna show you later that it will be converting you can see here the Python script and you can see that it's actually making a request on this device it should be request so the I me not doing any any an industrial magic or whatever and that's it just pull in a value which is gonna be you can see here on the request that we actually request GDP so get process data and I'm gonna request the index 0 all this is specified in this file I told you before in the IO DD file by the way we don't manufacture hardware so so I'm not selling you anything so I'm just gonna render that simple Python script here yes thing is this one basically yeah it's freaking hot here as you can see so so basically important I'm pushing and reading the the values and Tony is actually touching the sensor now with the temperature increasing here and the check the temperature should be increasing I have two device over here sorry here it is so there it is that's my temperature just let me open this temperature yes so that's my sensor sending data you can probably yeah you can probably even that's a real-time data of the of their sensor and I'm not doing any magic and just like connecting this we are either made let's say this powered and everything and so so yeah I like to if time allows yeah maybe Indian yeah yeah okay we don't know something we're going to keep going and then we will try to make them all privately for the rest just five minutes to this really quick just to show you like I show it things that that are currently in use I'm going to show a little bit of a glimpse into the future so up until now we have eccentric networking right so in the beginning the problem was off can one reach us reach another host and they saws all day all the thing that was behind the development of IP but now more and more watching listening in data we went to checked all the rest because the O's and the connectivity is already there so we just inserted in the data and this is a new type of networking called information centric networking as you can see their full screen so information centric networking so as you can see here what's important is the data that is transferred and there are things there are interested subscribers that you see in a particular data and what you should see what is important is the type of data interested in a particular type of data and I just want this data to get to me and this is data exists in this space in a data space Genet global data space here so eccentric networking there's a conversation between hosts information centric networking spreads that objects it's not who you want to talk to is what you're going to say so there's a standard that's been used for a long time in industry especially in the part mode of defense the friend industries like avionics industries for airplanes and pretty manufacturers usually service Boeing they use this has been around this is quite heavy it's like a proprietary kind of thing they made it like a standard but there's not a lot of free software implementations out there it's a very close thing it's done for people developed by people that are defense contractors they say this can be using constrained devices but right now you can use it just right away it's something that wasn't evolve evolve some from something it existed long time ago called korba so it's just a way to exchange these objects in messages you can see I'm not going to go into details this is an older thing so this is DDS in a nutshell so there's all these kind of entities that you can see there's any casting and there's multi casting you remember there's already one thing that co-op doesn't have co-op doesn't have any casting and here is ICN in ICN it's a newer thing which improves upon DD a DDS there's consumers there's a certain interest that I have a name and the consumer says I'm interesting they start with this name and this is the new thing that is coming up there's a implementation this is basically a research project so there's a communications between consumers and name data there's forwarders so it uses some ideas from the internet like how to forward data there's some problem still film still open problems to solve like routing congestion control right now it's a polling thing only there's no event so for instance with the widows every pattern you have an event based model when there's a change please notify the the the clients are interested in this value with with a new with the new updates there's multiple research projects in US and Europe and watch this place this is really interesting it's something that is really promising could simplify a lot of stuff there's a lot of complexity they have now in all this networking because you have this o centric networking so in a nutshell MQTT divides to cloud or cloud to cloud co-op device to device this is what you need to use HTTP one cloud to cloud HTTP 2 we haven't talked about it possibly you can use it device to clone ok because HTTP 2 as nice things like I had a compression so if your device can support a crypto stack which is in turn which allows you to have TLS then yes please HTTP to PDFs cloud to cloud and device so call this would be quite powerful device they claim they can be used device to device but the device it's not really a very constrained device WebSockets cloud to cloud so operation of technology this will be around you have to deal with it it's not going to change then people are not going to throw out this is mean for you they it's very expensive it's really reliable and there's no silver bullet so this is us if you this presentation is there and questions
Info
Channel: GOTO Conferences
Views: 51,402
Rating: undefined out of 5
Keywords: GOTO, GOTOcon, GOTO Conference, GOTO (Software Conference), Videos for Developers, Computer Science, GOTOams, GOTO Amsterdam, relayr, Antonio Almeida, Jaime González-Arintero Berciano, IoT, MQTT, CoAP, HTTP, WebSockets
Id: s6ZtfLmvQMU
Channel Id: undefined
Length: 52min 49sec (3169 seconds)
Published: Mon Oct 30 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.