Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 28

Subject : Wireless Sensor Network Class : TYCS

Practical 1
Aim : Create a wireless network of multiple PCs using appropriate AccessPoints.

Steps :

Step 1 : Create the following topology using the component (i.e AccessPoint-PT-A,
AccessPoint-PT, AccessPoint-PT-N, 2PCs, Laptop and Server).

Step 2 : Now add the required modules as given below :


1.) Add PT-HOST-NM-1W-A to PC0 and PC1 as soon as you turn on the PCs after
Adding the module it will form association with AccessPoint-PT-A.
2.) Add PT-HOST-NM-1W to Laptop and Server as soon as you turn on the machines after
adding the module it will form association with AccessPoint-PT.

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Step 3 : Now turn off the port 1 or add WEP key for port 1 of A AccessPoint-PT after
adding the WEP Key the laptop and the server will form association with
AccessPoint-PT-N .

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Practical 2
Aim : Exploring and understanding TinyOS computational concepts :- Events, Commands
and Task.
- nesC model
- nesC Components
Explaination :
TinyOS:
• TinyOS is an open-source operating system designed for low-power wireless devices,
particularly those used in sensor networks and Internet of Things (IoT) applications. It
is characterized by its lightweight design, efficiency, and flexibility, making it suitable
for resource-constrained devices.
• Originally developed at the University of California, Berkeley, TinyOS is written in
the nesC (network embedded systems C) programming language, which is
specifically designed for embedded systems and sensor networks.

1. Events:
• Definition: Events represent asynchronous occurrences such as sensor
readings, incoming messages, or timer expirations. They are declared within
interfaces of components using the event keyword.
• Event Handlers: Event handlers are functions that are called in response to
the occurrence of an event. They are defined using the event qualifier.
• Invocation: Events are raised (or fired) by components to signal the
occurrence of a specific event using the call statement.
• Registration: Components can subscribe to events raised by other
components using the post statement.
• Concurrency: Events are scheduled and executed in a non-preemptive
manner. It's essential to write event handlers efficiently to avoid blocking
operations.
2. Commands:
• Definition: Commands represent actions that can be performed on a
component. They are declared within interfaces of components using the
command keyword.
• Command Handlers: Command handlers are functions that implement the
behavior associated with a command. They are defined using the command
qualifier.
• Invocation: Commands are called by other components or modules to perform
specific actions using the call statement.

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

• Execution: Command execution is synchronous, meaning that the caller waits


for the command to complete before proceeding.
• Parameters and Return Values: Commands can take parameters and return
values, allowing for communication of data between components.

3. Tasks:
• Definition: Tasks represent units of computation that are executed
asynchronously. They are similar to functions or procedures in conventional
programming languages but are executed asynchronously.
• Task Handlers: Task handlers are functions that define the behavior of a task.
They are defined using the task qualifier.
• Scheduling: Tasks are scheduled for execution by the TinyOS scheduler. They
can be scheduled to execute periodically, in response to events, or based on
other criteria.
• Concurrency: Tasks can run concurrently with other tasks and event handlers.
It's crucial to manage concurrency effectively to avoid race conditions and
ensure correct behavior.
• Asynchronous Execution: Tasks execute asynchronously, meaning that they
can be preempted by higher-priority tasks or events.

A. nesC model:

• nesC (network embedded systems C) is a programming language specifically


designed for programming embedded systems and sensor networks, with a focus on
efficiency and modularity. It was developed as part of the TinyOS project at the
University of California, Berkeley. The language is primarily used in conjunction with
TinyOS, although it can also be used independently.

• The nesC model encompasses several key features and design principles:
1. Component-Based Architecture: nesC promotes a component-based architecture,
where software is divided into modular components that interact through well-defined
interfaces. Components encapsulate functionality and can be composed to build
complex systems.

2. Interfaces: Interfaces define the contracts between components. They specify a set of
commands, events, and sometimes configuration parameters that a component must
support. Components can provide or use interfaces, allowing for modularity and code
reuse.

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

3. Wiring: Wiring is the process of connecting components together to form a complete


system. It involves specifying how interfaces of different components are connected,
allowing them to communicate and interact.

4. Concurrency: nesC supports concurrency through event-driven programming.


Components communicate asynchronously through events and commands, allowing
for efficient use of system resources and responsiveness to external events.

5. Static Configuration: Configuration parameters can be used to customize the


behavior of components at compile time. This allows for flexibility and optimization
while avoiding the overhead of runtime configuration.

6. Generic Programming: nesC supports generic programming techniques, allowing


components and interfaces to be parameterized by types and values. This promotes
code reuse and flexibility.
7. Efficient Resource Usage: nesC is designed to be highly efficient in terms of
memory usage and execution speed. It achieves this by providing lightweight
abstractions and optimizations tailored for resource-constrained embedded systems.

B. nesC components:
In nesC (network embedded systems C), components are the building blocks of the
software architecture. They encapsulate functionality, promote modularity, and enable
code reuse. Components in nesC follow a component-based architecture, where
software is divided into modular units that interact through well-defined interfaces.
Components are defined using the module keyword in nesC. Components interact
with each other through interfaces. Interfaces specify a set of commands, events, and
possibly configuration parameters that a component must support.

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Practical 3
Aim : Understanding TOSSIM for
- Mote-mote radio communication
- Mote-PC serial communication

Explanation :
TOSSIM stands for TinyOS Simulator. It is a simulation environment for TinyOS-
based wireless sensor networks. TOSSIM allows developers to test and debug their TinyOS
applications without the need for physical hardware, providing a convenient and efficient way
to experiment with different network configurations, algorithms, and protocols.

Mote-Mote Radio Communication


Mote-to-mote radio communication refers to the wireless communication between
individual sensor nodes or motes within a wireless sensor network (WSN). In a WSN, sensor
nodes, often referred to as motes, are small, resource-constrained devices equipped with
sensors, processing units, and wireless communication capabilities. Mote-to-mote
communication enables these devices to exchange data and collaborate in various sensing and
monitoring tasks. Each mote is equipped with a radio transceiver that allows it to transmit and
receive radio signals. Mote-to-mote communication can occur in different network
topologies, such as point-to-point, mesh, or multi-hop networks. Motes communicate using
communication protocols designed for WSNs. Motes are typically assigned unique identifiers
or addresses that allow them to communicate with each other. In multi-hop networks, routing
protocols are used to determine the path data should take to reach its destination, considering
factors such as link quality and energy efficiency. Energy efficiency is a critical consideration
in mote-to-mote communication. Motes often employ power-saving techniques such as duty
cycling, where they alternate between active and sleep states to conserve energy while
maintaining communication capabilities.

Mote-PC Serial Communication


Mote-to-PC serial communication involves establishing a communication link
between a sensor node (mote) and a personal computer (PC) using serial communication
protocols. This setup allows for data exchange between the mote and the PC, enabling tasks
such as sensor data retrieval, configuration, and monitoring. Both the mote and the PC must
have serial interfaces for communication. The mote typically uses a UART (Universal
Asynchronous Receiver-Transmitter) module to interface with its microcontroller, while the
PC usually connects to the mote via a USB-to-serial adapter or a built-in serial port. Serial
communication between the mote and the PC follows a specific protocol. The mote and the
PC are connected physically using a serial cable or a USB cable with appropriate connectors.
Both the mote and the PC must be configured to use the same serial communication
parameters, such as baud rate, data bits, parity, and stop bits. These parameters ensure proper
communication synchronization between the mote and the PC. Once the serial connection is
established, data exchange can occur between the mote and the PC. Error handling
mechanisms, such as checksums or error correction codes, may be employed to ensure data
integrity during transmission.

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Practical 4

Aim : Create and simulate a simple adhoc network.

Steps :
Step 1 : Open OMNet++ and Goto File and click on Import the Select Existing Project into
Workspace .

Step 2 : Open OMNet++ and Goto File and click on Import the Select Existing Project into
Workspace .

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Step 3 : Create a new folder inside inet > samples > adhoc folder .

Step 4 : Create a new .NED file inside the folder you created .

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Step 5 : After naming file click on next and select the following options.

Step 6: After clicking finish this topology will be appeared.

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Step 7: Then Right-click on our .NED file and Goto Run as > Omnet++ Simulation.

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Practical 5

Aim : Understanding, Reading and Analyzing Routing Table of a network. Routing Table is
given we need draw the topology.
Routing Table :
 Router 0 :

 Router 1 :

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Topology Diagram :

Now We have given the Topology we have to configure router.

Configuration of Router 0:

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Configuration of Router 1:

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Practical 6

Aim : Create a basic MANET implementation simulation for Packet animation and Packet
Trace.

Steps :
Step 1 : Create a new folder “manetPract” in “inet/example/manetrouting”.

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Step 2 : Create a new “.NED(Network Description File)”.

Step 3 : Enter the name of the file and click on “Next >”

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Step 4 : Select Generated Wizards > New Adhoc Mobility Wireless Networ.

Step 5 : Select options No. of hosts= 5, Topology type = static.

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Step 6 : We will get the predefined topology with 5 hosts.

Step 7 : Right Click on the .NED file and select Run as > 1 OMNet++ Simulation.

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Practical 7
Aim : Implement a Wireless sensor network simulation.

Steps :
Step 1 : Create the topology using the component mention in the aim.

Step 2 : Now copy the “Home Gateway SSID“ and paste it in the “Smart Device
SSID” .

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Step 3 : Go to “Smart Device > Desktop > IoT Monitor Enter the Username and
password if signed in or else create the Username as “admin” and password as
“admin”.

Step 4 : Now Go to IoT Devices enable Advance option in bottom right corner and add
the PT-IOT-NM_1W Network Adapter. Repeat this step for all IoT Devices.

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Step 5 : Now Go to IoT Devices > Config > IoT Server and choose Home Gateway.

Step 6 : Now Go to SmartDevice > Desktop > IoT Monitor and Login.

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Step 7 : Now you can control your IoT Devices with your smart phone,

Step 8 : Now you can control your IoT Devices with your smart phone,

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Practical 8

Aim : Simulate Mobile Adhoc Network with Directional Anetenna.


.

Steps :
Step 1 : Go to “File > Import” and select “Existing Projects into Workspace” and click

on Next .

Step 2 : Select root directory as


“inet.2.1.0-src” and Click on
Finish.

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Step 3 : Create a new folder in “inet/examples/adhoc”.

Step 4 : Create a new “.NED file ”


in new folder you have created.

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Step 5 : Enter file name and click on Next> then select the “New Managed Mobility
Wireless Network Wizard”.

Step 6 : Select options No. of hosts = 5, Topology type = static.

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Step 7 : After Click on Finish you will get the predefined topology with 5 hosts, 1AP, 1 CC ,
and 1 configurator then click on the .NED file that you have created and
Run as > Run Configuration.

Step 7 : Here is the Code.

Name : Ashish Yadav Roll No : 84


Subject : Wireless Sensor Network Class : TYCS

Practical 9

Aim : Create a mobile network using Cell Town and Central Office Server. Simulate
connection between them.

Steps :
Step 1 : Take Smart Phone, WRT300N, PT-HUB, Cell Tower, Central-Office Server and
Router for forming the topology.

Step 2 : Configure the Router 0.

Step 3 : Ping the Router 0 from the Smart Phone.

Name : Ashish Yadav Roll No : 84

You might also like