Testbed HOWTO

RSC is a logging utility for a mote testbed. There is nothing fancy about this :(. It is just some scripts I put together long time ago. I may as well make it pretty so that people can make use of it.

Installation

Upgrade your postgresql to 7.4 or above, if you have not done so. You can upgrade your postgresql from the cygwin installation program. To check your version, you do

psql --version

Download the code, unzip it and move it to anywhere you want.

Define your $HOME directory, $RSCPATH (to where you unzip the tar files), and add $RSCPATH to your $PATH. You can do this by adding these lines at the end of ~/.bashrc

export HOME="/path/to/your/home"
export RSCPATH="$HOME/path/to/rsc"
export PATH="$PATH:$RSCPATH"

To interface with the emote, you need this specific uisp. Do the usual untar, configure, make, make install on it.

program.sh usage

program.sh is a bash script that nicely interface with an ethernet module. You can download, ping, erase a mote with emote connected to it. The following are a few examples on how to use it

apps/Blink> program.sh --download --networkhost=c62b266.research.intel-berkeley.net \\
--platform=mica2dot --moteid=1
apps/Blink> program.sh --erase --networkhost=c62b266.research.intel-berkeley.net
apps/Blink> program.sh --ping --networkhost=c62b266.research.intel-berkeley.net
apps/Blink> program.sh --help

logger.sh installation and database basic

To initialise the database, you do .. and will see something like ..

~> $RSCPATH/makedb

The files belonging to this database system will be owned by user "Terence".
This user must also own the server process.

The database cluster will be initialized with locale C.

creating directory /home/terence/pgdata... ok
creating directory /home/terence/pgdata/base... ok
creating directory /home/terence/pgdata/global... ok
creating directory /home/terence/pgdata/pg_xlog... ok
creating directory /home/terence/pgdata/pg_clog... ok
selecting default max_connections... 100
selecting default shared_buffers... 1000
creating configuration files... ok
creating template1 database in /home/terence/pgdata/base/1... ok
initializing pg_shadow... ok
Enter new superuser password:
Enter it again:
setting password... ok
enabling unlimited row size for system tables... ok
initializing pg_depend... ok
creating system views... ok
loading pg_description... ok
creating conversions... ok
setting privileges on built-in objects... ok
creating information schema... ok
vacuuming database template1... ok
copying template1 to template0... ok

Success. You can now start the database server using:

    /usr/bin/postmaster -D /home/terence/pgdata
or
    /usr/bin/pg_ctl -D /home/terence/pgdata -l logfile start

CREATE DATABASE

The username of the newly created database is displayed and the script will prompt you for a password. Remember the username and password you defined here because you are going to need it later. You only need to do makedb once. Once you have your database built, you are set.

To start the database service, you need to issue this command.

~> $RSCPATH/startdb

To login to a local database, you do something like this ..

~> psql rsc 

To login a remote database, you do ...

~> psql -h webbie.berkeley.intel-research.net -U postgres -d rsc 

Once you are in the database, you get issue your favourite SQL command.

rsc=# select * from exp1;

To quit, you do ...

rsc=# \q

logger.sh usage

You can have messages dumped to the uart displayed. You can also archive the messages and create table with logger.sh.

~> logger.sh --createtable --url=localhost/rsc --tablename=exp1 \\
--user=Terence --pass=blah
~> logger.sh --display --source=network@c62b266.research.intel-research.net:10002
~> logger.sh --logging --url=localhost/rsc --tablename=exp1 \\
--user=Terence --pass=blah --source=network@c62b266.research.intel-research.net:10002

Of course, you don't have to use the same ip address, tablename, user and password I have here.

There is a file called PrettyPrint.java in $RSCPATH. Given a byte array, you can have a nicely parse packet nicely printed. You can call David Gay's mig java classes to have parsing done for you.

To make the testbed more useful, I wrote a layer that copy all messages sent and received to and from the radio to the uart, making debugging easier. Included is a Nesc module TestbedDbgM.nc that sit above GenericComm. Hopefully, it will be useful to you.

Care should be taken if you are sending message from pc to uart. Since the layer has no way to identify if that packet comes from air or from uart, it will bounce back the message to the uart at once. You will need to do some filtering in your pc program.

intel-program.sh usage

Since we have a zillion of motes on our testbed, calling logger.sh or program.sh for each one of them is a pain. intel-program.sh basically is a shell script that has a giant loop to fork a process for each mote for you.

Edit intel-program.sh and you will see two variables called MOTES and PLATFORM. Modify those variables to suit your own testbed. The first mote in the $MOTE array will have an id of 1, an id of 2 for the second one, and so on.

You may want to do .. if there are newly connected emotes.

~> ipconfig /flushdns

Here are some examples of using the script.

~> intel-program.sh --erase # erase each one of them
~> intel-program.sh --download # download program to each one of them
~> intel-program.sh --resume --moteid=2 # resume from 2 if download freezed
~> intel-program.sh --createtable --url=localhost/rsc --user=Terence \\
--password=blah --tablename=exp1 # create exp1_n1 for mote 1, exp1_n2 for mote 2
~> intel-program.sh --logging --url=localhost/rsc --user=Terence \\
--password=blah --tablename=exp1 # have mote dump its packets to its own table