0% found this document useful (0 votes)
504 views77 pages

Unit-I Introduction To Iot and Python Programming

The document outlines the syllabus for a course on Internet of Things (IoT) and Python programming. It covers 6 units over the course, including introductions to IoT, key technologies, logical and physical design of IoT systems, and case studies. Assessments include quizzes, a mid-semester exam, and an end-of-semester exam. The course aims to explain IoT concepts and technologies, compare wireless standards, and propose solutions to real-world problems using IoT.

Uploaded by

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

Unit-I Introduction To Iot and Python Programming

The document outlines the syllabus for a course on Internet of Things (IoT) and Python programming. It covers 6 units over the course, including introductions to IoT, key technologies, logical and physical design of IoT systems, and case studies. Assessments include quizzes, a mid-semester exam, and an end-of-semester exam. The course aims to explain IoT concepts and technologies, compare wireless standards, and propose solutions to real-world problems using IoT.

Uploaded by

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

INTERNET OF THINGS (IoT)

UCSE0801

UNIT-I
INTRODUCTION TO IoT
AND
PYTHON PROGRAMMING
Mr. Naresh A. Kamble
Asst. Professor
Department of Computer Science & Engineering
KIT’s COLLEGE OF ENGINEERING (AUTONOMOUS)
POINTS TO BE COVERED
• INTRODUCTION
• PHYSICAL DESIGN OF IOT
• LOGICAL DESIGN OF IOT
• IOT ENABLING TECHNOLOGIES
• IOT LEVELS AND DEPLOYMENT TEMPLATES

2
SYLLABUS STRUCTURE

UNIT NAME OF UNIT HOURS

I INTRODUCTION TO IoT AND PYTHON PROGRAMMING 6

II FUNDAMENTALS OF IoT MECHANISM AND KEY TECHNOLOGIES 6

III IoT SYSTEMS – LOGICAL DESIGN USING PYTHON 5

IV IoT PHYSICAL DEVICES & ENDPOINTS 4

V IoT PHYSICAL SERVERS & CLOUD OFFERING 5

VI CASE STUDIES IILUSTRATING IoT DESIGN 4

3
ASSESSMENTS

ASSESSMENT MARKS

ISE1 10

MSE 30

ISE2 10

ESE 50

TOTAL 100
4
COURSE OUTCOMES

CO AFTER THE COMPLETION OF THE COURSE THE STUDENT WILL BE ABLE TO

CO1 EXPLAIN THE KEY CONCEPTS AND KEY TERMINOLOGY RELATED TO IoT.

CO2 COMPARE DIFFERENT WIRLESS TECHNOLOGIES RELATED TO IoT.

CO3 PROPOSE IoT SOLUTIONS FOR REAL LIFE PROBLEMS.

5
INTRODUCTION
• WHAT IS IoT?

• IoT is an umbrella term that refers to the billions of physical


objects or “things” connected to the Internet, all collecting
and exchanging data with other devices and systems over the
Internet.

6
INTRODUCTION
• CHARACTERISTICS OF IoT

• Dynamic & Self-Adapting.

• Self-Configuring.

• Interoperable Communication Protocols.

• Unique Identity.

• Integrated into Information Network.

7
INTRODUCTION
• TYPES OF IoT

• Consumer IoT.

• Commercial IoT.

• Military Things (IoMT).

• Industrial Internet of Things (IIoT).

• Infrastructure IoT.

8
INTRODUCTION

SENCE

FEEL
PEOPLE PEOPLE
SHARE

9
HOW DOES A DEVICE
COMMUNICATE WITH OTHER
DEVICE OVER INTERNET?

10
PHYSICAL DESIGN OF IoT

11
PHYSICAL DESIGN OF IoT
• The "Things" in IoT usually refers to IoT devices which have unique
identities and can perform remote sensing, actuating and
monitoring capabilities.
• IoT devices can:
– Exchange data with other connected devices and applications (directly or
indirectly), or
– Collect data from other devices and process the data locally or
– Send the data to centralized servers or cloud-based application back-ends
for processing the data, or
– Perform some tasks locally and other tasks within the IoT infrastructure,
based on temporal and space constraints
12
GENERIC BLOCK DIAGRAM OF IoT

• An IoT device may consist of


several interfaces for
connections to other
devices, both wired and
wireless.

• I/O interfaces for sensors.

• Interfaces for Internet


Connectivity.

• Memory and storage


interfaces.

• Audio/video interfaces.
13
IoT PROTOCOLS
• Link Layer
• 802.3 – Ethernet
• 802.11 – WiFi
• 802.16 – WiMax
• 802.15.4 – LR-WPAN
• 2G/3G/4G
• Network/Internet Layer
• IPv4
• IPv6
• 6LoWPAN
• Transport Layer
• TCP
• UDP
• Application Layer
• HTTP
• CoAP
• WebSocket
• MQTT
• XMPP
• DDS
• AMQP 14
LOGICAL DESIGN OF IoT

15
LOGICAL DESIGN OF IoT

• Logical design of an IoT


system refers to an abstract
representation of the
entities and processes
without going into the low-
level specifics of the
implementation.

• An IoT system comprises of


a number of functional
blocks that provide the
system the capabilities for
identification, sensing,
actuation, communication,
and management.
16
IoT COMMUNICATION
MODELS

17
IoT COMMUNICATION MODELS
• TYPES OF MODELS

• REQUEST – RESPONSE COMMUNICATION MODEL.

• PUBLISH – SUBSCRIBE COMMUNICATON MODELS.

• PUSH – PULL COMMUNICATION MODELS.

• EXCLUSIVE PAIR COMMUNICATION MODELS.

18
REQUEST-RESPONSE COMMUNICATION MODEL

• Request-Response is a
communication model in
which the client sends
requests to the server and
the server responds to the
requests.

• When the server receives a


request, it decides how to
respond, fetches the data,
retrieves resource
representations, prepares
the response, and then
sends the response to the
client.
19
PUBLISH-SUBSCRIBE COMMUNICATION MODEL
• Publish-Subscribe is a
communication model that
involves publishers, brokers
and consumers.
• Publishers are the source of
data. Publishers send the
data to the topics which are
managed by the broker.
Publishers are not aware of
the consumers.
• Consumers subscribe to the
topics which are managed
by the broker.
• When the broker receives
data for a topic from the
publisher, it sends the data
to all the subscribed
20
consumers.
PUSH-PULL COMMUNICATION MODEL
• Push-Pull is a
communication model in
which the data producers
push the data to queues and
the consumers pull the data
from the queues. Producers
do not need to be aware of
the consumers.
• Queues help in decoupling
the messaging between the
producers and consumers.
• Queues also act as a buffer
which helps in situations
when there is a mismatch
between the rate at which
the producers push data and
the rate at which the
21
consumers pull data.
EXCLUSIVE PAIR COMMUNICATION MODEL

• Exclusive Pair is a
bidirectional, fully duplex
communication model that
uses a persistent connection
between the client and
server.

• Once the connection is


setup it remains open until
the client sends a request to
close the connection.

• Client and server can send


messages to each other
after connection setup.

22
IoT COMMUNICATION APIs

23
IoT COMMUNICATION APIs
• TYPES OF APIs

• REST - BASED COMMUNICATION APIs.

• WEBSOCKET – BASED COMMUNICATON APIs.

24
REST-BASED COMMUNICATION APIs
• Representational State
Transfer (REST) is a set of
architectural principles by
which you can design web
services and web APIs that
focus on a system’s
resources and how resource
states are addressed and
transferred.
• REST APIs follow the request
response communication
model.
• The REST architectural
constraints apply to the
components, connectors,
and data elements, within a
distributed hypermedia
25
system.
WEBSOCKET-BASED COMMUNICATION APIs

• WebSocket APIs allow


bidirectional, full duplex
communication between
clients and servers.

• WebSocket APIs follow the


exclusive pair
communication model

26
IoT ENABLING
TECHNOLOGIES

27
IoT ENABLING TECHNOLOGIES
• An IoT is enabled by following technologies:

• Wireless Sensor Network.

• Cloud Computing.

• Big Data Analytics.

• Communication Protocols.

• Embedded Systems.

28
IoT ENABLING TECHNOLOGIES
• WIRELESS SENSOR NETWORK.
• Wireless sensor network (WSN) comprise of distributed devices with the
sensor which are used to monitor the environmental and physical
conditions.
• A WSN consists of a number of end nodes and routers and a coordinator.
• End nodes have several sensors attached to them. End node can also act
as a routers.
• Routers are responsible for routing the data packet from end nodes to the
coordinator.
• The coordinator node collect the data from all the notes coordinator also
act as a Gateway that connects the WSN to the internet.
29
IoT ENABLING TECHNOLOGIES
• Weather monitoring system using WSN in which the nodes collect temperature,
humidity and other data which is aggregated and analyzed .

• Indoor air quality monitoring system using WSN to collect data on the indoor air
quality and connections of various gases.

• Soil moisture monitoring system using WSN to monitor soil moisture at various
location.

• Surveillance systems use WSN for collecting surveillance data(motion detection


data)

• Smart grid use wireless sensor network for monitoring the grid at various point.

• Structural health monitoring systems use WSN to monitor the health of structure
by writing vibration data from sensor nodes deployed at various points in the
structure. 30
IoT ENABLING TECHNOLOGIES
• CLOUD COMPUTING
• Cloud Computing is a transformative computing paradigm that
involves delivering applications and services over the internet.

• Cloud Computing involves provisioning of computing networking


and storage resources on demand and providing these resources as
metered services to the users, in a “ pay as you go” model.

• Cloud Computing resources can be provisioned on demand by the


user without requiring interactions with the Cloud Service Provider.
31
IoT ENABLING TECHNOLOGIES
• CLOUD COMPUTING SERVICES

• Infrastructure as a service(IAAS)

• Platform as a service(PaaS)

• Software as a service(SaaS)

32
IoT ENABLING TECHNOLOGIES
• BIG DATA ANALYTICS

• Big data is defined as collections of data set whose volume,


velocity in terms of its temporal variations )or variety, is so
large that it is difficult to store, manage, process and analyze
the data using traditional database and data processing tools.

• Big Data Analytics involving several steps starting from Data


cleaning data munging data processing and visualization.

33
IoT ENABLING TECHNOLOGIES
• EXAMPLES OF BIG DATA GENERATED BY IoT

• 1. Sensor data generated by IoT system such as weather monitoring


stations

• 2. Machine sensor data collected from sensor embedded in


Industrial and energy system for monitoring their files and
protecting failure

• 3. Health and fitness data generated by IoT devices such as


wearable fitness band.

• 4. Data generated by IoT system for Location tracking of vehicle.

• 5. Data generated by retail inventory monitoring system. 34


IoT ENABLING TECHNOLOGIES
• COMMUNICATION PROTOCOLS

• Communications protocols form the backbone of IoT system and


enable network connectivity and coupling to applications.

• Communications protocols allow device to exchange data over the


network.

• These protocols define the data exchange formats and data


encoding schemes for devices and routing of packets from source to
destination.

• Other function of the protocol include sequence control flow


control and transmissions of Lost packet. 35
IoT ENABLING TECHNOLOGIES
• EMBEDDED SYSTEMS
• An Embedded system is computer system that has computer hardware
and software embedded perform specific task.
• In contrast to general purpose computers or personal computers which
can perform various types of tasks, embedded systems are designed to
perform a specific set of tasks.
• Embedded system include Microprocessor and Microcontroller
memory Ram ROM cache networking units (Ethernet WI-FI adaptor)
input/output unit display keyboard , display and storage such as Flash
Memory some embedded system have specialist processes such as
digital signal processor DSP graphic processor and application.
36
IoT LEVELS AND
DEPLOYMENT TEMPLATES

37
IoT LEVELS & DEPLOYMENT
TEMPLATES
• An IoT system comprises of the following components:
• Device: An IoT device allows identification, remote sensing, actuating and
remote monitoring capabilities. You learned about various examples of IoT
devices in section
• Resource: Resources are software components on the IoT device for
accessing, processing, and storing sensor information, or controlling
actuators connected to the device. Resources also include the software
components that enable network access for the device.
• Controller Service: Controller service is a native service that runs on the
device and interacts with the web services. Controller service sends data
from the device to the web service and receives commands from the
application (via web services) for controlling the device.
38
IoT LEVELS & DEPLOYMENT
TEMPLATES
• Database: Database can be either local or in the cloud and stores the data
generated by the IoT device.
• Web Service: Web services serve as a link between the IoT device,
application, database and analysis components. Web service can be either
implemented using HTTP and REST principles (REST service) or using
WebSocket protocol (WebSocket service).
• Analysis Component: The Analysis Component is responsible for analyzing
the IoT data and generate results in a form which are easy for the user to
understand.
• Application: IoT applications provide an interface that the users can use to
control and monitor various aspects of the IoT system. Applications also
allow users to view the system status and view the processed data.
39
IoT LEVEL 1
• A level-1 IoT system has a single
node/device that performs sensing
and/or actuation, stores data,
performs analysis and hosts the
application

• Level-1 IoT systems are suitable for


modeling low-cost and low-complexity
solutions where the data involved is
not big and the analysis requirements
are not computationally intensive. 40
IoT LEVEL 2
• A level-2 IoT system has a single node
that performs sensing and/or actuation
and local analysis.

• Data is stored in the cloud and application


is usually cloud based.

• Level-2 IoT systems are suitable for


solutions where the data involved is big,
however, the primary analysis
requirement is not computationally
41
intensive and can be done locally itself.
IoT LEVEL 3
• A level-3 IoT system has a single
node. Data is stored and analyzed
in the cloud and application is
cloud based.

• Level-3 IoT systems are suitable for


solutions where the data involved
is big and the analysis
requirements are computationally
intensive. 42
IoT LEVEL 4
• A level-4 IoT system has multiple nodes that
perform local analysis. Data is stored in the
cloud and application is cloud-based.

• Level-4 contains local and cloud based


observer nodes which can subscribe to and
receive information collected in the cloud
from IoT devices.

• Level-4 IoT systems are suitable for solutions


where multiple nodes are required, the data
involved is big and the analysis requirements
43
are computationally intensive.
IoT LEVEL 5
• A level-5 IoT system has multiple end nodes
and one coordinator node.
• The end nodes that perform sensing and/or
actuation.
• Coordinator node collects data from the end
nodes and sends to the cloud.
• Data is stored and analyzed in the cloud and
application is cloud-based.
• Level-5 IoT systems are suitable for solutions
based on wireless sensor networks, in which
the data involved is big and the analysis
requirements are computationally intensive.
44
IoT LEVEL 6
• A level-6 IoT system has multiple independent
end nodes that perform sensing and/or
actuation and send data to the cloud.
• Data is stored in the cloud and application is
cloud-based.
• The analytics component analyzes the data
and stores the results in the cloud database.
• The results are visualized with the cloud-based
application.
• The centralized controller is aware of the
status of all the end nodes and sends control
commands to the nodes.
45
INTRODUCTION TO PYTHON
PROGRAMMING

46
POINTS TO BE COVERED
• INTRODUCTION
• FEATURES OF PYTHON
• IDENTIFIERS
• VARIABLES
• INPUT / OUTPUT
• SETTING UP PYTHON PROGRAMMING
ENVIRONMENT.

47
INTRODUCTION
• WHAT IS PYTHON LANGUAGE ?

• Python is general purpose interpreted, interactive, object


oriented and high level programming language.

48
FEATURES OF PYTHON
• SIMPLE AND EASY TO LEARN

• INTERPRETED AND INTERACTIVE

• OBJECT-ORIENTED

• PORTABLE

• SCALABLE

• EXTENDABLE

• GUI PROGRAMMING AND DATABASES

• BROAD STANDARD LIBRARY


49
PYTHON BUILDING BLOCKS
• IDENTIFIERS

• KEYWORDS

• INDENTION

• VARIABLES

• COMMENTS

50
PYTHON BUILDING BLOCKS
• IDENTIFIERS

• A Python identifier is a name used to identify a variable,


function, class, module or other object.

• An identifier starts with a letter A to Z or a to z or an


underscore (_) followed by zero or more letters, underscores
and digits (0 to 9).

• Identifiers cannot begin with digit.

• Special symbols like @, !, #, $, % etc. cannot be used.

• Identifier can be of any length.


51
PYTHON BUILDING BLOCKS
• NAMING CONVENTIONS FOR PYTHON IDENTIFIERS

• Class names start with an uppercase letter. All other


identifiers start with a lowercase letter.

• Example: Person

• Starting an identifier with a single leading underscore


indicates that the identifier is private.

• Example: _person

52
PYTHON BUILDING BLOCKS
• NAMING CONVENTIONS FOR PYTHON IDENTIFIERS

• Starting an identifier with two leading underscores indicates a


strongly private identifier.

• Example: __person

• If the identifier also ends with two trailing underscores, the


identifier is a language-defined special name.

• Example: person__

53
PYTHON BUILDING BLOCKS
• KEYWORDS

• Python keywords are special reserved words that have


specific meanings and purposes and can’t be used for
anything but those specific purposes.

• These keywords are always available—you’ll never have to


import them into your code.

54
PYTHON BUILDING BLOCKS
• There are total 35 keywords in Python

55
PYTHON BUILDING BLOCKS
• Meaning of each keyword in Python

Keyword Description
and A logical operator
as To create an alias
assert For debugging
break To break out of a loop
class To define a class
continue To continue to the next iteration of a loop
def To define a function
del To delete an object
elif Used in conditional statements, same as else if
56
PYTHON BUILDING BLOCKS
• Meaning of each keyword in Python
Keyword Description
else Used in conditional statements
except Used with exceptions, what to do when an exception occurs

False Boolean value, result of comparison operations

finally Used with exceptions, a block of code that will be executed no matter if there is an exception
or not

for To create a for loop


from To import specific parts of a module
global To declare a global variable
if To make a conditional statement
import To import a module
in To check if a value is present in a list, tuple, etc.
57
PYTHON BUILDING BLOCKS
• Meaning of each keyword in Python
Keyword Description
is To test if two variables are equal
lambda To create an anonymous function
None Represents a null value
nonlocal To declare a non-local variable
not A logical operator
or A logical operator
pass A null statement, a statement that will do nothing

raise To raise an exception


return To exit a function and return a value
True Boolean value, result of comparison operations
58
PYTHON BUILDING BLOCKS
• Meaning of each keyword in Python

Keyword Description
try To make a try...except statement
while To create a while loop
with Used to simplify exception handling
yield To end a function, returns a generator

59
PYTHON BUILDING BLOCKS
• INDENTATION

• Indentation in Python refers to the spaces and tabs that are


used at the beginning of a statement.

• The statements with the same indentation belong to the same


group called a suite.

60
PYTHON BUILDING BLOCKS
• EXAMPLE 1
if a==1:

print(a)

if b==2:

print(b)

print('end’)

• In the above code, the first and last line of the statement is
related to the same suite because there is no indentation in
front of them.
61
PYTHON BUILDING BLOCKS
• EXAMPLE 2
if True:

print(“Answer”)

print(“Correct”)

else:

print(“Answer”)

print(“Wrong”)

• The above code will generate ERROR as indentation is not


properly followed

62
PYTHON BUILDING BLOCKS
• VARIABLES

• Variables are containers for storing data values.

• Python has no command for declaring a variable.

• A variable is created the moment you first assign a value to it.

63
PYTHON BUILDING BLOCKS

CASTING

64
PYTHON BUILDING BLOCKS
• COMMENTS

• Comments can be used to explain Python code.

• Comments can be used to make the code more readable.

• Comments can be used to prevent execution when testing


code.

65
PYTHON BUILDING BLOCKS
• Comments starts with a #, and Python will ignore them:

SINGLE LINE COMMENTS


66
PYTHON BUILDING BLOCKS
• To add a multiline comment you could insert a # for each line:

MULTI LINE COMMENTS 67


PYTHON ENVIRONMENT SETUP
• STEPS FOR INSTALLING PYTHON ON WINDOWS

• Visit website “Python Releases for Windows”:


https://www.python.org/downloads/windows/

68
PYTHON ENVIRONMENT SETUP
• STEPS FOR INSTALLING PYTHON ON WINDOWS

• Click link “Download Windows x86-64 executable installer” under “Stable


Releases” header.

69
PYTHON ENVIRONMENT SETUP
• STEPS FOR INSTALLING PYTHON ON WINDOWS

• A popup opens. Click “Save File”.

70
PYTHON ENVIRONMENT SETUP
• STEPS FOR INSTALLING PYTHON ON WINDOWS

• Wait until the download completes and double click on the installer file to
run it.

71
PYTHON ENVIRONMENT SETUP
• STEPS FOR INSTALLING PYTHON ON WINDOWS

• Select “Add Python to Path” and click “Install Now”.

72
PYTHON ENVIRONMENT SETUP
• STEPS FOR INSTALLING PYTHON ON WINDOWS

• Wait until the installation completes “Setup was successful”.

73
PYTHON ENVIRONMENT SETUP
• STEPS FOR INSTALLING PYTHON ON WINDOWS

• Use the Windows Search for “IDLE” and open the standard Python editor
to start coding.

74
PYTHON ENVIRONMENT SETUP
• CHECKING PYTHON INSTALLTION ON WINDOWS

• Type ‘python’ in terminal to check installation

SHELL

75
RUNNING PYTHON SCRIPTS
• OPEN IDLE AND RUN FIRST PROGRAM

• Use the Windows Search for “IDLE” and open the standard Python editor
to start coding.

76
77

You might also like