Building the Internet of Things with Eclipse IoT - IoTBE meetup

68
BUILDING THE INTERNET OF THINGS WITH ECLIPSE IOT Benjamin Cabé, Eclipse Foundation @kartben "Kortrijk Begijnhof and Our Lady's" by Michael O'Donnabhain

description

The slides from my session at the IoTBE meetup http://www.meetup.com/intom2m/events/168897132/

Transcript of Building the Internet of Things with Eclipse IoT - IoTBE meetup

Page 1: Building the Internet of Things with Eclipse IoT - IoTBE meetup

BUILDING THE INTERNET OF THINGS WITH ECLIPSE IOT Benjamin Cabé, Eclipse Foundation @kartben

"Kortrijk Begijnhof and Our Lady's" by Michael O'Donnabhain

Page 2: Building the Internet of Things with Eclipse IoT - IoTBE meetup

M2M? IoT?

Page 3: Building the Internet of Things with Eclipse IoT - IoTBE meetup

❝ Technology that supports wired or wireless communication between devices

Page 4: Building the Internet of Things with Eclipse IoT - IoTBE meetup
Page 5: Building the Internet of Things with Eclipse IoT - IoTBE meetup
Page 6: Building the Internet of Things with Eclipse IoT - IoTBE meetup
Page 7: Building the Internet of Things with Eclipse IoT - IoTBE meetup
Page 8: Building the Internet of Things with Eclipse IoT - IoTBE meetup

http://www.flickr.com/photos/brunauto/5687363705

fragmentation

Page 9: Building the Internet of Things with Eclipse IoT - IoTBE meetup

lock-in

http://www.flickr.com/photos/photosightfaces/8152791780/

Page 10: Building the Internet of Things with Eclipse IoT - IoTBE meetup

http://www.flickr.com/photos/90514086@N00/952121271/ http://www.flickr.com/photos/cyberslayer/952121271

complexity

Page 11: Building the Internet of Things with Eclipse IoT - IoTBE meetup
Page 12: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Protocols

Tools

Frameworks

Services

Page 13: Building the Internet of Things with Eclipse IoT - IoTBE meetup

 Hand  by  Castor  &  Pollux  from  The  Noun  Project  

AT FIRST THEY WERE THREE…

Page 14: Building the Internet of Things with Eclipse IoT - IoTBE meetup

 Hand  by  Castor  &  Pollux  from  The  Noun  Project  

AT FIRST THEY WERE THREE…

Page 15: Building the Internet of Things with Eclipse IoT - IoTBE meetup

 Hand  by  Castor  &  Pollux  from  The  Noun  Project  

AT FIRST THEY WERE THREE…

Page 16: Building the Internet of Things with Eclipse IoT - IoTBE meetup

 Hand  by  Castor  &  Pollux  from  The  Noun  Project  

AT FIRST THEY WERE THREE…

Page 17: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Paho provides client implementations of the MQTT protocol.

Mihini is an embedded Lua runtime providing HW abstraction and other services.

Koneki provides tools for embedded Lua developers.

Page 18: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Eclipse SCADA is a complete Java/OSGi-based SCADA system (communication, monitoring, GUI, …)

Kura is a Java/OSGi-based M2M container for gateways. Has support for Modbus, CANbus, MQTT, …

Mosquitto is a lightweight server implementation of the MQTT and MQTT-SN protocols, written in C.

Page 19: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Ponte bridges M2M/IoT (MQTT, CoAP) protocols to the Web.

SmartHome provides a complete set of services for home automation gateways.

OM2M implements the ETSI M2M standard.

(code pending)

Page 20: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Californium is an implementation of the CoAP protocol written in Java. Includes DTLS for security.

Wakaama is an implementation of LWM2M written in C.

Krikkit is a rules system for programming edge devices just like you’d configure a router

Wakaama

Krikkit

(code pending)

(code pending)

(code pending)

Page 21: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Concierge is a lightweight implementation of OSGi Core R5.

Your project? J

Concierge

We need to talk! ;-)

Page 22: Building the Internet of Things with Eclipse IoT - IoTBE meetup

I often get asked…

Page 23: Building the Internet of Things with Eclipse IoT - IoTBE meetup

WHAT IS ZE BEST LANGUAGE FOR

IOT?!?

I often get asked…

Page 24: Building the Internet of Things with Eclipse IoT - IoTBE meetup

ANSWER: It depends! J For embedded systems…  

Co

de

vs.

C

on

figu

rati

on

Constrained micro-controllers vs. Smart gateways

C Javascript Lua Java/OSGi

Page 25: Building the Internet of Things with Eclipse IoT - IoTBE meetup

ANSWER: It depends! J In

fras

tru

ctu

re

v

s.

A

pp

. dev

elo

pm

ent

Communication enablement vs. Information systems

On the server side…  

C Javascript Java/OSGi

Page 26: Building the Internet of Things with Eclipse IoT - IoTBE meetup

BUILDING BLOCKS FOR IOT

Page 27: Building the Internet of Things with Eclipse IoT - IoTBE meetup

BUILDING BLOCKS FOR IOT … for building what?

Page 28: Building the Internet of Things with Eclipse IoT - IoTBE meetup

 Cloud  by  Andrew  Lynne  from  The  Noun  Project    Thermometer  by  Lemon  Liu  from  The  Noun  Project  

 Fluorescent  Light  Bulb  by  Dmitriy  Lagunov  from  The  Noun  Project    Water  by  Gilad  Fried  from  The  Noun  Project  

MQTT Network

Mosquitto broker

Building… SENSOR NETWORKS

Page 29: Building the Internet of Things with Eclipse IoT - IoTBE meetup
Page 30: Building the Internet of Things with Eclipse IoT - IoTBE meetup

MQTT?

Page 31: Building the Internet of Things with Eclipse IoT - IoTBE meetup

MQTT?

M is for Messaging… (mmmmaybe!)

Q is not for Queue ☺︎

Publish/Subscribe protocol

Lightweight (bandwidth, battery, …)

Page 32: Building the Internet of Things with Eclipse IoT - IoTBE meetup

21.3

21.3

Page 33: Building the Internet of Things with Eclipse IoT - IoTBE meetup

MQTT history

•  … it’s not new!

•  Invented in 1999 (Andy Stanford-Clark, Arlen Nipper)

•  Royalty-free since 2010

•  Being standardized at OASIS since 2013

Page 34: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Neat MQTT features

•  Wildcards

•  Quality of Service

•  Last Will & Testament

•  Retained Messages

Page 35: Building the Internet of Things with Eclipse IoT - IoTBE meetup

MQTT Features | Wildcards

•  The number sign (#) is a wildcard character that matches any number of levels within a topic.

•  The plus sign (+) is a wildcard character that matches only one topic level

Examples

mygreenhouse/sensors/#

+/sensors/temperature

Page 36: Building the Internet of Things with Eclipse IoT - IoTBE meetup

MQTT Features | QoS

•  QoS flag allows to control the level of assurance for delivery you want when publishing a message to the broker

Page 37: Building the Internet of Things with Eclipse IoT - IoTBE meetup

MQTT Features | QoS 0

•  QoS flag allows to control the level of assurance for delivery you want when publishing a message to the broker

•  A message published with QoS=0 will be received at most once (“fire & forget”) by subscribed clients

Page 38: Building the Internet of Things with Eclipse IoT - IoTBE meetup

MQTT Features | QoS 1

•  QoS flag allows to control the level of assurance for delivery you want when publishing a message to the broker

•  A message published with QoS=1 will be received at least once (acknowledged delivery) by subscribed clients

Page 39: Building the Internet of Things with Eclipse IoT - IoTBE meetup

MQTT Features | QoS 2

•  QoS flag allows to control the level of assurance for delivery you want when publishing a message to the broker

•  A message published with QoS=2 will be received exactly once (assured delivery) by subscribed clients

Page 40: Building the Internet of Things with Eclipse IoT - IoTBE meetup

MQTT Features | Last Will & Testament

•  IoT devices can come & go on the network quite often and in a very unpredictable way

•  Last Will & Testament allows to notify interested parties to an abnormal disconnection of a client

•  The Last Will & Testament (if any) is part of the initial connection message

Page 41: Building the Internet of Things with Eclipse IoT - IoTBE meetup

MQTT Features | Retained messages

•  The Retained flag allows a published message to be stored on the broker, so as possible receivers can subscribe later and still receive the message

Page 42: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Real world example… and demo!

Page 43: Building the Internet of Things with Eclipse IoT - IoTBE meetup

21.3

21.3

Page 44: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Is the MQTT API that simple?

Page 45: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Is the MQTT API that simple? MqttClient mqttClient = new MqttClient ( "tcp://iot.eclipse.org:1883", MqttClient.generateClientId() );

mqttClient.setCallback(…);mqttClient.connect();mqttClient.subscribe("myGreenhouse/#");// the rest of your app

Page 46: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Is the MQTT API that simple?

mqttClient.setCallback(new MqttCallback() {@Overridepublic void messageArrived(String topic, MqttMessage message) throws Exception { // process received message // e.g. display temperature value}// ...

});

Callback code:

Page 47: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Data viz. w/ MQTT over Websockets

•  Rickshaw is a JavaScript toolkit for creating interactive time series graphs

•  It’s built on top of d3.js

•  MQTT over Websockets makes it very easy to feed data into Rickshaw datasets… perfect for IoT!

– More at http://code.shutterstock.com/rickshaw, lots of examples to get started

Page 48: Building the Internet of Things with Eclipse IoT - IoTBE meetup

 Cloud  by  Andrew  Lynne  from  The  Noun  Project    Thermometer  by  Lemon  Liu  from  The  Noun  Project  

 Fluorescent  Light  Bulb  by  Dmitriy  Lagunov  from  The  Noun  Project    Water  by  Gilad  Fried  from  The  Noun  Project  

MQTT Network

Ponte broker

CoAP Network

Building… SENSOR NETWORKS (2)

Page 49: Building the Internet of Things with Eclipse IoT - IoTBE meetup

CoAP: Constrained Application Protocol

•  Internet Eng. Task Force standard for the Internet of Things.

•  Started in 2010!

•  Draft-18 is the final one.

Page 50: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Co: Constrained

•  Simple to encode: targets 8 bits MCU.

•  UDP based, targets low power IP networks.

•  Two level of QoS: confirmable message or not.

•  Simple observation mechanism.

Page 51: Building the Internet of Things with Eclipse IoT - IoTBE meetup

CoAP: RESTful things!

•  REST paradigm for things: – URI: coap://hostname/lamps/12/status

•  HTTP like verbs: – GET for reads

– POST, PUT, DELETE for mutation

– … but in a compact binary datagram.

Page 52: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Co: Constrained

.0 1 2 3 .0 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 53: Building the Internet of Things with Eclipse IoT - IoTBE meetup

CoAP: Discoverability GET coap://hostname/.well-known/core

à Provides a list of all supported resources!

Page 54: Building the Internet of Things with Eclipse IoT - IoTBE meetup

CoAP: Security

•  DTLS (TLS on UDP Datagrams)

•  Pre-shared key or not

•  DTLS is not really light :(

Page 55: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Device management Secure, monitor, manage fleet of

deployed devices.

•  Configure the device.

•  Update the firmware (and maybe the app)

•  Monitor and gather connectivity statistics

Page 56: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Lightweight M2M

•  A new Open Mobile Alliance standard

•  An OMA-DM successor for M2M targets

Page 57: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Lightweight M2M: CoAP

•  Built on top of CoAP:

•  Really lighter than OMA-DM or TRS-069.

Page 58: Building the Internet of Things with Eclipse IoT - IoTBE meetup

LWM2M features

•  Firmware upgrades (in band or thru HTTP)

•  Device monitoring and configuration

•  Server provisioning (bootstraping)

Page 59: Building the Internet of Things with Eclipse IoT - IoTBE meetup

LWM2M SMS

•  SMS can be used for waking-up the device.

•  Or for any GET/POST/PUT!

Page 60: Building the Internet of Things with Eclipse IoT - IoTBE meetup

LWM2M: standard objects – Device

– Server

– Connectivity monitoring

– Connectivity statistics

– Location

– Firmware

The objects have a numerical identifier (saves bytes…)

Page 61: Building the Internet of Things with Eclipse IoT - IoTBE meetup

LWM2M the URLs

URLs:

/{object}/{instance}/{resource

Ex: /6/0 à whole position object (binary TLV)

x /6/0/2 à only the altitude value

Page 62: Building the Internet of Things with Eclipse IoT - IoTBE meetup

DEMO

•  Copper, a Firefox plug-in for CoAP

•  Eclipse Wakaama, a LWM2M client

•  Leshan, a LWM2M server

Page 63: Building the Internet of Things with Eclipse IoT - IoTBE meetup

 Cloud  by  Andrew  Lynne  from  The  Noun  Project    Thermometer  by  Lemon  Liu  from  The  Noun  Project  

 Fluorescent  Light  Bulb  by  Dmitriy  Lagunov  from  The  Noun  Project    Water  by  Gilad  Fried  from  The  Noun  Project  

CoAP Network

LWM2M server (e.g. Leshan)

wakaama wakaama

wakaama

Building… DEVICE MANAGEMENT

battery level avail. memory …

firmware reboot …

Page 64: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Android UI

X10

Serial …

Bluetooth

Building… HOME AUTOMATION

Page 65: Building the Internet of Things with Eclipse IoT - IoTBE meetup

In a nutshell

•  MQTT is a very versatile protocol for building your IoT solution from the ground up. You should try it!

•  Eclipse IoT has lots of projects, from basic building blocks to more complete solutions

•  We have cool Java projects… among many others! J

Page 66: Building the Internet of Things with Eclipse IoT - IoTBE meetup

Join us at EclipseCon France!

http://eclipsecon.org/france2014

Page 67: Building the Internet of Things with Eclipse IoT - IoTBE meetup

http://iot.eclipse.org

Page 68: Building the Internet of Things with Eclipse IoT - IoTBE meetup

http://iot.eclipse.org

<[email protected]> @kartben

Thanks! Questions?