IOT Unit-5
IOT Unit-5
o A "Thing" in Internet of Things (IoT) can be any object that has a unique identifier and
which can send/receive data (including user data) over a network (e.g., smart phone,
smart TV, computer, refrigerator, car, etc. ).
o IoT devices are connected to the Internet and send information about themselves or
about their surroundings (e.g. information sensed by the connected sensors) over a
network (to other devices or servers/storage) or allow actuation upon the physical
entities/ environment around them remotely.
o A home automation device that allows remotely monitoring the status of appliances
and controlling the appliances.
o An industrial machine which sends information abouts its operation and health
monitoring data to a server.
o A car which sends information about its location to a cloud-based service.
o A wireless-enabled wearable device that measures data about a person such as the
number of steps walked and sends the data to a cloud-based service.
o Sensing: Sensors can be either on-board the IoT device or attached to the device.
o Actuation: IoT devices can have various types of actuators attached that allow taking
actions upon the physical entities in the vicinity of the device.
o Communication: Communication modules are responsible for sending collected data
to other devices or cloud based servers/storage and receiving data from other devices
and commands from remote applications.
o Analysis & Processing: Analysis and processing modules are responsible for making
sense of the collected data.
Stages of IoT Solutions Architecture
There are several layers of IoT built upon the capability and performance of IoT elements
that provides the optimal solution to the business enterprises and end-users. The IoT
architecture is a fundamental way to design the various elements of IoT, so that it can
deliver services over the networks and serve the needs for the future.
Following are the primary stages (layers) of IoT that provides the solution for IoT
architecture.
o Sensors/Actuators: Sensors or Actuators are the devices that are able to emit, accept
and process data over the network. These sensors or actuators may be connected either
through wired or wireless. This contains GPS, Electrochemical, Gyroscope, RFID, etc.
Most of the sensors need connectivity through sensors gateways. The connection of
sensors or actuators can be through a Local Area Network (LAN) or Personal Area
Network.
o Gateways and Data Acquisition: As the large numbers of data are produced by this
sensors and actuators need the high-speed Gateways and Networks to transfer the data.
This network can be of type Local Area Network (LAN such as WiFi, Ethernet, etc.), Wide
Area Network (WAN such as GSM, 5G, etc.).
o Edge IT: Edge in the IoT Architecture is the hardware and software gateways that analyze
and pre-process the data before transferring it to the cloud. If the data read from the
sensors and gateways are not changed from its previous reading value then it does not
transfer over the cloud, this saves the data used.
o Data center / Cloud: The Data Center or Cloud comes under the Management Services
which process the information through analytics, management of device and security
controls. Beside this security controls and device management the cloud transfer the
data to the end users application such as Retail, Healthcare, Emergency, Environment,
and Energy, etc.
Raspberry Pi
The history of the Raspberry Pi was basically introduced in 2006. Its main concept is based
on Atmel ATmega644 which is particularly designed for educational use and intended for
Python. A Raspberry Pi is of small size i.e., of a credit-card-sized single-board computer,
which is developed in the United Kingdom(U.K) by a foundation called Raspberry Pi. The
main motto of this foundation is to promote the teaching of basic computer science in the
education institutes and also in developing countries. The first generation of Raspberry (Pi 1)
was released in the year 2012, which has two types of models namely model A and model B.
In the subsequent year, A+ and B+ models were released. Again in 2015, Raspberry Pi2
model B was released and an immediate year Raspberry Pi3 model B was released in the
market. Raspberry Pi can be plugged into a TV, computer monitor, and it uses a standard
keyboard and mouse. It is userfriendly as it can be handled by all the age groups. It does
everything you would expect a desktop computer to do like word-processing, browsing the
internet spreadsheets, playing games to playing high definition videos. It is used in many
applications like in a wide array of digital maker projects, music machines, parent detectors
to the weather station and tweeting birdhouses with infrared cameras.
All models feature on a Broadcom system on a chip (SOC), which includes chip graphics
processing unit GPU(a Video Core IV), an ARM-compatible and CPU. The CPU speed ranges
from 700 MHz to 1.2 GHz for the Pi 3 and onboard memory range from 256 MB to 1 GB
RAM. An operating system is stored in the secured digital SD cards and program memory in
either the MicroSDHC or SDHC sizes. Most boards have one to four USB slots, composite
video output, HDMI and a 3.5 mm phone jack for audio. Some models have WiFi and
Bluetooth.
The Raspberry Pi Foundation provides Arch Linux ARM and Debian distributions for
download, and promotes Python as the main programming language, with support for BBC
BASIC, Java, C, Perl, Ruby, PHP, Squeak Smalltalk, C++, etc.
WSN Nodes:
A wireless sensor network (WSN) consists of three main components: nodes, gateways, and
software. The spatially dispersed measurement nodes interface with the sensors to monitor
assets or their surroundings. The acquired information is wirelessly transmitted to the
gateway, which provides a connection to the wired globe where you can collect, procedure,
analyze, and present your measurement information using the software. Routers are an
individual type of dimension node that you can use to expand the distance and dependability
in a WSN. Sensors can be dispersed on the roads, vehicles, hospitals, buildings, people and
allow dissimilar applications such as medical services, battlefield operations, disaster
response, disaster relief, and environmental monitoring.
Raspberry Pi GPIO:
Raspberry Pi interfaces:
• Serial: The serial interface on Raspberry Pi has receive (Rx) and transmit (Tx) pins for
communication with serial peripherals.
• SPI: Serial Peripheral Interface (SPI) is a synchronous serial data protocol used for
communicating with one or more peripheral devices.
• I2C: The I2C interface pins on Raspberry Pi allow you to connect hardware modules. I2C
interface allows synchronous data transfer with just two pins - SDA (data line) and SCL
(clock line).
Programming Raspberry Pi with Python:
Interfacing LED and switch with Raspberry Pi:
GPIO.setmode(GPIO.BCM)
#Switch Pin
GPIO.setup(25, GPIO.IN)
#LED Pin
GPIO.setup(18, GPIO.OUT)
state=false
def toggleLED(pin):
state = not state
GPIO.output(pin, state)
while True:
try:
if (GPIO.input(25) == True):
toggleLED(pin)
sleep(.01)
except KeyboardInterrupt:
exit()
BeagleBone Black:
Chip: TI AM3359
CPU: 1 GHz ARM Cortex-A8
GPU: PowerVR SGX530
Memory: 512 MB DDR3
Pins: 2x 46 pin headers
USB 2.0: USB 2.0 type a host port. Dedicated single mini-USB 2.0 client port (no additional
2-port hub)
Video Output: microHDMI
Audio Output: microHDMI
Onboard Storage: 2 GB 8-bit embedded MMC on-board flash versionmicroSD card 3.3 V
Supported
(No Card Supplied)
Operating System: Linux, Android, Cloud9 IDE on Node.js w/ BoneScript library, plus more
Dimensions 86.40 × 53.3 mm (3.402 × 2.10 in)
pcDuino:
WAMP – Concepts:
• Transport: Transport is channel that connects two peers.
• Session: Session is a conversation between two peers that runs over a transport.
• Client: Clients are peers that can have one or more roles. In publish-subscribe model
client can have following roles:
• Publisher: Publisher publishes events (including payload) to the topic maintained by
the Broker.
• Subscriber: Subscriber subscribes to the topics and receives the events including the
payload.
In RPC model client can have following roles:
Caller: Caller issues calls to the remote procedures along with call arguments.
Callee: Callee executes the procedures to which the calls are issued by the caller and returns
the results back to the caller.
Router: Routers are peers that perform generic call and event routing. In publish-subscribe
model Router has the role of a Broker:
Broker: Broker acts as a router and routes messages published to a topic to all subscribers
subscribed to the topic.
In RPC model Router has the role of a Broker:
Dealer: Dealer acts a router and routes RPC calls from the Caller to the Callee and routes
results from Callee to Caller.
Application Code: Application code runs on the Clients (Publisher, Subscriber, Callee or
Caller).
Django is a Model-Template-View (MTV) framework wherein the roles of model, template and
view, respectively, are:
Model: The model acts as a definition of some stored data and handles the interactions with
the database. In a web application, the data can be stored in a relational database, non-
relational database, an XML file, etc. A Django model is a Python class that outlines the
variables and methods for a particular type of data.
Template:In a typical Django web application, the template is simply an HTML page with a
few extra placeholders. Django's template language can be used to create various forms of
text files (XML, email, CSS, Javascript, CSV, etc.)
View:The view ties the model to the template. The view is where you write the code that
actually generates the web pages. View determines what data is to be displayed, retrieves the
data from the database and passes the data to the template.
Amazon RDS is a web service that allows you to create instances of MySQL, Oracle or
Microsoft SQL Server in the cloud. With RDS, developers can easily set up, operate, and scale
a relational database in the cloud. RDS can serve as a scalable datastore for IoT systems.
With RDS, IoT system developers can store any amount of data in scalable relational
databases.
Amazon SQS offers a highly scalable and reliable hosted queue for storing messages as they
travel between distinct components of applications. SQS guarantees only that messages
arrive, not that they arrive in the same order in which they were put in the queue. While
Kinesis is meant for real-time applications that involve high data ingress and egress rates,
SQS is simply a queue system that stores and releases messages in a scalable manner. SQS
can be used in distributed IoT applications in which various application components need to
exchange messages.
Amazon AutoScaling allows automatically scaling Amazon EC2 capacity up or down
according to user defined conditions. Therefore, with AutoScaling users can increase the
number of EC2 instances running their applications seamlessly during spikes in the
application workloads to meet the application performance requirements and scale down
capacity when the workload is low to save costs. AutoScaling can be used for auto scaling IoT
applications and IoT platforms deployed on Amazon EC2.