0% found this document useful (0 votes)
148 views77 pages

Unit 4 IoT

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 77

UNIT IV

IOT PHYSICAL DEVICES AND PHYSICAL


SERVER
IOT PHYSICAL DEVICES AND PHYSICAL SERVER

• IoT Device — Raspberry Pi — Raspberry Interfaces — Programming Raspberry Pi


with Python —Other IoT Devices —Cloud Storage Models and Communication APIs
- WAMP — Xively Cloudfor IoT— Django — Amazon Web Services for IoT —
SkyNet IoT Messaging Platform.
IoT Device:
• IoT devices are hardware devices, such as sensors, actuators or appliances and
other machines that collect and exchange data over the Internet.
• Most IoT devices are configured and managed through a software application.
• For example, an app on your smartphone to control the lights in your home.
• Some devices also have integrated web servers, which eliminates the need for
external applications. For example, the lights switch on immediately when you
enter a room.
• Examples of IoT Devices:
• Home Security :
• Activity Trackers : Sensor device. You can track and manage your blood pressure,
appetite, physical movement and oxygen levels.
• Motion Detection: Motion sensors can detect vibrations in buildings, bridges,
dams and other large-scale structures.
• Doorbell Cam: It is IoT device that allows you to answer your door from any
remote location.
• A home automation device that allows remotely monitoring the status of
appliances and controlling the appliances.
• An industrial machine which sends information abouts its operation and health
monitoring data to a server.
• A car which sends information about its location to a cloud-based service.
• 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.
Basic building blocks of an IoT Device:
Sensing:
• Sensors can be either on-board the IoT device or attached to the device.
Actuation:
• IoT devices can have various types of actuators attached that allow taking actions
upon the physical entities in the vicinity of the device.
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.
Analysis & Processing:
• Analysis and processing modules are responsible for making sense of the collected
data.
• Block diagram of an IoT Device:
Raspberry Pi
• Raspberry Pi is a low-cost mini-computer with the physical size of a credit card.
• Raspberry Pi runs various flavors of Linux and can perform almost all tasks that a
normal desktop computer can do.
• Raspberry Pi also allows interfacing sensors and actuators through the general
purpose I/O pins.
• Since Raspberry Pi runs Linux operating system, it supports Python "out of the
box".
Generations and Models
• In 2012, the company launched the Raspberry Pi.
• Raspberry Pi had the following four options −
• Model A
• Model A +
• Model B
• Model B +
• The Raspberry Pi B models are the original credit-card sized format.
• The Raspberry Pi A models have a smaller and more compact footprint and
hence, these models have the reduced connectivity options.
• Raspberry Pi GPIO
• Monitor:
• The Raspberry Pi uses a high-definition multimedia interface (HDMI) connection
for video feed, and you can connect your monitor directly with this interface
connection, if your monitor has an HDMI socket.
• Television:
• In the similar way, if you have High Definition Television (HD TV), you can also
connect it to your Raspberry Pi using an HDMI socket. It will give you a crisper
picture.
• USB hub:
• Depending on the model, Raspberry Pi has 1, 2, or 4 Universal Serial Bus (USB)
sockets. You should consider using powered USB to connect other devices to your
Raspberry Pi at the same time.
• Keyboard and Mouse:
• Raspberry Pi only supports the USB keyboards and mouse. If you are using
keyboards and mouse with PS/2 connectors, you need to replace them with
Raspberry Pi.
• SD or MicroSD card:
• As we know that the Raspberry Pi does not have a hard drive, so we need to use
SD cards or MicroSD cards (depending on the model) for storage.
• USB Wi-Fi adapter:
• If you are going to use model A and A+ then, you need to buy a USB Wi-Fi
adapter for connecting to the internet. This should be done because these
Raspberry models do not have an Ethernet socket.
• External hard drive:
• If you want to share your collection of music and movies, you need to use an
external hard drive with your Raspberry Pi model. You can connect the same by
using a powered USB cable.
• Raspberry Pi Camera Module:
• The Raspberry Pi camera module originated at Raspberry Pi foundation. It is an
8MP (megapixel) fixed focus camera that can be used to shoot high-definition
video and take still photos. For wildlife photography at night, it provides another
version without an infrared filter.
• Speakers:
• The Raspberry Pi has a standard audio out socket. This socket is compatible with
headphones and speakers that use a 3.5mm audio jack. We can plug headphones
directly to it.
• Power supply:
• For power supply, it uses a Micro USB connector. Hence theoretically, it is
compatible with a mobile phone and tablet charger.
• Cables:
• Following are some of the cables, which you need for the connections to the
Raspberry Pi computer −
• HDMI cable
• HDMI-to-DVI adapter, if you are using a Digital Visual Interface (DVI) monitor.
• RCA cable, if you want to connect to an older television.
• Audio cable
• Ethernet cable
• GPIO Pinout
• One of the powerful features of the Raspberry Pi is the row of GPIO (general-
purpose input output) pins and the GPIO Pinout is an interactive reference to these
GPIO pins.
• Voltages
• There are two 5V pins and two 3V3 pins on the board. It also has several ground
pins (0V). All these pins are unconfigurable.
• Outputs:
• A GPIO pin can be designated as an output pin. The pin set as output pin can be
set to 3V3(high) or 0V(low).
• Inputs:
• A GPIO pin can be designated as an input pin.
• The pin set as input pin can be read as 3V3(high) or 0V(low). You can use internal
pull-up or pull-down resistors.
• GPIO2 and GPIO3 pins have fixed pull-up resistors but for the other pins, you
can configure it in software.
• Uses:
• Like a desktop computer, you can do almost anything with the Raspberry Pi.
You can start and manage programs with its graphical windows desktop. It also
has the shell for accepting text commands.
• We can use the Raspberry Pi computer for the following −
• Playing games
• Browsing the internet
• Word processing
• Spreadsheets
• Editing photos
• Paying bills online
• Managing your accounts.
Raspberry Interfaces
• Raspberry pi has the following interfaces for data transfer.
Serial
SPI and
I2C
Serial:
• The serial interface on Raspberry Pi has receive (Rx) and transmit (Tx) pins for
communication with serial peripherals.
Raspberry Interfaces
SPI :
• Serial Peripheral Interface (SPI) is a synchronous serial data protocol used for
communicating with one or more peripheral devices.
• In a SPI connection, there are five pins on Raspberry Pi for SPI interface :
MISO (Master in slave out) – Master line for sending data to the peripherals.
MOSI (Master out slave in) – Slave line for sending data to the master.
SCK (Serial Clock) – Clock generated by master to synchronize data transmission
CE0 (Chip Enable 0) – To enable or disable devices
CE1 (Chip Enable 1) – To enable or disable devices
Raspberry Interfaces
I2C (Inter-Integrated Circuit.):
• The I2C interface pins on Raspberry Pi allow you to connect hardware modules.
• I2C interface allows synchronous data transfer with just two pins -SDA (Serial data
line) and SCL (Serial clock line).
SDA:
• it is used for transmitting data between the Raspberry Pi and the I2C device.
SCL:
• it provides the clock signal that synchronizes the communication between the Raspberry
Pi and the I2C device.
Cloud Storage Models and Communication APIs
Cloud Storage Models and Communication APIs
• Cloud computing and IoT are tightly coupled.
• The growth of IoT and the rapid development of associated technologies create a widespread
connection of things.
• This has lead to the production of large amounts of data, which needs to be stored, processed and
accessed.
• Cloud computing as a paradigm for big data storage and analytics.
• While IoT is exciting on its own, the real innovation will come from combining it with cloud
computing.
• The combination of cloud computing and IoT will enable new monitoring services and powerful
processing of sensory data streams.
• For example, sensory data can be uploaded and stored with cloud computing, later to be used
intelligently for smart monitoring and actuation with other smart devices.
Cloud Storage Models and Communication APIs

• The cloud effectively serves as the brain to improved decision-making and


optimized internet-based interactions.
• However, when IoT meets cloud, new challenges arise.
• The critical concerns during integration are quality of service (QoS) and quality of
experience (QoE), as well as data security, privacy and reliability.
• Cloud computing offers a practical utility-based model that will enable businesses
and users to access applications on demand anytime and from anywhere.
the group of networked elements providing services does not need to be addressed or managed individually by users;
instead, the entire provider-managed suite of hardware and software can be thought of as an amorphous cloud.
Cloud Storage Models and Communication APIs
Deployment models:
Deployment in cloud computing comprises four deployment models:
• private cloud - data and other info that is only accessible to users within your organization.
• public cloud - data and other info delivered over the internet that can be shared with various
people and organizations.
• community cloud - community clouds are a recent variation on the private cloud model that
provide a complete cloud solution for specific business communities.
• hybrid cloud - a combination of private cloud and public cloud.
Cloud Storage Models and Communication APIs
• A cloud storage API is an application program interface that connects a locally-based
application to a cloud-based storage system, so that a user can send data to it and access
and work with data stored in it.
• To the application, the cloud storage system is just another target device, like tape or disk-
based storage
• An application program interface (API) is code that allows two software programs to
communicate with each other.
• The API defines the correct way for a developer to write a program that requests services
from an operating system (OS) or other application.
API
Cloud Storage Models and Communication APIs
• Three basic types of APIs
• APIs take three basic forms: local, web-like and program-like.
• Local API
offer OS or middleware services to application programs.
Microsoft's .NET APIs, the TAPI (Telephony API) for voice applications, and database
access APIs are examples of the local APIform.
• Web APIs
designed to represent widely used resources like HTML pages and are accessed using a
simple HTTP protocol.
 Any web URL activates a web API.
• Program APIs
based on remote procedure call (RPC) technology that makes a remote program
component appear to be local to the rest of the software.
RPC is especially well suited for client-server (e.g. query-response)
WAMP
WAMP
• Web Application Messaging Protocol (WAMP) is a sub-protocol of
Websocket which provides publish-subscribe and remote procedure
call (RPC) messaging patterns.
WAMP

• 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.
WAMP

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.
WAMP

In RPC model Router has the role of a Dealer: –


• 1. Dealer: Dealer acts a router and routes RPC calls from the Caller to the Callee
and routes results from Callee toCaller.
• 2. Application Code: Application code runs on the Clients (Publisher, Subscriber,
Callee or Caller).
Xively Cloud for IoT
Xively Cloud for IoT
• Commercial platform as a Service built
for the Internet of Things.
• Xively is an IoT Cloud platform.
• According to their website, this include directory
services, data services etc.
• It is an enterprise platform for building,
managing, and deriving business value
from connected products
• Supports hundreds of platforms,
millions of gateways and the billions of
smart devices.
• Comprehensive and secure infrastructure services.
Xively Cloud for IoT
Xively PaaS services:
• Data visualization for data of connected sensors to IoT devices.
• Graphical plots of collected data.
• Generates alerts.
• Access to historical data
• Generates feeds which can be real-world objects of own or others.

Xively APIs:
• Enable interface with Python, HTML5, HTML5 server, tornado .
• Interface with WebSocket Server and WebSockets .
• Interface with an RPC (Remote Procedure Call).
Xively Cloud for IoT
Xively HTTP based APIs
• Easy to implement on device hardware acting as clients to Xively web services .
• APIs connect to the web service and send data.
• APIs provides services for logging, sharing and displaying sensor data.

Xively Support
• The platform supports the REST, Web Sockets and MQTT protocols
Xively Cloud for IoT
Xively Data formats and Structures :
• Number of data formats and structures enable the interaction, data collection and services.
• Support exists for JSON , XML and CSV .
• Structures: Tabular, spreadsheet, Excel, Data numbers and Text with a comma-separated
values in file

Xively Uses in IoT/M2M


• Private and Public Data Access.
• Data streams, Data points and Triggers.
• Creating and Managing Feeds
Django
Django
• Django is an open source web application framework for developing web applications in
Python.
• A web application framework in general is a collection of solutions, packages and best
practices that allows development of web applications and dynamic websites.
• Django is best suited for cloud applications.
• It has a built-in admin interface which makes it easy to work with it.
• Django is based on MVT (Model-View-Template) architecture.
• MVT is a software design pattern for developing a web application.
Django
Django
Django
Model
• “Model”, the data access layer.
• This layer contains everything about the data: how to access it, how to validate it, which
behaviors, it has, and the relationships between the data.
• 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
• “Template,” the presentation layer.
• This layer defines how something should be displayed on a Web page .
• 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
• “View,” the logic layer.
• View ties the model to the template.
• View is where you write the code that actually generates the web pages.
• It determines what data is to be displayed, retrieves the data from the database and passes
the data to the template.
Other IoT Devices
Other IoT Devices
• pcDuino
• Beagle Bone Black
• Cubieboard

PcDuino

Beagle Bone Black

Cubieboard
pcDuino (“PC + Arduino”)
• pcDuino is a high-performance, cost-effective mini PC platform that runs PC-like OS
such as Ubuntu Linux.
• Outputs screen:- HDMI enabled TV or monitor via the built-in HDMI interface.
• Belongs with open source community.
• OS with an easy-to-use tool chain and compatible with the popular Arduino ecosystem
such as Arduino Shields and open source projects etc.
• Also run Android 4.0 ICS.
• Arduino same code used in pcDuino.
• supports various programming languages including C, C++( with GNU toolchain), Java
(with standard android SDK), and python
• The list of I/O interfaces on the pcDuino board.
• 1. 14 digital pins for GPIO: GPIO max out current is 4mA.
• 2. One UART RX, one UART TX
• 3. Two PWM pins, support up to 24MHz.
• 4. Six ADC pins, ADC 0 and ADC 1 are 6 bits resolution, while the rest are 10 bits
resolution.
• 5. Four SPI pins
• 6. Two I2C pins
Beaglebone Black
• The Beaglebone Black is an open hardware single-board computer, developed by
Texas instruments.
• It’s similar to a Raspberry Pi but It’s more powerful, Based on the TI Sitara AM335x,
an application processor SoC containing an ARM Cortex-A8 core.
• You have more pins to control.
• The BeagleBoard community is perfect for developers and
hobbyists.
Specifications:
• Chip TI AM3359
• CPU 1 GHz ARM Cortex-A8
• GPU PowerVR SGX530
• Memory 512 MB DDR3
• Pins2x 46 pin headers
• Video Output microHDMI
• Audio Output microHDMI
• Dimensions86.40 × 53.3 mm (3.402 × 2.10 in)
• Operating System Linux, Android, Cloud9 IDE on Node.js w/ BoneScript library, plus
more
Cubieboard
• Cubieboard is mini pc development board, which is based on All winner A10 SoC,
small size (10x6cm), hacker friendly, extendable and very low-cost. Compare with
Raspberry Pi, it has higher performance, SATA supported and 96 extended interface.
• If you plan to assemble a small computer, you can try using this small ARM platform
cubieboard.
• It supports Ubuntu and other Linux distributions; you could use it like an ordinary
computer operation.
• At the same time, the platform also supports Android 4.0 Ice Cream Sandwich system
and has built-in IR sensor, can be used as "Android TV".
Features
• All winner A10 SOC
• 96 pin extended interface
• Built-in IR receiver
• SATA supported [Serial Advanced Technology Attachment]
• Supports 2.4GHz wireless keyboard and mouse.

Specifications
• CPU: 1G ARM cortex-A8 processor, NEON, VFPv3, 256KB L2 cache
• GPU: Mali400, OpenGL ES GPU
• Memory: 1GB DDR3 @480MHz
• Video output: HDMI 1080p Output
• Network: 10/100M Ethernet
• Internal storage: 4GB NAND Flash
Specifications
• IO ports: 2 USB Host, 1 micro SD slot, 1 SATA, 1 ir
• Extended interfaces: 96 extend pin including I2C, SPI, RGB/LVDS, CSI/TS, FM-IN, ADC,
CVBS, VGA, SPDIF-OUT, R-TP
• Supports systems: Running Android, Ubuntu and other Linux distributions
• Power supply : 5VDC/2A power supply with 4.00mm(ext.diameter) x 1.7mm(int.diameter)
barrel plug
Amazon Web Services for IoT
Amazon Web Services for IoT
• AWS IoT provides the cloud services that connect your IoT devices to other
devices and AWS cloud services.
• AWS IoT provides device software that can help you integrate your IoT devices
into AWS IoT-based solutions.
Amazon Web Services for IoT
• AWS IoT lets you select the most appropriate and up-to-date technologies for your
solution.
• To help you manage and support your IoT devices in the field, AWS IoT Core
supports these protocols:
MQTT (Message Queuing and Telemetry Transport)
MQTT over WSS (Websockets Secure)
HTTPS (Hypertext Transfer Protocol - Secure)
LoRaWAN (Long Range Wide Area Network)
• The AWS IoT Core message broker supports devices and clients that use MQTT
and MQTT over WSS protocols to publish and subscribe to messages.
• It also supports devices and clients that use the HTTPS protocol to publish
messages.
Amazon Web Services for IoT

Fig: Amazon web services


AMAZON EC2

• EC2 (Amazon Elastic Compute Cloud)


• Amazon EC2 provides on-demand, scalable computing capacity in the Amazon
Web Services (AWS) Cloud.
• An Iaas provided by Amazon.
• EC2 delivers scalable, pay-as-you-go compute capacity in the cloud.
• EC2 can be used for several purposes for IoT systems.
• Using Amazon EC2 reduces hardware costs so you can develop and deploy
applications faster.
Instances : Virtual servers.
1. Various configurations of CPU,
memory, storage, networking
capacity, and graphics hardware
for your instances.
2. Persistent storage volumes for
your data using
Amazon Elastic Block Store
(Amazon EBS).
3. Security groups: A virtual firewall
that allows you to specify the
protocols, ports, and source IP
ranges that can reach your
instances.
For example, usually, when there is high network traffic application might end up crashing, but the AWS load balancer
manages the network traffic and avoids challenges like system crash.
AMAZON AUTOSCALING
• AWS Auto Scaling is a service that helps the user to monitor applications and
automatically adjusts the capacity to maintain steady, predictable performance at the
lowest possible cost.
• In Auto Scaling, creating a backup, and restoring the data is an essential part.
• Allows automatically scaling EC2 capacity up or down according to user condition.
• Users can increase number of EC2 instances.
• Autoscaling can be used for auto scaling IoT applications and IoT platforms deployed as
Amazon EC2
AMAZON AUTOSCALING
AMAZON S3

• Online cloud based data storage infrastructure for storing and


retrieving large amount of data.
• Offers reliable, scalable, fast, fully redundant and affordable storage
infrastructure.
• Serve as raw datastore for IoT systems for storing raw data such as
sensor data, log data, image, audio, video, etc.
1. Buckets and the objects in them are private and can be accessed only if you explicitly grant access permissions.
2. To store your data in Amazon S3, you first create a bucket and specify a bucket name and AWS Region. Then, you upload
your data to that bucket as objects in Amazon S3. Each object has a key (or key name), which is the unique identifier
for the object within the bucket.
AMAZON RDS

• Web service that allows to create instances of MySQL, Oracle or MS


SQL Server in cloud.
• Developers can easily set up, operate and scale a relational database in
cloud.
• Serve as a scalable data store for IoT systems.
• With RDS, IoT system developers can store any amount of data in
scalable relational databases.
Relation Database
AMAZON DYNAMO DB

• Amazon DynamoDB is a fully managed NoSQL service that works on key-value


pair and other data structure documents provided by Amazon.
• It requires only a primary key and doesn’t require a schema to create a table.
• Fully-managed, scalable, high performance No-SQL database service.
• Serve as scalable data store for IoT systems.
• With Dynamo DB, IoT system developers can store any amount of data and serve
any level of requests for the data.
SkyNet IoT Messaging Platform
SkyNet IoT Messaging Platform

• SkyNet is an open source instant messaging platform for Internet of Things.


• The SkyNet API supports both HTTP REST and real time WebSockets.
• SkyNet allows users to register devices on the network.
• A device can be anything including sensors, smart home devices, cloud resources, drones
etc.
• Each device is assigned a UUID [Universally Unique Identifier] and a secret token.
• Devices or client applications can subscribe to other devices and receive/send messages.
• Powered by Node.JS, known for fast, event-driven operations, ideal for nodes and
devices such as RaspberryPi, Arduino etc..
• When nodes and devices register with Skynet, they are assigned a unique id known as a
UUID along with a security token.
• Skynet aim is real time M2M communication.
• NodeRed, a visual tool for wiring the IoT, is now connected to SkyNet and can control a
network of connected smart devices with a drag and drop designer.
• The single SkyNet API supports the following IoT protocols: HTTP, REST, WebSockets,
MQTT (Message Queue Telemetry Transport), and CoAP (Constrained Application
Protocol) for guaranteed message delivery and low-bandwidth satellite communications.
• Every connected device is assigned a 36 character UUID and secret token that act as the
device’s strong credentials.
• Security permissions can be assigned to allow device discoverability, configuration, and
messaging.
SkyNet IoT Messaging Platform
❖Commands to set up SkyNet IoT on Linux machine

You might also like