Recent Changes - Search:

How to Write Applications for TelosB Devices or similar

TelosB nodes are deployed at CCSR Testbed in Guildford. TelosB motes can be programmed with different languages and OSs ranging from pure C code to TinyOS/Contiki. Currently the Guildford testbed with respect to the provision of tools for configuring, conducting and collecting results of an experiment is fully supporting applications written for TelosB motes using the TinyOS operative system. Support for Contiki is currently ongoing and it will be provided in the near future.

In order to develop TinyOS applications for the Guildford testbed, some useful information is provided below.

First of all, the TinyOS environment needs to be properly set up on your local machine in order to develop your TinyOS application for TelosB motes. Although it is possible to install TinyOS on a large variety of machines and OSs (such as Linux,Windows and MacOSX) we strongly recommend to install TinyOS on a linux machine. Detailed information on how to easily install can be found at the following link.

Once you have the TinyOS environment properly set up on your local machine you maybe want to test it by running the first basic application, called Blink. This application basically turns on and off the three LED available on the TelosB platform in order to emulate a binary counter. In order to do this, from a terminal, you can navigate to the apps folder in your TinyOS installation (something like /opt/tinyos-2.1.1/apps) and locate the Blink folder. Move to this folder and run the following command:

make telosb

This will generate an exe file that is the result of the compilation and that represents the basic assembler code that your TelosB can interpret and run. If you have some spare TelosB motes and you want to test your application before deploying it on the nodes at the Guildford testbed, you can do this by connecting your TelsoB mote to your computer using the provided USB connector. You can then run the following command:


in order to discover to which virtual serial adapter your TelosB is mapped. You will get an output similar to this:

Reference Device Description

---------------- ---------------------------------------------

XBSL1F6Z /dev/ttyUSB0 XBOW Crossbow Telos Rev.B

showing that your TelosB (XBOW version) mote is connected to the /dev/ttyUSB0 port of your machine.

Having obtained this information, the Blink application can be installed on your local mote, by typing the following:

make telosb install.0 bsl,/dev/ttyUSB0

where the .0 parameter tells to the boot strap loader to assign ID 0 to the following node. In order to better understand the TinyOS programming paradigm and how to develop more complex TinyOS application, requiring also the use of other resources, such as radio and serial communication with a connected host (the latter very useful for collecting debug information during your experiment), please follow the TinyOS tutorial at the following link.

Assuming that you have already a good comprehension of the TinyOS programming and you are able to write your own application, in case you want to exploit the additional sensors (such as the context-aware and energy metering unit) provided by our platform and interfaced with the TelosB mote a set of libraries are available and can be requested via email to Guildford testbed administrator.

This library comes with a new defined interface called SmartBox and providing the following commands and events:

interface SmartBox {
command void ledToggle();
command void ledOn();
command void ledOff();
command void enableOffTimers(uint8_t on);
command void setSamplingPeriod(uint16_t period);
event void samplesReady(context_msg_t* payload);

The first three can be used for toggling (turning on and off) an additional LED provided by our external sensor board. When interfaced with an external actuator (such as desk lamps) this LED can be used to control the switching frequency of a connected desk lamp for soft actuation feedback. Similarly, the enableOffTimers can be used in order to use our energy meter as an actuator, for instance for turning on and off the connected appliances. The command setSamplingPeriod can be used in order to set up the period for polling the energy meter and the sensors provided by our extension board in order to read the produced value. The firing of the event samplesReady generates a report containing the packet with the required observed information following an event-driven paradigm common in TinyOS programming. More information about this, in particular of the structure of the returned packet, can be found in the documentation attached to the driver software.

Finally, in order to use this interface in your application, the following component wiring needs to be specified in your application configuration file:

components SmartBoxC;

YourApplicationC.SubControl -> SmartBoxC;

YourApplicationC.SmartBox -> SmartBoxC;

In a similar way the same codes can be compiled and installed on the additional provided XM1000 Adavanticsys TelosB clones deployed at the Guildford testbed. More information on how to use TinyOS with this platform can be found at the following link.

Once you have your application ready and properly working and you want to deploy on our Guildford testbed, in order to simplify your interaction with the testbed, a GUI, called TMON, is available. The purpose of such GUI is to allow the user to browse the available nodes, reserve part of them, upload them with a image and collect and visualize the results of an experiment in the SmartSantander Experiment Repository. The GUI is provided at the following link .

More details about TMON and how to use it can be found at the following section TMON.

Edit - History - Print - Recent Changes - Search
Page last modified on December 05, 2012, at 02:39 PM