Motes, nesC and TinyOS

TinyOS Resources

I gave an introductory talk about TinyOS, in which I mentioned the following resources:

Crossbow has also given a training seminar on TinyOS, and the materials are now available on the research filesystem (they include several series of presentation slides, and an installer to use the TinyOS distribution on MS Windows.)


Instructions for using TinyOS and TOSSIM on the research machines

Getting started

TinyOS, TOSSIM, and several dependent tools have been installed for access from BU Linux machines in the research lab. To use TinyOS, you should:

  1. Make sure you are running on a BU Linux machine which can mount /research/tinyos from moby.
  2. Set up your environment to access the local TinyOS installation. If you are using a Bourne-style shell, you can do this with the command
    . /research/tinyos/bin/tinyos.sh
    (it is probably easiest to add that command to your shell startup script). For other shells, you will need to use commands equivalent to those given in that tinyos.sh file.
  3. Test that everything so far is working by executing the command toscheck (which should be found in /research/tinyos/bin/, added to your $PATH in the previous step). If all is well, toscheck should spit out dozens of lines of diagnostics, ending with:
    toscheck completed without error.
    If not, go back and check for errors.

If you have completed the above successfully, you should now be ready to play with TinyOS. The documentation is installed under:

/research/tinyos/tosroot/doc/index.html
and the tutorial included there is probably worth investigating at this point.

The "hello, world" example

As a very brief example of how to use TOSSIM, here are the instructions for running a simulation of the Morse Code example given in the introductory talk:

  1. Create a convenient working directory (/tmp/foo for the purpose of this example, but any reasonable one will do):
    mkdir /tmp/foo && cd /tmp/foo
  2. Copy the module and configuration components and the trivial Makefile for the "hello, world" example into that directory. A tar file is available to make this easier:
    tar xf /research/tinyos/hello-world-example.tar
  3. Compile everything into a simulator binary:
    make pc
  4. Run the simulator to make sure it works (this step assumes you are using a Bourne-style shell):
    DBG=led ./build/pc/main.exe -l=1 1
    After a short pause, you should see messages reading "0: LEDS: Red on." and "0: LEDS: Red off." from time to time, as the simulated Mote blinks "hello, world". Stop the program as soon as you are sick of it.
  5. Run the simulator again under TinyViz, to test the graphical interface:
    tinyviz -run ./build/pc/main.exe 30
    Once the simulator eventually loads, you should see 30 simulated Motes start to blink away.
  6. To program the same example into real Mote hardware, connect one of the programming boards to the first serial port, ensure you have write permission to the appropriate serial device (/dev/ttyS0), and run the command:
    MIB510=/dev/ttyS0 make install mica2
    Once programming is complete, the red LEDs on the Mote and programming board should blink "Hello, world."

That's all for this example... if everything has worked so far, then hopefully you are now set to run your own experiments.

(Some further sample files to demonstrate the radio stack are:

/research/tinyos/hello-world-radio-transmitter.tar
/research/tinyos/hello-world-radio-receiver.tar
which transmit and receive "hello, world" in Morse code via radio.)

Other notes

NB: Our installation varies from that assumed in the documentation in a few subtle ways. One notable exception is that you should create a working directory outside the TinyOS installation for your own experiments, rather than doing everything under the apps directory. If you want to use any of the distribution examples, you should copy the entire application directory (e.g. /research/tinyos/tosroot/apps/Blink) to somewhere convenient, and edit the (very short) Makefile to read:

include /research/tinyos/tosroot/apps/Makerules
in place of:
include ../Makerules

If you are feeling adventurous, I have installed the TinyOS 1.1.15 CVS snapshot under /research/tinyos/tosroot-1.1.15. If you want to use 1.1.15 for any reason, please use the script /research/tinyos/bin/tinyos-1.1.15.sh instead of /research/tinyos/bin/tinyos.sh when setting up your environment.

We now have a testbed wireless sensor network installed, which is measuring the temperature in the labs.


Gary Wong