Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
Keio USN with Sensor-Over-XMPP
TutorialTakuro Yonezawa Keio University
Agenda• What is USN ? What is SOX ?
• Learning the Architecture
• Tools and libs developed by Keio Univ.
• Install libs and make the programs
• Java or Javascript
What is• Virtual Sensor Network Infrastructure developed and
operated by Keio University HT Lab.
• Flexible, Scalable, Dependable and Secure
• based on Sensor-Over-XMPP by CMU
• Added feature of participatory sensing, cross-domain federation, etc.
• Various libraries and tools are also available.
What is SOX?• Sensor-Over-XMPP (http://xmpp.org/extensions/inbox/
sensors.html)
• Using XMPP PubSub extension for sensor data publishing/subscribing
• Developed by Sensor Andrew Project in CMU
Anthony Rowe (CMU)
XMPP ?• Extensible Messaging and Presence Protocol (XMPP)
• A communications protocol for message-oriented middleware based on XML
• Open standard and uses an open systems approach of development and application
• Specification: RFC 6120, 6121, 6122
★ Decentralization ★Open standards ★ History ★ Security ★ Flexibility
Strength Implementation✓ ejabberd (erlang) ✓ Openfire (java) ✓ etc..
PubSub ?XMPP Server (MQTT server, etc..)
Event Nodes (alias:topic, channel)
economicnews
sportsnews
politicsnews
Publisher Subscriber
SubscribePubilsh
Sensor Andrew• Using PubSub for sensor/actuator network
• Defining Virtual Sensor Node as the pair of meta node and data node
• Sensor-Over-XMPP(SOX) specification defines a payload format for communicating sensor and actuation information
meta node data node(ex. TestSensor_meta) (ex. TestSensor_data)
Virtual Sensor(ex. TestSensor)
TestSensor
Adapter
SOX libSubscribing
User
Sensor Data (via Subscribing)
Meta Data (getting cache)
Meta Data (only once sending)
Sensor Data (periodic sending)
Meta-‐data Publish
XMPP Server
meta node data node
<iq type='set' to=‘pubsub.sox.ht.sfc.keio.ac.jp’ from=‘owner_of_a_sensor’ id='publish1'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <publish node=‘a_sensor_meta’> <item id='current'> <device xmlns='http://jabber.org/protocol/sox' name='mote' id='4d4335b0-4134-11e0-9207-0800200c9a66' type=‘outdoor_weather' <transducer name='current temperature' id='temp' canActuate='false' hasOwnNode='false' units='kelvin' unitScalar='0' minValue='270' maxValue='320' resolution=‘0.1'> <transducer name='current humidity' id='humid' canActuate='false' hasOwnNode='false' units='percent' unitScalar='0' minValue='0' maxValue='100' resolution='0.1'> </transducer> </device> </item> </publish> </pubsub></iq>
Meta publish (at sensor deployment step)
Sensor data Publish
XMPP Server
<iq type='set' to=‘pubsub.sox.ht.sfc.keio.ac.jp’ from=‘owner_of_a_sensor’ id='publish2'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <publish node='a_sensor_data'> <item id='current'> <data xmlns='http://jabber.org/protocol/sox'> <transducerValue id='temp' typedValue='293.2' timestamp=‘2011-02-25T17:13:20Z'/>
<transducerValue id='humid' typedValue=’82.5’ timestamp='2011-02-25T17:13:20Z'/> </data> </item> </publish> </pubsub></iq>
meta node data nodedata publish (periodically)
Tools and Libs• Available from http://sox.ht.sfc.keio.ac.jp
• Developed by Keio Univ.
• Online testing toolsVisualization Application (Dashboard, Live Earth!)
• Sensorizer - make web as sensors
• SOX Libraries (Java, objective-c, JavaScript, Python)
Run the testing tool
1.Monitor the hogehoge node
2.Publish data
3.Check data will be shown in monitoring page
←check
←click
←click
←select
http://sox.ht.sfc.keio.ac.jp/tools/soxClient2.html
http://sox.ht.sfc.keio.ac.jp/tools/soxDataPublisher2.html
(1)
(2)
Surfboard
Live Earth!
Hello, SOX ! with Java SOX Lib
Hello, SOX!• Preparation: Install Java (>JDK7), eclipse
(recommend)
• Download JSoxLib.zip from http://sox.ht.sfc.keio.ac.jp
• Create new project in eclipse, import library of “JSoxLib.jar” and all jar file in “lib directory”.
• Run “example/subscribe.java”
Create New Project
set project name
1.7 or more
then, finish
Drag-to-Drop JSoxLib.jar and lib dir to created project
Then, you can see those files in the project
(1)click (2)clickOpen Project Properties (3)click
Build Path Setting
Add jar files
Select all jar files
(1)click
(2)click
(3)click
Drag-to-Drop example dir and src dir
Then, you can see those files in the project
(1)open Subscribe.java
(2)click run command
You can see raw XML communication for debugging
Message will be appear in your console
Use test publish tool in “sox.ht.sfc.keio.ac.jp”-> ・Test Sensor-Data Publishing
(1)select hedgehog node
(2)click
Then, you can see the published data when Subscribe.java is running
Or You can run Publish.java
SoxConnection con = new SoxConnection("sox.ht.sfc.keio.ac.jp", “YOUR_JID", “YOUR_PASSWORD", true);
SoxConnection con = new SoxConnection("sox.ht.sfc.keio.ac.jp", true);
Bind virtual sensor node in SOX to SoxDevice object
Connect to SOX sensor
As anonymous user
As registered user
SoxDevice soxDevice = new SoxDevice(con, "hogehoge");
Subscribe & register event listenersoxDevice.subscribe();soxDevice.addSoxEventListener(this);
1. Create “test_yourname” sensor node by your JID
2. Publish meta information to the node by your JID
•set 2 transducers :temperature and humidity
3.Subscribe the node, and publish sensor data to the node by anonymous user
See Create.java
See Subscribe.java
See Publish.java
For more understanding..
You can also monitor your sensor node by online monitoring tool or dashboard
Sensorizer• Make WEB page as Sensor
• Extracting data and send the data to PubSub node
• Checking the status via http://sensorizer.ht.sfc.keio.ac.jp:8888/list
• Monitoring the active sensor node by monitoring page
WEB Sensorizer Usage Guide
ver.20140614
{jin, takuro}@ht.sfc.keio.ac.jp
Jin Nakazawa and Takuro Yonezawa
28
Install• Install the Chrome Extension of Sensorize It! to Google Chrome• Sensorize It! can be downloaded from
https://www.dropbox.com/s/ys2nzvg6dwdywil/chrome.crx
After install the extension, you can see the menu
29
Usage Process1. Create a virtual sensor device
2. Add sensors(we call transducers) to the virtual sensor device
3. Configure the information of the device and transducers
4. Sensorize !
Just 4 steps :)
30
1. Create a virtual sensor device
(1) right click where the text is appropriate as sensor node name
(2) Select this menu
31
1. Create a virtual sensor device
You can edit name of the device, also define location of the device
32
2. Add transducers to the device
(1) right click where you want to add the sensor information as transducer
(2) Select this menu33
3. Configure the information of the node and transducers
Define the transducer name and unit
lat&lon transducers are automatically added if you set the device’s location34
4. Sensorize ! Click
Click
35
Architecture
(based on Sensor Andrew)Virtual Sensor Device (PubSub Node)
Subscribe App
App
App
App…
36