Making things that work with us - Distill

17,967 views
20,452 views

Published on

Published in: Technology
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
17,967
On SlideShare
0
From Embeds
0
Number of Embeds
14,795
Actions
Shares
0
Downloads
32
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

Making things that work with us - Distill

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

×