Statuses

Testing Sensors 2

In Uncategorized on May 7, 2010 by salvadormrf

Statuses

Testing sensors 1

In Uncategorized on May 7, 2010 by salvadormrf

Statuses

System use cases and refrigerator experience

In Uncategorized on May 7, 2010 by salvadormrf

System overview

SAWA can be considered as a platform, with a set of services and web application. It uses XMPP Protocol to transport all sensor data in real-time, and allowing secure connections. Using XEP-060, Publisher-Subscribers paradigm it is possible to share data with multiple users with flexibility and scalability.This project uses soxlib with modifications from Sensor Andrew project.

Project blog, Project source

Web application
In web application is possible to manage networks and sensors, manage XMPP nodes, define policies, and share data.

-Technologies

Google Maps, Flexigrid, Open Flash Charts 2, jQuery, Ajax, JavaScript, Openfire Css, CodeIgniter, PHP, C, MySQL

Services

-Datarecorder

This service is responsible to store sensor data in database, when published in nodes

-Actionchecker

This service is responsible to match all sensor data with existing policies, and launch these actions when policy matches.
Each notification type is included as plugin, making this service more easy to extend.

-Scheduller

This service is responsible to order the previous services to subscribe or unsubscribe from PubSub nodes.

-Technologies

glib-2, gmodule, libloudmouth, soxlib, mysql, C, XML, XMPP

Servers
Openfire XMPP Server
MySQL database server
Apache HTTP Server
Postfix email server

Tools

install soxlib and sox_tools

soon

sox_tools

-sox_tools config

create .sox_tools.cfg in your home
 
[XMPP]
PORT=10223
HOST=hci.uma.pt
PUBSUB_SERVER_NAME=pubsub.hci.uma.pt
TIMEOUT=10
 
[DEFAULT_USER]
JID=user123@hci.uma.pt/resource_xpto
PASSWORD=user123

– in this example we are publishing the value 25 with unit “C” from variable 14 in user123_network network

 
sox_tools publish user123_network 14 25 C

Bash script (HTTP method)

 
#!/bin/bash
 
# user credentials
USERNAME=user123@hci.uma.pt
USERPASSWORD=user123
NODE=user123_network
VARIABLEID=55
 
# publish Url
URL=http://dev.hci.uma.pt/sawa/xmpp/publish
 
# data value
DATA=99
 
curl -d "USERNAME=$USERNAME&USERPASSWORD=$USERPASSWORD&VARIABLEID[]=$VARIABLEID&NODE=$NODE&DATA[]=$DATA" $URL

How to use this system?

Create account

File:account.pngFile:login.png

After creating an account, login with your credentials.

Create Network

When creating a new network it is possible to specify the access level, and network location.

Create Sensor

To create a sensor, we have to select the network which will belong to, the type (sensor or actuator), location and the variables of the sensor (this variables can be for example door status, open time and closed time count from a door switch sensor). After this steps, we are now able to upload data and see them on charts.

Publish data

There is two methods of sending data, one is HTTP POST, useful for simples devices, without capabilities of parsing XML and establishing SSL connections. The other method is using sox_tools, a specific XMPP client for this system. Last one has the ability to publish, listen events and manage pubsub nodes.

using XMPP Client ( sox_tools recommended )

sox_tools publish myHome 11 14698

using HTTP POST

curl -d -m 10 “USERNAME=user123@hci.uma.pt&USERPASSWORD=user123&VARIABLEID[]=11&NODE=myHome&DATA=14698” $URL

View data charts

All sensor data is set to be recorded by default, in “Data” menu, select the chart type and sensor variables to be represented, and to finish click on interval to generate graph.

Create policies

In policies we have, four types of notifications, email, sms, url and publish events to actuators, in this example I created a policy to alert me when thee door is more than 300 seconds open. I repeated the same test with all notifications types, the results are bellow.

Email notification

Email notification working

URL notification

Datarecorder service output, policy Url being called

SMS notification

SMS notification arrived

Node event

Event published on node

Practical use cases

Monitoring a refrigerator

I used this experience to test the system, so the objective was to record sensor data.
The variables I selected to record was: door status(open or closed), time open (number of seconds the door was open), and temperature.
Since arduino is very resource limited, i used HTTP POST method to publish data.

Sensors

  • sensors
    • 1 temperature sensor
    • 1 photo-resistor
  • devices
    • 2 arduinos
    • 1 ethernet shield
    • 1 RF kit

Network diagram

Sensor Network diagram


– The arduino on refrigerator sends messages to gateway (arduino in router) with format msg_id:sensor_variable:value (example: 455:door:1:temperature:10)
– Then gateway sends via HTTP POST the sensor value with user credentials and sensor identification
– Then on server, this data is published to XMPP node

Pictures

Refrigerator with Arduino

Arduino with RF transmitter module (with yellow wire as antenna)
Blue wire is energy source, red, black and white are connected to sensors

Instead of having a door switch, I used a photo-resistor as door switch, which measures the amount of light. So when we open the door, the light from refrigerator will go up and go down when door is closed.

Here is two basic sensors the “door switch” and temperature sensor

My sensor gateway, responsible for receiving data through RF and send to server

Arduino+Ethernet Shield+RF Reciver

Data charts

Possible experiences

Inteligent Mail box

adding soon

Wine monitoring

adding soon

Energy savings

turn power off from all standby devices, if inactivity in a room is greater than a number of seconds
arduino or pc+PIR+Relay

GPS

create policy with geographical limitations (square), when device enters this area an action will be triggered

Statuses

New updates

In Uncategorized on May 3, 2010 by salvadormrf

WEB APP

done | added demo chart, to remove white flash square
done | removed intervals and groupby options
done | added fixed intervals
done | added time consistency on charts
done | added beta logo
done | fixed export data problems
done | removed multiple devices from groups
done | each network has a members list
done | added admin user
done | added user list for admin user
done | added access to sensor data, to device members and open networks
done | added filter list on admin options
done | added access model type on google maps icon
done | added download and chart icons in google maps

SERVICES

done | started building a service to replace sox command line tools (suspended for now)
done | fixed memory leaks
done | added sensor value units support
done | added timeout in sox_tools and sawa_publish

Statuses

Services

In Uncategorized on March 18, 2010 by salvadormrf Tagged: , , ,

#datarecorder
– subscribes to event nodes
– store sensor data in database

#actionchecker
– load action plugins
– subscribes to event nodes
– check if has policies
– match policies filters
– launch action

#scheduller
– check for new recordings or new policies
– send subscribe or unsubscribe orders to actionchecker and datarecorder services


Statuses

sox_tools

In Uncategorized on March 17, 2010 by salvadormrf Tagged: , , ,

I adapted our command line tools into a single tool, sox_tools (sensor over XMPP tools).

Download (libs and libraries)

Download (source) NOTE compile loudmouth with openSSL instead of gnuTLS,  gnuTLS is hanging in block reply

In your home you must create the configuration file .sox_tools.cfg
also you can add more than one user

############################### CONFIG ###############################

[XMPP]
PORT=5223
HOST=genbox
PUBSUB_SERVER_NAME=pubsub.genbox

[DEFAULT_USER]
JID=username@genbox
PASSWORD=userpassword

[sapo]
JID=sapo@genbox
PASSWORD=sapo123

############################### USAGE ###############################

Available commands:

user_________ Select user from config

listen_________ Listens for pubsub events
publish________Publish to a pubsub node
last_item ______Get last item from a pubsub node

create_________Creates a pubsub node
subscribe ______Subscribe to a pubsub node
unsubscribe____Unsubscribe from a pubsub node

add_member___Add a member to a pubsub node

subscriptions___List pubsub subscriptions
affiliations_____ Lists pubsub affiliations

delete_________Deletes a pubsub node

############################### EXAMPLES ###############################

# creating a event node with open access model
sox_tools create test-node open

# subscribe to event node
sox_tools subscribe test-node

# subscribe to event node using other user sapo
sox_tools –user sapo subscribe test-node

# deleting a event node
sox_tools delete test-node

# retrieve user subsciptions
sox_tools subscriptions

# retrieve user affiliations
sox_tools affiliations

# unsubscribe from event node
sox_tools unsubscribe test-node oozGM08Gz7G12W4PYi91o5ENEM53RH3GNEy0J64k

# publish sensor data
sox_tools publish laptop 3 55

# request last item published on a event node
sox_tools –user datarecorder last_item laptop

_# output ##############################################################################
_Initialized XMPP connection

_Last item published on node ‘laptop’

_<item id=“SQjQugKl5wOW79X”>
__<System>
___<DeviceInstallation id=“-1” regid=”-1” type=”” description=”” timestamp=”2010-0317T12:27:35“>
____<TransducerInstallation name=“” id=”-1” regid=”-1” canActuate=”false”>
_____<TransducerValue typedValue=“55” rawValue=”” timestamp=”2010-0317T12:27:35” variableId=”3″>
_____</TransducerValue>
____</TransducerInstallation>
___</DeviceInstallation>
__</System>
_</item>
_####################################################################################

Statuses

New Web Interface

In Uncategorized on March 14, 2010 by salvadormrf

I replaced our layout for openfire layout using openfire css.

Web App

Interface

– to simplify forms, i splited in more forms (new location, new category)

– removed buildings and rooms

– removed mixed type of transducers

– adapted flexigrid css to main css

– network node name is the same as network name

– added form to create new node

– define access mode in nodes (open and whitelist. Authorize access mode is not supported by sox lib, for now i will not touch in this part)

– possibility do list user node affiliations

Data

– added support for line, pie, bar and radar charts

– chart configuration panel

– export data as csv or json

Policies

– added policies creation form