Leveraging Android for the Internet of Things with Eclipse M2M

Preview:

DESCRIPTION

The Eclipse M2M (Machine-to-Machine) open source initiative delivers a stack of open source building blocks that accelerate the development of connected solutions. In this session, you’ll be briefly introduced to the Eclipse M2M projects and discover cool end-to-end examples (Augmented Reality anyone?) combining the use of Android API with Open Hardware platforms (Arduino, Raspberry Pi…) for doing fleet tracking, remote monitoring, home automation, and much more.

Citation preview

Leveraging Android for the Internet of Things with Eclipse M2M

Droidcon London 24-27th October 2013 Benjamin Cabé | Sierra Wireless

Who I am

•  Benjamin Cabé •  Open Source M2M

Evangelist at Sierra Wireless •  Eclipse M2M WG chairperson

M2M?

M2M? IoT?

❝ Technology that supports wired or wireless communication between devices

Typical architecture Healthcare example

IOT

IOT

However… It’s not as easy as it looks

Network is unreliable

Network is unreliable

Objects need to be ID’d

Network is unreliable

Objects need to be ID’d

Embedded is complex

When all you want to do…

POST /turnOn

GET /temperature

Eclipse M2M building blocks

protocols

frameworks

tools

Eclipse M2M building blocks

Network is unreliable

MQTT

MQTT?

MQTT? M = Messaging

MQTT? M = Messaging

Publish/subscribe protocol

MQTT? M = Messaging

Publish/subscribe protocol

Lightweight (bandwidth, battery, …)

72.2

72.2

Show me the code! embedded device

Show me the code!

var mqtt = require('mqtt');var c = mqtt.createClient(1883, 'm2m.eclipse.org');

client.on('message’, cb);client.subscribe('/kettle232/switch');client.publish('/kettle232/temp’, '72.2');var cb = function(topic, message) {// turn the kettle on/off

}

Show me the code!

var mqtt = require('mqtt');var c = mqtt.createClient(1883, 'm2m.eclipse.org');

client.on('message’, cb);client.subscribe('/kettle232/switch');client.publish('/kettle232/temp’, '72.2');var cb = function(topic, message) {// turn the kettle on/off

}

Show me the code!

var mqtt = require('mqtt');var c = mqtt.createClient(1883, 'm2m.eclipse.org');

client.on('message’, cb);client.subscribe('/kettle232/switch');client.publish('/kettle232/temp’, '72.2');var cb = function(topic, message) {// turn the kettle on/off

}

Show me the code!

var mqtt = require('mqtt');var c = mqtt.createClient(1883, 'm2m.eclipse.org');

client.on('message’, cb);client.subscribe('/kettle232/switch');client.publish('/kettle232/temp’, '72.2');var cb = function(topic, message) {// turn the kettle on/off

}

Show me the code! Android device

Show me the code!

MqttClient c = new MqttClient ( "tcp://m2m.eclipse.org:1883", MqttClient.generateClientId() );

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

Show me the code!

MqttClient c = new MqttClient ( "tcp://m2m.eclipse.org:1883", MqttClient.generateClientId() );

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

Show me the code!

MqttClient c = new MqttClient ( "tcp://m2m.eclipse.org:1883", MqttClient.generateClientId() );

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

Show me the code!

MqttClient c = new MqttClient ( "tcp://m2m.eclipse.org:1883", MqttClient.generateClientId() );

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

Show me the code!

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

});

Callback code:

Show me the code!

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

});

Callback code:

Simple but not Stupid

•  QoS – at most once, at least once, exactly once, …

•  “Last will & Testament” – automatically publish a message when a client

goes offline

More about MQTT

http://mqtt.org http://eclipse.org/paho

Network is unreliable

Objects need to be ID’d

So… now my objects talk … to me?

NFC RFID

Bluetooth LE QR Code

How about AR*? * Augmented Reality

Demo! Connected greenhouse

Raspberry Pi + NodeJS MQTT client

Raspberry Pi + NodeJS MQTT client

MQTT broker m2m.eclipse.org

Raspberry Pi + NodeJS MQTT client

MQTT broker m2m.eclipse.org

Raspberry Pi + NodeJS MQTT client

MQTT broker m2m.eclipse.org

Raspberry Pi + NodeJS MQTT client

Nexus 10 + Java MQTT client +

metaio SDK

Network is unreliable

Objects need to be ID’d

Embedded is complex

Simplifying embedded for home automation

with .

http://www.deviantart.com/art/Android-Version-Cupcake-150995350

Eclipse Smart Home

•  A flexible framework for smart home and ambient assisted living (AAL) solutions.

•  Easy to extend (based on OSGi)

•  Smooth Android integration

Ready to Play?

Data consolidation

Ready to Play?

Data consolidation

Alerting

Ready to Play?

Data consolidation

Alerting

User management

Ready to Play?

Data consolidation

Alerting

User management

etc.

Ready to Play?

Management dashboards

System diagnostics

(Big!) Data history

Register for a free trial!

http://airvantage.net

Get a greenhouse kit!

http://airvantage.github.io/devkit

http://m2m.eclipse.org

Thanks!

Liked it? … Share it!

Benjamin Cabé bcabe@sierrawireless.com | @kartben

Recommended