Internet Of Things
(IOT)
What is IOT
• Network of interconnected things/devices
• Embedded with sensors, software, network connectivity and
necessary electronics that enables them to collect and
exchange data making them responsive
• The idea of IOT started in the year 1999
• Kevin Ashton is the “Father of IOT”
Why IOT?
• Any object that can be connected by the IoT
• More productive, safer and smarter
• More extensive
• More efficient
• Lower cost
• Existing Infrastructure
Applications
• Transportation
• Industrial Automation
• Healthcare
• Defense
• Smart Farming
• Home Automation
• Manufacturing
Examples
• Electronic Fork
• Smart Tooth Brush
• Egg minder
• Smart Propane Tank
• Glucose Monitor
• Smart Washing Machine
• Smart Piggy Bank
• Smart Sprinkler control
• Smart Home Security
• Smart Garbage System
• Smart Socks
IOT Projection
Fundamental Components
• Hardware-Making physical objects responsive
and giving them capability to retrieve data
and respond to instructions
• Software-Enabling the data collection,
storage, processing, manipulating and
instructing
• Communication Infrastructure-Consists of
protocols and technologies which enable two
physical objects to exchange data
IOT Hardware
IOT Sensors
Sensors for IOT Applications
• Transportation
GPS Sensors, Speed Monitoring Sensors, RFID Readers, Passenger Counting
Sensors, Environmental sensors
• Healthcare
Heart Beat Sensor, Body Temperature Sensor, Pressure Sensor, Glucose Meter
• Energy Management
Current Sensor, Voltage Sensor
• Agriculture
Soil Moisture Sensor, Humidity Sensor, Temperature Sensor, Air-flow Sensor,
Water-level Monitor Sensor, Light Density Sensor
IOT Software
Raspberry Pi
•Developed by Raspberry Pi Foundation in the
United Kingdom
• Broadcom BCM2837 chipset running at 1.2 GHz
• 40 GPIO pins
• Low cost
• Plug and play
• Linux-based operating systems
Raspberry Pi 3 Features
• 64-bit quad-core ARM Cortex-A53
• 802.11 b/g/n Wireless LAN
• Bluetooth 4.1 (Classic & Low Energy)
• Dual core Videocore IV® Multimedia co-
processor
• 1 GB LPDDR2 memory
• Supports all the latest ARM GNU/Linux
distributions and Windows 10 IoT
• 1 x 10/100 Ethernet port
• 1 x HDMI video/audio connector
• 1 x RCA video/audio connector
• 1 x CSI camera connector
• 4 x USB 2.0 ports
• 40 GPIO pins
• Chip antenna
• DSI display connector
• microSD card slot
• Power source: 5V via MicroUSB or GPIO header
Raspbian OS
• Official operating system of the Raspberry Pi Foundation
• Based on Debian Linux
• Optimized for the Raspberry Pi hardware
• Comes with a full GUI and a whole range of software installed
Raspbian OS Installation
Required:
1. microSD Card (at least 8 GB)
2. Card Reader or a computer with a
slot
3. Raspberry Pi
4. Win32 Disk Imager
Steps:
1. Insert microSD card in the card
reader
2. Write the disc image
3. Boot the Raspberry Pi to that microSD
card
Python
• Created by Guido van Rossum
• Powerful
• High-level
• Object-oriented programming language
• Cross-platform programming language
• Has simple easy-to-use syntax, making it the perfect language for
someone trying to learn computer programming for the first time
• Wide range of applications from Web development, scientific and
mathematical computing to desktop graphical user Interfaces
• Syntax of the language is clean and length of the code is relatively
short
• Free and open source
Sample Program
# Add two numbers Note:
1. # is a comment to understand the intent of the code
num1 = 3 2. No need to define the type of a variable
3. Not necessary to add semicolon at the end of the statement
num2 = 5 4. For multiline comment triple quotes are used(‘’’,”””)
5. To represent a statement, newline (enter) is used
sum = num1+num2 6. Instead of curly braces { }, indentations are used to represent a
block.
print(sum)
for i in range(1,11):
print(i)
if i == 5:
break
Python Keywords
Data Types
• Python Numbers Conversion between datatypes:
(Eg: a = 5,a = 2.0,a = 1+2j) >>> float(5)
• Python List 5.0
>>> int(10.6)
(Eg: a = [1, 2.2, 'python']) 10
• Python Tuple >>> str(25)
'25'
(Eg: t = (5,'program', >>> set([1,2,3])
1+3j)) {1, 2, 3}
• Python Strings >>> tuple({5,6,7})
(5, 6, 7)
(Eg: s = "This is a string“) >>> list('hello')
• Python Set ['h', 'e', 'l', 'l', 'o']
>>> dict([[1,2],[3,4]])
(Eg: a = {5,2,3,1,4}) {1: 2, 3: 4}
• Python Dictionary
(Eg: d = {1:'value','key':2})
Program to blink the LED connected at
GPIO
import time #Importing the time modules
import RPi.GPIO as GPIO #Importing GPIO modules
GPIO.setmode(GPIO.BOARD) # Set GPIO mode
GPIO.setup(7, GPIO.OUT) #Set the GPIO as output
while 1: #Loop Forever
GPIO.output(7,True) #LED On
time.sleep(1) #Delay
GPIO.output(7,False) #LED Off
time.sleep(1) #Delay
GPIO.cleanup() #Clear the settings
PIR Sensor Interfacing
PIR Sensor Interfacing with Raspberry
Program:
PI
import RPi.GPIO as GPIO
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.IN) #Read output from PIR motion sensor
GPIO.setup(3, GPIO.OUT) #LED output pin
while True:
i=GPIO.input(11)
if i==0: #When output from motion sensor is LOW
print "No intruders",i
GPIO.output(3, 0) #Turn OFF LED
time.sleep(0.1)
elif i==1: #When output from motion sensor is HIGH
print "Intruder detected",i
GPIO.output(3, 1) #Turn ON LED
time.sleep(0.1)
IOT Gateway
Bluetooth Interfacing
Wifi Interfacing
Thingspeak