WSN Lab Manual PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 109

DEPARTMENT OF INFORMATION &

COMMUNICATION TECHNOLOGY

CERTIFICATE

This is to certify that Ms./Mr. __________________________________________________

Reg. No. __________________ Section _____ Roll No: ______ has satisfactorily completed the

lab exercises prescribed for Network Design and Wireless Sensor Networks Lab [ICT 4161 ] of

7th semester B.Tech (CCE) degree at MIT, Manipal, in the academic year 2017-2018.

Date: __________________

Signature
Faculty in-charge
CONTENTS

Lab Page
Title Signature Remarks
No. No.

Course Objectives and Outcomes, Evaluation


ii
Plan

Instructions to Students ii

Prototyping the Network Model Using Packet


1 1
Tracer

2 Configuring a Network Using Routing Protocols 13

Configuring DHCP and NAT On A Multi-


3 25
Function Device
Configuring VLAN and PAP Using Packet
4 42
Tracer

5 Configuring Wireless Topology And VOIP 53

Detection and Measurement of Gases Using


6 67
Sensors
Sensors for Atmospheric Parameters
7 75
Measurement

8 Proximity Estimation Using Sensors 83

9 Sensors For Home Automation 92

10 Resource Conservation Using Sensors 98

i
COURSE OBJECTIVES
 To understand the functionalities of various layers of OSI model.
 To demonstrate the working of network components such as switch, router, gateways,
etc.
 To inculcate the use of tools in network topology design.
 To understand the distributed sensing capabilities and the ease of deployment provided
by a wireless communication paradigm.
 To efficiently design WSN communication system for a given set of parameters and
constraints.

COURSE OUTCOMES
Students will be able to
 Design the network for different applications, configure and manage the network
components
 Analyze the different types of sensors to be used based on the problem definition.
 Design and develop the WSN communication system for the given parameters and
constraints in real time.
 Understand and deploy machine to machine communication systems

EVALUATION PLAN
Split up of 60 marks for Regular Lab Evaluation
Execution: 2 Marks
Regular Evaluation (50 Marks) Record: 4 Marks
Evaluation: 4 Marks
Mini Project 10 Marks
End Semester Lab evaluation: 40 marks (Duration 2 hours)
Program write up and Execution: 20 Marks
Mini-Project: 20 Marks

INSTRUCTIONS TO STUDENTS
Pre- Lab Session Instructions
1. Students should carry the Lab Manual Book and the required stationery to every lab
session
2. Be in time and follow the institution dress code
3. Must sign in the log register provided

ii
4. Make sure to occupy the allotted seat and answer the attendance
5. Adhere to the rules and maintain the decorum

In- Lab Session Instructions


1. Follow the instructions on the allotted exercises
2. Show the program and results to the instructors on completion of experiments
3. Prescribed textbooks and class notes can be kept ready for reference if required

General Instructions for the exercises in Lab


1. Implement the given exercise individually and not in a group.
2. Plagiarism (copying from others) is strictly prohibited and would invite severe penalty in
evaluation.
3. In case a student misses a lab, he/ she must ensure that the experiment is completed
before the next evaluation with the permission of the faculty concerned.
4. Students missing out the lab for genuine reasons like conference, sports or activities
assigned by the Department or Institute will have to take prior permission from the HOD
to attend additional lab (with another batch) and complete it before the student goes on
leave. The student could be awarded marks for the write up for that day provided he
submits it during the immediate next lab.
5. Students who feel sick should get permission from the HOD for evaluating the lab
records. However, attendance will not be given for that lab.
6. Students will be evaluated only by the faculty with whom they are registered even though
they carry out additional experiments in another batch.
7. The presence of the student during the lab end semester exams is mandatory even if the
student assumes he has scored enough to pass the examination
8. Minimum attendance of 75% is mandatory to write the final exam.
9. If the student loses his book, he/she will have to rewrite all the lab details in the lab
record.
10. Questions for lab tests and examination are not necessarily limited to the questions in the
manual, but may involve some variations and / or combinations of the questions.

The students should NOT


1. Bring mobile phones or any other electronic gadgets to the lab.
2. Go out of the lab without permission.

iii
iv
LAB NO: 1

LAB NO: 1 Date:


PROTOTYPING THE NETWORK MODEL USING PACKET TRACER

Objective
1. Develop an understanding of the basic functions of Packet Tracer.
2. To build a network using packet tracer
3. To demonstrate use of different network components such as routers, switches etc
4. Observe traffic behavior on the network.

Cisco Packet Tracer is a powerful network simulation program that allows students to
experiment with network behavior and ask “what if” questions. As an integral part of the
Networking Academy comprehensive learning experience, Packet Tracer provides simulation,
visualization, authoring, assessment, and collaboration capabilities and facilitates the teaching
and learning of complex technology concepts.

Packet Tracer supplements physical equipment in the classroom by allowing students to create a
network with an almost unlimited number of devices, encouraging practice, discovery, and
troubleshooting. The simulation-based learning environment helps students develop 21st century
skills such as decision making, creative and critical thinking, and problem solving. Packet Tracer
complements the Networking Academy curricula, allowing instructors to easily teach and
demonstrate complex technical concepts and networking systems design.

Packet Tracer complements the Networking Academy curricula, allowing instructors to easily
teach and demonstrate complex technical concepts and networking systems design. Instructors
can customize individual or multiuser activities, providing hands-on lessons for students that
offer value and relevance in their classrooms. Students can build, configure, and troubleshoot
networks using virtual equipment and simulated connections, alone or in collaboration with other
students. Packet Tracer offers an effective, interactive environment for learning networking
concepts and protocols. Most importantly, Packet Tracer helps students and instructors create
their own virtual “network worlds” for exploration, experimentation, and explanation of
networking concepts and technologies.
Key Features

Packet Tracer Workspaces: Cisco Packet Tracer has two workspaces—logical and physical. The
logical workspace allows users to build logical network topologies by placing, connecting, and
clustering virtual network devices. The physical workspace provides a graphical physical
dimension of the logical network, giving a sense of scale and placement in how network devices
such as routers, switches, and hosts would look in a real environment. The physical view also
provides geographic representations of networks, including multiple cities, buildings, and wiring
closets.
1
LAB NO: 1

Packet Tracer Modes: Cisco Packet Tracer provides two operating modes to visualize the
behavior of a network—real-time mode and simulation mode. In real-time mode the network
behaves as real devices do, with immediate real-time response for all network activities. The
real-time mode gives students a viable alternative to real equipment and allows them to gain
configuration practice before working with real equipment. In simulation mode the user can see
and control time intervals, the inner workings of data transfer, and the propagation of data across
a network. This helps students understand the fundamental concepts behind network operations.
A solid understanding of network fundamentals can help accelerate learning about related
concepts.
Protocols: Cisco Packet Tracer supports the following protocols:

A client has requested that you set up a simple network with two PCs connected to a switch.
Verify that the hardware, along with the given configurations, meet the requirements of the
client. Following are the steps to setup the above given scenario

Step 1: Set up the network topology


a) Add two PCs and a Cisco 2950T switch.
b) Using straight-through cables, connect PC0 to interface Fa0/1 on Switch0 and PC1 to
interface Fa0/2 on Switch0.
c) Configure PC0 using the Config tab in the PC0 configuration window:
1. IP address: 192.168.10.10
2. Subnet Mask 255.255.255.0
d) Configure PC1 using the Config tab in the PC1 configuration window:

1. IP address: 192.168.10.11

2
LAB NO: 1

2. Subnet Mask 255.255.255.0


Step 2: Test connectivity from PC0 to PC1
a) Use the ping command to test connectivity.
1. Click PC0.
2. Choose the Desktop tab.
3. Choose Command Prompt.
4. Type: ping 192.168.10.11 and press enter.
b) A successful ping indicates the network was configured correctly and the prototype validates
the hardware and software configurations. A successful ping should resemble the below output:

Close the configuration window.

Communication between 2 PC’s via the router


Here, we will see communication enabled between PCs via Router in Packet Tracer. So, for this
we need two PCs, a router, and two cross over cables to connect them. Important point is that we
use cross over cable to connect PC to a router because they both use the same pins for
transmission and receiving of data.

3
LAB NO: 1

Now, we will connect them by selecting fast ethernet interfaces on both ends.

Now, we have connect the devices. Further, we will go to the router CLI mode and enter the
following commands.
Step by step , we will have to do the following things.

4
LAB NO: 1

i. Access the interfaces one by one


ii. Assign IP addresses to interfaces
iii. Change the status of the interfaces i.e. from Down to Up.
iv. Assign IP addresses to PCs.
v. Assign Default GateWay to PCs. FYI fast ethernet ip address is the gateway address to the PC.
Now, commands of the Router CLI mode are as follows.

Now, we have accessed both interfaces one by one and we have assigned IP addresses
respectively.

5
LAB NO: 1

Now, we have accessed both interfaces one by one and we have assigned IP addresses
respectively.

See the difference the lights have changed the color from Red to Green. Now, lets assign IP
addresses to the PCs.
Click on PC1, go to Desktop, then click IP Configuration.
PC1:

6
LAB NO: 1

PC2:

Now, our communication is enabled and we are able to communicate from PC1 to PC2 via
Router.
Click on the packet in the right panel on the packet tracer, then click on PC1 and then click on
PC2. You will see the successful packet tracer (status is shown in the bottom right corner)

7
LAB NO: 1

Lab Exercises
1. Set up a network with 4 switches and 8 PC’s and verify the connectivity between all the
PC’s.
2. Design and configure a network using 4 PC’s and a router. Configuration should be done
using Command Line Interface (CLI).

8
[OBSERVATION SPACE]
LAB NO: 1

9
[OBSERVATION SPACE]
LAB NO: 1

10
[OBSERVATION SPACE]
LAB NO: 1

11
[OBSERVATION SPACE]
LAB NO: 1

12
LAB NO: 2

LAB NO: 2 Date:


CONFIGURING A NETWORK USING ROUTING PROTOCOLS

Objective:
1. To understand working principle of various routing protocols using packet tracer.
2. To make use of various routing protocols to route packets between the systems.

RIP: Routing information protocol


Routing Information Protocol (RIP) is a standards-based, distance-vector, interior gateway
protocol (IGP) used by routers to exchange routing information. RIP uses hop count to determine
the best path between two locations. Hop count is the number of routers the packet must go
through till it reaches the destination network. The maximum allowable number of hops a packet
can traverse in an IP network implementing RIP is 15 hops. it has a maximum allowable hop
count of 15 by default, meaning that 16 is deemed unreachable. RIP works well in small
networks, but it's inefficient on large networks with slow WAN links or on networks with a large
number of routers installed.
In a RIP network, each router broadcasts its entire RIP table to its neighboring routers every 30
seconds. When a router receives a neighbor's RIP table, it uses the information provided to
update its own routing table and then sends the updated table to its neighbors.

Differences between RIPv1 or RIPv2

RIPv1
A classful protocol, broadcasts updates every 30 seconds, hold-down period 180 seconds. Hop
count is metric (Maximum 15).
RIP supports up to six equal-cost paths to a single destination, where all six paths can be placed
in the routing table and the router can load-balance across them. The default is actually four
paths, but this can be increased up to a maximum of six. Remember that an equal-cost path is
where the hop count value is the same. RIP will not load-balance across unequal-cost paths.

RIPv2
RIPv2 uses multicasts, version 1 use broadcasts,
RIPv2 supports triggered updates—when a change occurs, a RIPv2 router will immediately
propagate its routing information to its connected neighbors.
RIPv2 is a classless protocol. RIPv2 supports variable-length subnet masking
(VLSM)
RIPv2 supports authentication. You can restrict what routers you want to participate in RIPv2.
This is accomplished using a hashed password value.

13
LAB NO: 2

RIP Timers
RIP uses four different kinds of timers to regulate its performance:

1. Route update timer


Sets the interval (typically 30 seconds) between periodic routing updates in which
the router sends a complete copy of its routing table out to all neighbors.
2. Route invalid timer
Determines the length of time that must elapse (180 seconds) before a router
determines that a route has become invalid. It will come to this conclusion if it
hasn’t heard any updates about a particular route for that period. When that
happens, the router will send out updates to all its neighbors letting them know that
the route is invalid.
3. Holddown timer
This sets the amount of time during which routing information is suppressed.
Routes will enter into the holddown state when an update packet is received that
indicated the route is unreachable. This continues either until an update packet is
received with a better metric or until the holddown timer expires. The default is 180
seconds.
4. Route flush timer
Sets the time between a route becoming invalid and its removal from the routing
table (240 seconds). Before it's removed from the table, the router notifies its
neighbors of that route's impending failure. The value of the route invalid timer
must be less than that of the route flush timer. This gives the router enough time to
tell its neighbors about the invalid route before the local routing table is updated.

RIP Routing configurations


Solved Example : Configure the following network using RIP

14
LAB NO: 2

Assign ip address to PC. Select pc and double click on it. Select ip configurations from
desktop tab and set ip address given as in table. To configure router double click on it and
select CLI.To configure this topology use this step by step guide.

(1841Router0) Hostname R1:


To configure and enable rip routing on R1 follow these commands exactly.
Router>enable
Router#configure terminal
Enter configuration commands, one per line.
End with CNTL/Z.
Router(config)#hostname R1
R1(config)#interface fastethernet 0/0
R1(config-if)#ip address 10.0.0.1 255.0.0.0
R1(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0,

15
LAB NO: 2
changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface
FastEthernet0/0, changed state to up
R1(config-if)#exit
R1(config)#interface fastethernet 0/1
R1(config-if)#ip address 20.0.0.1 255.0.0.0
R1(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/1,
changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface
FastEthernet0/1, changed state to up
R1(config-if)#exit
R1(config)#interface serial 0/0/0
R1(config-if)#ip address 50.0.0.1 255.0.0.0
R1(config-if)#clock rate 64000
R1(config-if)#bandwidth 64
R1(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0/0, changed
state to down
R1(config-if)#exit
R1(config)#router rip
R1(config-router)#network 10.0.0.0
R1(config-router)#network 20.0.0.0
R1(config-router)#network 50.0.0.0
R1(config-router)#exit

(2811Router1) Hostname R2:


To configure and enable rip routing on R2 follow these commands exactly.
Router>enable
Router#configure terminal
Enter configuration commands, one per line.
End with CNTL/Z.
Router(config)#hostname R2
R2(config)#interface fastethernet 0/0
R2(config-if)#ip address 30.0.0.1 255.0.0.0
R2(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0,
changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface
FastEthernet0/0,
changed state to up
R2(config-if)#exit
R2(config)#interface fastethernet 0/1
R2(config-if)#ip address 40.0.0.1 255.0.0.0
R2(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/1,
changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface
FastEthernet0/1,

16
LAB NO: 2
changed state to up
R2(config-if)#exit
R2(config)#interface serial 0/0/0
R2(config-if)#ip address 50.0.0.2 255.0.0.0
R2(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0/0, changed
state to up
R2(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface
Serial0/0/0,
changed state to up
R2(config-if)#exit
R2(config)#router rip
R2(config-router)#network 30.0.0.0
R2(config-router)#network 40.0.0.0
R2(config-router)#network 50.0.0.0
R2(config-router)#exit

To test rip routing do ping from pc0 to all pc and vice versa. If you get replay then you have
successfully configured rip routing.

Configure OSPF Routing Protocol


Configuration of OSPF routing protocol is easy as RIP Routing. The Open Shortest Path First
(OSPF) is a routing protocol for wide area networks and enterprise network. OSPF is
perhaps the most widely used interior gateway protocol (IGP) in large enterprise networks.
The most widely used exterior gateway protocol is the Border Gateway Protocol (BGP), the
principal routing protocol between autonomous systems on the Internet.
Solved Example: Configure the following network using OSPF

17
LAB NO: 2

Router 1
R1>enable
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1
R1(config)#interface serial 0/3
R1(config-if)#ip address 10.10.10.1 255.255.255.252
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#
R1(config)#interface serial 0/2
R1(config-if)#ip address 10.10.10.5 255.255.255.252
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown

Router 2
Router#enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R2
R2(config)#interface serial 0/2
R2(config-if)#ip address 10.10.10.6 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface fastEthernet 0/0
R2(config-if)#ip address 192.168.10.1 255.255.255.0
R2(config-if)#no shutdown

Router 3
Router#enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R3
R3(config)#interface serial 0/2
R3(config-if)#ip address 10.10.10.2 255.255.255.252
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface fastEthernet 0/0
R3(config-if)#ip address 192.168.1.1 255.255.255.0
R3(config-if)#no shutdown

18
LAB NO: 2

Configure OSPF Routing Protocol


R1>enable
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#router ospf 1
R1(config-router)#network 10.10.10.0 0.0.0.3 area 0
R1(config-router)#network 10.10.10.4 0.0.0.3 area 0
R1(config-router)#
The router OSPF command is enable OSPF routing on the router, and the 1 before OSFP is the
process ID of the OSFP Protocol. You can set different process id from “1-65535” for each
router. The network command with network ID “network 20.10.10.0” is the network identifier,
and the “0.0.0.3″ is the wildcard mask of 20.10.10.0 network. Wildcard mask determine which
interfaces to advertise, because OSPF advertise interfaces, not networks
R2>enable
R2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#router ospf 1
R2(config-router)#network 192.168.10.0 0.0.0.255 area 0
R2(config-router)#network 10.10.10.4 0.0.0.3 area 0

R3>enable
R3#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#router ospf 1
R3(config-router)#network 192.168.1.0 0.0.0.255 area 0
R3(config-router)#network 10.10.10.0 0.0.0.3 area 0
OSPF routing configuration has been finished successfully, now test your network whether
they can ping with each other or not.
Various Commands

19
LAB NO: 2

Lab Exercises
1. Using RIP, configure the below network and verify the connectivity between PC0
and PC1.

2. For the above given scenario, configure the network using OSPF and verify the
connectivity between the PC’s.

20
[OBSERVATION SPACE] LAB NO: 2

21
[OBSERVATION SPACE] LAB NO: 2

22
[OBSERVATION SPACE] LAB NO: 2

23
[OBSERVATION SPACE] LAB NO: 2

24
LAB NO: 3

LAB NO: 3 Date:


CONFIGURING DHCP AND NAT ON A MULTI-FUNCTION DEVICE

Objective:
1. To configure DHCP using packet tracer.
2. To examine NAT on a Multi-Function Device

The use of Network Address Translation (NAT) has been widespread for a number of years; this
is because it is able to solve a number of problems with the same relatively simple configuration.
At its most basic, NAT enables the ability to translate one set of addresses to another; this
enables traffic coming from a specific host to appear as though it is coming from another and do
it transparently.
NAT Concepts
There are a number of different concepts that must be explained in order to really get a good
understanding of how NAT operates, which ultimately makes the configuration of NAT
increasingly simple. This section reviews these different concepts and begins with an
understanding of how NAT can be used. Some of the main uses for NAT include:
 Translation of non-unique addresses into unique addresses when accessing the Internet:
This is one of the most common uses of NAT today; almost every household that has a “router”
to access the Internet is using NAT on this device to translate between internal private address
and public Internet addresses.
 Translation of addresses when transitioning internal addresses from one address range
into another (this is common when the organization of addresses within a company is
being changed):
This is often done when a company is transitioning their IP addressing plan; common scenarios
include when expanding (and the IP addressing plan was not built sufficiently when the initial
addresses were assigned) and when a company is merging with another with potential
overlapping addresses.
 When simple TCP load sharing is required across many IP hosts:
This is very common, as many highly used servers are not really a single machine but a bank of
several machines that utilize load balancing. In this scenario, commonly, a single public address
is translated into one of several internal addresses in a round robin fashion. This is not a
complete list of every possible way that NAT can be configured but simply a list of the most
common ways that it is used in modern networks.

25
LAB NO: 3

There are a couple of main concepts that also must be reviewed and understood before
configuring NAT:
1. Inside and Outside Addresses
2. NAT types
1. Inside and Outside Addresses
In typical NAT configurations, interfaces are placed into one of two categories (or locations):
inside or outside. Inside indicates traffic that is coming from within the organizational network.
Outside indicates traffic that is coming from an external network that is outside the
organizational network.
These different categories are then used to define different types of address depending on
location of the address and how it is being “seen”. These different types include:
a) inside local address: This is the inside address as it is seen and used within the
organizational network.
b) inside global address: This is the inside address as it is seen and used on the outside of the
organizational network.
c) outside local address: This is the outside address as it seen and used within the
organizational network.
d) outside global address: This is the outside address as it is seen and used on the outside of
the organizational network.
2. NAT Types
Another important concept to be familiar with is the different types of NAT and how they are
defined. On most networks there are three different types of NAT that are defined:
a. Static address translation (Static NAT): This type of NAT is used when a single
inside address needs to be translated to a single outside address or vice versa.
b. Dynamic address translation (Dynamic NAT): This type of NAT is used when an
inside address (or addresses) need to be translated to an outside pool of addresses
or vice versa.
c. Overloading (Port Address Translation (PAT): This type of NAT is a variation on
dynamic NAT. With dynamic NAT, there is always a one to one relationship
between inside and outside addresses; if the outside address pool is ever
exhausted, traffic from the next addresses requesting translation will be dropped.
With overloading, instead of a one to one relationship, traffic is translated and
given a specific outside port number to communicate with; in this situation, many
internal hosts can be using the same outside address while utilizing different port
numbers.

26
LAB NO: 3

Static NAT Configuration


There a few steps that are required when configuring static NAT; the number of the commands
depends on whether there will be more than one static translation:

Using NAT we can hide real IP address, we can translate private IP address to public IP address
and vice versa. As we all know in internet only public IP addresses are used and some IP in
every class has been reserved for use in LOCAL AREA CONNECTION say LAN and these
ranges of IP are known as Private IP Address. Private Addresses can only be used in LAN and it
can’t be used in internet. But our PC with private address can communicate with PC or Machine
having public IP address using NAT(Network Address Translation).
A public IP address is an IP address that can be accessed over the Internet. Like postal address
used to deliver a postal mail to your home, a public IP address is the globally unique IP address
assigned to a computing device. Private IP address on the other hand is used to assign computers
within your private space without letting them directly expose to the Internet. For example, if
you have multiple computers within your home you may want to use private IP addresses to

27
LAB NO: 3

address each computer within your home. In this scenario, your router get the public IP address,
and each of the computers, tablets and smartphones connected to your router (via wired or wifi)
get a private IP address from your router via DHCP protocol.
Internet Assigned Numbers Authority (IANA) is the organization responsible for registering IP
address ranges to organizations and Internet Service Providers (ISPs). To allow organizations to
freely assign private IP addresses, the Network Information Center (InterNIC) has reserved
certain address blocks for private use.
The following IP blocks are reserved for private IP addresses.

What is public IP address?


A public IP address is the address that is assigned to a computing device to allow direct access
over the Internet. A web server, email server and any server device directly accessible from the
Internet are candidate for a public IP address. A public IP address is globally unique, and can
only be assigned to an unique device.
What is private IP address?
A private IP address is the address space allocated by InterNIC to allow organizations to create
their own private network. There are three IP blocks (1 class A, 1 class B and 1 class C) reserved
for a private use. The computers, tablets and smartphones sitting behind your home, and the
personal computers within an organizations are usually assigned private IP addresses. A network
printer residing in your home is assigned a private address so that only your family can print to
your local printer.
When a computer is assigned a private IP address, the local devices sees this computer via it's
private IP address. However, the devices residing outside of your local network cannot directly
communicate via the private IP address, but uses your router's public IP address to communicate.

28
LAB NO: 3

To allow direct access to a local device which is assigned a private IP address, a Network
Address Translator (NAT) should be used.
How to configure NTP Server and NTP Client on cisco Router
Whenever we talks about cisco routers and how to set clock or accurate time on routers it
becomes so important because a variety of services depend on it. We need to monitor our routers
and secure our routers through server configuration. We use to configure syslog server for
monitoring routers log and incident happening over routers. The logging service shows each log
entry with the date and time and all details which are directly or indirectly related to NTP Server.
It becomes very critical if you’re trying to track a specific incident or troubleshoot a problem.
Cisco routers have two types of clocks :
[1] A battery-powered hardware clock, referenced as the ‘calendar’ in the IOS CLI,
and
[2] a software clock, referenced as the ‘clock’ in the IOS CLI.
The software clock is the primary source for time data and runs from the moment the system is
up and running. The software clock can be updated from a number of sources.

Configure DHCP on a Router


DHCP stands for Dynamic Host Configuration Protocol, as the name indicates it dynamically
controls the hosts. DHCP is very common in home networks and in most enterprise networks.
DHCP (Dynamic Host Configuration Protocol) is a networking protocol that permits network
administrators centrally manage and automate the assignment of network parameters to a client
device like PCs or Laptops.
1. DHCPDISCOVER: Server Discovery – Broadcast In server discovery process, when a
computer or other networked device connects to a DHCP network, it starts trying to discover
whether there is any DHCP server available in the network by sending broadcast to
255.255.255.255 destination address. This is called DHCPDISCOVER.
2. DHCPOFFER: IP Lease Offer – Unicast
After the DHCP server accepts the DHCPDISCOVER message, it replies with a DHCPOFFER
message. This could be Unicast to the MAC address of the client and those packet includes an
IPv4 address lease among the pool of IPs, Subnet mask, Gateway, DNS, lease duration.
3. DHCPREQUEST: IP request – Broadcast
Clients take the first offer received from DHCP server by broadcasting a DHCP Request packet
called DHCPREQUEST. This message allowing the server to know that the client supposed to
use the address offered by the server

29
LAB NO: 3

4. DHCPACK: IP lease acknowledgment – Unicast


The server directs an acknowledgment (DHCPACK) message in unicast, confirming that
acceptance of the allotted IP for a specified period of time. It also used to renew the lease time.

Solved Example:
1. Configure DHCP on routers for the given topology

Configure the Router 1


Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1
R1(config)#interface serial 0/0/0
R1(config-if)#ip address 10.10.10.1 255.255.255.252
R1(config-if)#no shutdown
R1(config-if)#clock rate 64000
R1(config-if)#
30
LAB NO: 3

Configure the Router 2


Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R2
R2(config)#interface serial 0/0/0
R2(config-if)#ip address 10.10.10.2 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#
R2(config)#interface fastEthernet 0/0
R2(config-if)#ip address 192.168.10.1 255.255.255.0
R2(config-if)#no shutdown

Lets config Router 2 as DHCP Server and set the clients to get there IP addresses from DHCP
Server.
In the R2 while you are in the config mode, type the command ‘ip dhcp excluded-address
192.168.10.1 192.168.10.20‘ and then press enter. This command ‘ip dhcp excluded-address’
will create an exclusive range of IP addresses which reserved for Network Servers and DHCP
Server will not assign theme to clients.
The ‘ip dhcp pool‘ command create a pool for a network. You can create many pools on a router
for all Local area network that connected to the router.
R2>enable
R2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#ip dhcp excluded-address 192.168.10.1 192.168.10.20
R2(config)#ip dhcp pool mynetwork (you can give any name)
R2(dhcp-config)#
R2(dhcp-config)#network 192.168.10.0 255.255.255.0
R2(dhcp-config)#default-router 192.168.10.1
R2(dhcp-config)#dns-server 192.168.10.100

31
LAB NO: 3

R2(dhcp-config)#
Now go to client setting and set the IP Configuration to DHCP and see the client get new IP
address from DHCP Server.

DHCP Options on Cisco Router


Remember some DHCP options when you need to provide IP addresses from a DCHP server to
clients that are outside of your network or are not in the same Local Area Network. You must
use the ‘ip helper-address‘ to forward the DHCP client requests to remote host.

32
LAB NO: 3

Configure the R1 to relay the DHCP client request. It will not work without routing. So
configure Routers with static or dynamic routing. Here I’m testing with RIP.
R1>enable
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip helper-address 10.10.10.2
R1(config-if)#exit
R1(config)#router rip
R1(config-router)#network 10.10.10.0
R1(config-router)#network 192.168.30.0
R1(config-router)#exit

Go to the client IP configuration setting and see the forwarded request by DHCP Server.

33
LAB NO: 3

Lab Exercises
1. Configure static NAT for the below given scenario. Also ping a private IP address given
and mention your inference.

2. Perform NTP client-server configuration for the below given topology

34
LAB NO: 3

3. Configure DHCP for the following topology.

35
[OBSERVATION SPACE]
LAB NO: 3

36
[OBSERVATION SPACE]
LAB NO: 3

37
[OBSERVATION SPACE]
LAB NO: 3

38
[OBSERVATION SPACE]
LAB NO: 3

39
[OBSERVATION SPACE]
LAB NO: 3

40
[OBSERVATION SPACE]
LAB NO: 3

41
LAB NO: 4

LAB NO: 4 Date:


CONFIGURING VLAN AND PAP USING PACKET TRACER

Objective:
1. To configure Virtual Local Area Networks (VLANs) using Virtual Trunk Points (VTPs)
2. To configure Password Authentication Protocol (PAP) to validate users before allowing
them access to server resources

THE NEED FOR ROUTING


Each network has it's own needs, though whether it's a large or small network, internal routing,
in most cases, is essential - if not critical. The ability to segment your network by creating
VLANs, thus reducing network broadcasts and increasing your security, is a tactic used by most
engineers. Popular setups include a separate broadcast domain for critical services such as File
Servers, Print servers, Domain Controllers e.t.c, serving your users non-stop.
The issue here is how users from one VLAN (broadcast domain) can use services offered by
another VLAN?

Two VLANs consisting of two servers and workstations of which one workstation has been
placed along with the servers in VLAN 1, while the second workstation is placed in VLAN 2.
In this scenario, both workstations require access to the File and Print servers, making it a very
simple task for the workstation residing in VLAN 1, but obviously not for our workstation in
VLAN 2. we need to somehow route packets between the two VLANs and the good news is that
there is more than one way to achieve this and that's what we'll be covering.

42
LAB NO: 4

VLAN ROUTING SOLUTIONS


While the two 2924 Catalyst switches are connected via a trunk link, they are unable to route
packets from one VLAN to another. If we wanted the switch to support routing, we would
require it to be a layer 3 switch with routing capabilities, a service offered by the popular
Catalyst 3550 series and above.
Since there are quite a few ways to enable the communication between VLANs (InterVLAN
Routing being the most popular) there is a good chance that we are able to view all possible
solutions. This follows our standard method of presenting all possible solutions, giving you an
in-depth view on how VLAN routing can be setup, even if you do not have a layer 3 switch.
VLAN ROUTING SOLUTION NO.1: USING A ROUTER WITH 2
ETHERNET INTERFACES
A few years ago, this was one of the preferred and fastest methods to route packets between
VLANs. The setup is quite simple and involves a Cisco router e.g 2500 series with two Ethernet
interfaces as shown in the diagram, connecting to both VLANs with an appropriate IP Address
assigned to each interface. IP Routing is of course enabled on the router and we also have the
option of applying access lists in the case where we need to restrict network access between our
VLANs.

In addition, each host (servers and workstations) must either use the router's interface connected
to their network as a 'default gateway' or a route entry must be created to ensure they use the
router as a gateway to the other VLAN/Network. This scenario is however expensive to
implement because we require a dedicated router to router packets between our VLANs, and is
also limited from an expandability prospective.

43
LAB NO: 4

VLAN ROUTING SOLUTION NO.2: USING A ROUTER WITH ONE ETHERNET


(TRUNK) INTERFACE
A router that supports trunk links. With this kind of setup, the trunk link is created, using of
course the same type of encapsulation the switches use (ISL or 802.1q), and enabling IP routing
on the router side. This method of InterVLAN routing is also known as 'Router on a Stick'.

The router will need to be configured with two virtual interfaces, one for each VLAN, with the
appropriate IP Address assigned to each one so routing can be performed.

VLAN ROUTING SOLUTION NO.3: USING A SERVER WITH TWO NETWORK


CARDS
Configure one of the servers to perform the routing between the two VLANs, reducing the
overall cost as no dedicated equipment is required.

44
LAB NO: 4

In order for the server to perform the routing, it requires two network cards - one for each VLAN
and the appropriate IP Addresses assigned, therefore we have configured one with IP Addresses
192.168.1.1 and the other with 192.168.2.1. Once this phase is complete, all we need to do is
enable IP routing on the server and we're done.
Lastly, each workstation must use the server as either a gateway, or a route entry should be
created so they know how to get to the other network.

VLAN ROUTING SOLUTION NO.4: INTERVLAN ROUTING


This is without a doubt the best VLAN routing solution out of all of the above. InterVLAN
routing makes use of the latest in technology switches ensuring a superfast, reliable, and
acceptable cost routing solution.

The Cisco Catalyst 3550 series switches used here are layer 3 switches with built-in routing
capabilities, making them the preferred choice at a reasonable cost. Of course, the proposed
solution shown here is only a small part of a large scale network where switches such as the
Catalyst 3550 are usually placed as core switches, connecting all branch switches together
(2924's in this case) via superfast fiber Gigabit or Fast Ethernet links, ensuring a fast and reliable
network backbone.
VLAN Configuration and InterVLAN routing for Cisco Layer 3 switches (3550, 3560 series,
3750 series, 4500 series and 6500 series switches) 3550 Catalyst will be configured with two
virtual interfaces, one for each
VLAN, and of course the appropriate IP Address assigned to them to ensure there is a logical
interface connected to both networks. Then we need to issue the 'IP Routing' command to enable
the InterVLAN Routing service.
45
LAB NO: 4

The diagram above was designed to help you 'visualise' how switches and their interfaces are
configured to specific VLAN, making the InterVLAN routing service possible. The switch above
has been configured with two VLANs, VLAN 1 and 2. The Ethernet interfaces are then assigned
to each
VLAN, allowing them to communicate directly with all other interfaces assigned to the same
VLAN and the other VLAN, when the internal routing process is present and enabled.
What is VLAN
VLAN is a logical grouping of networking devices. When we create VLAN, we actually break
large broadcast domain in smaller broadcast domains.
Consider VLAN as a subnet. Same as two different subnets cannot communicate with each other
without router, different VLANs also requires router to communicate.
Advantage of VLAN
VLAN provides following advantages:-
 Solve broadcast problem
 Reduce the size of broadcast domains
 Allow us to add additional layer of security
 Make device management easier
 Allow us to implement the logical grouping of devices by function instead of location
VLAN Membership
VLAN membership can be assigned to a device by one of two methods
1. Static
2. Dynamic

46
LAB NO: 4

These methods decide how a switch will associate its ports with VLANs.
1. Static
Assigning VLANs statically is the most common and secure method. It is pretty easy to set up
and supervise. In this method we manually assign VLAN to switch port. VLANs configured in
this way are usually known as port-based VLANs.
Static method is the most secure method also. As any switch port that we have assigned a VLAN
will keep this association always unless we manually change it. It works really well in a
networking environment where any user movement within the network needs to be controlled.
2. Dynamic
In dynamic method, VLANs are assigned to port automatically depending on the connected
device. In this method we have configure one switch from network as a server. Server contains
device specific information like MAC address, IP address etc. This information is mapped with
VLAN.
Switch acting as server is known as VMPS (VLAN Membership Policy Server). Only high end
switch can configured as VMPS. Low end switch works as client and retrieve VLAN
information from VMPS. Dynamic VLANs supports plug and play movability. For example if
we move a PC from one port to another port, new switch port will automatically be configured to
the VLAN which the user belongs. In static method we have to do this process manually.
VLAN Connections
During the configuration of VLAN on port, we need to know what type of connection it has.
Switch supports two types of VLAN connection
 Access link
 Trunk link

Access link
Access link connection is the connection where switch port is connected with a device that has a
standardized Ethernet NIC. Standard NIC only understand IEEE 802.3 or Ethernet II frames.
Access link connection can only be assigned with single VLAN. That means all devices
connected to this port will be in same broadcast domain.
For example twenty users are connected to a hub, and we connect that hub with an access link
port on switch, then all of these users belong to same VLAN. If we want to keep ten users in
another VLAN, then we have to purchase another hub. We need to plug in those ten users in that
hub and then connect it with another access link port on switch.

47
LAB NO: 4

Trunk link
Trunk link connection is the connection where switch port is connected with a device that is
capable to understand multiple VLANs. Usually trunk link connection is used to connect two
switches or switch to router. Remember, VLAN can span anywhere in network, that is happen
due to trunk link connection. Trunking allows us to send or receive VLAN information across
the network. To support trunking, original Ethernet frame is modified to carry VLAN
information.

Lab Exercises
1. Company has three offices. Offices are connected with each other via layer 2 links. For
redundancy purpose each office has one more layer 2 link. Company has two department
sales and management. In each office we have one PC from each department. Company
has one router. You can use router's Ethernet port for inter VLAN communication.
Configure VLAN VTP DTP and Router on Stick

48
[OBSERVATION SPACE]
LAB NO: 4

49
[OBSERVATION SPACE]
LAB NO: 4

50
[OBSERVATION SPACE]
LAB NO: 4

51
[OBSERVATION SPACE]
LAB NO: 4

52
LAB NO: 5

LAB NO: 5 Date:


CONFIGURING WIRELESS TOPOLOGY AND VOIP

Objective
1. To create and configure wireless network using packet tracer
2. To configure VOIP

Let us create wireless topology on packet tracer.


For this go to the wireless devices and select wireless router, choose some PCs and provide them
with wireless module so that they can communicate through router wirelessly.

For providing wireless module, go to the PC physical mode Go to PC, and remove wired LAN
and install WMP300N Module.

53
LAB NO: 5

Repeat the procedure for PC1


Now devices are connected

Set the IP address for the router

54
LAB NO: 5

As this wireless router provides us with the DHCP service, so we can obtain IP automatically by
using this service for our PCs.

This enables the devices to communicate.


Now, let us apply authentication to our wireless router. For that, go to Config tab, click on
Wireless. Provide it with the information (SSID and Passkey) as below.

55
LAB NO: 5

Go to PC desktop mode, Click on PC Wireless.

Go to PC desktop mode, Click on PC Wireless.

56
LAB NO: 5

Go to the connect tab and click refresh

Now click on connect button and give the passkey you have set in the router

57
LAB NO: 5

Now you can see that the PC has been connected to the router, you can also check the signal
strength and quality by clicking on Link Information

Repeat the procedure for PC1

VOIP(Voice Over IP)


VOIP is an acronym for Voice Over Internet Protocol, or in more common terms phone service
over the Internet. .
If you have a reasonable quality Internet connection you can get phone service delivered through
your Internet connection instead of from your local phone company.
Some people use VOIP in addition to their traditional phone service, since VOIP service
providers usually offer lower rates than traditional phone companies, but sometimes doesn't offer
911 service, phone directory listings, 411 service, or other common phone services. While many
VoIP providers offer these services, consistent industry-wide means of offering these are still
developing.
How does VOIP work?
A way is required to turn analog phone signals into digital signals that can be sent over the
Internet.This function can either be included into the phone itself or in a separate box like an
ATA.

58
LAB NO: 5

VOIP Using an ATA


Ordinary Phone ---- ATA ---- Ethernet ---- Router ---- Internet ---- VOIP Service Provider

VOIP using an IP Phone


IP Phone ----- Ethernet ----- Router ---- Internet ---- VOIP Service Provider

VOIP connecting directly


It is also possible to bypass a VOIP Service Provider and directly connect to another VOIP user.
However, if the VOIP devices are behind NATrouters, there may be problems with this approach
.
IP Phone ----- Ethernet ----- Router ---- Internet ---- Router ---- Ethernet ---- IP Phone
Applications using VOIP
Traditional telephony applications, such as outbound call center applications and inbound IVR
applications, normally can be run on VOIP .

Why use VOIP?


There are two major reasons to use VOIP
• Lower Cost
• Increased functionality

Lower Cost
In general phone service via VOIP costs less than equivalent service from traditional sources.
This is largely a function of traditional phone services either being monopolies or government
entities. There are also some cost savings due to using a single network to carry voice and data.
This is especially true when users have existing under-utilized network capacity that they can use
for VOIP without any additional costs. .
In the most extreme case, users see VOIP phone calls (even international) as FREE. While there
is a cost for their Internet service, using VOIP over this service may not involve any extra
charges, so the users view the calls as free. There are a number of services that have sprung up to
facilitate this type of "free" VOIP call. Examples are: FreeWorldDialup and Skype .
Increased Functionality
VOIP makes easy some things that are difficult to impossible with traditional phone networks.

59
LAB NO: 5

Incoming phone calls are automatically routed to your VOIP phone where ever you plug it into
the network. Take your VOIP phone with you on a trip, and anywhere you connect it to the
Internet, you can receive your incoming calls.
Call center agents using VOIP phones can easily work from anywhere with a good Internet
connection.

Lab Exercise
1. In the below topology, we have three pc connected with Linksys Wireless routers.

i. DHCP is configured and enabled on Wireless router


ii. IP pool for DHCP is 192.168.0.100 to 192.168.0.150
iii. PC are configured to receive IP from DHCP Server
iv. No security is configured
v. Default SSID is configured to Default
vi. Topology is working on infrastructure mode
vii. Default user name and password is admin
viii. IP of wireless is set to 192.168.0.1
Given the above information, perform the following tasks
i. Configure Static IP on PC and Wireless Router
ii. Change SSID to MotherNetwork
iii. Change IP address of router to 10.0.0.1 and 10.0.0.2 of PC0 10.0.0.3 of PC1
10.0.0.4 of PC2
iv. Secure your network by configuring WAP key on Router
v. Connect PC by using WAP key

60
LAB NO: 5

2. Configure VOIP for the below given topology and call IP Phone1 from IP Phone0

61
LAB NO: 6

62
LAB NO: 6

63
LAB NO: 6

64
LAB NO: 6

65
LAB NO: 6

66
LAB NO: 6

LAB NO: 6 Date:


DETECTION AND MEASUREMENT OF GASES USING SENSORS

Objective:
1. To identify the different gas sensors used with Waspmote Gases sensor board.
2. To make use of Waspmote Gases sensor board and sensors for measuring the levels of
gases present.

WASPMOTE
Waspmote is an open source wireless sensor platform which focuses on the implementation of
low consumption modes to allow the sensor nodes (“motes”) to be completely autonomous and
battery powered. Waspmote is based on a modular architecture: -integrate only the modules
needed in each device optimizing costs.

Waspmote counts with 2 sleep modes, Deep Sleep and Hibernate. In deep sleep, the device is
completely slept and the sensors powered. Sensors may generate an interruption to wake the
main microcontroller up when the value read goes above or below a pre-programed threshold.
Values of the sensor thresholds are controlled by software via digital potentiometers (digipots).
The consumption in Deep Sleep mode is 55µA. In Hibernate, the consumption is only 0.7µA. All
systems are switched off to ensure minimum consumption. Waspmote will be woken up by an
alarm from the internal clock.
Waspmote has two types of nodes:

(i) End Nodes have sensors integrated and are used to gather information and send (mesh
networking) to the Gateway (GW). Each End Node is equipped with a 6LoWPAN
radio, sensors, and a battery.
(i) Gateway takes the information sent by the End Nodes and sends it to the Tunneling
server by using the Ethernet IPv4 interface. Each GW Node is equipped with a
6LoWPAN radio, an Ethernet interface, anda battery.

Waspmote can be programmed in two ways: basic programming done from the USB port, and
Over the Air Programming (OTAP) once the node has been installed.

GASES SENSOR BOARD


The Waspmote Gases 2.0 board has been designed to monitor environmental parameters such as
temperature, humidity, atmospheric pressure and 14 different types of gases. It allows the
inclusion of 7 gases sensors at the same time. There is a dedicated socket for each of the
following sensors:

67
LAB NO: 6

Temperature, humidity, air pressure, CO2 (socket 1A), O2 (socket 1B), NO2 (socket 3B), O3 or
VOC (socket 2B). Sockets 2A, 3 and 4 are available for the rest of the sensors. CO and NH3
sensors can only be placed in the sockets 3 or 4.

Fig 6.1. Upper side of Waspmote Gases 2.0 sensor board

GAS SENSORS
Name of Sensor Type of Measureme Response Output range Average
Sensor nt range Time Consumption
O2 (SK 25) Analog 0 ~ 30 % 15 seconds 0~10 mV approx. 50mA
5.5mV~8.8mV at
21%
CO2 (TGS 4161) Analog 350 ~ 10000 1.5 220~490 mV at 350 0µA
ppm minutes ppm

NO2 (MiCS 2710) 0.05 ~ 5 ppm 30 seconds Typically, 2.2kΩ 26mA


NH3 (TGS 2444) Resistive 10 ~100 ppm 250 ms 3.63~36.3kΩ at 10 12mA
ppm
Air Contaminants- Resistive 1 ~ 30 ppm 30 seconds 10~100kΩ without 31mA
I (TGS 2602) contaminants
Air Contaminants- Resistive 1 ~ 100 ppm 30 seconds 10-90kΩ 46mA
II (TGS 2600)

68
LAB NO: 6

PROGRAMMING TO READ A SENSOR


Waspmote IDE is used to write code/sketch that is uploaded to the board. The Gases 2.0 board
for Waspmote has its own library WaspSensorGas_v20.hwhich contains the set of necessary
instructions to easily and intuitively configure and read each one of the sensors which connect to
the board. The structure in which the code to read a sensor must be presented is the following:
1. The board is switched on using the function SensorGasv20.ON().

2. Configuration of the sensor’s amplification gain and load resistance (the latter if necessary)
using the function SensorGasv20.configureSensor(SENSOR, GAIN, RESISTOR).
3. Turn on the RTC to avoid possible conflicts in the I2C bus using the function RTC.ON().

4. The sensor is switched on (except for the CO and NH3 sensors) using the function
SensorGasv20.setSensorMode(SENS_ON,SENSOR).

5. Wait for the necessary amount of time for the sensor’s response depending on the accuracy
required. The function delay(TIME)may be used.
6. Read the sensor using the function SensorGasv20.readValue(SENSOR).

7. If necessary, switch off the sensors and the board using the functions
SensorGasv20.setSensorMode(SENS_OFF, SENSOR)andSensorGasv20.OFF ().

Lab Exercises
1. Design an application that measures the level of Oxygen(O2) and Carbon-dioxide (CO2)
gases in the room and display an alert message if the levels cross optimum levels.
For CO2 :
250-350 ppm: normal background concentration in outdoor ambient air.
350-1000 ppm: concentrations typical of occupied indoor spaces with good air exchange.
For O2 : 19.5 % to 21 %.

Additional Exercises
1. Design an application that displays a warning message if traces of (i) Ammonia gas, (ii)
Nitrogen Dioxide gas are found in your environment beyond acceptable limits.
(The U. S. Occupational Safety and Health Administration (OSHA)has set a 15-minute
exposure limit for gaseous ammonia of 35 ppm by volume in the environmental air and
an 8-hour exposure limit of 25 ppm by volume.)
2. Measure the concentrations of different air pollutant gases present in a room and convey
periodical data to a device.

69
[OBSERVATION SPACE] LAB NO: 6

70
[OBSERVATION SPACE] LAB NO: 6

71
[OBSERVATION SPACE] LAB NO: 6

72
[OBSERVATION SPACE] LAB NO: 6

73
[OBSERVATION SPACE] LAB NO: 6

74
LAB NO: 7

LAB NO: 7 Date:


SENSORS FOR ATMOSPHERIC PARAMETERS MEASUREMENT

Objective:
1. To experiment with basic functionalities of Arduino board.
2. To estimate the atmospheric parameters using Arduino board and sensors.

ARDUINO
Arduino is an open source prototype platform based on an easy to use hardware and software. It
consists of a programmable circuit board and a readymade software called Arduino IDE, which
is used to write code/sketch to be uploaded to the physical board. Arduino boards can read inputs
- light on a sensor, a finger on a button, or a Twitter message - and turn it into an output -
activating a motor, turning on an LED, publishing something online. All the tasks can be
accomplished by sending a set of instructions to the microcontroller on the board.

ARDUINO BOARD
Arduino boards can be of various types depending on the different microcontrollers used. The
differences are based on the number of inputs and outputs, speed, operating voltage, form factor,
etc. For the lab, Arduino Uno board will be used, which has 6 analog inputs, 6 pins for PWM,
16MHz clock speed, and is based on ATMEGA328 microcontroller.

ARDUINO SOFWARE (IDE)


The Arduino Integrated Development Environment - or Arduino Software (IDE) - contains a text
editor for writing code, a message area, a text console, a toolbar with buttons for common
functions and a series of menus. It connects to the Arduino hardware to upload programs and
communicate with them. The programs/sketches are written in the text editor and are saved with
the file extension ‘.ino’ (previously ‘.pde’).

The Serial Monitor displays serial data being sent from the Arduino board. To send data to the
board, the required text may be entered and "send" button or enter pressed. The baud rate can be
chosen from the drop-down that matches the rate passed to Serial.begin() in the sketch.

ARDUINO LIBRARIES
Libraries are a collection of code that makes it easy to connect to a sensor, display, module, etc.
Libraries provide extra functionality for use in sketches, e.g. working with hardware or
manipulating data. To use a specific library in a sketch, it can be selected from the Sketch menu.
The Library Manager can be used for installing new libraries.

75
LAB NO: 7

1 → Power USB
2 → Power (Barrel Jack)
3 → Voltage Regulator
4 → Crystal Oscillator
5,17 → Arduino Reset
6,7
→ Pins (3.3V, 5V, GND, Vin)
8,9
10 → Analog Pins
11 → Main Microcontroller
12 → ICSP pin
13 → Power LED indicator
14 → TX and RX LEDs
15 → Digital I/O
16 → AREF

Fig 7.1. Different Components of Arduino Uno Board

BUILT-IN EXAMPLES
Built-in Examples are sketches included in the Arduino Software (IDE), These sketches may be
accessed from the toolbar menu: File > Examples. These simple programs demonstrate all basic
Arduino commands. They span from a Sketch Bare Minimum to Digital and Analog IO, to the
use of Sensors and Displays.

ARDUINO SENSOR: MEASURING HUMIDITY AND TEMPERATURE


Sensors are used to measure the necessary parameters required for any application. The sensor,
DHT11 senses the environmental parameters like humidity and temperature.

The DHT11 detects water vapor by measuring the electrical resistance between two
electrodes. The humidity sensing component is a moisture holding substrate with electrodes
applied to the surface. When water vapor is absorbed by the substrate, ions are released by the
substrate which increases the conductivity between the electrodes. The change in resistance
between the two electrodes is proportional to the relative humidity. Higher relative humidity
decreases the resistance between the electrodes, while lower relative humidity increases the
resistance between the electrodes.

The DHT11 measures temperature with a surface mounted NTC temperature sensor (thermistor)
built into the unit.

76
LAB NO: 7

An IC mounted on the back of the unit converts the resistance measurement to relative
humidity. It also stores the calibration coefficients, and controls the data signal transmission
between the DHT11 and the Arduino.
Connections: Connect the sensor to the Arduino using the pin details as shown below:

DHT11 ARDUINO
Pin 1: Power Supply Vcc
Pin 2: Serial Data Output Analog0
Pin 3: No Connections -
Pin 4: Ground GND

Fig 7.2. A 4-pin DHT11 sensor and Connections

Ranges and Accuracy of DHT11:


 Humidity Range: 20-90% RH
 Humidity Accuracy: ±5% RH
 Temperature Range: 0-50 °C
 Temperature Accuracy: ±2% °C
 Operating Voltage: 3V to 5.5V

After setting up the connections, the sketch written to measure temperature and humidity can be
uploaded to Arduino. The DHT11 library is used in the sketch as well. The serial monitor is used
to observe the data readings from the sensor.

Lab Exercises
1. Write a program to blink an LED in Arduino Uno board when the temperature recorded
is:
i. Below 25ºC
ii. Above 32ºC
iii. Below 25ºC or above 32ºC
2. Design a program that displays the humidity of air every 60 seconds and displays:
i. Low humidity for relative humidity less than 30 %
ii. Healthy humidity for relative humidity more than 30 % and less than 50%
iii. High humidity for relative humidity more than 50%
3. Develop a simple web application that displays the temperature and humidity records
collected through Arduino sensors over a period of time.
Additional Exercise
1. Design an application that sends periodical average temperature and humidity collected
using Arduino sensors.

77
[OBSERVATION SPACE] LAB NO: 7

78
[OBSERVATION SPACE] LAB NO: 7

79
[OBSERVATION SPACE] LAB NO: 7

80
[OBSERVATION SPACE] LAB NO: 7

81
[OBSERVATION SPACE] LAB NO: 7

82
LAB NO: 8

LAB NO: 8 Date:


PROXIMITY ESTIMATION USING SENSORS

Objective:
1. To measure proximity of an object using infrared sensor.
2. To compare the performance of infrared and ultrasound sensors in target estimation.

ULTRASOUND SENSOR
Ultrasound Sensors/ Ultrasonic Sensors are primarily used in projects that involves distance
measurement. They can be used to find the distance to an object, or to detect when something is
near the sensor like a motion detector. They are ideal for projects involving navigation, object
avoidance, and home security. They work just as well in the dark as they do in the light because
they use sound to measure distance.

Sensor Specifications

Sensor Name: HC-SR04 Ultrasonic Sensor


Voltage: DC 5V
Current: Less than 2mA
Detection distance: 2cm-450cm
Precision: 2mm

Fig 8.1. The HC-SR04 Ultrasonic Sensor


Connections
HC-SR04 ARDUINO
Pin 1: Vcc +5V
Pin 2: Trig Analog0
Pin 3: Echo Analog0
Pin 4: Ground GND

83
LAB NO: 8

Working
The HC-SR04 has two metal cylinders called transducers at the front. One is a transmitting
transducer and the other one is a receiving transducer. The transmitting transducer converts an
electrical signal into the ultrasonic pulse, and the receiving transducer converts the reflected
ultrasonic pulse back into an electrical signal. The IC labelled MAX3232 at the back of the
sensor controls the transmitting transducer. The IC labelled LM324 at the back amplifies the
signal generated by the receiving transducer into a signal that’s strong enough to transmit to the
Arduino.

For measuring distance, an ultrasound needs be generated. For this, the Trig should be set on a
high signal for a minimum of 10µs. The sensor module, on receiving this signal, sends out an 8-
cycle sonic burst of frequency 40KHz from the transmitting transducer. If an object is within
measurable range, the 8-pulses hits the receiving transducer at the sensor. This is received at the
Echo pin, which outputs a high voltage signal equal to the total time taken by the 8-pulseto travel
from the transmitting transducer and back to the receiving transducer. To get the distance of the
object, the total time is halved and multiplied with the speed of sound.

INFRARED SENSOR
The Infrared Sensor can be used for obstacle sensing, color detection (between basic contrasting
colors), fire detection, line sensing, and as an encoder sensor.IR sensors are highly susceptible to
ambient light. The FC-51 IR sensor is suitably covered to reduce effect of ambient light on the
sensor. It has built-in IR transmitter and IR receiver that sends out IR energy and looks for
reflected IR energy to detect presence of any obstacle in front of the sensor module. The module
has on board potentiometer that lets user adjust detection range. The sensor has very good and
stable response even in ambient light or in complete darkness.

Sensor Specifications
Sensor Name: FC-51Infrared Obstacle Avoidance Proximity Sensor
Voltage: 3V–6V
Current: 23mA at 3.3V, 43mA at 5V
Detection Angle: 35º
Detection Range: 2cm – 30 cm (adjustable)

Connections

FC-51 ARDUINO
Pin 1: Vcc +5V
Pin 2: Ground GND
Pin 3: OUT Digital Output Pin
Fig 8.2. The FC-512 IR Sensor
84
LAB NO: 8

Working
The IR transmitter sends an infrared signal to be ultimately received by an IR receiver on being
reflected from a surface/object. In case of a reflective surface, the signal is reflected off in some
directions including that of the IR receiver. If the IR receiver captures the signal, it indicates the
presence and detection of an object. However, if the surface is absorbent (like black color) or if
the object is absent, the signal is not reflected and hence not detected by the receiver. There is an
IC (LM393) which is an open-collector voltage comparator. It provides an output if there is a
pull-up resistance between the output of the IC (DO) and the power supply Vcc. The output DO
is:
 high if the object is not detected;
 low if the object is detected.
Lab Exercises
1. Design one application which can compute the proximity of any object using an
ultrasound sensor.
2. Design one application which can compute the proximity of any object using an infrared
sensor.
3. Test and compare the precision of proximity calculations of any object/surface by using
both ultrasound and infrared sensors.
Additional Exercise
1. Write a program that can compute distance of an object using ultrasound sensor while
taking into consideration the environmental parameters of humidity and temperature.

85
[OBSERVATION SPACE] LAB NO: 8

86
[OBSERVATION SPACE] LAB NO: 8

87
[OBSERVATION SPACE] LAB NO: 8

88
[OBSERVATION SPACE] LAB NO: 8

89
[OBSERVATION SPACE] LAB NO: 8

90
[OBSERVATION SPACE] LAB NO: 8

91
LAB NO: 9

LAB NO: 9 Date:


SENSORS FOR HOME AUTOMATION

Objective:
1. To design a system for movement detection using sensors.
2. To demonstrate applications of various home safety sensors.

PIR SENSOR
PIR sensors are pyroelectric or “passive” infrared sensors which can be used to detect changes in
infrared radiation levels. The sensor is split in half, and any significant difference in IR levels
between the two sections of the sensor will cause the signal pin to swing HIGH or LOW. Hence,
it can be used as a motion detector when IR levels move across and trigger the sensor, like
human movement across a room.

Sensor Specifications
Sensor Name: HC-SR501 PIR Sensor
Input Voltage: 5V – 20V
Output Signal: 0.3V – 5V
Sentry Distance Maximum 7m
Sentry Angle: 110º
Connections

HC-SR501 ARDUINO
Pin 1: Ground GND
Pin 2: OUT Digital Output Pin
Pin 3: Vcc +5V

Fig 9.1. The HC-SR501PIR Sensor


Working
PIR sensor, being a passive element, do not generate their own voltages or energy. They are just
meant to measure the radiations emitted by other objects. There are two slots in the PIR sensor
module made of pyroelectric materials. Pyroelectric materials generate energy when exposed to
heat. A small screen on top of the PIR sensor which allows the infrared radiations to enter the
sensor. When the radiations fall on the pyroelectric material, they generate energy. When the
sensor is idle, both slots detect the same amount of IR, the ambient amount radiated from the
room or walls or outdoors. When a warm body like a human or animal passes by, it first
intercepts one half of the PIR sensor, which causes a positive differential change between the two

92
LAB NO: 9

halves. When the warm body leaves the sensing area, the reverse happens, whereby the sensor
generates a negative differential change. These change pulses are detected as presence (or
absence) of a motion. When the PIR detects motion, the output pin will go "high" to 3.3V and
light up the LED.

The PIR has a trim-pot on the back for adjusting sensitivity. This can be adjusted if the PIR is too
sensitive or not sensitive enough - clockwise makes it more sensitive.

The sketch for the PIR sensor can be written to just keeps track of whether the input to pin 2 is
high or low. The state of the pin should also be tracked, so that it prints out a message when
motion has started and stopped.

Lab Exercises
1. Develop an application that detects the presence of an intruder by lighting up an LED.
Use PIR sensor.
2. Modify the above application to send alert messages to a device on detection of an
intruder.
Additional Exercise
1. Develop an automatic lighting system in a room using PIR sensor.

93
[OBSERVATION SPACE] LAB NO: 9

94
[OBSERVATION SPACE] LAB NO: 9

95
[OBSERVATION SPACE] LAB NO: 9

96
[OBSERVATION SPACE] LAB NO: 9

97
LAB NO: 10

LAB NO: 10 Date:


RESOURCE CONSERVATION USING SENSORS

Objective:
1. To develop a system for water level monitoring in a tank using sensor.
2. To understand working of various sensors for resource conservation.

WATER LEVEL SENSOR


Water sensor is a high level/drop recognition sensor, which is obtained by having a series of
parallel wires exposed to traces of droplets/water volume to determine the water level.

Sensor Specifications:
Sensor Name: Water Level Sensor
Operating Voltage: 5V
Working Current: Less than 20mA
Sensor Type: Analog
Working Temperature: 10ºC - 30ºC
Operating Humidity: 10% ~ 90% non-condensing

Connections

Water Level Sensor ARDUINO


Pin 1: Ground GND
Pin 2: Vcc +5V
Pin 3: Signal Analog0
Fig 10.1. The Water Level Sensor
Working
To use the water level sensor as level detector in a water tank, the sensor must be installed on the
inside of the tank at the level where controlling the water is desired. The sensor must be
positioned in a way, so that the parallel lines are perpendicular to the water level. The
pin S(Signal) will give us a greater value as the sensor is immersed.

To detect whether it is raining, the sensor should be positioned horizontally, so that rain falling
on the sensor film will contribute to the readings of the pin S.An analog value
between VCC and GNDwill be given by pin S. The value read will be higher depending on the
sensor surface is covered with water. This is because the water acts as a conductor.

98
LAB NO: 10

Lab Exercise
1. Develop an application that measures the water level in a water tank and triggers any
form of alarm when water reaches a specific level.

Additional Exercise
1. Make use of both water level sensor and ultrasound sensor to detect water level in a water
tank. Compare the precision with the previous applications. Design the application to be
accessed remotely.

99
[OBSERVATION SPACE] LAB NO: 10

100
[OBSERVATION SPACE] LAB NO: 10

101
[OBSERVATION SPACE] LAB NO: 10

102
[OBSERVATION SPACE] LAB NO: 10

103
[OBSERVATION SPACE] LAB NO: 10

104

You might also like