Making things that works with us

10,890 views
9,572 views

Published on

In the ”Internet of Things” (IoT) vision the physical world blends with virtual one, while machine-to-machine interaction improve our daily life. Clearly, how these virtual objects are exposed to us is critical, so that their user interface must be designed to support the easiness of usage that is driven by the users’ needs, which is different from what machines requires. These two requirements must be solved, and an integrated solution should emerge, if we want to bring the IoT to the 50 billions network that is predicted to became in the next years.
In this talk, you will see how these requirements cannot be met by the same communication protocol, as the user interfaces dictates a way of communication that is no suitable for the "machines". We will analyze what are the state-of-art protocols for both machines and users, and finally we will propose a solution to solve this problem.

Published in: Technology, Sports

Making things that works with us

  1. @matteocollina matteocollina.com Making things that work with us!Better Software - Florence 2012/09/26
  2. Smartphones arechanging the world
  3. How many people will owna smartphone by 2014 1.000.000.000
  4. Did you seeit coming http://www.flickr.com/photos/12738000@N00/360231193/
  5. Stevedid. http://www.flickr.com/photos/noppyfoto/6216399465/
  6. Thanks. http://www.flickr.com/photos/noppyfoto/6216399465/
  7. They didn’t! ...
  8. Whats next (hint: its a big number) 50.000.000.000
  9. 50.000.000.0001.000.000.000
  10. "Things"
  11. http://www.flickr.com/photos/adactio/2337914481 50.000.000.000 interconnected "things" by 2020
  12. Social Web OfThings Videohttp://www.youtube.com/watch?v=i5AuzQXBsG4
  13. Lets experiment
  14. http://www.flickr.com/photos/jurvetson/2798315677
  15. Goal: Monitor my house temperature
  16. I want tochat withmy house
  17. >: hi househi matteo>: whats thetemperature?36
  18. >: 4 8 15 16 23 42 If you don’t understand this, you are not a geek!
  19. Enter Hubot Hubot © 2012 GitHub Inc. All rights
  20. A programmable robotthat is controlled throughchat Hubot © 2012 GitHub Inc. All rights
  21. We can supercharge our house with hubot
  22. We can supercharge our house with hubot Howmodule.exports = (robot) -> robot.respond /what’s the temperature?/i, (msg) -> msg.http("http://mchouse.it/temperature") .header("Accept", "application/json") .get() (err, res, body) -> msg.send JSON.parse(body)
  23. In order to ask our tempto hubot, we need to: 1. sense the temp 2. get the temp on the web 3. build a web API
  24. From Hubot, I want to dothe equivalent of: >: curl http://mchouse.it/temp What about JSON
  25. We are building an API In Italy, “API” means “bees” http://www.flickr.com/photos/theseanster93/4056815767
  26. What do we need tosense my housetemperature
  27. Arduino is an opensource microcontroller,that you can use tohack things http://www.flickr.com/photos/mattrichardson/5029708468/
  28. We add a sensor to an Arduino TMP 36 TMP 36
  29. We add an ethernet shield to connect to the Internet TMP 36 http://www.flickr.com/photos/snootlab/6052465980/
  30. What protocol do we useto push our temperature to our API? HTTP POST
  31. HTTP is slow and safe http://www.flickr.com/photos/clearlyambiguous/48185613/
  32. We need afast, binaryprotocol http://www.flickr.com/photos/grrphoto/305649629
  33. likes binary
  34. What if weneed tointerconnectour things?
  35. To build asocial web ofthings weneed to reactto events.
  36. We need apublish/subscribepattern.
  37. HTTP
  38. Devices need:• binary protocol• publish/subscribe
  39. Binary vs RESTM2M protocols are “Things” shouldad-hoc, and interact with ourresearchers and lives, and all thebusinesses focus on technology shouldlow level problems. be built to make them easy to use.
  40. • binary protocol • devices exposed to the web• publish/subscribe • REST architecture• topics as the naming system • URIs as the naming system• royalty free • syndication• open source implementations
  41. MQTT is thestate of artprotocol for theInternet ofThings
  42. Mosquitto Really SmallMessage Broker
  43. • the base element of the protocol is a topic• devices and other systems can publish or subscribe to topics
  44. How to use on
  45. Step 1: downloadPubSubClient, the library for
  46. on Arduino: SetupString server = String("qest.me");PubSubClient client = PubSubClient(server, 1883, callback);
  47. on Arduino: publishingif (!client.connected()) { client.connect("arduino");}client.loop();char s[10];itoa(get_temperature(), s, 10);client.publish("temp", s);
  48. on Arduino: publishingif (!client.connected()) { client.connect("arduino");}client.loop(); This is called a topic, and it is where we publishchars[10]; MQTT. things onitoa(get_temperature(), s, 10);client.publish("temp", s);
  49. speaks, Hubot speak HTTP
  50. speaksCommunication, Hubot speak HTTP
  51. DiscoverQESTqest.me
  52. QEST HTTP Clients MQTT Clients• MQTT broker• REST interface REST Server MQTT Server• HTTP semantics QEST• no QoS Data Layer• built in node.js• crafted by me Redis
  53. QEST : MQTT to REST• retains every message received client.publish("temp", "30");• every topic has its own URI: /topics/<NAME> curl -H "Accept: txt" http://qest.me/topics/temp
  54. QEST : REST to MQTT• transform every HTTP PUT received to a MQTT message curl -X PUT -d { "housetemp": 42 } -H "Content-Type: application/json" http://qest.me/topics/temp• devices can listen directly to MQTT topics void callback(char* topic, byte* payload, int length) { ... } PubSubClient(server, 1883, callback); client.subscribe("temp");
  55. state-of-art QEST-based approach to IoT apps solution to IoT apps Web App Web App Bridge QEST IoT Device 3 2 1 0 9 8 7 6 5 4 3 2 1 0 GND SCL AREF SDA 1 1 1 1 DIGITAL RX TX PWM PWM PWM PWM PWM PWM L TX Arduino UNO ON Broker RX 1 ICSP www.arduino.cc RESET IOREF POWER ANALOG IN 3V3 5V Gnd Vin 0 1 2 3 4 5 Device 3 2 1 0 9 8 7 6 5 4 3 2 1 0 GND SCLAREF SDA 1 1 1 1 DIGITAL RX TX PWM PWM PWM PWM PWM PWM L TX RX Arduino UNO ON 1 ICSP www.arduino.cc RESET IOREF POWER ANALOG IN 3V3 5V Gnd Vin 0 1 2 3 4 5
  56. QEST : Scalability HTTP/MQTT Clients Load Balancer REST Server MQTT Server REST Server MQTT Server QEST Data Layer ... QEST Data Layer Redis
  57. Do you likeSpaghettiCode?JavaScript Apps areoften a messWe mix logic withpresentation withpersistance.Is QEST different? http://www.flickr.com/photos/mpirotta/4944504834
  58. QEST:Built BDD-style, withCucumber-js and mochaContinuous Integrationbased on Travis-CIWritten in CoffeeScriptPatches are welcome! http://www.flickr.com/photos/mpirotta/4944504834
  59. Let’s ask something to my house! http://www.flickr.com/photos/oneaustin/1261907803
  60. Hubot Integrationmodule.exports = (robot) -> robot.respond /qest check ([a-z0-9A-Z]+)/i, (msg) -> topic = msg.match[1] if topic? msg.http("http://qest.me/topics/#{topic}") .header("Accept", "application/json") .get() (err, res, body) -> msg.send JSON.parse(body) else msg.send "No topic specified" Hubot © 2012 GitHub Inc. All rights
  61. Security Issues• What devices can a user monitor?• What devices can listen to the state of other devices?• Who can access the devices state?• Is the communication secure?
  62. We need tointerconnect UsersSocial profiles tothe Devices!
  63. We need OAuth for Devices! I’m working on it!!
  64. tryQESTqest.me
  65. TL;DR• The Internet of Things will be big• Devices need binary and pub/sub protocols• Devs need HTTP API• QEST does both
  66. Matteo Collina Software Engineer Ph.D. Student@matteocollina matteocollina.com
  67. www.mavigex.com www.wemobi.it
  68. Credits• Font Awesome for the Icons.• Flickr for LOTS of CC images :).• Balsamiq Mockup for the iPhone Mockup
  69. Thank You!
  70. Any Questions? http://www.flickr.com/photos/alexindigo/1606826416

×