TinysOsAccelerometer
This application is the result of a didactic project for the Pervasive Systems course of the Master of Science of Engineering in Computer Science at Sapienza University of Rome
Overview
The goal of the project is to create a wireless sensors network (WSN) for collecting data from an accelerometer and storing them to a server
The network is made of a number of motes, small electronic devices capable of doing some processing and communicating one another by mean of a radio transceiver.
The solution adopted to reach the goal comprises two main parts:
- a TinyOS-based application, running on every single node of the network
- a Java GUI application in charge of uploading data to a server
Architecture
The network is based on the Collection Tree Protocol (CTP):nodes organize themselves to form a tree-shaped network, where packets are transmitted from the leaf node to the root node. In particular, every node maintains its own routing table with an estimation of the quality of the link to all its neighbors, so it's always capable of determining the path which involves less hops before a packet is delivered to the root; periodically every node sends broadcast packets (beacons), waiting for the other nodes to acknowledge them in order to discover the quality of the links. For this project the architecture of the network is as follows:
- 1 leaf node: interacts with the accelerometer in order to sample data from it and then sends them towards the root of the network. Its mote-id has to be set to "1" in order to correctly update data on Parse(see later)
- 1 root node : the recipient of the data sent by the leaf; it's connected to the serial port of a pc
- n intermediate nodes: they are in charge of forwarding data received from one neighbor node to another neighbor node on the path to the root
Hardware implementation
The accelerometer used in this project is the ADXL-345 by AnalogDevices, a 3-axis accelerometer with 13-bit resolution, up to +/-16g peaks of acceleration. The leaf node to which it's connected is a MagoNode Platform, while the root node and the various messengers are represented by Crossbow TelosB
Software implementation
TinyOS-based application
Since the hardware platform of the leaf node is different from the one of the messenger nodes and of the root node, the TinyOs-based application comes in two distinct flavours:
- Accelerometer: it's the application installed on the Magonode platform (leaf node); it includes the driver to configure the accelerometer, with which it interacts
- Node: this is installed both in all the intermediate nodes and in the root node, meaning that they execute the same code, but actually their behaviour is not the same. In fact the root node is assigned a reserved mote id (50,arbitrarly chosen),so that it's possible to make it perform specific tasks by mean of the variable "TOS_NODE_ID"
Java GUI application
TinyOS comes with a Java application named "mviz" which provides a graphical tool to show the links in a network made of nodes running the Collection Tree Protocol:
the application communicates with the root node through a serial port,so when messages are received the representation of the topology of the network gets updated.
Thus the Java application included in this project represents an extension of "mviz" which provides it with two additional features:
- Data upload on a database created at Parse.com Only data extracted from packets whose origin is set to "1" are uploaded (data from the accelerometer)
- Data download of the last three uploaded value, from the database
Files Description
The most important files available from this project are:
- TinyOs applications for the motes, i.e. for the Magonode (Accelerometer) and for the TelosB (Node)
- Header file (Acceleration.h) including the fields of the packets to be visualized by the Java GUI application
- Extended version of Mviz
- Make files to compile to magonode (avr folder and magonode.target); to be put in the make directory of the TinyOS installation