WoT Tutorial @ Cisco

49
Web of Things - Fast Prototyping Physical Computing Applications Cisco - 3. March 2011 Vlad Trifa - ETH Zurich Dominique Guinard - ETH Zurich

description

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

Transcript of WoT Tutorial @ Cisco

Page 1: WoT Tutorial @ Cisco

Web of Things - Fast Prototyping Physical Computing ApplicationsCisco - 3. March 2011Vlad Trifa - ETH ZurichDominique Guinard - ETH Zurich

Page 2: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

Electronic things are invading us...

‣ Powerful tiny computers‣ Sensors & actuators‣ Web connectivity‣ Cheap‣ Ubiquitous

Page 3: WoT Tutorial @ Cisco

Translation for hackers:An infinite playground.

YAAAY!

Page 4: WoT Tutorial @ Cisco

OGC SensorML

Zorro III

Megaco

AMQP

Modbus

Zorro III

OPC-UA

Page 5: WoT Tutorial @ Cisco

Problem:

Given that tons of different‣ Devices ‣ Capabilities‣ Functionalities‣ Applications/middlewares‣ Networking protocols

How to combine heterogeneous mobile devices

to create interactive ad-hoc applications?

I don’t have a PhD in Computer

Science...

Can I use this too?

pleeeeease?

Page 6: WoT Tutorial @ Cisco

We need an universal protocol that is:

simple, lightweight, loosely-coupled, scalable, flexible

and hopefully... standard

Page 7: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

Sounds like the Web...

‣ 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 free

Use Web standards to develop applications for networked devices.

HTTP, HTML, XML, JSON, RSS, ATOM, MIME,...

Page 8: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

Social Web

Real-time Web

Programmable WebSemantic Web

Physical Web

Web of Things

Page 9: WoT Tutorial @ Cisco

RESTful devices

Page 10: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

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 resources

Page 11: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

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)

Page 12: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

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/led1

Page 13: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

Representations

‣ XHTML ideal for browsinghttp://webofthings.com/spots

‣ JSON ideal for parsing (& lightweight for device)

http://webofthings.com/spots.json

‣ XML ideal for business integrationhttp://webofthings.com/spots.xml

Page 14: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

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)

Page 15: WoT Tutorial @ Cisco

RouterProxy

Indirect Pass-through

Non Web-enabled Web-enabled

HTTP

HTTPLegacy

Devices

Internet

Gateway

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

Page 16: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

Gateway level integration: Energie Visible

Gateway  (IP:10.1.1.5)

Sensors(Ploggs)

Electric  appliances

Web  /  Mobile  Interface

GET http://10.1.1.5:8080/energymonitor/ploggs/*

[{

"deviceName": "ComputerAndScreen",

"currentWatts": 50.52,

"KWh": 5.835,

"maxWattage": 100.56

},

"deviceName": "Fridge",

"currentWatts": 86.28.,

"KWh": 4.421,

"maxWattage": 288.92

}, {...}]

D. 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.

Page 17: WoT Tutorial @ Cisco

/ethz

../building/CNB

../CNB/FloorD

../southWing/D48.1

../CNB/FloorEvirt

ual g

atew

ays

(can

run

anyw

here

)ph

ysic

al g

atew

ays

(mus

t be

embo

died

)

../southWing/D48.2

../floorD/southWing

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

Towards infrastructures

Page 18: WoT Tutorial @ Cisco

The era of physicalMashups

Page 19: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

Real-world Web applications

REST

REST

URL

PHP

REST

API

[hCp://www.pachube.com] [hCp://www.webothings.com/energievisible] [hCp://www.clickscript.ch]

JavaScript

Page 20: WoT Tutorial @ Cisco

So, my fridge is online. But what about

sharing and authentication?

Page 21: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

FAT - Friends and Things

Page 22: WoT Tutorial @ Cisco

Err, what about eventing & streaming ?

The Web wasn’t quite made for that...

Yet we need this!

Page 23: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

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 push

Page 24: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

!"##$%&'($)' *$+,-./0$'($)'

Page 25: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

HTML5 Websockets

•  !"##$%"&#'()*+),-')./012'/)

•  34/,)05),-')200+)2,4+%4/%)6789):)2&';<)

•  =".2;/*&>0+),-/0"?-)@4A42;/*&,)

•  B+;/'42*+?)+"C.'/)05)./012'/2)2"&&0/,)

Page 26: WoT Tutorial @ Cisco

Ok, great. But how do I quickly prototype

end-to-end applications?

Page 27: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

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...

Page 28: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

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 WebSockets

Page 29: WoT Tutorial @ Cisco

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

Page 30: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

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 > 19

Page 31: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

Response

HTTP/1.1 201 [...] Content-Location: http://example.com:8085/datastreams/bh_0 [...] Connection: close

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_0

‣ Then we just subscribe to it:

Page 32: WoT Tutorial @ Cisco

Ok, great. But is this useful for

real world applications?

Page 33: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

| SENSEable City Lab

crowd sourcing application design

LIVE Singapore!real time data platform with tools

real Singapore city and citizens

enabling platform for application developmentdata collection/combination/distributionEnabling platform for developing urban applications

Data collection/processing/distribution

Page 34: WoT Tutorial @ Cisco

this is you

Web API

LIVE Singapore!

real-time (raw) data streams

http://senseable.mit.edu/livesingapore

Page 35: WoT Tutorial @ Cisco

the epcis network in a nutshell

Page 36: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

A typical Fosstrack deployment...

!

" #

$%

&

' ()

!*+

!!,+-./.+011+23456.7486+98:;:<+=3>?.5,+ !",+-./.+@4586167A8+BCD+

~12 software components for a typical RFID deployment!!

Page 37: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

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!

Page 38: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

Fosstrack EPC cloud

Page 39: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

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 Computing

Page 40: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

•  !"#$%&'()*#+,-&,"-).,'/,0'&&.)-1,

•  !$#%*23*1,3$&.-22,'$,.'",'/,0'&&.)-1,45678,

•  6)'&&%9)':&#),;#9,3$.#)/-*#,

•  <'932#,=&#),7$.#)/-*#,•  :#9'>?3$@&A*'BC)D+,,?E"FCCAAAC!"#$%"&CB3@)'&F9-&#2C'($)('C,

:-)#?'(&#F3$*'B3$@C%*(C,GHHI%JG%GJKJLFGGFHMAHHHNC(+(&,C456,

Page 41: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

•  !"#$%&'()&*+$',-.**(–  /01+,2023(4"'(./5(,6,2+1(– !$%7*%,8,'9(

•  :(,6,2+(-;(2()"22,<+"'1(–  )"2+'"%(+='"$3=(>5?@4$%(.ABC(

Page 42: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

•  !"#$%&'($)"*+,-"$•  )&../*0'$'"+"*12$

0*13'./*0'4$–  !"#'/-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;/'.("*"9E"*'"F$13C$,0'$EG&"*F$%2&7,3$

Page 43: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

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"(

Page 44: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

RFID Mashup Editor

•  !"#$%&'()*+,(-.%*+/"-."0*01,+"2+13.(/&%+4567+&..%(/&8"0,+

•  9:*'+&+!&,;$.+5'&-*<"'=+>+?0@(0*A+–  B,*',+/&0+C$(%#+1;*('+"<0+$,*+/&,*,+

•  D'"1"3.*+C&,*#+"0A+–  E'"<,*'FC&,*#+GH&I&,/'(.1J+–  K%(/=,/'(.1L/;+&##*#A+

•  M*C+.$,;+,$.."'1+•  N*'I*'&%+4567OM"P+-"#$%*,+

6D+4*&#*'++Q&-*+

?DK+

6D+

E$,(0*,,++,1*.+

?DK+?I*01,+GR,"0J+

P'$*O+5&%,*+

Page 45: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

Clickscript

Page 46: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

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#(

Page 47: WoT Tutorial @ Cisco

Still not convinced? Try it!!! http://epcmashup.webofthings.com

•  !"#"$%&'()*+"$,-(*./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**

Page 48: WoT Tutorial @ Cisco

Web of Things, 3.3.2011 Vlad Trifa/Dominique Guinard - ETH Zurich

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.

Page 49: WoT Tutorial @ Cisco

Thanks for your attention !

ありがとうございました!

[email protected]@inf.ethz.ch

http://www.webofthings.com