Difference between revisions of "Quickstart: TelosB"

From TinyOS Wiki
Jump to: navigation, search
m (Getting started using Ubuntu 9.10 and TelosB motes moved to Quickstart: TelosB: Ubuntu 9.10?? Duplicate install instructions are outdated.)
 
Line 1: Line 1:
This page details how to install TinyOS 2.1 on Ubuntu 9.10 and it provides a tutorial on running the provided Blink and Oscilloscope applications on TelosB sensor motes, after running these you should have a greater understanding of TinyOS and [[TelosB]] motes.
+
This page provides a tutorial on running the provided Blink and Oscilloscope applications on TelosB sensor motes, after running these you should have a greater understanding of TinyOS and [[TelosB]] motes.
  
Note on conventions used below:
 
*Anything in a box is code that is entered into a terminal.
 
 
 
==Installing TinyOS 2.1 on Ubuntu 9.10==
 
 
Install Ubuntu 9.10 and run full updates.
 
 
Add the TinyOS repository to your list of packages start by opening sources.list
 
<pre>sudo gedit /etc/apt/sources.list</pre>
 
 
Add the following line at the bottom of sources.list
 
<pre>deb http://tinyos.stanford.edu/tinyos/dists/ubuntu hardy main
 
deb http://hinrg.cs.jhu.edu/tinyos oneiric main</pre>
 
 
Update sources.list by typing
 
<pre>sudo apt-get update</pre>
 
 
Install TinyOS 2.1
 
<pre>sudo apt-get install tinyos-2.1.0</pre>
 
You should get two questions answer yes to both. During the install you will have to say OK and Yes to EULA information
 
 
Edit your ~/.bashrc file in your home directory to set up the environment for TinyOS development at login
 
<pre>sudo gedit ~/.bashrc</pre>
 
 
Add the following two lines:
 
<pre>source /opt/tinyos-2.1.0/tinyos.sh
 
export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:.</pre>
 
(NOTE: the . at the end is intentional)
 
 
Save and exit the .bashrc file
 
Next run the command
 
<pre>source ~/.bashrc</pre>
 
 
Run the following to prevent errors with java apps
 
<pre>sudo tos-install-jni</pre>
 
 
If you are getting any errors running make on the nesC files run the following...
 
<pre>sudo apt-get install g++
 
sudo apt-get install python2.5-dev</pre>
 
 
Edit your ~/.bashrc file in your home directory. Add the following line:
 
<pre>export PYTHONPATH=$TOSROOT/support/sdk/python</pre>
 
 
Save and exit the .bashrc file, run the command
 
<pre>source ~/.bashrc</pre>
 
  
 
==Blink: An example Hello World program==
 
==Blink: An example Hello World program==
Line 53: Line 7:
  
 
Enter the application directory
 
Enter the application directory
<pre>cd /opt/tinyos-2.1.0/apps/Blink</pre>
+
<pre>cd <tinyos code directory>/apps/Blink</pre>
  
 
Compile the application
 
Compile the application
Line 65: Line 19:
 
Example of motelist output:
 
Example of motelist output:
 
<pre>
 
<pre>
Reference Device Description
+
Reference Device           Description
 
---------- ---------------- ---------------------------------------------
 
---------- ---------------- ---------------------------------------------
XBS5H6PH /dev/ttyUSB0 XBOW Crossbow Telos Rev.B</pre>
+
XBS5H6PH   /dev/ttyUSB0     XBOW Crossbow Telos Rev.B</pre>
  
 
Install application to the specified mote
 
Install application to the specified mote
Line 103: Line 57:
  
 
Enter the Oscilloscope application directory
 
Enter the Oscilloscope application directory
<pre>cd /opt/tinyos-2.1.0/apps/Oscilloscope</pre>
+
<pre>cd <tinyos code directory>/apps/Oscilloscope</pre>
  
 
Compile the Oscilloscope application
 
Compile the Oscilloscope application
Line 126: Line 80:
  
 
Enter the BaseStation application directory
 
Enter the BaseStation application directory
<pre>cd /opt/tinyos-2.1.0/apps/BaseStation</pre>
+
<pre>cd <tinyos code directory>/apps/BaseStation</pre>
  
 
Begin by compiling the BaseStation application
 
Begin by compiling the BaseStation application

Latest revision as of 18:38, 12 May 2013

This page provides a tutorial on running the provided Blink and Oscilloscope applications on TelosB sensor motes, after running these you should have a greater understanding of TinyOS and TelosB motes.


Blink: An example Hello World program

Open a terminal

Enter the application directory

cd <tinyos code directory>/apps/Blink

Compile the application

make telosb

Insert mote into USB

List available motes

motelist

Example of motelist output:

Reference  Device           Description
---------- ---------------- ---------------------------------------------
XBS5H6PH   /dev/ttyUSB0     XBOW Crossbow Telos Rev.B

Install application to the specified mote

make telosb reinstall bsl,/dev/ttyUSB0

Replace /dev/ttyUSB0 with what motelist displays for you


Installing Applications on TelosB mote: General Process

1) In the application directory, begin by compiling the program

make telosb

2) Next, insert the TelosB mote via USB

3) Verify the mote is recognized. Take note of the USB path under Device column, as this is used in specifying the path for the installation. In most cases, the DEVICE path is in the format /dev/ttyUSBx on Linux.

motelist

4) Still in the application directory, install the application on the mote that is currently connected

make telosb reinstall bsl,DEVICE

where DEVICE is the USB Device path provided from motelist command. example: make telosb reinstall bsl,/dev/ttyUSB0

5) Thats it, if no errors occurred, the application is now running on the mote.

Oscilloscope Application: BaseStation & Sensor Testing

Oscilloscope is a good application provided that you can test mote to mote communication with a base station

Overview

  • Compile & Install Oscilloscope application on one or more motes
  • Compile & Install BaseStation application on a mote connected via USB
  • Run the Serial Forwarder
  • Execute Java based Oscilloscope application

Compile & Install Oscilloscope application on one or more motes

Enter the Oscilloscope application directory

cd <tinyos code directory>/apps/Oscilloscope

Compile the Oscilloscope application

make telosb

Install Oscilloscope application to TelosB mote

make telosb reinstall bsl,DEVICE

DEVICE is the path name of the USB connected mote that can be found by running the command motelist

If no errors occur, Oscilloscope is now installed on the mote. Remove the mote. Note: if you are going to use multiple motes to transmit data to the BaseStation you need to label them to avoid conflict

An example would be, instead of using: make telosb reinstall bsl,DEVICE like we did above for one sensor we can use the following for the first mote

 make telosb install,1

And the following for the second mote

 make telosb install,2

Additional motes can be added this way as well.

Compile & Install BaseStation application on a mote connected via USB

Enter the BaseStation application directory

cd <tinyos code directory>/apps/BaseStation

Begin by compiling the BaseStation application

make telosb

Next, connect a TelosB mote via USB connection

Install the BaseStation application to the connected telosb mote

make telosb reinstall bsl,DEVICE

DEVICE is the path name of the USB connected mote that can be found by running the command motelist

NOTE: Do not remove this mote, it is the BaseStation and is used to collect data from the other motes in the network that have Oscilloscope installed.

Run the Serial Forwarder

Run Serial Forwarder in a separate terminal

java net.tinyos.sf.SerialForwarder -comm serial@DEVICE:telosb

DEVICE can be found by executing the command motelist

motelist

EXAMPLE: java net.tinyos.sf.SerialForwarder -comm serial@/dev/ttyUSB0:telosb

Execute Java based Oscilloscope application

The Java application itself is in the Oscilloscope application directory in the subdirectory java. Begin by entering this directory

cd /opt/tinyos-2.1.0/apps/Oscilloscope/java

Next run the make command

make

You can then run Oscilloscope Java Application with the following

./run

What's Next?

  • Read more detailed tutorials on this wiki to further you knowledge on nesC programing and TinyOS
  • Try to fork Oscilloscope so it reads from a different sensor then default (Temperature is a good project)