http://500px.com/photo/20389019
We #code
@matteocollina
http://500px.com/photo/32597639
We are no Jedi
http://500px.com/photo/20388963
We #code
apps
Did you see
it coming
http://www.flickr.com/photos/12738000@N00/360231193/
Thanks.
http://www.flickr.com/photos/noppyfoto/6216399465/
They didn’t!
...
7:11 PMiPad
How do we #code an App?
7:11 PMiPad
We #code a response to
some kind of user action
Pop-up Dialog
OK
This message come
from the server!
Cancel
Web ServerTap
We #code a remote
web server
Web and Mobile
apps are based on
HTTP
REST
REpresentational
State Tranfer = REST
What's next
(hint: it's a big number)
X0.000.000.000
X0.000.000.000
Number of connected
“things” by 2020:
X0.000.000.000
Number of connected
“things” by 2020:
1.000.000.000
Number of smartphones
users in 2012
10X
http://500px.com/photo/4766384
In the future, this chain
will be connected to
the Internet
http://500px.com/photo/20591939
Things are
different
http://500px.com/photo/26425201
We want to #code
the real world.
Arduino is an open
source microcontroller
that you can use to hack
things
http://www.flickr.com/photos/mattrichardson/5029708468/
http://www.flickr.com/photos/jurvetson/2798315677
Control my
house from
GTalk or Twitter
Goal:
I want to
chat with
my house
>: hi house
hi matteo
>: what's the
temperature?
36
>: turn
airconditioning on
consider it done!
>: 4 8 15 16 23 42
Hubot © 2012 GitHub Inc. All rights
Enter Hubot
Hubot © 2012 GitHub Inc. All rights
A programmable robot
that can receive commands
through chat
We can supercharge my house with hubot
We can supercharge my house with hubot
My house needs to:
1. publish sensed data to the web
2. receive commands from the web
Our control
room is in the
Cloud 
How can we
send and receive
the updates
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
The world
is event
based,
too!
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
Pidgeons are not a
communication
protocol
See RFC1149 http://500px.com/photo/32895129
http://www.flickr.com/photos/clearlyambiguous/48185613/
HTTP is slow
and safe
We need a fast, binary
protocol
http://www.flickr.com/photos/grrphoto/305649629
• Binary
• Publish/Subscribe
• Free
• Standard (in a few months)
• Offline/Disconnected mode
• 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/
How to use
on
Download PubSubClient,
the library for
on Arduino: Setup
String server = String("qest.me");
PubSubClient client =
PubSubClient(server,
1883,
callback);
if (!client.connected()) {
client.connect("arduino");
}
client.loop();
char s[10];
itoa(get_temperature(), s, 10);
client.publish("temp", s);
on Arduino: publishing
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
Your “thing” speaks MQTT.
Your App speaks HTTP.
http://500px.com/photo/35382862
Your App cannot serve
two masters.
http://500px.com/photo/35382862
http://500px.com/photo/31083423
We need a Bridge between
the Web and the
“Things” world
(bridge in Italian)
http://eclipse.org/proposals/technology.ponte/
http://github.com/mcollina/ponte
A M2M/IoT bridge for REST developers
• MQTT broker
• REST interface
• can be deployed on
top of a lot pub/sub
systems and
databases
• built in node.js
ponte
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
http://www.flickr.com/photos/oneaustin/1261907803
DEMO!
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
Matteo Collina (matteo.collina2@unibo.it)
Thank You!
@matteocollina
http://www.flickr.com/photos/axel-d/479627824/

Making things that work with us - Distill