IOT RaspberryPi
IOT RaspberryPi
(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
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