iot 1906 - approaches for building applications with the ibm iot cloud
TRANSCRIPT
© 2014 IBM Corporation
IOT-1906:Approaches for Building Applications with the IoT Cloud
Gari Singh – IBMPeter Niblett - IBM
Agenda
The Internet of Things
The IBM IoT Cloud and the IoT Cloud Quickstart
How is Quickstart implemented?
Building Applications
Demonstration
1
The Internet of Things is the next Internet Frontier
Source:http://www.digitalcommunities.com/articles/FutureStructure-The-New-Framework-for-Communities.html
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
Technology shift: 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
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”
IBM Internet of Things Cloud
Connect
Collect
Visualize
Assemble
PartnersCustomers
Developers
Employees
More Things
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
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
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
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
Sampling of IBM Products used in On Premise IoT Solutions
11
Collection of data for all sensors
Data from other kinds of
sensors
Consumer / Business
Sensors in the home
Informix TimeSeries Service
NoSQL, Relational, Timeseries & Spatial storage & analytics
Informix Warehouse Accelerator
SPSS/Cognos
MessageSight / MQTT
SoftLayer / BlueMix
BigInsights
Gateways for data consolidation
Infosphere Streams
(no gateway)
In-memory analytics
Predictive analytics and dashboard
Cloud infrastructure
Hadoop
Publish / Subscribe
Real-time analytics
Methods For Building Applications With the IoT Cloud
Develop applications using MQTT client libraries and runtime of choice (Java, Node, WebSphere, etc) and deploy on premise
Use BlueMix runtime of choice with the Internet of Things service
Use the BlueMix Internet Of Things Boilerplate
12
Sample Application
Our sample application will do the following:
• Collect sensor reading from a device
• Detect when the temperature sensor exceed a given threshold
• Send an SMS to alert the owner
We will build the same application in three way:
• Local NodeJS application communicating with the IoT Service
• BlueMix NodeJS application bound to the IoT Service
• BlueMix Internet of Things Boilerplate which includes Node-RED bound to the IoT Service
For our device, we will use a TI SensorTag with a BeagleBoneBlack gateway
For SMS, we will use Twilio
13
BeagleBone with Texas Instruments SensorTag
14
TI SensorTag Quickstart Visualization
15
Internet Of Things Quickstart Message Format
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.
Building Our App Locally
NodeJS installed locally
Use MQTT and Twilio libraries
• var mqtt = require('mqtt');
• var twilio = require('twilio');
Connect MQTT client to IoT messaging service and subscribe
• client = mqtt.createClient(mqtt_port,mqtt_host, { "clientId": clientId } );
• client.subscribe(topicString);
Implement “on message” handler client.on('message',
function (topic, message)
{
console.log(message);
var payload = JSON.parse(message);
console.log(payload.d.objectTemp);
//check to see if the objectTemp is above 50 degrees
if (payload.d.objectTemp > 50)
{
//send SMS alert
sendSMS(twilioSid,twilioToken,'+1 240 506-8077','It is getting hot in here. Temp is ' + payload.d.objectTemp);
}
}
);
17
Building our App in Bluemix
18
NodeJS Bound to IoT and Twilio Services
19
20
{
"user-provided": [{
"name": "Twilio","label": "user-provided","credentials": {
"url": "https://api.twilio.com","accountSID": "ACc42bfaf72c6d782aff6e98b867e24742","authToken": "6b999a837771afafd556c7ca2c2ecc1f"
}}
],
"InternetOfThings-null": [{
"name": "iot-quickstart:InternetOfThings","label": "InternetOfThings-null","plan": "EarlyAccess","credentials": {
"topic_template": "iot-1/d/${device_id}/evt/${message_type}/json","endpoint_host": "messaging.quickstart.internetofthings.ibmcloud.com","endpoint_port": 1883,"clientid_template": "quickstart:${device_id}","tenant_prefix": "quickstart","endpoint_uri": "tcp://messaging.quickstart.internetofthings.ibmcloud.com:1883"
}}
]}
VCAP_SERVICES
Modify Our App To Use VCAP_SERVICES
21
//parse VCAP_SERVICES if running in Bluemix
if (process.env.VCAP_SERVICES)
{
var env = JSON.parse(process.env.VCAP_SERVICES);
//debugging
for (var svcName in env)
{
console.log(svcName);
}
console.log(env);
//find the IoT Service
if (env['InternetOfThings'])
{
iot_props = env['InternetOfThings'][0]['credentials'];
console.log(iot_props.endpoint_host);
console.log(iot_props.endpoint_port);
}
else
{
console.log('You must bind the InternetofThings service to this
application');
}
//find the Twilio service
env['user-provided'].forEach(function(service) {
if (service.name == 'Twilio') {
foundTwilio = true;
twilio_props = service.credentials;
}
});
if(!foundTwilio)
{
console.log('You must bind the Twilio service to this application');
}
}
//mqtt properties
var mqtt_host = (iot_props.endpoint_host ||
'messaging.quickstart.internetofthings.ibmcloud.com');
var mqtt_port = (iot_props.endpoint_port || 1883);
var topic_template = iot_props.topic_template || 'iot-1/d/${device_id}/evt/
${message_type}/json';
//Twilio properties
var twilioSid = (twilio_props.accountSID||'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
var twilioToken = (twilio_props.authToken||'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
Building our App Using the Internet of Things Boilerplate
22
Introducing Node-RED
23
Iot Service Node
24
Check Condition
25
Twilio Node
26
Internet of ThingsRapidly growing space, across nearly every industry
IoT Cloud QuickStart and BlueMixConnect devices, collect, route, and visualize dataBuild internet of things applications to analyze data
MQTT Messaging optimized for mobile, smart sensors and telemetry devicesSimple APIs for Java, JavaScript and other languages
Summary
intelligentinterconnectedinstrumented
Questions?
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
29
Thank You
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 you will 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 yourpresentation. 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 and other 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.