Module 3 IOT
Module 3 IOT
Raspberry Pi
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
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.