TinyOS Implementation of Fusion-Based Volcanic Earthquake Detection

Rui Tan

Version 20140615

This document describes the TinyOS implementation of the fusion-based volcanic earthquake detection approach presented in [3,4]. The latest code package can be downloaded from


We request that publication derived from the use of any part of the code package explicitly acknowledges by citing [3,4].

Test Data

The package includes one segment of test data, seg3. It is in the testdata directory. seg3 has the seismic data traces collected by 12 wireless sensors deployed on an active volcano in 2009 [2]. The IDs of the nodes are {1, 2, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14}. This segment of data lasts for 10 minutes, during which a significant earthquake occurred. The visualization of this data segment can be found from testdata/html/seg3.html

This web page plots the signal energy and frequency spectrum measured by each node. It also shows the system detection decision fused from the detection results of all nodes (i.e., the first figure in the web page). This code package should be able to reproduce this result. The web page also draws the filtered system detection result by a morphological algorithm [3,4], and the result for picking the arrival time of primary wave (i.e., P-phase) at each node. This code package will not reproduce these two results.

Compilation and Installation

Environment Preparation

I was able to compile this code package under the following environment1:

  1. Debian Wheezy amd64
  2. TinyOS 2.1.2 and related toolchain from http://tinyprod.net/repos/debian/
  3. Oracle JDK 8u5 from http://www.oracle.com/technetwork/java/javase/downloads/index.html

This is the script for setting up TinyOS environment (a.k.a. tinyos.sh [1])

#! /usr/bin/env bash
# Here we setup the environment
# variables needed by the tinyos 
# make system

echo "Setting up for TinyOS 2.1.2"
export TOSROOT=
export TOSDIR=


export TOSROOT
export TOSDIR

Make Them

This code package has four modules:

  1. testbed-basestation: the code running at the base station (BS) node, which forwards data from/to distributed nodes to/from the JAVA fusion algorithm running at a computer attached to BS.
  2. testbed-config: the code for loading the multi-scale Bayesian models [3,4] to the flash memory of nodes
  3. testbed-data: the code for loading a segment of test data to the flash memory of nodes
  4. testbed-detect: the code for running the fusion-based earthquake detection approach on a testbed of TelosB motes. In the testbed, each node communicates directly with the BS.

Issue the following command under the directory for each of the above four modules:

make telosb

If you encounter JAVA compilation errors complaining class SerialPacket undefined, make sure $TOSROOT/support/sdk/java/tinyos.jar is within the CLASSPATH.

Load Data and Program

I recommend to have 13 TelosB motes to reproduce the results. First, open a terminal and set up two environment variables:

export DATAROOT=<absolute path to the testdata folder>
export SEGMENT=3

Install the testbed-basestation module to the BS with node ID 0:

make telosb reinstall.0 bsl,/dev/ttyUSB0

To download the data trace and detection algorithm into a node with ID x at /dev/ttyUSB0, call the installation script install.py in the root directory of the code package:

./install.py x /dev/ttyUSB0 # replace x with a number

The script will download data trace to the node and read the data out for verification. Moreover, the script will install the detection algorithm into the node. Wait for about 5 minutes for each node. If any exception occurs, try to re-issue the script. Note that the node ID you specify will correspond to the real node ID on the volcano, i.e., node 1 will have the data trace from node 1 on the volcano. Therefore, the node ID x must be within {1, 2, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14} and set up 12 nodes with these IDs using the script install.py.


Before running the detection algorithm, you may need to change some configuration in testbed-detect/FusionCenter.java. At the end of the JAVA file, there are some hard-coded configurations:

  1. source: The USB address of the BS
  2. sensors: The nodes that will be involved in the testbed experiment
  3. startRtime: The start time of the experiment, e.g., if we set 120, the experiment will start from the 120th second of the segment. Default setting is 0.
  4. endRtime: The end time of the experiment. Default setting is 598.

After appropriately setting them, re-compile the testbed-detect module by

make telosb

Turn on all nodes. After all nodes are booted (blue LED on), under the testbed-detect folder, run the fusion algorithm:

java FusionCenter


NSF CNS-0954039, CNS-0914371, CNS-0953067, CNS-1066391, CNS-1218475, OIA-1125163, OIA-1125165



W.-Z. Song, R. Huang, M. Xu, A. Ma, B. Shirazi, and R. LaHusen.
Air-dropped sensor network for real-time high-fidelity volcano monitoring.
In Proceedings of the 7th international conference on Mobile systems, applications, and services, pages 305-318. ACM, 2009.

R. Tan, G. Xing, J. Chen, W.-Z. Song, and R. Huang.
Quality-driven volcanic earthquake detection using wireless sensor networks.
In Real-Time Systems Symposium (RTSS), 2010 IEEE 31st, pages 271-280. IEEE, 2010.

R. Tan, G. Xing, J. Chen, W.-Z. Song, and R. Huang.
Fusion-based volcanic earthquake detection and timing in wireless sensor networks.
ACM Transactions on Sensor Networks (TOSN), 9(2):17, 2013.

About this document ...

TinyOS Implementation of Fusion-Based Volcanic Earthquake Detection

This document was generated using the LaTeX2HTML translator Version 2008 (1.71)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -split 0 -nonavigation -dir html volcano-code.tex

The translation was initiated by terry on 2014-06-15


... environment1
Older environment may also work since this code package was developed in 2009-2010.

terry 2014-06-15