WoT Tutorial @ Cisco

4,406 views
4,329 views

Published on

These are the slides of a tutorial we gave on the Web of Things, smart cities and smart products at Cisco Switzerland in Rolles.

Published in: Technology

WoT Tutorial @ Cisco

  1. 1. Web of Things - Fast Prototyping PhysicalComputing ApplicationsCisco - 3. March 2011Vlad Trifa - ETH ZurichDominique Guinard - ETH Zurich
  2. 2. Electronic things are invading us... ‣ Powerful tiny computers ‣ Sensors & actuators ‣ Web connectivity ‣ Cheap ‣ UbiquitousWeb of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  3. 3. Translation for hackers:An infinite playground.YAAAY!
  4. 4. Megaco Modbus OGC SensorMLZorro III AMQP OPC-UA
  5. 5. Problem: How to combine heterogeneous mobile devices to create interactive ad-hoc applications? I don’t have a PhD in ComputerGiven that tons of different Science... ‣ Devices ‣ Capabilities Can I use this ‣ Functionalities too? ‣ Applications/middlewares pleeeeease? ‣ Networking protocols
  6. 6. We need an universal protocolthat is:simple, lightweight, loosely-coupled, scalable, flexibleand hopefully... standard
  7. 7. Sounds like the Web... Use Web standards to develop applications for networked devices. HTTP, HTML, XML, JSON, RSS, ATOM, MIME,... ‣ TCP/IP & Web granted, WiFi routers ubiquitous ‣ Development of simple Web apps: cheap & quick ‣ Integrate real-world data on the Web ‣ Get features of the Web for freeWeb of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  8. 8. Social Web Physical Web Real-time Web Semantic Web Programmable Web Web of ThingsWeb of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  9. 9. RESTful devices
  10. 10. The Web of Things in a nutshell Steps to create a basic Web of Things: 1. Connecting things to the Internet (IPv4/IPv6) 2. Embedded Web servers 3. Make devices part of the Web (using REST) ‣ Model their function as RESTful resourcesWeb of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  11. 11. RESTful SunSPOTs ‣ Properties and functions are RESTful resources ‣ Devices/services become Web resources ‣ URI-addressed ‣ Links between them (hateoas) ‣ Different representations (content negotiation) ‣ Uniform interface (HTTP verbs, status codes)Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  12. 12. Sunspots resources modeling Services on embedded devices are adapted for resource oriented architectures ‣ root: www.spotshost.com ‣ spots list: www.spotshost.com/sunspots ‣ spot #1: www.spotshost.com/sunspots/1 ‣ sensors list: www.spotshost.com/sunspots/1/sensors ‣ LEDs : www.spotshost.com/sunspots/1/actuators/leds ‣ LED #1 : www.spotshost.com/sunspots/1/actuators/leds/led1Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  13. 13. Representations ‣ XHTML ideal for browsing http://webofthings.com/spots ‣ JSON ideal for parsing (& lightweight for device) http://webofthings.com/spots.json ‣ XML ideal for business integration http://webofthings.com/spots.xmlWeb of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  14. 14. Uniform interface ‣ HTTP verbs ‣ GET: current temperature ‣ POST: add a timer ‣ PUT: turn a device on/off ‣ DELETE: delete a timer on a device ‣ HTTP headers ‣ Accept header for MIME types ‣ Status codes (200 ok, 401 unauthorized)Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  15. 15. Internet HTTP Proxy Router Gateway Indirect Pass-through Legacy HTTP Non Web-enabled Web-enabled DevicesWeb of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  16. 16. Gateway level integration: Energie Visible Web  /  Mobile   Interface GET http://10.1.1.5:8080/energymonitor/ploggs/* [{ Gateway   "deviceName": "ComputerAndScreen", (IP:10.1.1.5) "currentWatts": 50.52, "KWh": 5.835, "maxWattage": 100.56 }, "deviceName": "Fridge", "currentWatts": 86.28., Sensors "KWh": 4.421, (Ploggs) "maxWattage": 288.92 }, {...}] Electric   appliancesD. Guinard and V. Trifa. Towards the web of things: Web mashups for embedded devices. In 2nd Workshop on Mashups, Enterprise Mashups and Lightweight Composition on the Web (MEM 2009), Madrid, Spain, April 2009.Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  17. 17. Towards infrastructures /ethz (can run anywhere) virtual gateways ../building/CNB ../CNB/FloorD ../CNB/FloorE ../southWing/D48.1 (must be embodied) physical gateways ../floorD/southWing ../southWing/D48.2Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  18. 18. The era of physicalMashups
  19. 19. Real-world Web applications REST URL REST I AP Ja va P ST PH Sc RE rip t [hCp://www.pachube.com] [hCp://www.webothings.com/energievisible] [hCp://www.clickscript.ch]Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  20. 20. So, my fridge is online. But whataboutsharing andauthentication?
  21. 21. FAT - Friends and ThingsWeb of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  22. 22. Err, what about eventing &streaming ?The Web wasn’t quite made forthat...Yet we need this!
  23. 23. Need more than Push ‣ Web mainly request/response (HTTP) ‣ Need for eventing & streaming for many users ‣ Sensor data represented as sequence of messages ‣ Scalable pub/sub for devices as substrate ‣ Use the Web to build distributed event driven apps ‣ Parameterized subscriptions (channels/queries) ‣ Specify what sensors, devices, locations, etc... ‣ Many solutions (XMPP, etc....) ‣ None really integrate with the Web ‣ ATOM/ATOMpub is RESTful, but not pushWeb of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  24. 24. !"##$%&($) *$+,-./0$($)Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  25. 25. HTML5 Websockets •  !"##$%"&#()*+),-) ./012/) •  34/,)05),-)200+) 2,4+%4/%)6789):)2&;<) •  =".2;/*&>0+),-/0"?-) @4A42;/*&,) •  B+;/42*+?)+"C./)05) ./012/2)2"&&0/,)Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  26. 26. Ok, great. But how do I quicklyprototypeend-to-end applications?
  27. 27. Data streams ‣ Sensor data represented as Web streams ‣ Publish/subscribe paradigm ‣ Users can create and subscribe to streams ‣ Parameterized ‣ devices ‣ sensors ‣ filter data ‣ sampling frequency ‣ Using REST...Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  28. 28. Messaging implementation ‣ Messages transported in JSON ‣ Message broker as an external entity (“outsourced”) ‣ Swappable ‣ Scalable ‣ Currently use RabbitMQ ‣ Web integration with pubsubhubbub, RMS, etc. ‣ RESTful, Web-hook based pub/sub ‣ Supports CometD for Web push ‣ HTML5 WebSocketsWeb of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  29. 29. Wisspr - Web infrastructure for sensor streams processing user@machine:~$ curl -i -d "devices=http://vslab20:8083/sunspots/device_11 &data=temperature,light,tiltX&filter=temperature > 10" http://vslab20:8085/datastreams
  30. 30. Request POST example.org/datastreams/ HTTP/1.1 Content-Type: application/x-www-form-urlencoded devices=purpleSensor & data=temperature,light & frequency=2 & filter=light < 200 && temperature > 19Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  31. 31. Response HTTP/1.1 201 [...] Content-Location: http://example.com:8085/datastreams/bh_0 [...] Connection: close ‣ Then we just subscribe to it: curl -vd "hub.mode=subscribe&hub.callback=http://example.com: 8888/client_callback_handler&hub.topic=&hub.verify=sync" http://example.com:8085/datastreams/bh_0Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  32. 32. Ok, great. But is this useful forreal worldapplications?
  33. 33. | SENSEable City Lab crowd sourcing application design LIVE Singapore! real time data platform with tools real Singapore city and citizens enabling platform for application developmentEnabling platform for developing urban applications data collection/combination/distributionData collection/processing/distributionWeb of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  34. 34. real-time (raw) data streams LIVE Singapore! Web API this is youhttp://senseable.mit.edu/livesingapore
  35. 35. the epcis network in a nutshell
  36. 36. A typical Fosstrack deployment... $ ! % & " # ( ) !*+ !!,+-./.+011+23456.7486+ ~12 software components for a !",+-./.+@4586167A8+BCD+ typical RFID deployment!! 98:;:<+=3>?.5,+Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  37. 37. Case Study: WoT patterns for Global RFID Network ‣ Reduce the deployment complexity of standard RFID/ IoT software stacks. ‣ Allow easier (cheaper), more lightweight (mobile/ WSNs) RFID application development. ‣ Enable RFID mashability: ‣ Composition of RFID/WSNs/appliances and existing services on the Web ‣ Allow anyone to implement simple use-cases ‣ By applying Web and Web of Things blueprints!Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  38. 38. Fosstrack EPC cloudWeb of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  39. 39. Cloud computing ‣ Run your EPC Network server in 5 minutes! ‣ Cloud appliance: ‣ Full EPC Network backend ‣ Admin Web interface ‣ Fully configured Tomcat Instance ‣ Based on Amazon EC2: ‣ Public Cloud ‣ Utility ComputingWeb of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  40. 40. •  !"#$%&()*#+,-&,"-).,/, 0&&.)-1, •  !$#%*23*1,3$&.-22,$,.", /,0&&.)-1,45678, •  6)&&%9):&#),;#9, 3$.#)/-*#, •  <932#,=&#),7$.#)/-*#, ?E"FCCAAAC!"#$%"&CB3@)&F9-&#2C($)(C, :-)#?(&#F3$*B3$@C%*(C, •  :#9>?3$@&A*BC)D+,, GHHI%JG%GJKJLFGGFHMAHHHNC(+(&,C456,Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  41. 41. •  !"#$%&()&*+$,-.**( –  /01+,2023(4"(./5(,6,2+1( –  !$%7*%,8,9( •  :(,6,2+(-;(2()"22,<+"1( –  )"2+"%(+="$3=(>5?@4$%( .ABC(Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  42. 42. •  !"#$%&($)"*+,-"$ •  )&../*0$"+"*12$ 0*13./*04$ –  !"#/-5"0$ –  6/378./22,37$9$:/;"0$ –  )0*"1;,37$ •  :2,"30$<;/#,2"9!"#=$ 1..2,-1>/3$,3$?@$2,3"A$ •  B1"C$/3$D0;/.("*"9 E"*"F$13C$,0$EG&"*F$ %2&7,3$Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  43. 43. Mobile Reader Monitor •  !"#$%&"#( –  )%&*(+,(%-.#( –  /-*01-2(&*(,345(2#&.#2( 670&(88,9:;8<=(>07#(?2-@( &*A(@-B0>#(B2-C"#2( •  D#%E*->-FA( –  3-""12&G(<9H(H>-I.( –  19I"E#2(:(%&J1I2#( K#B&.&J1#2( –  LMN(>0*#"(-?(O&7&"%20J1( %-@J&PB>#(C01E(@-"1( @-B0>#(B2-C"#2"(Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  44. 44. RFID Mashup Editor •  !"#$%&()*+,(-.%*+ 6D+ /"-."0*01,+"2+13.(/&%+ 4*&#*++ ?DK+ 4567+&..%(/&8"0,+ Q&-*+ ?I*01,+ •  9:*+&+!&,;$.+ 6D+ GR,"0J+ 5&-*<"=+>+?0@(0*A+ ?DK+ E$,(0*,,++ P$*O+ –  B,*,+/&0+C$(%#+1;*(+"<0+ 5&%,*+ $,*+/&,*,+ ,1*.+ •  D"1"3.*+C&,*#+"0A+ –  E"<,*FC&,*#+GH&I&,/(.1J+ –  K%(/=,/(.1L/;+&##*#A+ •  M*C+.$,;+,$.."1+ •  N*I*&%+4567OM"P+ -"#$%*,+Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  45. 45. ClickscriptWeb of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  46. 46. Sample App: Mobile EAS •  !"#$%&( –  )*+(,-.#(/012(0*"3*0#( –  4$*0*(&013%5+#(6,-.7("80*"39( #183:( –  ;/(<1+(+"=*("(&>5+%0*(?>+$( 4*@5"2( –  -%#$(6?*@#15=*+7(&>5+%0*(+1("88( 58>*<+#(1<(AB+$*C#( •  !1@>8*( –  D%@#50>@*(+1(B+$*C#( –  E>#&8"9(#<"&#$1+("<3(&013%5+( ></1( –  ;2&8*2*<+*3(?>+$(+$*(D*<5$"( F1%5$(G"H"#50>&+(I>@0"09J( •  KHLJ(*<3M+1M*<3(&%#$(NOO(2#(Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  47. 47. •  !"#"$%&()*+"$,-(* ./0123* •  4$5$*),5*6781*9:;3* •  7<)5=$>?5*@AB5)*>"$53* •  8,C&)%C+=B$D* –  EC@*">C-)*&5"?FG+5H* –  I5JC=A*7:K;8H* –  L*65"A5&*M*(-$,H**Still not convinced? Try it!!!http://epcmashup.webofthings.com
  48. 48. Conclusions ‣ Huge opportunities ahead for WoT ‣ The Web of Things is hard because ‣ People are good Web developers XOR ‣ Good embedded systems developers ‣ Tools & best practices for Web-enabled things are needed ‣ Tradeoff between performance and features ‣ Web developers need to apply their skills and expertise to build a programmable world ‣ Prototyping via large-scale applications ‣ Deployment support, runtime debugging, patterns & toolkits, etc.Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich
  49. 49. Thanks for your attention ! trifa@inf.ethz.ch dguinard@inf.ethz.chhttp://www.webofthings.com

×