TinyOS 1.x Installation on Windows XP
This is a tutorial on how to install TinyOS 1.x on your Windows XP or Vista PC. It assumes you are starting with a clean installation of the OS.
Contents
Configuring the Environment
TinyOS requires Cygwin and a Java development environment. Follow these steps to set this up.
- Download and install Cygwin. Be sure to select cvs, gcc, gdb, openssh, perl, rpm, and vim for installation.
- You may want to add "set nocompatible" to ~/.vimrc to allow insert mode in vim.
- Download and install Sun's latest JDK.
- Download and install Sun's javax.comm package.
- Unzip javacomm20-win32.zip
- Copy win32comm.dll to C:\Program Files\Java\jdkxxxx\jre\bin
- Copy comm.jar to C:\Program Files\Java\jdkxxxx\jre\lib\ext
- Copy javax.comm.properties to C:\Program Files\Java\jdkxxxx\jre\lib
- Download and install graphviz.
- Download and install Eclipse, a Java IDE.
- Download and install a text editor. I recommend Textpad.
Installing TinyOS
The following instructions will download the CVS version of TinyOS. While this may contain some non-stable code, it will give you the most recent version. By checking it out from CVS, you can always switch versions of TinyOS or stay synchronized with the most recent code.
- Download the following RPMs into a temporary folder. They were obtained from here and here:
- If you are using Windows Vista, always start Cygwin in administrator mode.
- In Cygwin, go to the temporary folder with the RPMs and install them using:
- rpm --ignoreos -ivh *.rpm
- In Cygwin, use CVS to download the TinyOS source files.
- Non-Developer access (Note: the second command will prompt for a password, just hit enter):
- cd /opt
- cvs -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos login
- cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co -P tinyos-1.x
- Developer access: Be sure to configure the shared SSH keys!
- cd /opt
- export CVS_RSH=ssh
- cvs -z3 -d:ext:developername@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co -P tinyos-1.x
- Non-Developer access (Note: the second command will prompt for a password, just hit enter):
- Create file /opt/tinyos-1.x/tools/make/MakeLocal. Here is an example of what it should contain.
- Save washu.sh and tinyos.sh in /etc/profile.d.
- You may have to create /usr/local/bin/locate-jre with the following contents.
- Compile the Java code.
- cd /opt/tinyos-1.x/tools/java
- make
- Setup java's JNI library:
- cd /opt/tinyos-1.x/tools/java/jni
- make install
Installing Platform Support
TinyOS works on several hardware architectures. Here are instructions on how to add support for Mica2 and TelosB motes.
AVR Tools for Mica/Mica2/MicaZ Motes
- Download the following rpms into a temporary folder:
- Open cygwin and go to the temporary folder that you saved the rpms into and install them using:
- rpm --ignoreos -ivh *.rpm
- If you borrow an IOGear USB-to-Serial cable from the Mobilab (which is silver in color), here are the drivers. If you borrow a black USB-to-serial cable, here are the drivers.
MSP430 Tools for Telos Support
- If you are using TelosB motes, you may download the USB-to-Serial drivers here.
- Download the following rpms into a temporary folder:
- Open cygwin and go to the temporary folder that you saved the rpms into and install them using:
- rpm --ignoreos --nodeps -ivh *.rpm
Installing a TinyOS 1.x Application
We will now verify your TinyOS running the Oscilloscope application that comes with TinyOS 1.x. This application consists of two NesC programs (OscilloscopeRF and TOSBase) and two Java programs (SerialForwarder and oscilloscope). OscilloscopeRF periodically takes a sensor reading and broadcasts it wirelessly. TOSBase forwards the data to the base station. SerialForwarder receives the data from a serial port and forwards it to a local TCP port. Oscilloscope takes the data from the TCP port and displays in a GUI.
Customizing OscilloscopeRF
Before installing the application, you need to go into the source code of OscilloscopeRF to customize which sensor it uses and how frequently it takes a sensor reading. To do this, perform the following operations in Cygwin:
- cd /opt/tinyos-1.x/apps/OscilloscopeRF
- Open Oscilloscope.nc and change "DemoSensorC" to "Photo" on line 46. This will make it sense light readings.
- Open OscilloscopeM.nc amd change "125" to "8" on line 99. This is the period at which sensor readings will be taken. The period is in binary milliseconds (1024 = 1s). By changing it to 8, we will be taking 128 sensor readings per second.
Compiling and Installing the Application
Now that you have customized OscilloscopeRF, it's time to compile and install it. The following instructions are divided into Mica2 users and TelosB users. Follow the instructions for your platform. After installing the NesC programs, follow the instructions on how to launch the Java applications.
Mica2 users:
- Connect the MIB510 programming board to your computer. Note which serial port it is attached to. To find out, go into Device Manager and see which COM port it shows up as (see picture below). If it is COM1, the corresponding UNIX name is /dev/ttyS0. The UNIX number is always the Windows number - 1. For now, we assume it is attached to /dev/ttyS0.
- Attach a Mica2 mote to the programming board
- In Cygwin:
- cd /opt/tinyos-1.x/apps/OscilloscopeRF
- make mica2 install.1 mib510,/dev/ttyS0
- Remove the mote from the programming board and attach another mote.
- In Cygwin:
- cd /opt/tinyos-1.x/apps/TOSBase
- make mica2 install.0 mib510,/dev/ttyS0
- Leave the mote programmed with TOSBase on the programming board.
- Turn on the mote with OscilloscopeRF by plugging in two AA batteries and turning on the switch.
- You should now see the LEDs on both motes blinking.
TelosB users:
- Connect a TelosB mote to your USB port. Note which USB port it shows up as. To find out, go into Device Manager and see which COM port it shows up as. If it is COM1, the corresponding UNIX name is /dev/ttyS0. The UNIX number is always the Windows number - 1. For now, we assume it is attached to /dev/ttyS0.
- In Cygwin:
- cd /opt/tinyos-1.x/apps/OscilloscopeRF
- make telosb install.1 bsl,/dev/ttyS0
- Remove the TelosB mote from your computer and attach another mote.
- In Cygwin:
- cd /opt/tinyos-1.x/apps/TOSBase
- make telosb install.0 bsl,/dev/ttyS0
- Leave the mote programmed with TOSBase on the programming board.
- Turn on the mote with OscilloscopeRF by plugging in two AA batteries.
- You should now see the LEDs on both motes blinking.
Launching the Java Applications
- In Cygwin:
- cd /opt/tinyos-1.x/tools/java
- java net.tinyos.sf.SerialForwarder &
- java net.tinyos.oscope.oscilloscope
- If everything works, you should see the following: