Rasberry Pi
Rasberry Pi
Raspberry Pi?
2
Raspberry
Pi
Specificati
ons
Key features Raspberry pi 3 model B Raspberry pi 2 Raspberry Pi zero
model B
RAM 1GB SDRAM 1GB SDRAM 512 MB SDRAM
CPU Quad cortex A53@1.2GHz Quad cortex ARM 11@ 1GHz
A53@900MHz
GPU 400 MHz video core IV 250 MHz video core IV 250 MHz video core IV
Ethernet 10/100 10/100 None
Wireless 802.11/Bluetooth 4.0 None None
Video output HDMI/Composite HDMI/Composite HDMI/Composite
GPIO 40 40 40
3
Basic
Architecture
RAM
ETHERNET USB
4
Start up
raspberry pi
Raspberry Pi
GPIO
• Act as both digital output and digital input.
Source: Programming languages for Raspberry Pi, eProseed, Lonneke Dikmans, August 07, 2015
Popular
Applications
• Media streamer
• Home automation
• Controlling BOT
• VPN
• Light weight web server for IOT
• Tablet computer
Topics
Covered
Using GPIO pins
Taking pictures using PiCam
Blinking
LED
Requirement:
Raspberry pi
LED
100 ohm resistor
Bread board
Jumper cables
Blinking LED
(contd..)
Installing GPIO library:
Open terminal
Enter the command “sudo apt-get install python-dev” to install python
development
Enter the command “sudo apt-get install python-rpi.gpio” to install
GPIO library.
Blinking LED
(contd..)
Connection:
Connect the negative terminal of
the LED to the ground pin of Pi
Connect the positive terminal of
the LED to the output pin of Pi
Blinking LED
(contd..)
Basic python coding:
raspistill -o image.jpg
Python Code:
Import picamera
camera = picamera.PiCamera()
camera.capture('image.jpg')
Source: PYTHON PICAMERA, Raspberry Pi Foundation
Capture Image
(contd..)
Implementation of IoT with
Raspberry Pi: Part 1
IO
T
Internet Of Things
Creating an interactive environment
Network of devices connected
together
Sens
or
Electronic element
Converts physical quantity into electrical signals
Can be analog or digital
Actuat
or
Mechanical/Electro-mechanical device
Converts energy into motion
Mainly used to provide controlled motion to other
components
System
Overview
Sensor and actuator interfaced with Raspberry Pi
Read data from the sensor
Control the actuator according to the reading from the
sensor
Connect the actuator to a device
System Overview
(contd..)
Requirements
DHT Sensor
4.7K ohm resistor
Relay
Jumper wires
Raspberry Pi
Mini fan
DHT
Sensor
Digital Humidity and
Temperature Sensor (DHT)
PIN 1, 2, 3, 4 (from left to
right)
PIN 1- 3.3V-5V Power
supply
PIN 2- Data
PIN 3- Null
PIN 4- Ground
Rela
y
Mechanical/electromechanical
switch
3 output terminals (left to
right)
NO (normal open):
Common
NC (normal close)
Temperature Dependent Auto
Cooling System
Sensor interface with Raspberry Pi
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
sensor = Adafruit_DHT.AM2302 # create an instance of the sensor type
print (‘Getting data from the sensor’)
#humidity and temperature are 2 variables that store the values received from the sensor
Set the GPIO pin connected with the relay’s input pin as output in the sketch
GPIO.setup(13,GPIO.OUT)
Set the relay pin high when the temperature is greater than 30
if temperature > 30:
GPIO.output(13,0) # Relay is active low
print(‘Relay is on')
sleep(5)
GPIO.output(13,1) # Relay is turned off
after delay of 5 seconds
Connection: Relay
(contd..)
Connection:
Fan