Unit-I Introduction To Iot and Python Programming
Unit-I Introduction To Iot and Python Programming
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
3
ASSESSMENTS
ASSESSMENT MARKS
ISE1 10
MSE 30
ISE2 10
ESE 50
TOTAL 100
4
COURSE OUTCOMES
CO1 EXPLAIN THE KEY CONCEPTS AND KEY TERMINOLOGY RELATED TO IoT.
5
INTRODUCTION
• WHAT IS IoT?
6
INTRODUCTION
• CHARACTERISTICS OF IoT
• Self-Configuring.
• Unique Identity.
7
INTRODUCTION
• TYPES OF IoT
• Consumer IoT.
• Commercial IoT.
• 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
• 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
17
IoT COMMUNICATION MODELS
• TYPES OF 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.
• Exclusive Pair is a
bidirectional, fully duplex
communication model that
uses a persistent connection
between the client and
server.
22
IoT COMMUNICATION APIs
23
IoT COMMUNICATION APIs
• TYPES OF 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
26
IoT ENABLING
TECHNOLOGIES
27
IoT ENABLING TECHNOLOGIES
• An IoT is enabled by following technologies:
• Cloud Computing.
• 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.
• 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.
• Infrastructure as a service(IAAS)
• Platform as a service(PaaS)
• Software as a service(SaaS)
32
IoT ENABLING TECHNOLOGIES
• BIG DATA ANALYTICS
33
IoT ENABLING TECHNOLOGIES
• EXAMPLES OF BIG DATA GENERATED BY IoT
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
46
POINTS TO BE COVERED
• INTRODUCTION
• FEATURES OF PYTHON
• IDENTIFIERS
• VARIABLES
• INPUT / OUTPUT
• SETTING UP PYTHON PROGRAMMING
ENVIRONMENT.
47
INTRODUCTION
• WHAT IS PYTHON LANGUAGE ?
48
FEATURES OF PYTHON
• SIMPLE AND EASY TO LEARN
• OBJECT-ORIENTED
• PORTABLE
• SCALABLE
• EXTENDABLE
• KEYWORDS
• INDENTION
• VARIABLES
• COMMENTS
50
PYTHON BUILDING BLOCKS
• IDENTIFIERS
• Example: Person
• Example: _person
52
PYTHON BUILDING BLOCKS
• NAMING CONVENTIONS FOR PYTHON IDENTIFIERS
• Example: __person
• Example: person__
53
PYTHON BUILDING BLOCKS
• KEYWORDS
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
finally Used with exceptions, a block of code that will be executed no matter if there is an exception
or not
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
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”)
62
PYTHON BUILDING BLOCKS
• VARIABLES
63
PYTHON BUILDING BLOCKS
CASTING
64
PYTHON BUILDING BLOCKS
• COMMENTS
65
PYTHON BUILDING BLOCKS
• Comments starts with a #, and Python will ignore them:
68
PYTHON ENVIRONMENT SETUP
• STEPS FOR INSTALLING PYTHON ON WINDOWS
69
PYTHON ENVIRONMENT SETUP
• STEPS FOR INSTALLING PYTHON ON WINDOWS
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
72
PYTHON ENVIRONMENT SETUP
• STEPS FOR INSTALLING PYTHON ON WINDOWS
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
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