Uni w pachube 111108


Published on

Talk at Uni Westminster 111108

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Uni w pachube 111108

  1. 1. thSession 8 Nov 2011 Intro to Pachube and the “Internet of Things” Paul Tanner Virtual Technologies@paul_tanner ~ paul@virtual-techno.com
  2. 2. Agenda● The “Internet of Things”● Whats Pachube● Why its important● Whos using it● How to use it● Getting help● Questions
  3. 3. Me and You?● Independent Systems Consultant, Systems Integrator, Maker● Background in electronics and software● Part of network(s) of implementors● Active member of Pachube community● How about yall?
  4. 4. The Internet of Things● Internet: Email → Web → IoT● Devices: Mainframe → Mini → PC → IoT● Where people and things are connected● Related issues ● Open Data ● Security and Privacy ● Machine intelligence● Scope today: “Smart Object” connectivity
  5. 5. IoT Evolution● Discoverable devices● Devices online● Devices controllable● Devices interoperate● Smart devices
  6. 6. IoT Model
  7. 7. Physical Deployment
  8. 8. Whats Pachube● A cloud-based aggregation service● An “Application Programming Interface (API)”● A website based on that API ● Search and find data feeds ● Create and manage your own feeds – Sensors (e.g. thermometer, power meter) – Actuators (e.g. control something) ● Use “Apps” for visualisation and control – Graphs, Dashboards (web and phone) etc.● Almost everything can be done via the API
  9. 9. Key Characteristics● Open API● Ability to handle volume of data● Searchable● Shareable● Built-in privacy controls● Range of data formats● Large number of connected devices● Great user community
  10. 10. The Website● www.pachube.com● Search and find data feeds● Create account(s)● Create feeds● Add datastreams www.pachube.com/feeds/1539● Manage privacy settings, triggers etc.● Access “Apps” https://apps.pachube.com
  11. 11. The API● Basic API (GET/ PUT)● REpresentational State Transfer (REST)● Data Formats and Metadata● Security and Privacy● Triggers● History● Sockets & Websockets● Apps
  12. 12. Sensor Example (Uses PUT and GET APIs) Proximity sensor Nanode Router Pachube Web Page(Arduino + Internet)
  13. 13. Actuator Example (Uses PUT and SUBSCRIBE APIs) MBED w.Phone Pachube Radio Wireless Socket
  14. 14. Compatible Devices e.g.
  15. 15. Importance● Anyone can put up a server, right?● “Internet of Silos” vs. API standards● IoT growth is about: ● availability of data ● low cost of implementation ● diversity/ cross-sector capability● Pachube ticks all the boxes – and is now free!
  16. 16. Whos Using It● Power monitoring/ management● Home automation● Environmental monitoring● Radiation monitoring● General automation● What would you use it for?
  17. 17. Real ExamplesSearch Pachube for:● Energy Monitors● Weather Stations● Radiation Monitors
  18. 18. Live on homepage
  19. 19. Basic API● http://api.pachube.com/v2/● GET/ PUT/ POST● GET needs URL only● /v2/feeds/504 or /v2/feeds/504/datastreams/0● .csv/.json/.xml – format selector● ?api_key=xxxxxxxxxxxxx (unless logged in)● POST needs headers incl. api_key and accept● Use curl for testing
  20. 20. GET Examplecurl --request GET --header "X-PachubeApiKey: YOUR_API_KEY_HERE"http://api.pachube.com/v2/feeds/504/datastreams/1char msg[] = {"{"method":"get","resource":"/fee "current_value":"100",ds/504/datastreams/1","headers":{"X- "max_value":"10000.0",PachubeApiKey":"xxxxxxxxx"}}"; "at":"2010-07-02T10:16:19.270708Z", "min_value":"-10.0",Ethernet.begin(mac, ip,gateway,subnet); "tags":[Serial.println("Connecting .."); "humidity"if (client.connect()) { ], Serial.println("Connected"); "id":"1" client.print(msg); } while (!client.available()) {} Serial.print("Receiving:"); do { c = client.read(); buffer[len++] = c; Serial.print(c); } while (client.available()); buffer[len]=0; Serial.println();}
  21. 21. PUT Examplecurl --request PUT --data-binary @datafile.txt --header "X-PachubeApiKey: YOUR_API_KEY_HERE"http://api.pachube.com/v2/feeds/504/datastreams/1{ char "method": "put", pld[]="{"method":"put","resource":" /feeds/38728","headers":{"X- "resource": "/feeds/38728", PachubeApiKey":"my_api_key"}, "body": "headers": { {"version":"1.0.0","datastreams": "X-PachubeApiKey":"my_api_key" [{"id":"pir","current_value":”1"}, }, {"id":"pot","current_value":"245"} ]}}"; "body": { "version": "1.0.0", void post_callback(status,datapos) { "datastreams": [ Serial,println(status); { } "id": "pir", "current_value": "1" es.ES_client_http_post(“/feeds/38728”,"api }, .pachube.com", “”, "PUT", pld, { "id":"pot", &post_callback); "current_value":"245" } ] }}
  22. 22. Data Formats● .csv most compact● .xml most flexible● .json usually the best compromise ● Not verbose ● Allows access to all fields/ attributes ● Tolerates adding fields etc ● Simple to program
  23. 23. Attributes● Feeds: description, location, tags etc● Datastreams: id, tags, units● Good for searching but, as yet, no standard vocab for tags
  24. 24. Security & Privacy● By default, all feeds are public for read● Pro a/c can restrict to private: key required● Your master key: tantamount to giving out your password so keep it safe.● Restricted keys can be generated for a specific feed or datastream: ● Read-only, Write only, Read-write● Groups of users can be associated with a key● COMING SOON: oauth - additional security
  25. 25. Triggers● Make things happen: set a trigger on a feed or datastream● gt, gte, lt, lte, eq, change● Calls your designated URL with the value of the data; requires that a server be listening.● With appropriate opening in servers firewall● Sockets provide an attractive alternative
  26. 26. History● All datapoints stored by default● Can be created, updated, deleted● Various granularities available to pull in bulk ● All datapoints: up to 6 hours worth (start/ end) ● Daily data up to 1 year● http://api.pachube.com/v2/ .. for details● Multiple calls needed to get more
  27. 27. Sockets/ Websockets● Part of the beta API – subject to conditions● http://api.pachube.com/v2/beta/● TCP sockets very useful for actuators as there is no need for polling● Websockets (in certain browsers) are perfect for visualisations, dashboards etc.
  28. 28. Apps● http://apps.pachube.com/ - mostly OK● http://beta.apps.pachube.com/ - careful!!● Numerous “Apps” provided – mainly visualisation components● This is gradually being opened up for community contributions.● Not everything works yet – change of plan● Announcement expected Real Soon Now
  29. 29. App types● Graphs and Visualisations● Dashboards and Controllers● Mapping Tools● Mashups and Converters● Alerts and Plugins● Feed discovery● Mobile Phone Apps● Augmented Reality● Energy Apps and Gadgets
  30. 30. IoT Model
  31. 31. IoT Apps Engine● Make things happen in response to sensors● Make it as easy as possible for non-techies to develop and iterate apps. ● Declare a set of sensors and actuators ● Describe actions based on input changes and arbitrarily complex calculations ● Include external data and cause external actions (eg. Tweet/ call/ mail)● Currently at prototype stage● Looking for the right partners to evaluate
  32. 32. Example App
  33. 33. Getting Help● http://community.pachube.com/● Arduino Community http://arduino.org/● MBED forum http://mbed.org/forum/● Hackspace https://london.hackspace.org.uk/● nanode-users@googlegoups.com● .. not to mention www.google.co.uk● .. leading to numerous blogs
  34. 34. SuppliersApologies for an incomplete list ..● oomlout.co.uk● skpang.co.uk● coolcomponents.co.uk● rs-components.co.uk● nuelectronics.com● Via london.hackspace.org.uk
  35. 35. Questions?http://www.slideshare.net/paul_tanner/uni-w-pachube-111108 @paul_tanner ~ paul@virtual-techno.com