making things that work with us - distill

52
http://500px.com/photo/20389019 We #code @matteocollina

Upload: matteo-collina

Post on 20-Aug-2015

11.305 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Making things that work with us - Distill

http://500px.com/photo/20389019

We #code

@matteocollina

Page 2: Making things that work with us - Distill

http://500px.com/photo/32597639

We are no Jedi

Page 3: Making things that work with us - Distill

http://500px.com/photo/20388963

We #code apps

Page 4: Making things that work with us - Distill

Did you see it coming

http://www.flickr.com/photos/12738000@N00/360231193/

Page 5: Making things that work with us - Distill

Thanks.

http://www.flickr.com/photos/noppyfoto/6216399465/

Page 6: Making things that work with us - Distill

They didn’t!

...

Page 7: Making things that work with us - Distill

7:11 PMiPad

How do we #code an App?

Page 8: Making things that work with us - Distill

7:11 PMiPad

We #code a response to some kind of user action

Page 9: Making things that work with us - Distill

Pop-up Dialog

OK

This message comefrom the server!

Cancel

Web ServerTap

We #code a remote web server

Page 10: Making things that work with us - Distill

Web and Mobile apps are based on

HTTP

REST

Page 11: Making things that work with us - Distill

REpresentationalState Tranfer = REST

Page 12: Making things that work with us - Distill

What's next(hint: it's a big number)

X0.000.000.000

Page 13: Making things that work with us - Distill

X0.000.000.000

Number of connected“things” by 2020:

Page 14: Making things that work with us - Distill

X0.000.000.000

Number of connected“things” by 2020:

1.000.000.000

Number of smartphones users in 2012

Page 15: Making things that work with us - Distill

10X

Page 16: Making things that work with us - Distill

http://500px.com/photo/4766384

In the future, this chain will be connected to the Internet

Page 17: Making things that work with us - Distill

http://500px.com/photo/20591939

Things are different

Page 18: Making things that work with us - Distill

http://500px.com/photo/26425201

We want to #code the real world.

Page 19: Making things that work with us - Distill

Arduino is an open source microcontroller that you can use to hack things

http://www.flickr.com/photos/mattrichardson/5029708468/

Page 20: Making things that work with us - Distill

http://www.flickr.com/photos/jurvetson/2798315677

Page 21: Making things that work with us - Distill

Control my house from GTalk or Twitter

Goal:

Page 22: Making things that work with us - Distill

I want to chat with my house

Page 23: Making things that work with us - Distill

>: hi househi matteo

>: what's the temperature?36

>: turn airconditioning onconsider it done!

Page 24: Making things that work with us - Distill

>: 4 8 15 16 23 42

Page 25: Making things that work with us - Distill

Hubot © 2012 GitHub Inc. All rights

Enter Hubot

Page 26: Making things that work with us - Distill

Hubot © 2012 GitHub Inc. All rights

A programmable robotthat can receive commands through chat

Page 27: Making things that work with us - Distill

We can supercharge my house with hubot

Page 28: Making things that work with us - Distill

We can supercharge my house with hubot

My house needs to:

1. publish sensed data to the web

2. receive commands from the web

Page 29: Making things that work with us - Distill

Our controlroom is in the

Cloud How can we send and receive the updates

Page 30: Making things that work with us - Distill

In order to send commands to Things from the Web, we need to:

1. subscribe the Thing to some event

2. publish the new event

Page 31: Making things that work with us - Distill

The world is event

based, too!

Page 32: Making things that work with us - Distill

In order to publish live data, we need to:

1. sense it

2. send it in the cloud

3. build a web API to access it

Page 33: Making things that work with us - Distill

Pidgeons are not a communication protocol

See RFC1149http://500px.com/photo/32895129

Page 35: Making things that work with us - Distill

We need a fast, binary protocol

http://www.flickr.com/photos/grrphoto/305649629

Page 36: Making things that work with us - Distill
Page 37: Making things that work with us - Distill

• Binary

• Publish/Subscribe

• Free

• Standard (in a few months)

• Offline/Disconnected mode

Page 38: Making things that work with us - Distill

• 93x faster throughput

• 11.89x less battery to send

• 170.9x less battery to receive

• 1/2 as much power to keep connection open

• 8x less network overhead

MQTT vs HTTPS for Mobile Push Notifications

Source: http://mobilebit.wordpress.com/2013/05/03/rest-is-for-sleeping-mqtt-is-for-mobile/

Page 39: Making things that work with us - Distill

How to use

on

Page 40: Making things that work with us - Distill

Download PubSubClient, the library for

Page 41: Making things that work with us - Distill

on Arduino: Setup

String server = String("qest.me");

PubSubClient client = PubSubClient(server, 1883, callback);

Page 42: Making things that work with us - Distill

if (!client.connected()) { client.connect("arduino");}client.loop();

char s[10];itoa(get_temperature(), s, 10);client.publish("temp", s);

on Arduino: publishing

Page 43: Making things that work with us - Distill

if (!client.connected()) { client.connect("arduino");}client.loop();

char s[10];itoa(get_temperature(), s, 10);client.publish("temp", s);

This is called a topic, and it is where we publish

data on MQTT.

on Arduino: publishing

Page 44: Making things that work with us - Distill

Your “thing” speaks MQTT.Your App speaks HTTP.

http://500px.com/photo/35382862

Page 45: Making things that work with us - Distill

Your App cannot serve two masters.

http://500px.com/photo/35382862

Page 46: Making things that work with us - Distill

http://500px.com/photo/31083423

We need a Bridge between the Web and the

“Things” world

Page 48: Making things that work with us - Distill

• MQTT broker

• REST interface

• can be deployed on top of a lot pub/sub systems and databases

• built in node.js

ponte

Page 49: Making things that work with us - Distill

ponte’s pillars

• Node.js

• Ascoltatori, the pub/sub library for node backed for every broker out there! npm.im/ascoltatori

• Mosca, the multi-transport MQTT broker for node.js. npm.im/mosca

• MQTT.js, the MQTT library for node: npm.im/mqtt

Page 51: Making things that work with us - Distill

TL;DR• The Internet of Things

will be big

• Devices need binary formats and pub/sub protocols

• Apps are built on top of REST APIs

• Ponte does both

Page 52: Making things that work with us - Distill

Matteo Collina ([email protected])

Thank You!

@matteocollina

http://www.flickr.com/photos/axel-d/479627824/