Top Banner
Christian Götz | dc-square GmbH How do Things talk? IoT Application Protocols 101
68

How do Things talk? IoT Application Protocols 101

Jan 28, 2015

Download

Technology

Christian Götz

Analysts predict that in 2020 50 billion devices are connected to the internet. Together with the fact that more and more of these "things" are connected over the cellular network, new challenges are introduced to the communication of Internet of Things (IoT) and machine-to-machine (M2M) scenarios. There are a lot of protocols which claim to be ideal for these use cases, for example MQTT and COAP. In this talk you will get an overview of commonly used protocols and their underlying architectural styles. We will also look at advantages/disadvantages, use cases and the eco-system around them for Java developers.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 2: How do Things talk? IoT Application Protocols 101

Talking leads to Knowledge

Page 3: How do Things talk? IoT Application Protocols 101

GPSGPS

GPSGPS

GPS

GPSGPS

Detected: Traffic Jam!

Page 4: How do Things talk? IoT Application Protocols 101

...but waitwho’s talking here

Page 5: How do Things talk? IoT Application Protocols 101

author & speaker

things speech therapist ;)

CEO & co-founder developer

@goetzchr

Page 6: How do Things talk? IoT Application Protocols 101

THINGS talk?

Page 7: How do Things talk? IoT Application Protocols 101

THINGS?

Page 8: How do Things talk? IoT Application Protocols 101

Consumer Goods

Page 9: How do Things talk? IoT Application Protocols 101

Industry Machines

Page 10: How do Things talk? IoT Application Protocols 101

objects in our everyday life

Page 11: How do Things talk? IoT Application Protocols 101

logistics has a lot of things...

Page 12: How do Things talk? IoT Application Protocols 101

M2MIoT

IoEWoT

Web of Things

Internet of Things

Internet of Everything

Machine to Machinecommunication

UbicompUbiquitous computing

CPSCyper Physical Systems Pervasive

Computing

Page 13: How do Things talk? IoT Application Protocols 101

Technology that connects Devices

over wired or wireless communication

Page 14: How do Things talk? IoT Application Protocols 101

why should I care ?

Page 15: How do Things talk? IoT Application Protocols 101

Source: http://www.cisco.com/web/about/ac79/docs/innov/IoT_IBSG_0411FINAL.pdf

0

12,5

25

37,5

50

2003 2010 2015 2020

3,4

1,8

0,08

World Population Connected Devices

Ratio6,5

Page 16: How do Things talk? IoT Application Protocols 101

new devices per second

http://blogs.cisco.com/news/cisco-connections-counter/

2013 2014 2020

250

10080

Page 17: How do Things talk? IoT Application Protocols 101

finally a use case for IPv6 ;)

Page 18: How do Things talk? IoT Application Protocols 101

Open Hardware

simple

accessible

affordable

Raspberry Pi is a trademark of the Raspberry Pi Foundation

Page 19: How do Things talk? IoT Application Protocols 101

Developers are the new King Makers

… if you don’t believe me, read this book ;) http://thenewkingmakers.com/

Page 20: How do Things talk? IoT Application Protocols 101

So how do these things talk?

Page 21: How do Things talk? IoT Application Protocols 101
Page 22: How do Things talk? IoT Application Protocols 101

HTTP/RESTused since 1991

widely known and adapted

request/response

point 2 point

HTTP 2.0 - still work in progress

Page 23: How do Things talk? IoT Application Protocols 101

ChallengesConstrained devices

Bi-directional communication

Scaling to 100.000s of devices

Unreliable networks

Push messaging

Security

HTTPIoT

Page 24: How do Things talk? IoT Application Protocols 101

CoAPConstrained Application Protocol

CoAP HTTP

Introducing . . .

Page 25: How do Things talk? IoT Application Protocols 101

CoAP Message

0 1 2 30 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+|Ver| T | TKL | Code | Message ID |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Token (if any, TKL bytes) ...+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Options (if any) ...+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+|1 1 1 1 1 1 1 1| Payload (if any) ...+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Page 26: How do Things talk? IoT Application Protocols 101

protocol stack

CoAP

UDP

6LoWPan

HTTP

TCP

IP

vs

Page 27: How do Things talk? IoT Application Protocols 101

Message Flow

Client ServerRequest

Response

Non-Confirmable Message

1/2

Page 28: How do Things talk? IoT Application Protocols 101

Message Flow

Client Server

Request

Response

Ack

Ack

Confirmable Message2/2

Page 29: How do Things talk? IoT Application Protocols 101

URL REST style

coap://host:port/path?param=value

coap://localhost:5683/temp

coap://server/temp/critical?above=42

Page 30: How do Things talk? IoT Application Protocols 101

ObserveServer

Client

http://tools.ietf.org/html/draft-ietf-core-observe-13

Get O

pt O

bser

ve Response

Response

Response

Response

10 ℃ 8 ℃ 7 ℃ 5 ℃ 4 ℃

10 ℃ 8 ℃ 7 ℃ 4 ℃

lost

Response

5 ℃

Page 31: How do Things talk? IoT Application Protocols 101

Discovery of Resources

/.well-known/core

Multicast

Content-Negotiation

Proxy CoAP-HTTP and HTTP-CoAP

DTLS

Other features

Page 32: How do Things talk? IoT Application Protocols 101

Tools

Californium and Copper Logo from http://people.inf.ethz.ch/mkovatsc/

Californium & Copper

+More Implementations

http://en.wikipedia.org/wiki/Constrained_Application_Protocol#Implementations

Page 33: How do Things talk? IoT Application Protocols 101
Page 34: How do Things talk? IoT Application Protocols 101

XMPP at a glance• developed for chat

• based on XML

• extensible

• decentral / inter-server

• TLS and SASL

Page 35: How do Things talk? IoT Application Protocols 101

Typical XMPP Flow<iq type =’get’

from =’[email protected]

to =‘[email protected]

id =’S0001’>

<req xmlns =’urn:xmpp:iot:sensordata’ seqnr =’1’ momentary =’true’ >

</iq>

1/3

Page 36: How do Things talk? IoT Application Protocols 101

<iq type =’result’

from =’[email protected]

to =‘[email protected]

id =’S0001’>

<accepted xmlns =’urn:xmpp:iot:sensordata’ seqnr =’1’/ >

</iq>

2/3

Page 37: How do Things talk? IoT Application Protocols 101

<message from =’...’ to =’...’><fields xmlns=’urn:xmpp:iot:sensordata’ seqnr =’1’ done =’true’>

<node nodeId =’Device01’>

<timestamp value=‘2013-03-07T16:24:30’>

<numeric name =’Temperature’ momentary =‘true’ automaticReadout =’true’

value =’23.4’ unit =’°C’ >

</timestamp>

</node>

</fields>

</message>3/3

Page 38: How do Things talk? IoT Application Protocols 101

From chat to IoT - status quo

Page 39: How do Things talk? IoT Application Protocols 101

Who’s a friend ?

Page 41: How do Things talk? IoT Application Protocols 101

XMPP IoT Extensions323 Sensor Data experimental 04/2014324 Provisioning experimental 03/2014325 Control experimental 04/2014326 Concentrators experimental 03/2014347 Discovery experimental 04/2014??? Interoperability not approved??? Pub/Sub IoT not existent

Source: http://xmpp.org/xmpp-protocols/xmpp-extensions/

Page 42: How do Things talk? IoT Application Protocols 101

More XEPs

EXI (Efficient XML Interchange)

Service Discovery<query xmlns =’http://jabber.org/protocol/disco#info’/ >

Page 43: How do Things talk? IoT Application Protocols 101

it’s still XML

Page 44: How do Things talk? IoT Application Protocols 101

ToolsClients

http://xmpp.org/xmpp-software/libraries/

Server

http://xmpp.org/xmpp-software/servers/

Page 45: How do Things talk? IoT Application Protocols 101
Page 46: How do Things talk? IoT Application Protocols 101

Temperaturfühler MQTT-Broker

Laptop

Mobiles Endgerät

publish: “21°C“publish: “21°C“

publish: “21°C“

subscribe

subscribe

Page 47: How do Things talk? IoT Application Protocols 101

Topics

rheingoldhalle Goldsaal A

Goldsaal B

people

temp

people

temp

/ /

1/5

Page 48: How do Things talk? IoT Application Protocols 101

rheingoldhalle Goldsaal A

Goldsaal B

people

temp

people

temp

/ /

rheingoldhalle/Goldsaal-A/temperature

2/5

Page 49: How do Things talk? IoT Application Protocols 101

rheingoldhalle Goldsaal A

Goldsaal B

people

temp

people

temp

/ /

rheingoldhalle/+/temp

3/5

Page 50: How do Things talk? IoT Application Protocols 101

rheingoldhalle Goldsaal A

Goldsaal B

people

temp

people

temp

/ /

rheingoldhalle/Goldsaal B/#

4/5

Page 51: How do Things talk? IoT Application Protocols 101

rheingoldhalle Goldsaal A

Goldsaal B

people

temp

people

temp

/ /

#

5/5

Page 52: How do Things talk? IoT Application Protocols 101

Characteristics• Topics

• lightweight

• QoS Levels

• Retained / LWT

• MQTT over Websockets

• Bridging

• SSL

Page 53: How do Things talk? IoT Application Protocols 101

Broker• central communication point

• different implementations

• additional features

+ othershttp://mqtt.org/wiki/doku.php/brokers

Page 54: How do Things talk? IoT Application Protocols 101

MQTT-SensorNetworks

MQTT for WSN

utilizes UDP

Gateway to MQTT

Topic Preregistration

Sleeping Clients

-SN

Page 55: How do Things talk? IoT Application Protocols 101

protocol stack

MQTT-SN

UDP

6LoWPan

MQTT

TCP

IP

Page 56: How do Things talk? IoT Application Protocols 101

ToolsPublic Broker

http://mqttdashboard.com

Java-Broker with Plugin SDK

Client Lib

Page 57: How do Things talk? IoT Application Protocols 101
Page 58: How do Things talk? IoT Application Protocols 101

CONNECTaccept-version:1.0,1.1,2.0host:example.com/stomplogin:guestpasscode:guest

^@

Simple/Streaming Text Oriented Messaging Protocol

Page 59: How do Things talk? IoT Application Protocols 101

SENDdestination:/queue/test

This is a simple STOMP Message!

^@

Simple/Streaming Text Oriented Messaging Protocol

Page 60: How do Things talk? IoT Application Protocols 101

Facts• simple

• text-based

• publish/subscribe

• Websockets support

• Transaction support

Page 61: How do Things talk? IoT Application Protocols 101

Tools

reference broker impl

Stampyserver/client impl

+ othershttp://stomp.github.io/implementations.html

Page 62: How do Things talk? IoT Application Protocols 101

CoAP

HTTP

Page 63: How do Things talk? IoT Application Protocols 101

protocol war

Page 64: How do Things talk? IoT Application Protocols 101

You Mean the One and Unique Solutions

For All Problems

DOES NOT EXIST?

Page 65: How do Things talk? IoT Application Protocols 101

coexistence

Page 66: How do Things talk? IoT Application Protocols 101

How to choose a protocol• How constrained are the devices?

• Reliable/unreliable network?

• What is the message rate?

• How is the data processed further?

• Push or Pull ?

Page 67: How do Things talk? IoT Application Protocols 101
Page 68: How do Things talk? IoT Application Protocols 101

@goetzchr

Thanks