0% found this document useful (0 votes)
13 views21 pages

Iot Module 4

Uploaded by

leonlalichan2002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views21 pages

Iot Module 4

Uploaded by

leonlalichan2002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

MODULE 4

BUILDING IoT
IOT DEVICE

 A "Thing" in Internet of Things (IoT) can be any object that has a unique identifier
and which can send/receive data (including user data) over a network (e.g., smart
phone, smart TV, computer, refrigerator, car, etc. ).
 IoT devices are connected to the Internet and send information about themselves or
about their surroundings (e.g. information sensed by the connected sensors) over a
network (to other devices or servers/storage) or allow actuation upon the physical
entities/environment around them remotely.

IOT DEVICE EXAMPLES

• A home automation device that allows remotely monitoring the status of appliances and
controlling the appliances.

• An industrial machine which sends information about its operation and health monitoring
data to a server

. • A car which sends information about its location to a cloud-based service.

• A wireless-enabled wearable device that measures data about a person such as the number
of steps walked and sends the data to a cloud-based service.

BASIC BUILDING BLOCKS OF AN IOT DEVICE

• Sensing

• Sensors can be either on-board the IoT device or attached to the device.

• Actuation

• IoT devices can have various types of actuators attached that allow taking

actions upon the physical entities in the vicinity of the device.

• Communication
• Communication modules are responsible for sending collected data to other devices
or cloud- based servers/storage and receiving data from other devices and commands from
remote applications.

• Analysis & Processing

• Analysis and processing modules are responsible for making sense of the collected
data.

BLOCK DIAGRAM OF AN IOT DEVICE

Exemplary Device: RaspberryPI

 Raspberry Pi is a low-cost mini-computer with the physical size of a credit card.


 Raspberry Pi runs various flavors of Linux and can perform almost all tasks that a
normal desktop computer can do.
 Raspberry Pi also allows interfacing sensors and actuators through the general
purpose I/O pins.

• Since Raspberry Pi runs Linux operating system, it supports Python" out of the box".

Raspberry Pi is a low-cost mini-computer with the physical size of a credit card.

• Raspberry Pi runs various flavors of Linux and can perform almost all tasks that a
normal desktop computer can do.
• Raspberry Pi also allows interfacing sensors and actuators through the general purpose
I/O pins. • Since Raspberry Pi runs Linux operating system, it supports Python" out of the
box".

Linux on Raspberry Pi

• Raspbian

• Raspbian Linux is a Debian Wheezy port optimized for Raspberry Pi.

• Arch

• Arch is an Arch Linux port for AMD devices.

• Pidora

• Pidora Linux is a Fedora Linux optimized for Raspberry Pi.

• RaspBMC

• RaspBMC is an XBMC media-center distribution for Raspberry Pi.

• OpenELEC

• OpenELEC is a fast and user-friendly XBMC media-center distribution.

• RISC OS
• RISC OS is a very fast and compact operating system.

IOT Systems-Logical Design Using Python

PYTHON

• Python is a general-purpose high level programming language and suitable for providing a
solid foundation to the reader in the area of cloud computing.

• The main characteristics of Python are:

• Multi-paradigm programming language

• Python supports more than one programming paradigms including object-


oriented programming and structured programming

• Interpreted Language

• Python is an interpreted language and does not require an explicit compilation


step. The Python interpreter executes the program source code directly, statement by
statement, as a processor or scripting engine does.

• Interactive Language

• Python provides an interactive mode in which the user can submit commands
at the Python prompt and interact with the interpreter directly

Datatypes

Every value in Python has a datatype. Since everything is an object in Python programming,
data types are actually classes and variables are instance (object) of these classes.

There are various data types in Python. Some of the important types are listed below.

Python Numbers

Integers, floating point numbers and complex numbers falls under

Python numbers category.

They are defined as int, float and complex class in Python.


We can use the type() function to know which class a variable or a value belongs to
and
the isinstance() function to check if an object belongs to a particular class.

Script.py
1. a = 5
2. print(a, "is of type", type(a))
3. a = 2.0
4. print(a, "is of type", type(a))
5. a = 1+2j
6. print(a, "is complex number?", isinstance(1+2j,complex))

Integers can be of any length, it is only limited by the memory available. A floating point
number is accurate up to 15 decimal places. Integer and floating points are separated by
decimal points. 1 is integer, 1.0 is floating point number. Complex numbers are written in the
form, x + yj, where x is the real part and y is the imaginary part. Here are some examples.

>>> a = 1234567890123456789

>>> a

1234567890123456789

>>> b = 0.1234567890123456789

>>> b

0.12345678901234568

>>> c = 1+2j

>>> c

(1+2j)

Python List

List is an ordered sequence of items. It is one of the most used datatype in Python and is very
flexible. All the items in a list do not need to be of the same type. Declaring a list is pretty
straight forward. Items separated by commas are enclosed within brackets [].

>>> a = [1, 2.2, 'python']


We can use the slicing operator [ ] to extract an item or a range of items from a list. Index
starts form 0 in Python.

Script.py

1. a = [5,10,15,20,25,30,35,40]

2. # a[2] = 15

3. print("a[2] = ", a[2])

4. # a[0:3] = [5, 10, 15]

5. print("a[0:3] = ", a[0:3])

6. # a[5:] = [30, 35, 40]

7. print("a[5:] = ", a[5:])

Lists are mutable, meaning; value of elements of a list can be altered.

>>> a = [1,2,3]

>>> a[2]=4

>>> a

[1, 2, 4]

Python Tuple

Tuple is an ordered sequences of items same as list. The only difference is that tuples are
immutable. Tuples once created cannot be modified. Tuples are used to write-protect data
and are usually faster than list as it cannot change dynamically. It is defined within
parentheses () where items are separated by commas.

>>> t = (5,'program', 1+3j)

Script.py

t = (5,'program', 1+3j)

# t[1] = 'program'

print("t[1] = ", t[1])


# t[0:3] = (5, 'program', (1+3j))

print("t[0:3] = ", t[0:3])

# Generates error

# Tuples are immutable

t[0] = 10

Python Strings

String is sequence of Unicode characters. We can use single quotes or double quotes to
represent strings. Multi-line strings can be denoted using triple quotes, ''' or """.

>>> s = "This is a string"

>>> s = '''a multiline

Like list and tuple, slicing operator [ ] can be used with string. Strings are immutable.

Script.py

a ={5,2,3,1,4}

# printing setvariable

print("a = ", a)

# data type of variable a

print(type(a))

We can perform set operations like union, intersection on two sets. Set have unique values.
They eliminate duplicates. Since, set are unordered collection, indexing has no meaning.
Hence the slicing operator [] does not work. It is generally used when we have a huge amount
of data. Dictionaries are optimized for retrieving data. We must know the key to retrieve the
value. In Python, dictionaries are defined within braces {} with each item being a pair in the
form key:value. Key and value can be of anytype.

>>> d = {1:'value','key':2}

>>> type(d)

<class ‘dict’>
We use key to retrieve the respective value. But not the other way around.

Script.py

d ={1:'value','key':2}

print(type(d))

print("d[1] = ",d[1]);

print("d['key'] = ", d['key']);

# Generates error

print("d[2] = ",d[2]);

IoT PHYSICAL DEVICES AND ENDPOINTS

IoT Device

A "Thing" in Internet of Things (IoT) can be any object that has a unique identifier and which
can send/receive data (including user data) over a network (e.g., smart phone, smartTV,
computer, refrigerator, car, etc.).

• IoT devices are connected to the Internet and send information about themselves or about
their surroundings (e.g. information sensed by the connected sensors) over a network (to
other devices or servers/storage) or allow actuation upon the physical entities/environment
around them remotely.

IoT Device Examples


A home automation device that allows remotely monitoring the status of appliances and
controlling the appliances.

• An industrial machine which sends information abouts its operation and health monitoring
data to a server.

• A car which sends information about its location to a cloud-based service.

• A wireless-enabled wearable device that measures data about a person such as the number
of steps walked and sends the data to a cloud-based service.

Basic building blocks of an IoT Device

1. Sensing: Sensors can be either on-board the IoT device or attached to thedevice.

2. Actuation: IoT devices can have various types of actuators attached that allow taking
actions upon the physical entities in the vicinity of thedevice.

3. Communication: Communication modules are responsible for sending collected data to


other devices or cloud-based servers/storage and receiving data from other devices and
commands from remote applications.

4. Analysis & Processing: Analysis and processing modules are responsible for making sense
of the collected data.

Exemplary Device: Raspberry Pi Raspberry Pi is a low-cost mini-computer with the


physical size of a credit card. Raspberry Pi runs various flavors of Linux and can perform
almost all tasks that a normal desktop computer can do. Raspberry Pi also allows interfacing
sensors and actuators through the general purposeI/O pins. Since Raspberry Pi runs Linux
operating system, it supports Python "out of the box". Raspberry Pi is a low-cost mini-
computer with the physical size of a credit card. Raspberry Pi runs various flavors of Linux
and can perform almost all tasks that a normal desktop computer can do. Raspberry Pi also
allows interfacing sensors and actuators through the general purpose I/O pins. Since
Raspberry Pi runs Linux operating system, it supports Python "out of the box".
Sensor deployment & Node discovery
Five static sensor deployment strategies are introduced. The deployment strategies are one
uniform random deployment and four regular deployments: square grid, triangle grid,
hexagon grid, and THT. These strategies are shown in Fig. 1 . A square field is considered in
this work

• Uniform Random Deployment

• Regular Deployment

1. Square Grid

2. Triangle Grid

3. Hexagon Grid

4. Tri-Hexagon Tiling (THT)

Uniform Random Deployment:

In the random deployment scheme, sensors are deployed in a random way. Therefore, the
exact locations of nodes are not known. Random deployment is usually suitable in the
following cases:
• When the environment is harsh and therefore, deployment of nodes is exceedingly difficult.

• When wireless sensor network is large scale.

• When the cost of sensors is not an issue. In this method, sensors are dropped form a
helicopter, an airplane or an unmanned vehicle. Uniform random deployment is random
deployment where nodes are placed in a sensing area randomly with uniform distribution.
Fig. 1a illustrates the uniform random deployment method.

Regular Deployment:

Regular deployment refers to placing sensors in a regular form in a sensing area. This type of
deployment can usually be applied in non-harsh environment and non-large-scale regions.
four regular deployment strategies are introduced.

Square Grid:

In the square grid deployment, a square sensing area is divided into small squares and the
nodes are placed at the points of grid intersection as shown in Fig. 1b.

Triangle Grid: A square sensing area in this model is divided into small triangles and the
sensors are located in the points of triangle heads as shown in Fig. 1c

Hexagon Grid: In hexagon grid deployment scheme, a sensing area is divided into
hexagons, as illustrated in Fig. 1d, and the sensors are placed at the vertices of hexagons.

Tri-Hexagon Tiling (THT): THT is a deterministic deployment method .This model is a


pattern of hexagonal stars that consist of triangles and hexagons. Tiling refers to covering the
area without leaving any gaps and without any overlapping. Fig. 1e displays the THT
deployment strategy.

IoT Sensor Deployment Challenges: The business benefits of IoT coupled with market
trends are driving rapid IoT adoption in every industry vertical like smart cities, building
automation, industrial, healthcare, etc. This growing demand for IoT connectivity is paving
the way to a plethora of sensor types for various use cases such as traffic sensors, parking
meters, pressure sensors, electricity sensors, and so on. Efficient sensor deployment is one of
the key success factors in every IoT investment and that’s where most enterprises struggle a
lot today.
NEIGHBOUR DISCOVERY FOR lot SCENARIOS :

1. Time Synchronised Protocols

2. Deterministic Approach

3. Colocation based Approaches

4. A Fully Distributed Opportunistic Approach

5. Learning Based Approach

Time Synchronised Protocols: These protocols make use of


synchronization methods to schedule communication with
neighboring nodes. With these methods it is possible for the nodes to
arrive at a common time reference.

In sensor networks when the nodes are deployed, their exact location
is not known, so time synchronization is used to determine their
location. Also time stamped messages will be transmitted among the
nodes in order to determine their relative proximity to one another.
Time synchronization is used to save energy; it will allow the nodes to
sleep for a given time and then awaken periodically to receive a
beacon signal. Many wireless nodes are battery powered, so energy
efficient protocols are necessary. Lastly, having common timing
between nodes will allow for the determination of the speed of a
moving node.

Deterministic Approach: Deterministic approaches make use of


mathematical methods to guarantee overlap. Though they require
higher discovery latency, they do not need any synchronization. The
searchlight protocol can ensure discovery within a definite
latency(Network latency is the amount of time it takes for a data
packet to go from one place to another) by sequential search.

 This protocol has two slots - Active slots and probe slots.
 The nodes decide to remain awake during active slots, and
sleep during the remaining slots.
 During an active slot, the node may send or receive or do both.
 Successful discovery takes place between two neighboring
nodes whenever their active slots overlap.
 When a discovery scheme uses few active slots to discover
neighbors within a reasonable time limit, then it is said to be
efficient.
 In Searchlight, each node has two active slots in t.
 The first active slot, called the anchor slot, is the first slot in
the period.
 In the symmetric case, since the position of this anchor slot is
fixed in t but the start times for the t vary for different nodes,
the anchor slots for two nodes overlap only if the difference
between the start times of the two periods is less than a timeslot.
Searchlight introduces a second active slot in t called the probe
slot, which searches for the anchor slot of the other node.

Colocation based Approaches:


These approaches make use of knowledge coming from neighbouring
nodes. This knowledge is used to coordinate schedule between the
nodes.

A Fully Distributed Opportunistic Approach:

In order to optimize the discovery of constrained nodes in lOT


network, an EADP (Efficient Application-layer Discovery Protocol)
has been proposed.. The protocol targets low power applications.

 EADP architecture has the following components - User agent,


Service agent, Reply Agent.
 The user agent delivers a limited-flooding algorithm for
discovering nodes .
 The service agent is responsible for maintenance of remote
service information. The service agent also has a state-
maintenance mechanism that allows the protocol to react to
topology changes.
 The reply agent is responsible for control and delivery of
unicast replies.

Learning Based Approach:

In this approach, the machine learns by itself. It refers to the AI


modelling where the relationship or patterns in data are not defined by
the developer. In this approach, random data is fed to the machine
and it is left on the machine to figure out patterns and trends out of
it. Generally, this approach is followed when the data is un labelled
and too random for a human to make sense out of it. Q-Learning
techniques are used to do node discovery(agent,state,action-
reward). The system is able to reduce energy wastage when contacts
are not expected, while reducing discovery latency by employing an
approach in which both mobile and static devices can learn their
contact opportunities. Thus the time of contact useful for service is
increased provisioning data collection.
Q-Learning is becoming widely used in communication scenarios for solving problems that
require learning of knowledge to be exploited at a later time.

After the completion of the learning phase, the framework enters the experimental phase. In
this phase, the framework is tested with the real world data and optimal decisions are taken.

3.13 Data Aggregation :

Data Aggregation is the process of one or more sensor nodes and detects the information
result from the other sensor nodes. The aim of the data aggregation is removes data
redundancy and improves the energy lifetime in wireless sensor network. Therefore reducing
the number of data packets transmitted over the network because aggregation need less power
as compare to multiple packets sending having same data
Data Aggregation Approaches: Data aggregation is further divided into four basic
approaches.

a) Cluster based approach

b) Tree based approach

c) Multipath approach

d) Hybrid approach

Cluster Based Approach: Cluster Based Approach is defined as the hierarchical approach in
which whole network is separated into various cluster. Each cluster has cluster heads. The
main role of cluster head is to aggregate data received from cluster members locally and
then transmits the result to base station. The cluster head can share information with the
sink directly via long range transmissions or multi hopping using other cluster heads.

Tree Based Approach: The Tree Based Approach is actually defining aggregation concept
which is used to make aggregation tree. This tree define as minimum spanning tree in which
sink node act as root and source node act as leaves. Data start flowing from leave nodes up
to root nodes. The main disadvantage of this approach is data packet loss at any level of
tree which may cause failure of whole network.
Multipath Approach: This approach is used to overcome the drawbacks of tree based
approach. Accordingly to this approach each and every node could send data packets over
multiple paths using multiple neighbors in aggregation tree. So a data packet sends from
source to destination using multiple paths with the help of intermediate nodes. The example
of this approach like ring topology. Overhead is the disadvantage of this approach

Hybrid Approach: The Hybrid Approach is the mixture of cluster based approach, multipath
approach and tree based approach. This approach is mainly used for adaptively for optimal
performance of their data aggregation

3.14 Data Dissemination:

Data Dissemination is the process in which sensor nodes is collecting the data and
communicate to the base station or any other interested node. The source node is generating
the data and the information to be reported is known as event. Those nodes which are
interested in event and seek information are known as sink. So in this whole process data
are routed in sensor network. It is two steps process; in first step interested nodes broadcast
to their neighbor nodes in the network and in second step nodes after receiving the request
sends requesting data.

Data Dissemination Approach:

There are many data dissemination methods or approaches which are following as:

Flooding: If the destination node not received the data packet or specified number of hops is
not reached, then each node broadcast the gathered data until the packet reached to their
destination node. The main advantage of flooding is not requires costly topology maintain or
route discovery but it face several problems like implosion, overlap and resource blindness.

Gossiping: The gossiping is the version of flooding approach .In this approach the packet is
sent to a single neighbor chosen from neighbour table randomly instead of broadcasting
each packet to the entire neighbor. This process can take long time from completion.
Gossiping avoids the problem faced in flooding approach like implosion.

SPIN: (Sensor Protocol for Information via Negotiation) this is the enhancement of flooding
protocols based on data centric routing. Flooding has mainly three problems like:

implosion, overlap and resource blindness.


To overcome these problems the spin family protocols used three ways: ADV, REQ, DATA
are used.

 The nodes which are interested in the event transmit REQ message for DATA.
 After receiving REQ message source node sends DATA message to interested node.
 In this way data can reach to all interested node in entire network.

This technique prevents the problems implosion, overlap and resource blindness which is
faced by flooding. Wireless Sensor Network is the important in the field networking. A
WSN is basically made up of number of several sensor nodes which work together.

You might also like