TinyOS 2.1 code for SBT80 and WiEye Sensor Boards 1.0 Overview * Sample TinyOS 2.1 and Java code for reading sensor channels of SBT80 and WiEye sensor boards using the TelosB motes are available at http://www.easysen.com/support/TinyOS_2 * This document refers to the sensor board SBT80 in the following description. However, the same code can be used for reading the sensor channels on WiEye Sensor board. In this case, users must ignore the last 4 data bytes of each packet displayed on the PC. * To obtain further details on the mote to PC communication and displaying data on PC as described below, please refer to TinyOS 2.1 Tutorial Lesson #4 at http://docs.tinyos.net/index.php/Mote-PC_serial_communication_and_SerialForwarder * The description in this document assumes windows XP operating system with cygwin and a TinyOS 2.1 installation as described in http://docs.tinyos.net/index.php/Installing_TinyOS_2.1#Manual_installation_on_your_host_OS_with_RPMs. However, users with other operating systems should be able to use the same code with minor changes. * The sample application SenseToRadio consists of the following files: File Name Description SenseToRadioAppC.nc Main file with the application code. This samples all 8 sensor channels and transmit data directly to a PC via USB and also to a another mote via the wireless interface. SenseToRadioC.nc Configuration file associated with SenseToRadioAppC.nc SBT80ADCmap.h Header file defining the ADC mappings for TelosB motes SBT80_ADCconfigC.nc configuration file for reading ADC channels in TelosB motes SBT80_ADCconfigP.nc configuration file for reading ADC channels in TelosB motes SenseToRadio.h Header file defining the custom packet structure to carry SBT80 data SenseToRadioMsg.class java class file auomatically generated by MIG using SenseToRadio.h during compilation of application SenseToRadio SenseToRadioMsg.java java file auomatically generated by MIG using SenseToRadio.h during compilation of application SenseToRadio Makefile Compilation options during the "make telosb" command is specified here 2.0 Programming Sequence For Reading Sensor Data From a PC Directly via USB Port: 2.1. Program one TelosB mote with the SenseToRadio application given here. (a) Copy and unzip the folder SenseToRadio into the /opt/tinyos2.x/apps folder in your TinyOS installation (above files will be inside /opt/tinyos2.x/apps/SenseToRadio folder) (b) Connect one TelosB mote to the PC USB connector. (c) Open a cygwin window, go inside the folder /opt/tinyos2.x/apps/SenseToRadio in the cygwin prompt (d) Execute the command make telosB install.1 This will install the application code into the TelosB mote. Here the number "1" represents the address assigned to this particular mote. Users are free to assign any address for this purpose 2.2. Connect the sensor board SBT80 to the expansion connector of the TelosB mote 2.3. Display sensor readings on PC: (e) Ensure that the newly programmed TelosB mote is attached to the PC via the USB port (f) Open a cygwin window (or by reusing the same cygwin prompt above) (g) Execute the command motelist This will display the serial port number the telosB mote is connected to the PC Example : COM6 (h) Go inside the folder /opt/tinyos2.x/apps/SenseToRadio in the cygwin prompt (i) Using the above COM port number, execute the following command at the cygwin prompt java net.tinyos.tools.PrintfClient -comm serial@COM6:telosb (j) This should create a display the sensor data at the cygwin window as shown in Figure 1.0 (sensor readings are shown with decimal values in the range of 0-4095) Figure 1.0 Displayed sensor readings on PC when direct connected to the USB port 3.0 Programming Sequence For Transmitting Data To a Base Station Mote Over The Wireless Interface: 3.1. Program one TelosB mote (#1) with the SenseToRadio application given here. (k) Copy and unzip the folder SenseToRadio into the /opt/tinyos2.x/apps folder in your TinyOS installation (above files will be inside /opt/tinyos2.x/apps/SenseToRadio folder) (l) Connect one TelosB mote to the PC USB connector. (m) Open a cygwin window, go inside the folder /opt/tinyos2.x/apps/SenseToRadio in the cygwin prompt (n) Execute the command make telosB install.1 This will install the application code into the TelosB mote. Here the number "1" represents the address assigned to this particular mote. Users are free to assign any address for this purpose 3.2. Connect the sensor board SBT80 to the expansion connector of the TelosB mote #1 3.3. Program a second TelosB mote (#2) with the BaseStation application (a) BaseStation application is available in the default TinyOS 2.1 installation under the folder /opt/tinyos2.x/apps/BaseStation (b) Open a cygwin window (or by reusing the same cygwin window above), go inside the folder /opt/tinyos2.x/apps/BaseStation in the cygwin prompt (c) Execute the command make telosB install.9 This will install the BaseStation application code into the TelosB mote #2 Here the number "9" represents the address assigned to this base station mote. Users are free to assign any address for this purpose, however, please make sure that you use a different number than the addresses used to program other motes in step 1 above. 3.4. Display sensor readings on PC - attached to the BaseStation mote: (a) Ensure that the TelosB mote #2 with BaseStation application is attached to the PC via the USB port (b) Open a cygwin window (or by reusing the same cygwin prompt above) (c) Execute the command motelist This will display the serial port number the telosB mote is connected to the PC Example : COM4 (d) Go inside the folder /opt/tinyos2.x/apps/SenseToRadio in the cygwin prompt (e) Using the above COM port number, execute the following command at the cygwin prompt java net.tinyos.tools.MsgReader SenseToRadioMsg -comm serial@COM4:telos (f) This should create a display the sensor data at the cygwin window as shown in Figure 2.0: (Note that the sensor data displayed here are in the same order as in Figure 1. However the values are displayed in hex.) Figure 2.0 Displayed sensor readings on PC when connected to the PC via Base station mote 4.0. Contact Information Web site: http://www.easysen.com Sales: info@easysen.com Technical Support: support@easysen.com Phone: +1.574.607.5047 Address: EasySen, LLC. 401 North Coquillard Dr. South Bend, IN 46617 c 2009 EasySen LLC.