Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Uni w pachube 111108
1. th
Session 8 Nov 2011
Intro to Pachube
and the “Internet of Things”
Paul Tanner
Virtual Technologies
@paul_tanner ~ paul@virtual-techno.com
2. Agenda
● The “Internet of Things”
● What's Pachube
● Why it's important
● Who's using it
● How to use it
● Getting help
● Questions
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 y'all?
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
9. What's 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
10. 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
11. 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
12. The API
● Basic API (GET/ PUT)
● REpresentational State Transfer (REST)
● Data Formats and Metadata
● Security and Privacy
● Triggers
● History
● Sockets & Websockets
● Apps
13. Sensor Example
(Uses PUT and GET APIs)
Proximity
sensor
Nanode Router Pachube Web Page
(Arduino + Internet)
14. Actuator Example
(Uses PUT and SUBSCRIBE APIs)
MBED w.
Phone Pachube
Radio
Wireless
Socket
16. 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!
17. Who's Using It
● Power monitoring/ management
● Home automation
● Environmental monitoring
● Radiation monitoring
● General automation
● What would you use it for?
21. 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
22. GET Example
curl --request GET --header "X-PachubeApiKey: YOUR_API_KEY_HERE"
http://api.pachube.com/v2/feeds/504/datastreams/1
char 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();
}
24. 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
25. Attributes
● Feeds: description, location, tags etc
● Datastreams: id, tags, units
● Good for searching but, as yet, no standard
vocab for tags
26. 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
27. 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 server's firewall
● Sockets provide an attractive alternative
28. 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
29. 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.
30. 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
31. 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
33. 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
35. 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
36. Suppliers
Apologies for an incomplete list ..
● oomlout.co.uk
● skpang.co.uk
● coolcomponents.co.uk
● rs-components.co.uk
● nuelectronics.com
● Via london.hackspace.org.uk