CS G250: Wireless Networks

Spring 2005

Sensor Network Project

In this project, you will develop code to set up a spanning tree in a sensor network rooted at the base station, and then use the spanning tree to count the number of sensor nodes in the network reachable from the base station. The code will be developed over the TinyOS environment and can be run on a 8-node MICAz mote network (developed by Crossbow Technologies) that we have recently acquired. The assignment can be entirely developed and simulated on your home machine using the simulator TOSSIM, that is available with the TinyOS distribution.

  • Installation: There are two options.
  • Getting Started: Read through CrossBow's manual "Getting Started Guide", where basic sensor networing products and programming models are presented.

  • Mote programming:
  • Spanning tree and node count

    The goal of this assignment is to set up a spanning tree over the nodes reachable from the base station, and compute a count of the number of reachable nodes, using the tree. There are multiple approaches to this problem, one of which is outlined below. More hints and details will be added as we go along.
    1. Single-hop network: Broadcast a DISCOVERY packet. Node that receives a DISCOVERY packet replies to base station with a REPLY packet. The base station counts one for every node that replies. This count represents the number of nodes directly reachable from the base station. Using a topology file that simulates a network of nodes in 1 cell, check what that the program returns.
    2. Retransmissions: If the number of reachable nodes is high, which you can set by setting the topology file appropriately, you may observe that not all the replies from the neighbors of the base station are received by the base station. This is because there may be collisions, and the MAC protocol does not explicitly avoid these. You can implement a simple retransmission protocol in which the node retransmits up to a MAX_TRANSMISSIONS (say, 5) number of times, after waiting a random period of time between retransmissions. You can set up random waiting times using a timer.
    3. Multi-hop network: Now we will generalize the above protocol to apply to a multi-hop network. A node that receives a DISCOVERY packet for the first time stores information indicating that the source node of the DISCOVERY packet is its parent and sends two messages: (i) a unicast REPLY message to the sender of the DISCOVERY packet; and (ii) a broadcast DISCOVERY packet that forwards the packet to the neighbors.
    4. Processing REPLY messages: A node that is not the base station node receives a REPLY packet simply forwards the packet up to its parent. The base station node that receives a REPLY node adds 1 to the count for every unique originator of the REPLY message.
    5. Optimization: Rather than forwarding the REPLY messages, the intermediate nodes can maintain information about their children and compute the count of the number of nodes in their subtree. This is the count that the node can forward to its parent. This will imply only a linear number of messages in the number of nodes in the network.