Top Banner
© 2014 IBM Corporation Connecting Devices to the Internet of Things Peter Niblett - IBM Gari Singh - IBM
37

Session 1908 connecting devices to the IBM IoT Cloud

Jan 18, 2015

Download

Technology

PeterNiblett

IBM MessageSight and the IBM Internet of Things cloud enable connectivity across a wide variety of devices - from existing devices in silos and systems through the wide range of new devices that are appearing on a daily basis. This session covers patterns of connectivity, how to make it happen, including sending events like measurements and receiving of commands. The session goes into detail on how to use the industry standard MQ Telemetry Transport protocol to achieve this and encompasses best practices for topics and message format.
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 1: Session 1908   connecting devices to the  IBM IoT Cloud

© 2014 IBM Corporation

Connecting Devices to the Internet of ThingsPeter Niblett - IBM

Gari Singh - IBM

Page 2: Session 1908   connecting devices to the  IBM IoT Cloud

Please Note

IBM’s statements regarding its plans, directions, and intent are subject to change

or withdrawal without notice at IBM’s sole discretion.

Information regarding potential future products is intended to outline our general

product direction and it should not be relied on in making a purchasing decision.

The information mentioned regarding potential future products is not a

commitment, promise, or legal obligation to deliver any material, code or

functionality. Information about potential future products may not be incorporated

into any contract. The development, release, and timing of any future features or functionality described for our products remains at our sole discretion.

Performance is based on measurements and projections using standard IBM

benchmarks in a controlled environment. The actual throughput or performance

that any user will experience will vary depending upon many factors, including

considerations such as the amount of multiprogramming in the user’s job stream,

the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve results

similar to those stated here.

Page 3: Session 1908   connecting devices to the  IBM IoT Cloud

Agenda

• The Internet of Things and its Ecosystem

• The IBM IoT Cloud and the IoT Cloud Quickstart

• Quickstart device recipes and demonstration

• How is Quickstart implemented?

• Customizing the Quickstart device support

• Security considerations

3

Page 4: Session 1908   connecting devices to the  IBM IoT Cloud

The Internet of Things is the next Internet Frontier

Source:http://www.digitalcommunities.com/articles/FutureStructure-The-New-Framework-for-Communities.html

Page 5: Session 1908   connecting devices to the  IBM IoT Cloud

How Many Things ? •IoT 2020 View

Page 6: Session 1908   connecting devices to the  IBM IoT Cloud

What is the IoT being used for today?

Extend the value of goods and services, e.g.Lock/Unlock/Find your carTell me when my washing is doneHow well am I cleaning my teeth?

Monetize through new business modelsAd-hoc care hirePay-as-you-drive insurance

Optimize by understanding behaviour and anticipating most optimal actions

White goods manufacturer understanding customer behaviourImproved product support and maintenanceSmarter Supply Chain

Control remote behaviour with automationHome automation / remote controlEnergy Demand ManagementSmarter CitiesManufacturing

Key areas

Agriculture

Automotive

Consumer products

Energy and Utilities

Government

Healthcare

Home Automation

Insurance

Manufacturing

Transport

Oil and Gas

Page 7: Session 1908   connecting devices to the  IBM IoT Cloud

Consumers lead the Internet of thingsToday Tomorrow Integration

A few connected devices per person…

Almost every device that consumers own will be connected, and many new ones will be created to leverage

the value created by consumer connections.

Cross-platform integrators will

connected devices and automate

personal activity:Door Lock

Dishwasher

Clothes Washer

Clothes Dryer

Window Lock

Garage Door

Toothbrush

Garden Moisture

Coffee Maker

Home Lights

Examples:

Ifttt.comZapier.com

���� Just as consumers have led enterprises in embracing new mobile services, we

believe they will lead the adoption of connected devices & integrated services

Page 8: Session 1908   connecting devices to the  IBM IoT Cloud

Ecosystem & Partners are crucial

Solutions & Applications

SmarterCities

Transport& Rail

Energy & Utilities

ConsumerElectronics

Life Science& Healthcare

Oil & Gas

ConnectedVehicle

IndustrialManufacturing

Devices Gateways CloudsNetworks

IBM IndustrySolutions

IBM SWG

MessageSight

Streams

SDK SDK Partnerships

MaximoIoC

Page 9: Session 1908   connecting devices to the  IBM IoT Cloud

IoT use cases have many common requirements

Core Requirements:

� Easily on-board connected “things”

� Create a real-time communication channel with the “thing”

� Begin capturing data from the “thing”

� Visualize data from the “thing”

� Collect data in a historian DB

� Provide access to the collected data

� Manage the “things” and the connectivity to them

� Secure the data from the “thing” and control access to that that data

� Pay for the service based on usage

Extended Requirements:

� Perform analytics both in real-time and on historical trend data

� Trigger events based on specific data conditions

� Interact with the “thing” from business apps and/or from mobile devices

� Send commands to the “thing”

Page 10: Session 1908   connecting devices to the  IBM IoT Cloud

IBM Internet of Things Cloud

Connect

Collect

Visualize

Assemble

PartnersCustomers

Developers

Employees

More Things

Page 11: Session 1908   connecting devices to the  IBM IoT Cloud

IBM Internet of Things Cloud Quickstart

Key Capabilities:

• Extremely rapid device onboarding

• Real-time collection of data from devices

• Visualization of data from devices

• Communications api to allow custom devices to be added

• Access to data for Bluemix applications via the IoT Service

What Users Can Do:Connect devices, collect, route, and visualize dataBuild internet of things applications to analyze dataCustomize and add further devices

Note: IoT Cloud Quickstart is a tool to let embedded device developers connect

to the IoT and see data from their device, and to provide data for IoT application

developers to use. It is not intended for production use.

It is a free service, there is no device or user registration step, and all data sent to the Quickstart cloud could potentially be viewed by any internet user.

Platformas a Service

Page 12: Session 1908   connecting devices to the  IBM IoT Cloud

Try our IoT Cloud Quickstart …

12

Page 13: Session 1908   connecting devices to the  IBM IoT Cloud

Simple Connection for Internet of Things

Unpack device and connect it to the Internet

Install software* on the device

Start collecting and visualizing data

* We provide source code samples for a variety of devices on

https://github.com/ibm-messaging

Page 14: Session 1908   connecting devices to the  IBM IoT Cloud

QuickStart comes with recipes and code for the following

• Arm MBED

• intel Galileo

• Raspberry Pi

• Texas Instruments SensorTag and

BeagleBone

• …and we have a simulator for a smartphoneor tablet if you don’t have a physical device

Page 15: Session 1908   connecting devices to the  IBM IoT Cloud

The parts of each Recipe

• Ingredients

– The hardware that you need

• Preparation

– Unpacking the device, installing the OS if necessary, connecting it to your Computer, etc.

• Connecting

– Installing the QuickStart software and starting it up

• Visualization

– Type in your device’s MAC address and see the results

Page 16: Session 1908   connecting devices to the  IBM IoT Cloud

ARM mbed

Page 17: Session 1908   connecting devices to the  IBM IoT Cloud

New - ARM mbed starter kit for IBM IoT Cloud

https://mbed.org/blog/entry/IBM-teams-up-with-mbed-for-IoT-kit/

Page 18: Session 1908   connecting devices to the  IBM IoT Cloud

Visualizing the results

http://quickstart.internetofthings.ibmcloud.com/?deviceId=aabbccddeeffgghh

Page 19: Session 1908   connecting devices to the  IBM IoT Cloud

Chart View

Page 20: Session 1908   connecting devices to the  IBM IoT Cloud

Raspberry Pi

Page 21: Session 1908   connecting devices to the  IBM IoT Cloud

Node-Red running in the device

This shows the Sensor Tag device application logic implemented in Node-Red

Page 22: Session 1908   connecting devices to the  IBM IoT Cloud

Quickstart - how is it implemented?

MQTT Server infrastructure(based on IBM MessageSight)

Bluemixapplications

Softlayer cloud

MQTT MQTT

Embedded

device appC, C++ or

JavaScript

Visualization

app – HTML5

Page 23: Session 1908   connecting devices to the  IBM IoT Cloud

A lightweight publish/subscribe protocol with predictable bi-directional message delivery

MQTT - Open Connectivity for Mobile, M2M and IoT

Lossy or

Constrained

Network

Lossy or

Constrained

Network Monitoring & Analytics

ServerCommands or Data Visualisation

High volumes of data/eventsIT Systems

In the era of a Smarter Planet, open source and standards are essential

1999 Invented by Dr. Andy Stanford-Clark (IBM), Arlen Nipper (now Cirrus Link Solutions)

2011 - Eclipse PAHO MQTT open source project

2004 MQTT.org open community

2013 – MQTT Technical Committee formed

Cimetrics, Cisco, Eclipse, dc-Square,

Eurotech, IBM, INETCO Landis & Gyr,

LSI, Kaazing, M2Mi, Red Hat,

Solace, Telit Comms, Software AG,

TIBCO, WSO2

Evolution of an open technology

Page 24: Session 1908   connecting devices to the  IBM IoT Cloud

A producer publishes a message (publication) on a topic (subject)A consumer subscribes (makes a subscription) for messages on a topic (subject)

A message server matches publications to subscriptions

If none of them match the message is discarded

If one or more matches the message is delivered to each matching consumer

Publish / Subscribe has three important characteristics:

1. It decouples message senders and receivers, allowing for more flexible applications2. It can take a single message and distribute it to many consumers

3. This collection of consumers can change over time, and vary based on the nature of the message.

Publish / Subscribe Messaging (One to Many)

Page 25: Session 1908   connecting devices to the  IBM IoT Cloud

• The HTTP standard revolutionized how we consume data

‒ A single simple model: Send a request, read the response

‒ Available via any tablet, laptop, phone, PC etc.

‒ Good for requesting data from a known source

• MQTT brings features specifically designed for mobile or M2M use…

MQTT and HTTP

HTTP MQTT

Style/Paradigm Synchronous, request/response

Asynchronous, event-driven

Design Point Web browsers M2M / IoT

Message size Rich headers 2 bytes in minimum header

Reliability over fragile networks

Need to implement by custom code on top of HTTP

Built-in

Push client->server Yes Yes

Push server->client Polling has to used on top of HTTP

Efficient, scalable push is built into the protocol

Ubiquity Widely available Growing number of OSS and commercial implementations

Standards IETF OASIS

Data distribution 1-to-1 only Supports 1-to-none, 1-to-1, 1-to-n, n-to-1

Page 26: Session 1908   connecting devices to the  IBM IoT Cloud

MQTT Clients and APIs

Client libraries provide some or all of the following:

• Functions to build and parse the MQTT protocol control packets

• Threads to handle receipt of incoming control packets

• QoS 1 and QoS 2 delivery using a local persistence store

• KeepAlive handling

• Simple API for developers to use

� Open Source clients available in Eclipse Paho project

• C, C++, Java, JavaScript, Lua, Python and Go

� Clients for other languages are available, see mqtt.org/software

• E.g. Delphi, Erlang, .Net, Objective-C, PERL, PHP, Ruby

• Not all of the client libraries listed on mqtt.org are current. Some are at an early or

experimental stage of development, whilst others are stable and mature.

You can develop an MQTT client application by programming directly to the MQTT

protocol specification, however it is more convenient to use a prebuilt client

Page 27: Session 1908   connecting devices to the  IBM IoT Cloud

Eclipse Paho clients

• C / C++

– MQTT C Client for Posix and Windows

– MQTT C++ Client for Posix and Windows

– Embedded MQTT C Client

• Java

– J2SE client

– J2ME client

– Android service

• Others

– JavaScript (for browser and hybrid applications)

– Lua

– Python

– Go

Page 28: Session 1908   connecting devices to the  IBM IoT Cloud

Paho C Client libraries

• Linux (Posix) or Windows– Full featured clients providing an MQTT api with QoS1, QoS2 and keepAlive

handling

– Synchronous client (fully synchronous mode)• Connect, Disconnect, Publish, Subscribe and Unsubscribe calls block until they

receive a response from the server

• Applications use mqtt_receive() to read inbound messages

• Client library runs entirely on the calling application’s thread

– Synchronous client (asynchronous mode)• Selected by registering a messageReceived, messageDelivered or connectionLost

callback.

• Library starts a separate thread to handle these callbacks

– Asynchronous (use MqttAsynch )• All API calls are processed asynchronously and invoke a callback when complete

• Embedded Client– Limited to the construction and parsing of MQTT control packets

– Client runs entirely on the calling application’s thread

– Intended for embedded devices that don’t run Linux (e.g. ARM mbed)

Page 29: Session 1908   connecting devices to the  IBM IoT Cloud

Programming your own device to use Quickstart

You must• Use MQTT 3.1, or MQTT 3.1.1 (3.1.1 is preferable)• Connect to messaging.quickstart.iot.ibmcloud.com, port 1883• Supply a client-id of the form tenant-id:device-id, where:

•tenant-id = “quickstart”•device-id = a 12 hexadecimal mac address in lower case, without delimiting : (colon) characters. For example, a36d7c91bf9e.

• Publish to “iot-1/d/device-id/evt/messagetype/json”• Publish at QoS=0 only

You need to know that...• The retained flag will not be honoured• Subscribing to receive messages isn’t supported.• The messagetype portion of the topic drives the visualization…

Page 30: Session 1908   connecting devices to the  IBM IoT Cloud

Programming your own device

The UI has predefined visualizations for known messagetypes, but you can supply

your own messagetype. The UI delivers a generic visualization for messagetypes

that it doesn’t recognize.

The messagetypes known to the UI include:• rpi-quickstart• mbed-quickstart

• titag-quickstart

The message payload must be in JSON and conform to the following format. It must not exceed 4096 bytes (that’s the QuickStart limit):

{ "d": { "name1": "stringvalue", "name2": intvalue, ... } }

Here's an example:

{ "d": { "myName": "Stuart's Pi", "cputemp": 46, "sine": -10, "cpuload", 1.45 } }

"myName" is optional – but if you supply it, it’s displayed as a title on the visualization page.

Page 31: Session 1908   connecting devices to the  IBM IoT Cloud

Security Considerations

As we have already noted, the IBM IoT Cloud Quickstart service is free and does

not provide any security features.

When designing an IoT application for production use, you need to consider its security implications, including:

1. Do I need to secure the data coming from the devices? This could mean

• Authenticating the devices when they connect, to protect against an

attacker who attempts to impersonate them• Using TLS to protect the data as it travels from the device, to prevent the

data from being modified in transit

• Protecting the devices and the software that runs on them from being

subverted by an attacker.2. Do I need to restrict access to the data itself, for privacy or other reasons?

• Use TLS to encrypt the data as it travels from the device

• Authenticate any applications that try to access the device data

3. Do I need to protect my application against Denial of Service attacks launched

against it by third parties?

Page 32: Session 1908   connecting devices to the  IBM IoT Cloud

Internet of ThingsRapidly growing space, across nearly every industry

Partner ecosystem plays a vital part

IoT Cloud QuickstartConnect devices, collect, route, and visualize data

Build internet of things applications to analyze data

Customize and add further devices

MQTT Messaging optimized for mobile, smart sensors and telemetry devices

Simple APIs for Java, JavaScript and other languages

Summary

intelligentinterconnectedinstrumented

Page 33: Session 1908   connecting devices to the  IBM IoT Cloud

Useful Links

� IBM IoT Cloud Quickstart− http://internetofthings.ibmcloud.com

� IBM IoT Cloud Quickstart via developerWorks

− https://www.ibmdw.net/iot

� Quickstart recipes on developerWorks

− https://www.ibmdw.net/iot/recipes

� Quickstart code on GitHub

− https://github.com/ibm-messaging

� MQTT information

− http://mqtt.org

� MQTT 3.1 Specification

• http://www.ibm.com/developerworks/webservices/library/ws-mqtt/index.html

Page 34: Session 1908   connecting devices to the  IBM IoT Cloud

Questions?

Page 35: Session 1908   connecting devices to the  IBM IoT Cloud

We Value Your Feedback

Don’t forget to submit your Impact session and speaker feedback! Your feedback is very important to us – we use it to

continually improve the conference.

Use the Conference Mobile App or the online Agenda Builder to

quickly submit your survey

• Navigate to “Surveys” to see a view of surveys for sessions you’ve attended

35

Page 36: Session 1908   connecting devices to the  IBM IoT Cloud

Thank You

Page 37: Session 1908   connecting devices to the  IBM IoT Cloud

Legal Disclaimer

• © IBM Corporation 2014. All Rights Reserved.

• The information contained in this publication is provided for informational purposes only. While efforts were made to verify the completeness and accuracy of the information contained in this publication, it is provided AS IS without warranty of any kind, express or implied. In addition, this information is based on IBM’s current product plans and strategy, which are subject to change by IBM without notice. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this publication or any other materials. Nothing contained in this publication is intended to, nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and

conditions of the applicable license agreement governing the use of IBM software.• References in this presentation to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates. Product release dates and/or

capabilities referenced in this presentation may change at any time at IBM’s sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any way. Nothing contained in these materials is intended to, nor shall have the effect of, stating or implying that any activities undertaken by youwill result in any specific sales, revenue growth or other results.

• If the text contains performance statistics or references to benchmarks, insert the following language; otherwise delete:Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput or performance that any user will experience will vary depending upon many factors, including considerations such as the amount of multiprogramming in the user's job stream, the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve results similar to those stated here.

• If the text includes any customer examples, please confirm we have prior written approval from such customer and insert the following language; otherwise delete:

All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual environmental costs and performance characteristics may vary by customer.

• Please review text for proper trademark attribution of IBM products. At first use, each product name must be the full name and include appropriate trademark symbols (e.g., IBM Lotus® Sametime® Unyte™). Subsequent references can drop “IBM” but should include the proper branding (e.g., Lotus Sametime Gateway, or WebSphere Application Server). Please refer to http://www.ibm.com/legal/copytrade.shtml for guidance on which trademarks require the ® or ™ symbol. Do not use abbreviations for IBM product names in your

presentation. All product names must be used as adjectives rather than nouns. Please list all of the trademarks that you use in your presentation as follows; delete any not included in your presentation. IBM, the IBM logo, Lotus, Lotus Notes, Notes, Domino, Quickr, Sametime, WebSphere, UC2, PartnerWorld and Lotusphere are trademarks of International Business Machines Corporation in the United States, other countries, or both. Unyte is a trademark of WebDialogs, Inc., in the United States, other countries, or both.

• If you reference Adobe® in the text, please mark the first use and include the following; otherwise delete:Adobe, the Adobe logo, PostScript, and the PostScript logo are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States, and/or other countries.

• If you reference Java™ in the text, please mark the first use and include the following; otherwise delete:Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.

• If you reference Microsoft® and/or Windows® in the text, please mark the first use and include the following, as applicable; otherwise delete:Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other countries, or both.

• If you reference Intel® and/or any of the following Intel products in the text, please mark the first use and include those that you use as follows; otherwise delete:Intel, Intel Centrino, Celeron, Intel Xeon, Intel SpeedStep, Itanium, and Pentium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States andother countries.

• If you reference UNIX® in the text, please mark the first use and include the following; otherwise delete:UNIX is a registered trademark of The Open Group in the United States and other countries.

• If you reference Linux® in your presentation, please mark the first use and include the following; otherwise delete:Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both. Other company, product, or service names may be trademarks or service marks of others.

• If the text/graphics include screenshots, no actual IBM employee names may be used (even your own), if your screenshots include fictitious company names (e.g., Renovations, Zeta Bank, Acme) please update and insert the following; otherwise delete: All references to [insert fictitious company name] refer to a fictitious company and are used for illustration

purposes only.