Lab 7: Introduction to Sensor Networks - Data Aggregation

Assigned: April 27th. Due: May 2nd 11:00 PM via email -- Hard deadline.


In the last lab on sensor networks you looked at how you can use the sensors already available on the Motes to sense the environment, and display it on the screen. It was also discussed in class that sensors by themselves are not a new concept, except that miniaturization, low power, programmability, etc., along with wireless capabilities synergize to make them a power tool. Today, you will make use of these motes in a scenario where they will communicate over wireless and send information to a sink node. This way, sensors could be used to sense locations which may be unreachable or unwieldy to sense by normal wired sensors.

NB: You do not need batteries to power the motes. They can draw power from the USB port of a powered on Laptop. Once the application has been uploaded, you can connect them to any of the other three Laptops (node_b/ node_c/ node_d), just to power them. You may use batteries if you prefer the mobility, but is unnecessary.


As a first step start the X windows system using the following command, after logging into node_a.
 	# This command will bring up the X windowing system
	$ startx
Similar to how a group of computers may have a single network group ID, motes may also be assigned a group address. They can read this information from a file located in the $TOSROOT/apps/ directory. First, change into this directory and create a file named Makelocal (you may use your favorite editor to achieve this). This file should contain an 8 bit hexa decimal number which will act as the groups group address. Since each lab-group should use a different address, just use your group number to avoid any clashes. For example, lab-group 8 would create the file Makelocal, and add the following line.
	# In file $TOSROOT/apps/Makelocal, group 8 would write a line as follows, using
	# their fav. text editor.
	# Other groups would replace the number "08" with their group number.

This completes the setup required for the group ID.

In this assignment, we will program two motes to sense data and send all their information to a sink mote. Hence, you will need a total of 3 motes. First, let us program the motes which will send information as radio packets to their surrounding motes. You will make use of a slightly modified version of the Oscilloscope application, which senses and sends packets via the radio interface, instead of sending them over USB. The sink mote will use an application which can read decode these packets off the air, and send them over USB for the java Oscilloscope application to read it.

To upload the "OscilloscopeRF" application, first change to the directory "$TOSROOT/apps/OscilloscopeRF". Similar to the commands used to upload an application in assignment 10, use the following command.
	# Upload the OscilloscopeRF application to the mote connected on
	# "/dev/tts/USB0". Check that the mote is visible to the OS by
	# running the "motelist" command.

	$TOSROOT/apps/OscilloscopeRF> make tmote install.1 bsl,/dev/tts/USB0

	# In the above command, "1" is the address given to the mote

As explained previously, the number which follows the word "install" is analogous to an IP address, and is a 16 bit address given to the motes. We will number the motes, starting from the two source motes, as 1 and 2, to end with 3 for the sink mote (the mote which will read the packets and send them to USB port of the computer to which it is attached).

Disconnect the first mote from the USB port gently, and connect the second mote to the USB port. Recheck, by running "motelist", that the mote is visible to the operating system. We will upload the same OscilloscopeRF application to the mote, but assign it a different address. To do so, execute the following command.

	# Mote is given the address '2'

	$TOSROOT/apps/OscilloscopeRF> make tmote install.2 bsl,/dev/tts/USB0

Again, disconnect the mote gently from the USB port, and connect another mote. Recheck to see that the mote is visible to the operating system. Only this time, the mote will be configured as a sink mote. That is, this mote will only read any data packets which are sent over the wireless medium, and send them as a packet to the USB port. This information can then be read by any application, which may process or display the data.

The application which does this is located in the directory named, "$TOSROOT/apps/TOSBase". First, change to this directory, and upload the application to the mote as done previously, with a unique address. You may may use the following command.

	# Mote is given the address number 3.

	$TOSROOT/apps/TOSBase> make tmote install.3 bsl,/dev/tts/USB0

Do not detach this mote from the computer. Since this mote will send decoded wireless packets over the USB, it should stay connected to the PC. Let us now start the application which can read data from the USB port and display it on the screen. We will once again use the Oscilloscope JAVA application, used in the previous assignment.

	# Start the Oscilloscope application
	$ java net.tinyos.oscope.oscilloscope

Currently, you will not notice anything on the screen since the source motes are not powered on, and hence no data is being sent to the sink. To start sensing, power on the other two motes previously configured to send data over the wireless medium. This is done by gently connecting the other two motes, to any of the laptops next to node_a. If you wish to make use of batteries to power the motes, you may do so now.

Following this, adjust the oscilloscope application's view so that you can see both sets of data being reported. Take a screen-shot of this behavior, showing some data from both the source motes, in one view, using "ksnapshot".

After completing the experiment, please logout of X windows and logout from command prompt to allow other groups to work after you are gone. Leaving the machines logged in, is a security risk.


Please turn in screen shots of the Oscilloscope application, with both sets of data being visible, as jpg images (please be considerate of my mail box size). You can use the "ksnapshot" application to get the screen shots.


1. Are there any advantages of using the wireless medium in comparison to what you did in the last assignment?
2. Can you come up with some potential advantages of this simple source and sink model when motes may have to communicate over multiple hops? Please comment on how you may use the "in-network" data aggregation idea.

Version: $Revision 0.1 $. Last Modified: $Date 2006/04/27 17:16 $. Author: $Name- Chandrakanth Chereddi $.