Objective: To explain the features and components of any wireless sensor network WSN Overview: A sensor node, also known as a mote, is a node in a sensor network that is capable of performing some processing, gathering sensory information and communicating with other connected nodes in the network. The main components of a sensor node are a microcontroller, transceiver, external memory, power source and one or more sensors. A wireless sensor network (WSN) is an association of spatially dispersed independent sensor nodes. The sensors in each node are capable of sensing and monitoring physical or environmental parameters, such as temperature, sound, vibration, pressure, motion or pollutants in different areas. The data obtained by each sensor will then cooperatively pass through the network to a main control station. The main control station will take decisions based on the received data. Figure 1 shows one of the wireless sensor network topology. Figure 1 Structural design of the wireless sensor network WSNs are widely used for several military, industrial, civilian, environmental and medical applications. In all these applications, the sensor nodes are deployed over a region where some phenomenon or some parameters are to be monitored. Wireless sensor nodes make the task more mobile for sensing and collecting the data from different areas. Wireless sensor networks are deployed in many countries to monitor air pollution, water pollution, landslides, floods and infrastructure of a building. Size and cost constraints on sensor nodes result in corresponding constraints on resources such as energy, memory, computational speed and communications bandwidth. The topologyof the WSNs can vary from a simple star network to an advanced multi-hop wireless mesh network or from a centralized network to a hierarchical network. To make the wireless sensor network energy optimized, and to establish effective communication between the main station and the sensor nodes, the sensor nodes are classified into full function nodes and partial function nodes. Full function sensor nodes have additional features which will collect data from the nearby partial function nodes, aggregate it and send the data to the main station. Such architecture is shown in the figure 1. WSN Device Architecture and Operating System: The sensor nodes in the wireless sensor network typically consist of a radio transceiver, a microcontroller, sensors interfaced to the microcontroller, memory module and an energy source to charge the sensor node usually a battery. The microcontroller is the main part in the architecture of the sensor node. The user can program the controllers to decide how to process the data from the sensors and the data received from other sensor nodes, how to transmit and receive the data packets, the on/off time of the sensor node, and what type of data has to store in the memory. The sensors will sense the physical parameters and give output as analog data. The number of sensors that can be connected to the node depends on the type of sensor node that we are using. The analog to digital converter will convert the analog signal from the sensors to digital signals and fed to the microcontroller for further processing. The transceiver will send and receive data to and from the other sensor nodes and the memory module will store the required data. Energy source provides the power for the operation of all integrated circuitries. The architecture of the wireless sensor node is shown in figure 2 The sensor nodes that create the WSN should be of low cost and small size. These two aspects are considered as the major challenges in the development of sensor nodes. The design of the operating systems for the sensor nodes can be of two types, namely, event-driven and multithreading. In event driven method, every action of the operating system is triggered by an event while in multithreading, each task is considered as threads and multiplex the execution time between different threads. TinyOs is an example of the event driven operating system and MANTIS is an example of the multithreaded operating system for sensor nodes. Figure 2 Architecture of wireless sensor node The types of wireless sensor nodes that are currently commercially available are Berkely motes and its replicas. Some of the commonly used motes are Iris motes, iSense motes, Micaz motes and WASP motes. Much research is going on in the development of energy optimized and cost effective small sized motes. Aim: To develop a program for a specific wireless sensor network application, using nesC programming language (for eg: Blink program to toggle the Leds of a wireless sensor nodes at a specified interval). Objectives: To develop an application in wireless sensor network using nesC application through understanding the nesC component based architecture demonstrating the concepts of interfaces, module and configuration in nesC demonstrating the steps to develop a nesC application. nesC: nesC (network embedded system C) is a system level programming language for embedded sensor networks. nesC is an extension of C that supports TinyOS and uses a structured component based architecture. A nesC application is a set of components linked together to make an executable. A component can be accessed by using interface only. Each component can either provide an interface or use an interface. Interfaces are bidirectional. Figure 1: Diagramatic flow in the nesC application Configuration: This is the file which assembles all the components used in an application. This file connects the interfaces used by the corresponding application to its providers. This procedure is known as wiring. Module: Module is the implementation of application. Each module implements one or more interfaces. Directory structure: Directory Purpose apps TinyOS applications, many examples doc Documentation tools TinyOS simulation tools Base directory for all TinyOS java packages tools/java tos tos/interfaces Main directory which defines all the subdirectories such as interfaces, lib etc. Source for all interface declarations Location Memsic/cygwin/opt/MoteWorks/apps Memsic/cygwin/opt/MoteWorks/apps/tutorials Memsic/cygwin/opt/MoteWorks/tools Memsic/cygwin/opt/MoteWorks/tools/java Memsic/cygwin/opt/MoteWorks/tos Memsic/cygwin/opt/MoteWorks/tos/interfaces tos/lib Libraries tos/platform Platform specific sources The platform for TOSSIM simulation Memsic/cygwin/opt/MoteWorks/tos/platform tos/system Source for system interface implementations Memsic/cygwin/opt/MoteWorks/tos/system tos/types A few system wide definitions and types tos/platform/pc Memsic/cygwin/opt/MoteWorks/tos/lib Memsic/cygwin/opt/MoteWorks/tos/platform/pc Memsic/cygwin/opt/MoteWorks/tos/types Steps to develope a nesC application: 1. Develop configuration file 1.1 List the components that provide the required interface 1.2 Perform wiring. The syntax is Module name.interface name -> component name.interface name 2. Develop module file 2.1 This is the implementation of actual task. 3. Write Makefile.component 3.1 This file lists the configuration and the sensorboard. 4. Write Makefile 4.1 File to include MakeXbowlocal/MakeMemslocal (The file which defines all hardware related parameters such as channel, RF power level etc.)