Introduction: Using Cygwin for SALAMANDER Testing

This instructive will walk you through different steps on how to use cygwin.  We will learn how to navigate to different folders inside of cygwin, program motes, listen to motes, save files to different folders, and also learn how to translate files into a excel document.

** This instructable is primarily for the SALAMANDER Sensors Project ** 
** www.salamandersensors.org **

Step 1: Navigating to Different Folders Inside of Cygwin

When you first start up cygwin you will be given a command line similar to picture below.

The command line above where you type tells you what folder you are currently positioned. 

To get to the main cygwin folder you will want to type in "cd ../../", This will take you the main cygwin folder.

You can get to this file through my computer navigating to " C:\cygwin  " from here you can see what all file and folders that are located inside this main folder for cygwin. **** It's also possible to see what files and folders are under the main cygwin folder by typing "ls" (LS) into the command line.

Now that we know folders are located inside this folder we can decide which folder we want to goto next. 

To move to the next folder type "cd (foldername)" into the command line. The folder name wont have the () around it. Also the foldername can't have any spaces in it. The folder name can contain - or . but no spaces!

We are now in the folder called opt, from which we can follow the same process to move to folder deeper by looking at the folder contained inside of opt.

You can always go back a folder if you need to by typing "cd ../" each time you type this it will take you back one folder.

Step 2: Programming Motes

Now that we now how to navigate to different folders inside cygwin we can program motes.

You will first want to locate where you software to install onto motes is located.

In the example below my software in located at " C:\cygwin\opt\moteiv\tinyos-1.x\contrib\uofl\apps\salamander"

So to recap to navigate to this folder from start up I would type
"cd ../../
cd opt
cd moteiv
cd tinyos-1.x
cd contrib
cd uofl
cd apps
cd salamander" Now I am located inside this folder.

We are now located inside this folder we will want to open the software we want to install and make sure it has all the settings we want to load onto the mote.

After we have assured that the setting are correct we will type "make telosb" into the command line. This will compile the software in the folder we are currently located.

Once the software has been compiled we can install it to a mote. We will now plug in the mote that we want to install this program onto. Once it has been plugged in you type " make telosb reinstall,#" The # is the number you want to make the mote. This will help keep track of each mote once we have more than one on out in the field. 

The program will run through lines of code and install the software onto the mote, and your mote will be ready to use.


Step 3: Listening to Motes and Saving the File

We now know how to program motes we need to be able to listen to these motes so we can get the information back to the computer. 

To be able to listen to motes you have to have one of the motes setup with a listening program. Once you have this plug it into one of your usb ports. Now start up cygwin and type in "motelist" this will let you know what com port your listener is plugged into.

In the example below my listener is plugged into com port 7.

We know which com port we are plugged into we can type in the following, "motecom=serial@COM7:tmote java net.tinyos.tools.Listen" this will allow you to receive information from all of the motes in the field. 

If it was typed in correctly you will get a line that say "serial@COM7:57600: resynchronising  " This will let you know that everything is plugged in correctly and you are just waiting for a mote to be turned on or waiting for it to send information to you. 

Once a mote is turned on you will start receiving lots a hex numbers. These values will keep coming in until you press (ctrl + c) this will stop the listening command and give you a new command line. 

With all the values it is hard to understand what the information is telling you while it is in hex number. So we will now learn to save this values as a file and be able to translate later and make more sense of the values.

From the command line you will want to type "motecom=serial@COM7:tmote java net.tinyos.tools.Listen > example.txt" This will save all the hex values into a text file called example and this file will be saved under which ever folder you have navigated to last. Also to stop the file from continuing to receive information press (ctrl + c)

Saving these values into a text document will make it easier later on for us to convert them in to decimal values that are easier for us to understand, also it will organize these values into column format. 

Step 4: Translating the Text Documents Into Excel Files

We have just saved text documents into a folder of our choice we want to translate them into a excel file so we can better understand the information we received. 

The first the we want to find it where a translator file is located which in this example is called "TripleSensorBatchTranslatorJuly22_2010". In the example I have my file in the main folder in cygwin. Along with my translator file inside the cygwin folder I have a folder called "ProcessMe". This is the folder that all the text file I want translated to need to be located. So I will now copy all my files from the folder that I previous saved in and move them to the ProcessMe folder. 

Once all files have been moved into this folder we will open cygwin up and navigate to the folder our translator file is located in.

We are now in the folder with the translator we will type the following "perl TripleSensorBatchTranslatorJuly22_2010.pl" This will begin the process of translating all the text file into excel files. Once the new command line appears it means that all files in the ProcessMe folder have been changed into excel files.

You can now open all the new files into excel and better understand all the hex values in decimal form as well as organized them into column orientation.