0% found this document useful (0 votes)
12 views21 pages

Module 3 IOT

The document discusses the Raspberry Pi, a single-board computer used for teaching computer science. It describes what Raspberry Pi is, different versions of Raspberry Pi, operating systems used, and how to interface Raspberry Pi with common hardware components like LEDs, cameras, sensors.

Uploaded by

teswart2002
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)
12 views21 pages

Module 3 IOT

The document discusses the Raspberry Pi, a single-board computer used for teaching computer science. It describes what Raspberry Pi is, different versions of Raspberry Pi, operating systems used, and how to interface Raspberry Pi with common hardware components like LEDs, cameras, sensors.

Uploaded by

teswart2002
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/ 21

Module 3

Raspberry Pi

What is Raspberry Pi?


The Raspberry Pi is a series of small single-board computers developed in the
United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic
computer science in schools and in developing countries.
• The original model became far more popular than anticipated, selling outside
of its target market for uses such as robotics.
• Over 5 million Raspberry Pis have been sold before February 2015, making it
the best-selling British computer. By November 2016 they had sold 11 million
units.
Introduction
• Raspberry Pi is a small single board computer. By connecting peripherals
like Keyboard, mouse, display to the Raspberry Pi, it will act as a mini
personal computer.
• Raspberry Pi is slower than laptop or desktop but is still a computer which
can provide all the expected features or abilities, at a low power
consumption.
• Raspberry Pi is more than computer as it provides access to the on-chip
hardware i.e. GPIOs for developing an application. By accessing GPIO, we
can connect devices like LED, motors, sensors, etc and can control them
too.
Raspberry Pi is popularly used for real time Image/Video Processing, IoT based
applications and Robotics applications.
• Raspberry Pi Foundation officially provides Debian based Raspbian OS,
which is a Unix-like operating system based on the Debian Linux
distribution for the Raspberry Pi family of compact single-board
computers.
• Raspbian OS is official Operating System available for free to use. This
OS is efficiently optimized to use with Raspberry Pi. Raspbian have GUI
which includes tools for Browsing, Python programming, office, games,
etc.
• A minimum 8 GB SD card is recommended to store the OS (operating
System).
We can install several Third-Party versions of OS like Ubuntu, Archlinux, RISC
OS, Windows 10 IOT Core, etc.
Raspberry Pi processor
• It has ARM based Broadcom Processor SoC along with on-chip GPU
(Graphics Processing Unit).
• The CPU speed of Raspberry Pi varies from 700 MHz to 1.2 GHz. Also, it
has on-board SDRAM that ranges from 256 MB to 1 GB.
Raspberry Pi also provides on-chip SPI, I2C, I2S and UART modules.
Comparing different versions of Raspberry Pi
LED Interface with Raspberry Pi
◎ Use a jumper wire to connect the ground ( Pin 3) of GPIO.
◎ Connect the resistor from the same row on the breadboard to a column on
the breadboard.
◎ Connect the LED with the cathode in the same row as the resistor. Insert
the anode in the adjacent row.
Use another jumper cable to connect the GPIO Pin 23 ( 3.3 V) in the same row as
the anode of LED.

import RPi.GPIO as GPIO # Import the GPIO library


import time # Import the time module to enable sleep
GPIO.setwarnings(False) # Ignore warnings for simplicity
GPIO.setmode(GPIO.BCM) # Use BCM pin numbering
GPIO.setup( 23, GPIO.OUT, initial=GPIO.LOW)
# Setting GPIO pin 23 as an output pin with initial value low or LED off
while True: # Run forever
GPIO.output(23, GPIO.HIGH) # Turn LED on
time.sleep(1) # LED on for 1 second
GPIO.output(23, GPIO.LOW) # Turn LED off
time.sleep(1) # LED off for 1 second
Pi Camera interface
◎ The pi Camera module is a camera that can be used to take pictures and
high definition video.
◎ Raspberry Pi Board has CSI (Camera Serial Interface) interface to which
we can attach the PiCamera module directly.
This Pi Camera module can attach to the Raspberry Pi’s CSI port using a 15-pin
ribbon cable.
Features of Pi Camera
The Pi camera v1.3. features are listed below,
• Resolution – 5 MP
• HD Video recording – 1080p @30fps, 720p @60fps, 960p @45fps and so
on.
• It Can capture wide, still (motionless) images of a resolution 2592x1944
pixels
CSI Interface enabled.

For enabling the camera, type sudo raspi-config in the terminal and navigate to
Interfacing Options, as shown in Figure

Then, as shown in Figure 16.27, find the option that says Camera and enable it.
Connect the PiCam to the board as shown in below Figure
Connection description
➢ Connect the ribbon cable of the PiCam to the dedicated slot in the
Raspberry Pi.
Power the board using a USB adapter.
Users may control the Raspberry Pi camera or PiCam through the command line
or through Python programming.
For capturing still images through the command line and saving it in the Desktop,
type raspistill -o Desktop/image name.jpg in the terminal. The terminal opens a
prompt for a 5 second preview and then captures the image. Similarly, for
recording videos, type
raspivid -o Desktop/video name.h264 in the terminal.
Source Code
DHT11 Interfacing with Raspberry Pi
◎ DHT11 sensor measures and provides humidity and temperature values
serially over a single wire.
◎ It can measure relative humidity in percentage (20 to 90% RH) and
temperature in degree Celsius in the range of 0 to 50°C.
◎ It has 4 pins; one of which is used for data communication in serial form.
Pulses of different TON and TOFF are decoded as logic 1 or logic 0 or start pulse
or end of a frame.
◎ The DHT Sensor Python library by Adafruit from GitHub.
◎ The Adafruit Python DHT Sensor library is created to read the Humidity
and Temperature on Raspberry Pi or Beaglebone Black.
It is developed for DHT series sensors like DHT11, DHT22, or AM2302.
Software defined networking (SDN)
◎ Software defined networking (SDN) is an approach via which we take the
control plane away from the switch and assign it to a centralized unit called
the SDN controller. Hence, a network administrator can shape traffic via a
centralized console without having to touch the individual switches.
In order to understand software defined networks, we need to understand the use
of data plane and control plane in networking.
◎ Dataplane:
All the activities involving as well as resulting from data packets sent by
the end user belong to this plane. This includes:
▪ Forwarding of packets
▪ Segmentation and reassembly of data
▪ Replication of packets for multicasting
◎ Controlplane:
All activities necessary to perform data plane activities but do not involve
end user data packets belong to this plane. In other words, this is the brain
of the network. The activities of the control plane include:
▪ Making routing tables
▪ Setting packet handling policies
Overview of the Current Network
Current Network to SDN

SDN Architecture
Application layer
◎ The application layer contains the typical network applications or functions
organizations use.
This can include intrusion detection systems, load balancing or firewalls. Where
a traditional network would use a specialized appliance, such as a firewall or load
balancer, a software-defined network replaces the appliance with an application
that uses a controller to manage data plane behavior.

Control layer
◎ The control layer represents the centralized SDN controller software that
acts as the brain of the software-defined network. This controller resides
on a server and manages policies and traffic flows throughout the network.
Infrastructure layer
The infrastructure layer is made up of the physical switches in the network. These
switches forward the network traffic to their destinations.
Between Data Plane and Control Plane- Southbound API
Between Control Plane and Application Plane- Northbound API
◎ Basic Concepts of SDN
▪ Separate control logic from hardware switches
▪ Define the control logic in a centralized manner
▪ Control the entire network including individual switches
▪ Communication between the Application, control and data planes
are done through Application Programming Interfaces (APIs)
◎ Components/Attributes of SDN
▪ Hardware switches
▪ Controller
▪ Applications
▪ Flow-Rules
▪ Application Programming Interfaces (APIs)
▪ Challenges to build SDN
▪ Rule placement
Controller placement
Importance of Software-defined Networking in IoT?
◎ Increased control with incredible speed and flexibility:
Instead of manually programming multiple vendor-specific hardware
devices, developers can control traffic flow over a network by programming an
open standard software-based controller. Since they can select a single protocol
to communicate with any number of hardware devices through a central
controller, networking managers also have more freedom when selecting
networking equipment.
◎ Customizable network infrastructure:
With a software-defined network, administrators can centrally
design network services and instantly assign virtual resources to change the
network infrastructure. This enables network administrators to prioritize
applications that call for greater availability and optimize the data flow via the
network.
◎ Robust security:
A software-defined networking in IoT provides visibility across the whole
network, giving security threats a complete picture. With the proliferation of
intelligent devices that connect to the Internet, SDN offers clear advantages over
traditional networking. Operators can create separate zones for devices requiring
different levels of security or immediately quarantine compromised devices so
they cannot infect the rest of the network.
Software Defined Networking for IoT

◎ Software-defined networking (SDN) is a promising approach to control the


network in a unified manner using rule-based management.
◎ The abstractions provided by SDN enable holistic control of the network
using high-level policies, without being concerned about low-level
configuration issues. Hence, it is advantageous to address the heterogeneity
and application-specific requirements of IoT.
◎ We can study the application and impact of softwarization on IoT networks
from different perspectives:
○ Access networks
○ Edge networks
Wide area networks.

Key Elements of SDN


Centralized Network Controller
With decoupled control and data planes and a centralized network controller, the
network administrators can rapidly configure the network.
Programmable Open APIs
SDN architecture supports programmable open APIs for interface between the
SDN application and control layers (Northbound interface).
Standard Communication Interface (OpenFlow)
SDN architecture uses a standard communication interface between the control
and infrastructure layers (Southbound interface). OpenFlow, which is defined by
the Open Networking Foundation (ONF), is the broadly accepted SDN protocol
for the Southbound interface.

What are the different models of SDN?

While the premise of centralized software controlling the flow of data in switches
and routers applies to all software-defined networking, there are different models
of SDN.

• Open SDN: Network administrators use a protocol like OpenFlow to


control the behavior of virtual and physical switches at the data plane
level.
• SDN by APIs: Instead of using an open protocol, application
programming interfaces control how data moves through the network
on each device.
• SDN Overlay Model: Another type of software-defined networking
runs a virtual network on top of an existing hardware infrastructure,
creating dynamic tunnels to different on-premise and remote data
centers. The virtual network allocates bandwidth over a variety of
channels and assigns devices to each channel, leaving the physical
network untouched.
• Hybrid SDN: This model combines software-defined networking with
traditional networking protocols in one environment to support
different functions on a network. Standard networking protocols
continue to direct some traffic, while SDN takes on responsibility for
other traffic, allowing network administrators to introduce SDN in
stages to a legacy environment.

How is software-defined networking in IoT different from Traditional


Networking?

The critical difference between SDN and traditional networking is infrastructure:


SDN is software-based, while traditional networking is hardware-based. Because
the control panel is software-based, SDN is much more flexible than traditional
networking. It allows administrators to control the network, change configuration
settings, provision resources, and increase network capacity from a centralized
user interface without adding more hardware.

Additionally, there are security distinctions between SDN and traditional


networking. Software-defined networking (SDN) offers superior security in
many aspects because of its increased visibility and capacity to define safe paths.
But since software-defined networks rely on a centralized controller, protecting
the controller is essential to upholding the security of the network. A possible
weakness of SDN is represented by this single point of failure.

You might also like