Bluemix IOT 30 min to Nirvana Rio_v3.key

!
30mins to Nirvana!!
Concept to Operation using Services and a PaaS
!
Mark VanderWiele
Distinguished Engineer, IBM SWG Emerging Technologies
[email protected]; @MarkVanderwiele
#bluemix
1
© 2014 IBM Corporation
www.bluemix.net
Tweet @IBMBluemix with hashtag #qconrio
IBM will choose some of the best tweets about Bluemix!
!
!
Come play Code Rally in the IBM Bluemix Booth - Fastest time around the track wins!
!
Come to Ballroom B5 at 4:45pm Thursday 25th during the
coffee break to win
2
© 2014 IBM Corporation
www.bluemix.net
Enable your next billion dollar idea
It starts with an idea, developer, and a line of code.
Compose
3
Deploy
Monitor/Update
© 2014 IBM Corporation
Scale
www.bluemix.net
App development is about speed and choice
Developers’ expectations have evolved
Seconds
to
Deploy
Useful APIs
&
Community
Start
Small
&
Grow
Friction
Free
Continuous
Integration
Choice
of Tools
Failing
Fast
●
Mobile
Ready
Any
Language
●
●
Focus
on Code
●
●
●
4
© 2014 IBM Corporation
Select
language
services tools
Create
environment
Search
Code/build/test
Git
Push/update/push
www.bluemix.net
Rapid Design and Prototyping Experience
5
© 2014 IBM Corporation
www.bluemix.net
Why PaaS? What is IBM’s Bluemix, exactly?
Platform as a Service (PaaS), Allows you to focus on design and
development without worrying about the underlying infrastructure
!
BlueMix is an open-standards, open source cloud-based Platform
as a Service (PaaS) for rapidly building, managing, and running cloud
based applications and services of all types (web, mobile, big data,
new smart devices), while tapping a growing ecosystem of available
services and runtime frameworks.
!
Capabilities include, your choice of language, such as Java, Python,
Ruby, or Node, or community buildpacks, which lets developers
focus on building and running your apps and not worrying about
getting servers or installing software.
Compose
6
Deploy
Monitor/Update
www.bluemix.net
Scale
© 2013 IBM Corporation
Internet of Things (IoT)
Many Things
7
© 2014 IBM Corporation
www.bluemix.net
Business Opportunity
GSMA “Connected Life” forecast
“Connected Life” is:
everything that is
connected and
how they interact - cars,
mobile devices,
buildings, sensors and
people
8
$4.5T in 2020
Top Ten in 2020
Connected Car
Clinical Remote Monitoring
Assisted Living
Home and Building Security
Pay-As-You-Drive Car Insurance
New Business Models for Car Usage
Smart Meters
Traffic Management
Electric Vehicle Charging
Building Automation
Source:http://www.globaltelecomsbusiness.com/article/2985699/Connected-devices-will-be-worth-45t.html
© 2014 IBM Corporation
$600 billion
$350 billion
$270 billion
$250 billion
$245 billion
$225 billion
$105 billion
$100 billion
$75 billion
$40 billion
www.bluemix.net
Internet of Things
Developer Opportunity for Rapid Innovation
50B
Internet of Things
2020
41%
CAGR
12B
Medical Wearables
Wearable Wireless
Devices
2017
1. Instrument
2. Interconnect
Bluemix PaaS
Cloud
3. Intelligent
9
© 2014 IBM Corporation
www.bluemix.net
Imagine the Possibilities!!
“The innovation is up to you; we (PaaS) make it fun & easy”
Health Rater Monitor (Our idea)!
• Race and compare results with friends
around the world!
• Heart Rate, Speed, Location, Weather…!
• Real-time as well as historic views!
• Automated data capture!
• Analytics - Data abnormalities and fraud
detection!
!
Tomorrow's Apps"
• GIO fences, Live Weather Alerts, Home
Automation, Machine Learning, Fall
Detection…!
• Medical alerts and applications!
• Predictive analytics!
• Device location notification
10
© 2014 IBM Corporation
www.bluemix.net
So you want to build an IoT Application : )
●
!
●
!
●
!
●
!
●
!
●
!
●
How do I connect to my sensor?
How do I combine info from my phone?
How do I publish info to the cloud?
How do I subscribe to my sensor info in the cloud?
How do I combine data with other sources?
How do I easily store info into a database?
How do I provide APIs to access the data?
~Nirvana~"
Create an application !
that has a unique experience!
11
© 2014 IBM Corporation
www.bluemix.net
IoT - Heart Rate Monitor Demo
Bluemix PaaS
Cloud
Subscribers
Actions
(stored in DB)
MQTT
Message
Broker
Analytics/
Views apps
Notifications
Flows
IoT Device
Data Publish
Automation
Sensors
12
User Experience
© 2014 IBM Corporation
www.bluemix.net
IoT - Heart Rate Monitor Demo (continued)
IBM Cloud
IBM Bluemix
IBM IoT Cloud
MQTT (Publish)
Topic
Data
Topic Data
MQTT(Inside)
13
© 2014 IBM Corporation
MQTT(Subscribe)
www.bluemix.net
IoT - Heart Rate Monitor Demo (continued) !
Node-RED flow to receive the data and perform actions
Bluemix PaaS
Cloud
MQTT
Message
Broker
Subscribers
14
© 2014 IBM Corporation
Flows
www.bluemix.net
IoT - Heart Rate Monitor Application APIs - example
Application APIs
IBM Bluemix
(secure connection)
Trip Record Docs: http://hrtracker.mybluemix.net/api/trips
Completed Trip Record Docs: http://hrtracker.mybluemix.net/api/trips/completed
15
© 2014 IBM Corporation
www.bluemix.net
IoT - Heart Rate Monitor Demo (sample iOS code)
// Create MQTT connection
Messenger *messenger = [Messenger sharedMessenger];
NSArray *uuidBits = [uuid componentsSeparatedByString:@"-"];
self.deviceId = [[uuidBits objectAtIndex:4] lowercaseString];
!
if ([self.server isEqualToString:@"IoT"]) {
topic = [NSString stringWithFormat:@"iot-2/evt/tripDataPoint/fmt/
json", self.deviceId];
messenger.clientId = clientId;
[messenger
connectWithHost:@"gvzxo.messaging.internetofthings.ibmcloud.com" port:1883
clientId:clientId username:@"use-token-auth" password:@"@xxxwzXwRQTA7q0"];
} else if ([self.server isEqualToString:@"MessageSight"]) {
topic = [NSString stringWithFormat:@"iot-1/d/%@/evt/hrtracker/json",
self.deviceId];
messenger.clientId = clientId;
[messenger connectWithHost:@"xx.xx.71.163" port:1883
clientId:clientId];
}
// Publish the data
Messenger *messenger = [Messenger sharedMessenger];
NSString *messageData = [NSString stringWithFormat:@"{ \"d\":
{ \"userId
\":\"%@\", \"tripType\":\"%@\", \"tripName\": \"%@\", \"tripId\": \"%@\",
\"speed\": %.1f, \"longitude\":%.7f, \"latitude\":%.7f, \"elevation\":%d,
\"heartRate\":
%d, \"deviceId\":\"%@\", \"timestamp\": %@ } }",
self.name, self.tripType, self.tripName,
self.tripId, mph,
self.currentLocation.coordinate.longitude,
self.currentLocation.coordinate.latitude, elevationFeet, heartRate,
self.deviceId, timestamp];
!
!
[messenger publish:topic payload:messageData qos:0 retained:NO];
16
© 2014 IBM Corporation
www.bluemix.net
Nirvana! Create an app that has a unique experience
17
© 2014 IBM Corporation
www.bluemix.net
Data Analytics
18
© 2014 IBM Corporation
www.bluemix.net
Backend data analytics implementation - auto tweet if you cheat
19
© 2014 IBM Corporation
www.bluemix.net
Other Fun IoT Automation Stuff
The 'Thing': The Drone
Real-time events"
for a 'Thing'"
GEO detection "
of the 'Thing'"
Scenario: !
Launch a drone !
in real-time !
to take a picture!
of an activity !
(or a suspicious event)
Scenario: !
Use GEO location !
to detect when !
the drone is near
!
!
20
© 2014 IBM Corporation
www.bluemix.net
Other Fun IoT Automation Stuff (continued)
Home Automation
On my return:
•
Turn down my air
•
Turn on my hot tub
•
Turn on my outside lights if it is dark
•
Open my garage door
!
(With learning on time to achieve goal)
Hot tub on
Air adjusted
for your arrival
Door opened
21
© 2014 IBM Corporation
www.bluemix.net
Other Fun IoT Automation Stuff (continued)
Shark Tracking
!
Scenario: Katharine and Betsy are heading for Texas in search of great white sharks.
!
Notification to user of their range within a few miles of a large white shark based on
GEO detection.
22
© 2014 IBM Corporation
www.bluemix.net
Bluemix Free Trial
Sign up for a Free Trial:
www.bluemix.net
23
© 2014 IBM Corporation
www.bluemix.net
MQ Light
Designed for application developers writing apps that
need to scale!
• Exceptionally easy for developers to get started with!
• APIs that feel native in each language!
• Tooling that assists development
“MQ Light”
WebSphere MQ!
[Statement of Direction]
Develop Application node,
ruby, python, etc
Develop using MQ
Light
MQ Light for Bluemix
www.ibmdw.net/messaging/mq-light/
© 2014 IBM Corporation
Resources
Bluemix Demo Code !
!
https://github.com/CodenameBlueMix/!
IBM DeveloperWorks"
!
!
https://www.ibmdw.net/bluemix/ !
Videos "
!
https://www.youtube.com/user/IBMetinfo !
!
!
!
https://www.youtube.com/watch?v=_LBZagavmxY !
http://jamesthom.as/blog/2014/07/22/zero-downtime-deployments-using-bluemix/!
jstart Bluemix Page"
!
http://www-01.ibm.com/software/ebusiness/jstart/bluemix/!
!
Getting started !
!
https://hub.jazz.net/tutorials/jazzeditor!
!
Developing apps using Eclipse/JaazHub and Bluemix "
!
https://hub.jazz.net/tutorials/jazzrtc!
!
CloudFoundry"
http://cloudfoundry.org/index.html !
http://www.gopivotal.com/platform-as-a-service/pivotal-cf !
https://github.com/cloudfoundry
25
© 2014 IBM Corporation
www.bluemix.net
Bluemix IOT - Connect a Raspberry Pi
0. Sign up for Bluemix www.bluemix.net
1. Download Raspbian http://www.raspberrypi.org/downloads/
2. image sd card
3. Install IOT SW on Pi
https://developer.ibm.com/iot/recipes/raspberry-pi/
Get the deb installer pi@raspberrypi ~ $ curl -LO https://github.com/ibm-messaging/iotraspberrypi/releases/download/1.0.0/iot1.0.0_armhf.deb"
Install the deb
pi@raspberrypi ~ $ sudo dpkg -i iot1.0.0_armhf.deb
4. Register the device on IOT Cloud https://internetofthings.ibmcloud.com
5. Update config file on Pi device using the credentials from the IOT cloud registration.
sudo service iot stop sudo nano /etc/iotsample-raspberrypi/device.cfg #Sample
Device configuration file… org = yourOrganizationCode type = iotsample-raspberrypi
id =b827eba84426 auth-method=token auth-token = yourAuthToken #End of
Configuration file. sudo service iot start
6. Go into blue mix create a IOT service and use the credentials from the IOT cloud
registration. Bind the IOT service to your app www.bluemix.net
7.You can view your devices and published info on the IBM IOT cloud
https://internetofthings.ibmcloud.com
26
© 2014 IBM Corporation
www.bluemix.net
Bluemix IOT device managagement
27
© 2014 IBM Corporation
www.bluemix.net