connecting nest via mqtt to internet of things

25
How MQTT can connect devices to the IoT Markus van Kempen E: [email protected] T: @markusvankempen

Upload: markus-van-kempen

Post on 17-Jul-2015

736 views

Category:

Internet


3 download

TRANSCRIPT

How MQTT can connect devices to the IoT

Markus van Kempen

E: [email protected]

T: @markusvankempen

How MQTT protocol can connect devices to the Internet of Things (#IoT)

- What is MQTT?

-MQTT is a lightweight messaging protocol that supports publish/subscribe

- http://mqtt.org/

- How can it be used to talk to devices?

- How does MQTT work with IoT?

- Other scenarios

-Connecting Android Device to the IoT Cloud

-Connecting GOOGLE GLASS to the IoT Cloud

Choice of Sensors and devices

Internet

Scenario overview using MQTT

Publish Hosts messages

Proxy MQTT Client

IoT Cloud / MQTT BrokerTopic: iot-2/type/laptoplan/id/Deviceid/evt/+/fmt/json

1) Get Data from a Sensor e.g Nest

Pull

I am using node (js) and the unofficial nest api

2) Sign up or use a IoT broker

You can use Ibm IoT Cloud

https://internetofthings.ibmcloud.com/#/

Or open source broker like Mosquitto

See mqtt.org for more infos

3) Publish/Send Data via mqtt from you device sensor to IOT cloud / mqtt broker

Publish

client.publish('iot-2/evt/MVK/fmt/json', JSON.stringify(data), function() {});

d": {

"myName": "Markus Infos",

“targettemp" : 72, currenttem 70

}

};

4) Use a mqtt client to subscribe or publish to the broker

There is lots of Mqtt client out there like mqtt.js or a eclipse paho

Subscribe

iot-2/type/mvk-laptoplan/id/00-21-CC-C8-6F-1B/evt/+/fmt/json

5) Subscribe to broker (IoT Cloud) with a mqtt client to visualize the data

Subscribe

iot-2/type/mvk-laptoplan/id/00-21-CC-C8-6F-1B/evt/+/fmt/json

{"d":

{"myName":"Nest Data",

"deviceName":"Bedroom“,

"currentTemp":20.93,“

targetTemp":20}}

6) Implement a command which the device reacts to

{

"d": {

"myName": "Paho client",

"TargetTemp": 72

}

}

iot-2/type/mvk-laptoplan/id/00-21-CC-C8-6F-1B/cmd/MVK/fmt/json

Publish

Full Scenario overview using mqtt

Data Publish

Subscribe/

Notify of evt & cmd

CM

D P

ub

lish

Nest / Proxy

#1 Mqtt Client

#2 Mqtt Client

Visual Display

Distributes

Messages to

subscribers

MQTT Client and IoT Cloud

Publish

Distributes

Messages to

subscribers

Subscribe/

Notify of event & cmd

{"d":

{"myName":”Data",

“clientName":“paho“,

“Data":”Hello” ….}}

Publish / Subscribe to Topic iot-2/type/laptoplan/id/Deviceid/evt/+/fmt/json

References

MQTT

http://mqtt.org/

http://Mosquitto.org

Github

https://github.com/markusvankempen/SendNestDatatoIBMIoTCloud

IBM IoT Cloud

https://internetofthings.ibmcloud.com/

Quickstarter

https://developers.google.com/+/quickstart/android

Youtube:

https://www.youtube.com/watch?v=jm2oCSilIvU

My blog

http://markusvankempen.tumblr.com/

Markus van Kempen – EA ArchitectInnovating with People and Technology

email: [email protected]: @markusvankempenHashtag: #MVK

How MQTT can connect ANDIORD to the IoT

Markus van Kempen

E: [email protected]

T: @markusvankempen

https://github.com/ibm-messaging/iot-starter-for-android

Internet

Publish Hosts messages

IoT Cloud / MQTT Broker

Topic: iot-2/evt/accel/fmt/json

Android

Visualization

On Laptop

Scenario overview using Android App

with MQTT and IBM IoT

json Message

{ "d": {"myName":"MVK Nexus Accelerometer",

"acceleration_x":0.0, ,,,,,,} }

MQTT Client and IoT Cloud

Publish Distributes

Messages to

subscribers

{"d":

{"myName":”Data",

“text":“Hello Phone “,

….}}

Publish to device iot-2/type/MYNEXUS/id/8c705ae36b0c/cmd/alert/fmt/json

Su

bscrib

e/

Notify

of e

ve

nt &

cm

d

References

Code:

https://github.com/markusvankempen/IBMIotForAndriod

YouTube:

https://www.youtube.com/watch?v=PvFtxS8pO0Y

https://github.com/ibm-messaging/iot-starter-for-android

How MQTT can connect GLASS to the IoT

Markus van Kempen

E: [email protected]

T: @markusvankempen

Internet

Publish Hosts messages

IoT Cloud / MQTT Broker

Topic: iot-2/evt/status/fmt/json

Google GLASS

QuickStart

Visualization

Scenario overview using GLASS MQTT and IBM IoT

json Message

{

"d": {

"myName": “MVK GLASS",

“direction”: “Left”,

"x": 1000,

“y": 1000,

“z": 1000

}

}

MQTT Client and IoT Cloud

Publish

Distributes

Messages to

subscribers

Subscribe/

Notify of event & cmd

{"d":

{"myName":”Data",

“clientName":“paho“,

“Data":”Hello” ….}}

Publish / Subscribe to Topic iot-2/type/Name/id/Deviceid/evt/+/fmt/json

References

YouTube:

https://www.youtube.com/watch?v=pzUetPjTfCk

Code:

https://github.com/markusvankempen/GoogleGlass-LiveCard-Mqtt-to-IBMIot

Markus van Kempen – EA ArchitectInnovating with People and Technology

email: [email protected]: @markusvankempenHashtag: #MVK