330 Cory Testbed Usage Instructions

Testbed Picture



Figure 1: Testbed Layout.  (Despite the hexadecimal numbering in the diagram, the motes are numbered in decimal format in the configuration files given below)
Testbed Layout Picture

Our Testbed is setup to use static IP addressing.  The DHCP addressing instructions below is given for completeness.  The IP address numbering is 192.168.0.1xx, where xx is the moteID.


First Time Testbed Setup Instructions

  1. The first time you set up the network (after physically laying everything out), you must make sure to set the serial communication baud rate on each eMote properly for the mica2dot (see instructions on eMote programming page).
  2. You may also want to assign static IP addresses for each mote (again, see instructions on eMote programming page), depending on whether or not you have a DHCP server running on your computer.
  3. To turn on the PoE switch, plug it in (there is no on/off button).  At first, the fault light will be on.  This is normal, as it is part of the boot up phase.  After a minute or two, it will go through a self test and check that all the ports are active.
Note:   Resetting the power on the ethernet switch will make the motes request their IP addresses again.

Step I: Setting up network to use DHCP IP addressing

(Skip this step if you are using static IP addressing)
  1. Make sure your laptop is running a DHCP server, to give each of the eMotes an IP address.
  2. Plug your computer to the switch using an ethernet cable to any one of the ports.

Step II: Programming the network

We will use the scripts in tinyos-1.x/contrib/testbed for programming the network.  Read the readme file included in that directory for details on how to use the files.  The instructions below include sample commands specific to our network.  Many of the environment variables can be set in your .bashrc file.

  1. Dump cory330-testbed-dhcp.cfg in the directory tinyos-1.x/contrib/testbed/testbed if you are using DHCP.  This file is using the IP to mote mappings specified in the dhcpsrv.ini file above.  For static IP configurations that correspond to the moteIDs, dump the file cory330-testbed.cfg in the directory tinyos-1.x/contrib/testbed/testbed.  The MAC address to mote mapping, despite the difference in IP addresses, is the same as that found above.
  2. Set the environment variables TOS_TESTBED_CONFIG and PERL5LIB for the scripts to run properly
    export PERL5LIB="/opt/tinyos-1.x/contrib/testbed/perl"
    export TOS_TESTBED_CONFIG="/opt/tinyos-1.x/contrib/testbed/testbed/cory330-testbed.cfg"
  3. Add the directory tinyos-1.x/contrib/testbed/scripts to your PATH variable and set RSCPATH appropriately.
    export RSCPATH="/opt/tinyos-1.x/contrib/testbed/rsc"
    export TESTBED_SCRIPTS="/opt/tinyos-1.x/contrib/testbed/scripts"
    export PATH="$PATH:$TESTBED_SCRIPTS"
    Note: These scripts will NOT be called correctly if you also have the directory containing Terence's RSC scripts in your PATH and RSCPATH variables.  This is because the testbed scripts call a modified version of intel-program.sh residing in the testbed/scripts directory which has the same name as intel-program.sh in the RSC scripts.  You can use either the RSC scripts OR the testbed scripts, not both.  When running one, remember to remove the references to the other in your PATH and RSCPATH variables.
  4. Change to the directory containing your NesC program.  Then type at the command prompt
    testbed-program.pl --testbed=$TOS_TESTBED_CONFIG --download

Step III: Logging Data from the network over Ethernet

(This step assumes you have done the setup in step II above)

NesC Programming Changes

To broadcast over the ethernet, you need to change your NesC programs to send to TOS_UART_ADDR.   The packets from each mote will arrive on IP_Addr_of_eMote:10002 .  Choosing the right channel for the serial forwarder to listen to is handled by the scripts below.

Starting Services on the Base Station

  1. First make sure that you have compiled the java packet listener, and have added the testbed's java directory to your classpath.  Run
    export CLASSPATH="$CLASSPATH;C:/tinyos/cygwin/opt/tinyos-1.x/contrib/testbed/java"
    javac tinyos-1.x/contrib/testbed/java/net/tinyos/testbed/*.java

  2. Start a serial forwarder for each mote (no GUI).  Run
    testbed_start_sf.pl
    Note that this will take a LOT of memory. With 45 motes, it will take something on the order of 700 MB of memory to open a serial forwarder to each mote.
  3. Start the java packet listener.  Run
    java net.tinyos.testbed.TestBedPacketLogger <testbed config file> <time to run(seconds)>
  4. Start any other java application you need that interfaces with serial forwarder.
  5. Tell the network to start reporting (if you wrote your NesC code to have a 'start' command to send to your motes).
  6. When you are done, remember to kill al the background serial forwarder processes that are running.  Run
    cygwin_kill_all.sh java
    to kill all java processes running.  If you wish to be more specific on which processes to kill, use ps to list the "options".  The script uses grep to match the argument after the script with the strings listed by ps.

Debugging Tips