Iot Notes All Units PDF
Iot Notes All Units PDF
UNIT I - INTRODUCTION
Internet of Things -Domain Specific IoTs -IoT and M2M -Sensors for IoT Applications–
Structure of IoT - IoT Map Device- IoT System Management with NETCONF-YANG
IETF architecture for IoT - IoT reference architecture -First Generation – Description &
Characteristics–Advanced Generation – Description & Characteristics–Integrated IoT
Sensors – Description & Characteristics
SCADA and RFID Protocols - BACnet Protocol -Zigbee Architecture - 6LowPAN - CoAP
-Wireless Sensor Structure–Energy Storage Module–Power Management Module–RF
Module–Sensing Module
The Cloud types; IaaS, PaaS, SaaS.- Development environments for service development;
Amazon, Azure, Google Appcloud platform in industry
Building IoT with RASPBERRY Pi- Creating the sensor project - Preparing Raspberry Pi -
Clayster libraries – Hardware Interacting with the hardware - Interfacing the hardware-
Internal representation of sensor values - Persisting data - External representation of
sensor values - Exporting sensor data
Page 1
UNIT I - INTRODUCTION
Internet of Things -Domain Specific IoTs -IoT and M2M -Sensors for IoT Applications–
Structure of IoT - IoT Map Device- IoT System Management with NETCONF-YANG
1) Home Automation:
a) Smart Lighting: helps in saving energy by adapting the lighting to the ambient
conditions and switching on/off or diming the light when needed.
b) Smart Appliances: make the management easier and also provide status information
to the users remotely.
c) Intrusion Detection: use security cameras and sensors(PIR sensors and door
sensors) to detect intrusion and raise alerts. Alerts can be in the form of SMS or email
sent to the user.
2) Cities:
a) Smart Parking: make the search for parking space easier and convenient for drivers.
Smart parking are powered by IoT systems that detect the no. of empty parking slots
and send information over internet to smart application backends.
b) Smart Lighting: for roads, parks and buildings can help in saving energy.
c) Smart Roads: Equipped with sensors can provide information on driving condition,
travel time estimating and alert in case of poor driving conditions, traffic condition
and accidents.
e) Surveillance: The video feeds from surveillance cameras can be aggregated in cloud
based scalable storage solution.
f) Emergency Response: IoT systems for fire detection, gas and water leakage
detection can help in generating alerts and minimizing their effects on the critical
infrastructures.
Page 2
3) Environment:
a) Weather Monitoring: Systems collect data from a no. of sensors attached and send
the data to cloud based applications and storage back ends. The data collected in
cloud can then be analyzed and visualized by cloud based applications.
b) Air Pollution Monitoring: System can monitor emission of harmful gases(CO2, CO,
NO, NO2 etc.,) by factories and automobiles using gaseous and meteorological
sensors. The collected data can be analyzed to make informed decisions on pollutions
control approaches.
d) Forest Fire Detection: Forest fire can cause damage to natural resources, property
and human life. Early detection of forest fire can help in minimizing damage.
e) River Flood Detection: River floods can cause damage to natural and human
resources and human life. Early warnings of floods can be given by monitoring the
water level and flow rate. IoT based river flood monitoring system uses a no. of sensor
nodes that monitor the water level and flow rate sensors.
4) Energy:
a) Smart Grids: is a data communication network integrated with the electrical grids
that collects and analyze data captured in near-real-time about power transmission,
distribution and consumption. Smart grid technology provides predictive information
and recommendations to utilities, their suppliers, and their customers on how best to
manage power. By using IoT based sensing and measurement technologies, the
health of equipment and integrity of the grid can be evaluated.
b) Renewable Energy Systems: IoT based systems integrated with the transformers at
the point of interconnection measure the electrical variables and how much power is
fed into the grid. For wind energy systems, closed-loop controls can be used to
regulate the voltage at point of interconnection which coordinate wind turbine outputs
and provides power support.
5) Retail:
Page 3
6) Logistics:
a) Route generation & scheduling: IoT based system backed by cloud can provide first
response to the route generation queries and can be scaled upto serve a large
transportation network.
c) Shipment Monitoring: IoT based shipment monitoring systems use sensors such as
temp, humidity, to monitor the conditions and send data to cloud, where it can be
analyzed to detect foods poilage.
d) Remote Vehicle Diagnostics: Systems use on-board IoT devices for collecting data
on Vehicle operations(speed, RPMetc.,) and status of various vehicle subsystems.
7) Agriculture:
8) Industry:
b) Wearable Electronics
Page 4
1. Management System
2. Management API
3. Transaction Manager
4. Rollback Manager
5. Data Model Manager
6. Configuration Validator
7. Configuration Database
8. Configuration API
9. Data Provider API
3. Transaction Manager: executes all the NETCONF transactions and ensures that
ACID properties hold true for the transactions.
5. Data Model Manager : Keeps track of all the YANG data models and the
corresponding managed objects. Also keeps track of the applications which provide
data for each part of a data model.
8. Configuration API : Using the configuration API the application on the IoT device can
be read configuration data from the configuration datastore and write operational data
to the operational datastore.
9. Data Provider API: Applications on the IoT device can register for callbacks for
various events using the Data Provider API. Through the Data Provider API, the
applications can report statistics and operational ldata.
Page 5
3. Structure of IoT
IoT architecture varies from solution to solution, based on the type of solution which we
intend to build. IoT as a technology majorly consists of four main components, over which
an architecture is framed.
Stage 1: Sensors/actuators
Sensors collect data from the environment or object under measurement and turn it
into useful data. Think of the specialized structures in your cell phone that detect the
directional pull of gravity and the phone's relative position to the ―thing‖ we call the earth
and convert it into data that your phone can use to orient the device.
Page 6
Actuators can also intervene to change the physical conditions that generate the
data. An actuator might, for example, shut off a power supply, adjust an air flow valve, or
move a robotic gripper in an assembly process.
For example, a pump might contain a half-dozen sensors and actuators that feed
data into a data aggregation device that also digitizes the data. This device might be
physically attached to the pump. An adjacent gateway device or server would then process
the data and forward it to the Stage 3 or Stage 4 systems. Intelligent gateways can build
on additional, basic gateway functionality by adding such capabilities as analytics,
malware protection, and data management services. These systems enable the analysis
of data streams in real time.
Stage 3: Edge IT
Once IoT data has been digitized and aggregated, it's ready to cross into the realm
of IT. However, the data may require further processing before it enters the data center.
This is where edge IT systems, which perform more analysis, come into play. Edge IT
processing systems may be located in remote offices or other edge locations, but
generally these sit in the facility or location where the sensors reside closer to the sensors,
such as in a wiring closet. Because IoT data can easily eat up network bandwidth and
swamp your data center resources, it's best to have systems at the edge capable of
performing analytics as a way to lessen the burden on core IT infrastructure. You'd also
face security concerns, storage issues, and delays processing the data. With a staged
approach, you can preprocess the data, generate meaningful results, and pass only those
on. For example, rather than passing on raw vibration data for the pumps, you could
aggregate and convert the data, analyze it, and send only projections as to when each
device will fail or need service.
Page 7
Machine-to-Machine (M2M)
Fig. Shows the end-to-end architecture of M2M systems comprises of M2M area networks,
communication networks and application domain.
• To enable the communication between remote M2M are network, M2M gateways
are used.
Page 8
Fig. Shows a block diagram of an M2M gateway. The communication between M2M nodes
and the M2M gateway is based on the communication protocols which are naive to the
M2M are network. M2M gateway performs protocol translations to enable Ip-connectivity
for M2M are networks. M2M gateway acts as a proxy performing translations from/to
native protocols to/from Internet Protocol(IP). With an M2M gateway, each mode in an
M2M area network appears as a virtualized node for external M2M area networks.
1) Communication Protocols:
• Commonly uses M2M protocols include ZigBee, Bluetooth, ModBus, M-Bus,
Wireless M-Bus tec.,
• In IoT uses HTTP, CoAP, WebSocket , MQTT ,XMPP ,DDS ,AMQP etc.,
5) Applications
• M2M data is collected in point solutions and can be accessed by on-premises
applications such as diagnosis applications, service management applications, and
on- premisis enterprise applications.
• IoT data is collected in the cloud and can be accessed by cloud applications such as
analytics applications, enterprise applications, remote diagnosis and management
applications, etc.
Page 9
➢ The CoRE Link Format specification describes a discovery method for the
CoAP resources of a CoAP server.
➢ For example, a CoAP client sending a request with the GET method to a
specific well defined server resource (./well-known/core) should receive a
response with a list of CoAP resources and some of their capabilities (e.g.
resource type, interface type).
➢ The CoRE interface specification describes interface types and
corresponding expected behavior of the RESTful methods.
➢ The IETF stack for IoT does not currently include any specifications that are
similar to the profile specifications of other IoT technologies such as ZigBee
➢ Profile specification means a document that describes a list of profile
names and their mappings to specific protocol stack behavior, specific
information model, and specific serialization of this information model over
the relevant communication medium.
➢ An example of a profile specification excerpt would mandate that an
exemplary “Temperature” profile:
(a) should support a resource called /temp,
(b) the resource /temp must respond to a GET method request from a client, and
(c) the response to a GET method request shall be a temperature value in
degrees Celsius formatted as a text string with the format “,temperature
value encoded in a decimal number ._C”
➢ A Resource Directory is a CoAP server resource (/rd) that maintains a list of
resources, their corresponding server contact information (e.g. IP
addresses or fully qualified domain name, or FQDN), their type, interface,
and other information similar to the information that the CoRE Link Format
document specifies.
Page 11
Page 12
➢ The general essentials out of multiple concrete architectures can then are
aggregated, and contribute to the evolution of the Reference Architecture.
➢ It has three layers, namely, the perception, network, and application layers.
(i) The perception layer is the physical layer, which has sensors for
sensing and gathering information about the environment. It senses some
physical parameters or identifies other smart objects in the environment.
(ii) The network layer is responsible for connecting to other smart things,
network devices, and servers. Its features are also used for transmitting and
processing sensor data.
(iii) The application layer is responsible for delivering application specific
services to the user. It defines various applications in which the Internet of
Things can be deployed, for example, smart homes, smart cities, and smart
health.
➢ The three-layer architecture defines the main idea of the Internet of Things,
but it is not sufficient for research on IoT because research often focuses
on finer aspects of the Internet of Things.
➢ The five layers are perception, transport, processing, application, and business
layers.
➢ The role of the perception and application layers is the same as the
architecture with three layers. We outline the function of the remaining three
layers.
(i) The transport layer transfers the sensor data from the perception layer
to the processing layer and vice versa through networks such as wireless,
3G, LAN, Bluetooth, RFID, and NFC.
(ii) The processing layer is also known as the middleware layer. It stores,
analyzes, and processes huge amounts of data that comes from the
transport layer. It can manage and provide a diverse set of services to the
lower layers. It employs many technologies such as databases, cloud
computing, and big data processing modules.
(iii) The business layer manages the whole IoT system, including
applications, business and profit models, and users’ privacy.
Page 15
1. The ability to support an HTTP server and/or an MQTT broker to talk to the
devices
Page 17
➢ The bus layer may also provide some simple correlation and mapping
from different correlation models (e.g. mapping a device ID into an owner’s
ID or vice-versa).
➢ It must be able to act as an OAuth2 Resource Server (validating Bearer
Tokens and associated resource access scopes).
➢ It must also be able to act as a policy enforcement point (PEP) for policy-based
access.
➢ This layer takes the events from the bus and provides the ability to process
and act upon these events.
➢ A core capability here is the requirement to store the data into a database.
➢ It has the following approaches:
• Highly scalable, column-based data storage for storing events
• Map-reduce for long-running batch-oriented processing of data
• Complex event processing for fast in-memory processing and near real-
time reaction and autonomic actions based on the data and activity of
devices and other systems
• Firstly, we need the ability to create web-based front-ends and portals that
interact with devices and with the event-processing layer.
• Secondly, we need the ability to create dashboards that offer views into
analytics and event processing.
• Finally, we need to be able to interact with systems outside this network
using machine-to-machine communications (APIs).
• The final aspect is that the gateway publishes data into the analytics layer
where it is stored as well as processed to provide insights into how the APIs
are used.
Page 18
G. Device Management
• XACML PDP
Page 19
SCADA:
SCADA (supervisory control and data acquisition) is a category of software applications for
controlling industrial processes, which is the gathering of data in real time from remote
locations in order to control equipment and conditions. SCADA provides organizations with
the tools needed to make and deploy data-driven decisions regarding their industrial
processes.
SCADA PROTOCOL:
Industrial automation has a variety of vertical markets and there are also many types of
SCADAs. IEEE created a standard specification, called Std C37.1™, for SCADA and
automation systems [116] in 2007, targeting mostly power SCADA applications. It’s
recognized in the specification that in recent years, network-based industrial automation
has greatly evolved with the use of intelligent electronic devices (IEDs), or IoT devices in
our terms, in substations and power stations. The processing is now distributed, and
functions that used to be done at the control center can now be done by the IED, that is,
M2M between devices. Despite the fact that many functions can be moved to the IED,
utilities still need a master station, the IoT platform, for the operation of the power system.
Due to the restructuring of the electric industry, traditional vertically integrated electric
utilities are replaced by many entities such as GENCO (Generation Company), TRANSCO
(Transmission Company), DISCO (Distribution Company), ISO (independent system
operator), RTO (regional transmission organization), and so forth. To fulfill their role, each
of these entities needs a control center, that is, a substation, to receive and process data
and take appropriate control actions.
Page 20
OPC, which stands for Object Linking and Embedding (OLE) for Process Control, is the
original name for a standard specification developed in 1996 by an industrial automation
industry task force. The standard specifies the communication of real-time plant data
between control devices from different manufacturers.
OPC was designed to provide a common bridge for Windows-based software applications
and process control hardware. Standards define consistent methods of accessing field
data from plant floor devices. This method remains the same regardless of the type and
source of data. An OPC server for one hardware device provides the same methods for an
OPC client to access its data as each and every other OPC server for that same or
another hardware device. The aim was to reduce the amount of duplicated effort required
from hardware manufacturers and their software partners, and from the SCADA and other
HMI producers, in order to interface the two. When a hardware manufacturer had
developed their OPC server for the new hardware device, their work was done to allow
anyone to access their device; and when the SCADA producer had developed their OPC
client, their work was done to allow access to any hardware, existing or yet to be created,
with an OPC-compliant server.
OPC has achieved great success in many application areas, most of them closely related
to or part of IoT applications. However, OPC’s success story is accompanied by some
caveats. For example, standard OPC DA (data access) is based on Microsoft’s COM and
DCOM technology and is consequently restricted to the Windows operating system. In
addition, DCOM communication is easily blocked by firewalls that prevent OPC clients
from accessing data over a wide-area network and the World Wide Web. New approaches,
such as XML-DA and United Architecture (UA) [234], have been developed to make OPC
technology available on other platforms or accessible by other systems.
The RFID protocols and data formats are relatively well defined, mostly by EPCglobal, and
unified compared with protocols and formats of the other three pillars of IoT. The RFID
protocols (such as PML, Object Naming Service [ONS], Edgeware, EPC Information
Page 21
Service [EPCIS], Application Level Event [ALE], etc.) have been described in the previous
chapters, so we will talk only about protocols for the related contactless smart cards here.
RFID:
RFID or Radio Frequency Identification is an automatic identification method that uses
wireless non-contact radio frequency waves in which data is digitally encoded in RFID tags
or smart labels which can be read by reader through radio waves.
RFID PROTOCOL:
The RFID protocols and data formats are relatively well defined, mostly by EPC global,
and unified compared with protocols and formats of the other three pillars of IoT. The RFID
protocols (such as PML, Object Naming Service [ONS], Edgeware, EPC Information
Service [EPCIS], Application Level Event [ALE], etc.) have been described in the previous
chapters, so we will talk only about protocols for the related contactless smart cards here.
The smart cards with contactless interfaces (RFID is a subset) are becoming increasingly
popular for payment and ticketing applications such as mass transit and stadiums.
The standard for contactless smart card communications is ISO/IEC 14443. It defines two
types of contactless cards (A and B) and allows for communications at distances up to
10 cm. An alternative standard for contactless smart cards is ISO/IEC 15693, which allows
communications at distances up to 50 cm.
Working of RFID Protocol
Page 22
2. BACnet Protocol
Page 23
Advantages
The advantages of the Bacnet Protocol include the following.
• BACnet protocol is particularly designed for building automation as well as control
networks.
• It doesn’t depend on present LAN or WAN technologies.
• It is an American National Standard & a European pre-standard.
Page 24
Disadvantages
The disadvantages of the Bacnet Protocol include the following.
• The main drawback of the BACnet protocol was a compliant problem. So because of
this issue, the BTL (BACnet Testing Laboratories) was introduced in the year 2000.
BTL is compliance & and independent testing organization. The main intention of this
is to test the products of BACnet to verify compliance with the standard. Once
approved; the product will get the logo of BTL.
• The problems or net-worthy attacks which are widely found in this protocol are; Lack
of spoofing & authentication, DoS attacks, immobilized network connections, and lack
of encryption & write access over devices.
Applications
The use of Bacnet Protocol includes the following.
• The BACnet is used in HVAC applications, fire control lighting control, security,
alarm & interfacing to utility companies.
• This protocol was particularly designed for building automation as well as control
applications.
• This protocol is used to provide mechanisms, especially for automation devices for
exchanging data irrespective of the specific building service they perform.
• This protocol can be used by digital controllers, computers & application-specific
otherwise unitary controllers with equivalent effect.
• BACnet protocol was initially developed to develop interoperability between building
automation devices; however, its data descriptions, as well as flexible architecture,
will make it work within a broad range of control applications.
• This is an object-oriented protocol, so used to signify network-accessible control
equipment.
Page 25
3. Zigbee Architecture
ZigBee is a Personal Area Network task group with low rate task group 4. It is a
technology of home networking. ZigBee is a technological standard created for
controlling and sensing the network. As we know that ZigBee is the Personal Area
network of task group 4 so it is based on IEEE 802.15.4 and is created by Zigbee Alliance.
ZigBee is a standard that addresses the need for very low-cost implementation of Low
power devices with Low data rates for short-range wireless communications.
• Zigbee Coordinator Device: It communicates with routers. This device is used for
connecting the devices.
• Zigbee Router: It is used for passing the data between devices.
• Zigbee End Device: It is the device that is going to be controlled.
Operating Frequency Bands (Only one channel will be selected for use in a network):
Page 26
• Star Topology (ZigBee Smart Energy): Consists of a coordinator and several end
devices, end devices communicate only with the coordinator.
• Mesh Topology (Self Healing Process): Mesh topology consists of one coordinator,
several routers, and end devices.
• Tree Topology: In this topology, the network consists of a central node which is a
coordinator, several routers, and end devices. the function of the router is to extend
the network coverage.
Architecture of Zigbee:
1. Application Layer
2. Network Layer
3. Medium Access Control Layer
4. Physical Layer
• Medium Access Control layer (MAC layer): The layer is responsible for the
interface between the physical and network layer. The MAC layer is also
responsible for providing PAN ID and also network discovery through beacon
requests.
• Network layer: This layer acts as an interface between the MAC layer and the
application layer. It is responsible for mesh networking.
• Application layer: The application layer in the Zigbee stack is the highest protocol
layer and it consists of the application support sub-layer and Zigbee device object. It
contains manufacturer-defined applications.
Channel Access:
Zigbee Applications:
1. Home Automation
2. Medical Data Collection
3. Industrial Control Systems
4. meter reading system
5. light control system
Page 27
4. 6LowPAN
6LoWPAN is an IPv6 protocol, and It’s extended from is IPv6 over Low Power Personal
Area Network. As the name itself explains the meaning of this protocol is that this protocol
works on Wireless Personal Area Network i.e., WPAN.
WPAN is a Personal Area Network (PAN) where the interconnected devices are centered
around a person’s workspace and connected through a wireless medium. You can read
more about WPAN at WPAN. 6LoWPAN allows communication using the IPv6 protocol.
IPv6 is Internet Protocol Version 6 is a network layer protocol that allows communication to
take place over the network. It is faster and more reliable and provides a large number of
addresses.
6LoWPAN initially came into existence to overcome the conventional methodologies that
were adapted to transmit information. But still, it is not so efficient as it only allows for the
smaller devices with very limited processing ability to establish communication using one
of the Internet Protocols, i.e., IPv6. It has very low cost, short-range, low memory usage,
and low bit rate.
It comprises an Edge Router and Sensor Nodes. Even the smallest of the IoT devices can
now be part of the network, and the information can be transmitted to the outside world as
well. For example, LED Streetlights.
• 6LoWPAN can interact with 802.15.4 devices and also other types of devices on an
IP Network. For example, Wi-Fi.
• It uses AES 128 link layer security, which AES is a block cipher having key size of
128/192/256 bits and encrypts data in blocks of 128 bits each. This is defined in
IEEE 802.15.4 and provides link authentication and encryption.
Page 28
1. The device should be having sleep mode in order to support the battery saving.
2. Minimal memory requirement.
3. Routing overhead should be lowered.
Features of 6LoWPAN:
Advantages of 6LoWPAN:
1. 6LoWPAN is a mesh network that is robust, scalable, and can heal on its own.
2. It delivers low-cost and secure communication in IoT devices.
3. It uses IPv6 protocol and so it can be directly routed to cloud platforms.
4. It offers one-to-many and many-to-one routing.
5. In the network, leaf nodes can be in sleep mode for a longer duration of time.
Disadvantages of 6LoWPAN:
Applications of 6LoWPAN:
• Security: 6LoWPAN security is ensured by the AES algorithm, which is a link layer
security, and the transport layer security mechanisms are included as well.
• Interoperability: 6LoWPAN is able to operate with other wireless devices as well
which makes it interoperable in a network.
Page 29
5. CoAP
Constrained Application Protocol (COAP) is a client server-based protocol. With this
protocol, the COAP packet can be shared between different client nodes which are
commanded by the COAP server. The server is responsible to share the information
depending on its logic but has not acknowledged it. This is used with the applications
which support the state transfer model.
CoAP is a session layer protocol that provides the RESTful (HTTP) interface between
HTTP client and server. It is designed by IETF Constrained RESTful Environment (CoRE)
working group. It is designed to use devices on the same constrained network between
devices and general nodes on the Internet. CoAP enables low-power sensors to use
RESTful services while meeting their low power constraints. This protocol is specially built
for IoT systems primarily based on HTTP protocols.
This network is used within the limited network or in a constrained environment. The
whole architecture of CoAP consists of CoAP client, CoAP server, REST CoAP proxy, and
REST internet.
The data is sent from CoAP clients (such as smartphones, RFID sensors, etc.) to the
CoAP server and the same message is routed to REST CoAP proxy. The REST CoAP
proxy interacts outside the CoAP environment and uploads the data over REST internet.
Page 30
6. RF module
Types of RF modules
The term RF module can be applied to many different types, shapes and sizes of
small electronic sub assembly circuit board. It can also be applied to modules across a
huge variation of functionality and capability. RF modules typically incorporate a printed
circuit board, transmit or receive circuit, antenna, and serial interface for communication to
the host processor.
Most standard, well known types are covered here:
• transmitter module
• receiver module
• transceiver module
• system on a chip module.
Transmitter module
Page 31
Transceiver modules
An SoC module is the same as a transceiver module, but it is often made with an
onboard microcontroller. The microcontroller is typically used to handle radio data
packetisation or managing a protocol such as an IEEE 802.15.4 compliant module. This
type of module is typically used for designs that require additional processing for
compliance with a protocol when the designer does not wish to incorporate this processing
into the host microcontroller.
Wireless protocols used in RF modules
RF modules, especially SoC modules, are frequently used to communicate
according to a pre-defined wireless standard, including:
• Zigbee
• Bluetooth Low Energy
• Wi-Fi
• IEEE 802.15.4
• Z-Wave
Typical applications
• Vehicle monitoring
• Remote control
• Telemetry
• Small-range wireless network
• Wireless meter reading
• Access control systems
• Wireless home security systems
• Area paging
• Industrial data acquisition system
• Radio tags reading
• RF contactless smart cards
• Wireless data terminals
• Wireless fire protection systems
• Biological signal acquisition
• Hydrological and meteorological monitoring
• Robot remote control
• Wireless data transmissions
• Digital video/audio transmission
Page 32
Iaas is also known as Hardware as a Service (HaaS). It is one of the layers of the
cloud computing platform. It allows customers to outsource their IT infrastructures such
as servers, networking, processing, storage, virtual machines, and other resources.
Customers access these resources on the Internet using a pay-as-per use model.
In traditional hosting services, IT infrastructure was rented out for a specific period
of time, with pre-determined hardware configuration. The client paid for the configuration
and time, regardless of the actual use. With the help of the IaaS cloud computing platform
layer, clients can dynamically scale the configuration to meet changing requirements and
are billed only for the services actually used.
IaaS cloud computing platform layer eliminates the need for every organization to
maintain the IT infrastructure.
IaaS is offered in three models: public, private, and hybrid cloud. The private cloud
implies that the infrastructure resides at the customer-premise. In the case of public
cloud, it is located at the cloud computing platform vendor's data center, and the hybrid
cloud is a combination of the two in which the customer selects the best of both public
cloud or private cloud.
Page 33
1. Shared infrastructure
IaaS allows multiple users to share the same physical infrastructure.
3. Pay-as-per-use model
IaaS providers provide services based on the pay-as-per-use basis. The users are
required to pay for what they have used.
5. On-demand scalability
On-demand scalability is one of the biggest advantages of IaaS. Using IaaS, users
do not worry about to upgrade software and troubleshoot the issues related to hardware
components.
1. Security
Security is one of the biggest issues in IaaS. Most of the IaaS providers are not able
to provide 100% security.
3. Interoperability issues
It is difficult to migrate VM from one IaaS provider to the other, so the customers
might face problem related to vendor lock-in.
Page 34
PaaS Types : Various sorts of PaaS are presently accessible to engineers. They are :
1. Public PaaS
2. Private PaaS
3. Hybrid PaaS
4. Communication PaaS
5. Mobile PaaS
6. Open PaaS
2. Private PaaS – Plans to give dexterity of public pass while keeping up security,
consistence, advantages and ease of private security community. A private pass is
normally circulated as gadget or programming in client’s firewall, which is regularly
kept up in server farm on organization’s premises. A private PaaS can be created
on framework and works inside organization’s particular private cloud.
Private dice permit an association to all more likely serve designers, improve inside
Page 35
asset usage, and decrease expensive cloud entrance that numerous organizations
face. Likewise, private dice permit designers to run and deal with their
organization’s applications in consistence with severe security and protection
necessities.
3. Hybrid PaaS – Consolidates organizations with Public PaaS and Private PaaS,
with accommodation of unbounded limit offered by Public PaaS and cost-adequacy
of having inside framework in Private PaaS. Hybrid PaaS utilizes hybrid cloud.
Page 36
Business Services - SaaS Provider provides various business services to start-up the
business. The SaaS business services include ERP (Enterprise Resource Planning), CRM
(Customer Relationship Management), billing, and sales.
Social Networks - As we all know, social networking sites are used by the general public,
so social networking service providers use SaaS for their convenience and handle the
general public's information.
Mail Services - To handle the unpredictable number of users and load on e-mail services,
many e-mail providers offering their services using SaaS.
Page 37
Unlike traditional software, which is sold as a licensed based with an up-front cost
(and often an optional ongoing support fee), SaaS providers are generally pricing the
applications using a subscription fee, most commonly a monthly or annually fee.
2. One to Many
SaaS services are offered as a one-to-many model means a single instance of the
application is shared by multiple users.
Software as a service removes the need for installation, set-up, and daily maintenance for
the organizations. The initial set-up cost for SaaS is typically less than the enterprise
software. SaaS vendors are pricing their applications based on some usage parameters,
such as a number of users using the application. So SaaS does easy to monitor and
automatic updates.
All users will have the same version of the software and typically access it through the web
browser. SaaS reduces IT support costs by outsourcing hardware and software
maintenance and support to the IaaS provider.
6. Multidevice support
SaaS services can be accessed from any device such as desktops, laptops, tablets,
phones, and thin clients.
7. API Integration
SaaS services easily integrate with other software or services through standard APIs.
8. No client-side installation
SaaS services are accessed directly from the service provider using the internet
connection, so do not need to require any software installation.
1) Security
Actually, data is stored in the cloud, so security may be an issue for some users. However,
cloud computing is not more secure than in-house deployment.
Page 38
2) Latency issue
Since data and applications are stored in the cloud at a variable distance from the end-
user, there is a possibility that there may be greater latency when interacting with the
application compared to local deployment. Therefore, the SaaS model is not suitable for
applications whose demand response time is in milliseconds.
Switching SaaS vendors involves the difficult and slow task of transferring the very large
data files over the internet and then converting and importing them into another SaaS also.
Page 39
The Internet of Things (IoT) is a scenario in which objects, animals or people are provided
with single identifiers and the capability to automatically transfer and the capability to
automatically transfer data more to a network without requiring human-to-human or
human-to-computer communication.
Raspberry Pi
• The Raspberry Pi is a very cheap computer that runs Linux, but it also provides a
set of GPIO (general purpose input/output) pins that allow you to control electronic
components for physical computing and explore the Internet of Things (IoT).
• Raspberry Pi was basically introduced in 2006.
• It 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.
• There have been three generations of Raspberry Pis: Pi 1, Pi 2, and Pi 3
• The first generation of Raspberry (Pi 1) was released in the year 2012, that has two
types of models namely model A and model B.
• Raspberry Pi can be plugged into a TV, computer monitor, and it uses a standard
keyboard and mouse.
• It is user friendly as 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.
• 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 on board
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.
• Several generations of Raspberry Pis have been released.
• All models feature a Broadcom system on a chip (SoC) with an integrated ARM-
compatible central processing unit (CPU) and on-chip graphics processing unit
(GPU).
Page 40
• Processor speed ranges from 700 MHz to 1.4 GHz for the Pi 3 Model B+ or 1.5
GHz for the Pi 4; on-board memory ranges from 256 MB to 1 GB with up to 4 GB
available on the Pi 4 random-access memory (RAM).
• Secure Digital (SD) cards in MicroSDHC form factor (SDHC on early models) are
used to store the operating system and program memory.
• The boards have one to five USB ports. For video output, HDMI and composite
video are supported, with a standard 3.5 mm tip-ring-sleeve jack for audio output.
• Lower-level output is provided by a number of GPIO pins, which support common
protocols like I2C. The B-models have an 8P8C Ethernet port and the Pi 3 and Pi
Zero W have on-board Wi-Fi and Bluetooth.
• Voltages: Two 5V pins and two 3V3 pins are present on the board, as well as a
number of ground pins (0V). The remaining pins are all general purpose 3V3 pins
• A GPIO pin designated as an output pin can be set to high (3V3) or low (0V). A GPIO
pin designated as an input pin can be read as high (3V3) or low (0V).
• Processor & RAM: Raspberry based on ARM11 processor. Latest version supports
700MHz processor and 512MB SDRAM. The Central processing unit is the brain of
the raspberry pi board and that is responsible for carrying out the instructions of the
computer through logical and mathematical operations.
• Ethernet: The Ethernet port of the raspberry pi is the main gateway for
communicating with additional devices. The raspberry pi Ethernet port is used to plug
your home router to access the internet.
• USB Ports: It has 2 USB ports. USB port provide current upto 100mA. For connecting
devices that draw current more than 100mA, an external USB powered hub is
required.
Page 41
• Ethernet Port: It has standard RJ45 Ethernet port. Connect Ethernet cable or USB
wifi adapter to provide internet connectivity.
• HDMI Output: It supports both audio and video output. Connect raspberry Pi to
monitor using HDMI cable.
• Composite video Output: Raspberry comes with a composite video output with an
RCA jack that supports both PAL and NTSC video output.
• Audio Output: It has 3.5mm audio output jack. This audio jack is used for providing
audio output to old television along with RCA jack for video.
• GPIO Pins: It has a number of general purpose input/output pins. These pins are
used to connect other electronic components. For example, you can connect it to the
temperature sensor to transmit digital data.
• Display Serial Interface (DSI): DSI interface are used to connect an LCD panel to
Raspberry PI.
• Cameral Serial Interface(CSI): CSI interface are used to connect a camera module
to Raspberry PI.
• SD Card slot: Raspberry does not have built in OS and storage. Plug in an SD card
loaded with Linux to SD card slot.
• Power Input: Raspberry has a micro USP connector for power input.
• Memory: The raspberry pi model A board is designed with 256MB of SDRAM and
model B is designed with 51MB.Raspberry pi is a small size PC compare with other
PCs. The normal PCs RAM memory is available in gigabytes. But in raspberry pi
board, the RAM memory is available more than 256MB or 512MB
• Status LEDs: Raspberry has 5 status LEDs.
Raspberry PI Interfaces:
• Serial : Serial Interface on Raspberry 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. In an SPI connection, there is
one master device and one or more peripheral devices. There are 5 pins Raspberry
Page 42
• I2C: I2C Interface pins are used to connect hardware modules. I2C interface allows
synchronous data transfer with two pins: SDA(data line) and SCL (Clock Line)
1. Where the system processing is huge. They can process high end programs for
applications like Weather Station, Cloud server, gaming console etc. With 1.2GHz
clock speed and 1 GB RAM RASPBERRY PI can perform all those advanced
functions.
2. RASPBERRY PI 3 has wireless LAN and Bluetooth facility by which you can setup
WIFI HOTSPOT for internet connectivity.
3. RASPBERRY PI had dedicated port for connecting touch LCD display which is a
feature that completely omits the need of monitor.
4. RASPBERRY PI also has dedicated camera port so one can connect camera without
any hassle to the PI board.
5. RASPBERRY PI also has PWM outputs for application use. 6. It supports HD steaming
Applications
• Hobby projects.
• Low cost PC/tablet/laptop
• IoT applications
• Media center
• Robotics
• Industrial/Home automation
• Server/cloud server
• Print server
• Security monitoring
• Web camera
• Gaming
• Wireless access point
Page 43
Our first project will be the sensor project. Since it is the first one, we will cover it in
more detail than the following projects in this book. A majority of what we will explore will
also be reutilized in other projects as much as possible. The development of the sensor is
broken down into six steps, and the source code for each step can be downloaded
separately. You will find a simple overview of this here:
2. Then, you will configure the hardware and learn to sample sensor values and maintain a
useful historical record.
3. After adding HTTP server capabilities as well as useful web resources to the project,
you will publish the sensor values collected on the Internet.
4. You will then handle persistence of sampled data in the sensor so it can resume after
outages or software updates.
5. The next step will teach you how to add a security layer, requiring user authentication to
access sensitive information, on top of the application.
6. In the last step, you will learn how to overcome one of the major obstacles in the
request/response pattern used by HTTP, that is, how to send events from the server to the
client.
3. Preparing Raspberry Pi
Page 44
To prepare Raspberry for the execution of the .NET code, we need to install Mono,
which contains the Common Language Runtime for .NET that will help us run the .NET
code on Raspberry. This is done by executing the following commands in a terminal
window in Raspberry Pi:
4. Clayster libraries
To facilitate the development of IoT applications, this book provides you with the
right to use seven Clayster libraries for private and commercial applications. These are
available on GitHub with the downloadable source code for each chapter. Of these seven
libraries, two are provided with the source code so that the community can extend them as
they desire. Furthermore, the source code of all the examples shown in this book is also
available for download.
Library Description
This provides the application with a powerful object database. Objects are
persisted and can be searched directly in the code using the object's class
Clayster.Library.Data
definition. No database coding is necessary. Data can be stored in the
SQLite database provided in Raspberry Pi.
This provides the application with an extensible event logging architecture
Clayster.Library.EventLog
that can be used to get an overview of what happens in a network of things.
This contains classes that implement common Internet protocols.
Clayster.Library.Internet Applications can use these to communicate over the Internet in a dynamic
manner.
This provides mechanisms to create localizable applications that are simple
Clayster.Library.Language
to translate and that can work in an international setting.
This provides a powerful extensible, mathematical scripting language that
Clayster.Library.Math
can help with automation, scripting, graph plotting, and others.
This provides classes that help applications become interoperable by
Clayster.Library.IoT providing data representation and parsing capabilities of data in IoT. The
source code is also included here.
This contains Hardware Abstraction Layer (HAL) for Raspberry Pi. It
provides object-oriented interfaces to interact with devices connected to the
Clayster.Library.RaspberryPi
General Purpose Input/Output (GPIO) pins available. The source code is
also included here.
Page 45
Hardware
Our sensor prototype will measure three things: light, temperature, and motion. To
summarize, here is a brief description of the components:
• The light sensor is a simple ZX-LDR analog sensor that we will connect to a four-
channel (of which we use only one) analog-to-digital converter (Digilent Pmod AD2),
which is connected to an I2C bus that we will connect to the standard GPIO pins for
I2C.
• The temperature sensor (Texas Instruments TMP102) connects directly to the same
I2C bus.
• The SCL and SDA pins on the I2C bus use recommended pull-up resistors to make
sure they are in a high state when nobody actively pulls them down.
• The infrared motion detector (Parallax PIR sensor) is a digital input that we connect to
GPIO 22.
• We also add four LEDs to the board. One of these is green and is connected to GPIO
23. This will show when the application is running. The second one is yellow and is
connected to GPIO 24. This will show when measurements are done. The third one is
yellow and is connected to GPIO 18. This will show when an HTTP activity is
performed. The last one is red and is connected to GPIO 25. This will show when a
communication error occurs.
• The pins that control the LEDs are first connected to 160 Ω resistors before they are
connected to the LEDs, and then to ground. All the hardware of the prototype board is
powered by the 3.3 V source provided by Raspberry Pi. A 160 Ω resistor connected in
series between the pin and ground makes sure 20 mA flows through the LED, which
makes it emit a bright light.
Interaction with our hardware is done using corresponding classes defined in the
Clayster.Library.RaspberryPi library, for which the source code is provided.
For instance, digital output is handled using the DigitalOutput class and digital input
with the DigitalInputclass. Devices connected to an I2C bus are handled using the I2C
class. There are also other generic classes, such as ParallelDigitalInput and
ParallelDigitalOutput, that handle a series of digital input and output at once. The
SoftwarePwm class handles a software-controlled pulse-width modulation output. The Uart
class handles communication using the UART port available on Raspberry Pi. There's also
a subnamespace called Devices where device-specific classes are available.
Page 46
In the end, all classes communicate with the static GPIO class, which is used to
interact with the GPIO layer in Raspberry Pi.
Each class has a constructor that initializes the corresponding hardware resource,
methods and properties to interact with the resource, and finally a Dispose method that
releases the resource.
With our temperature sensor on the I2C bus, which limits the serial clock frequency to a
maximum of 400 kHz, we interface as follows:
private static AD799x adc = new AD799x (0, true, false, false, false, i2cBus);
The sensor data values will be represented by the following set of variables:
private static bool motionDetected = false;
private static double temperatureC;
private static double lightPercent;
private static object synchObject = new object ();
Page 47
8. Persisting data
Persisting data is simple. This is done using an object database. This object
database analyzes the class definition of objects to persist and dynamically creates the
database schema to accommodate the objects you want to store. The object database is
defined in the Clayster.Library.Data library. You first need a reference to the object
database, which is as follows:
Then, you need to provide information on how to connect to the underlying database. This
can be done in the .config file of the application or the code itself. In our case, we will
specify a SQLite database and provide the necessary parameters in the code during the
startup:
Finally, you will get a proxy object for the object database as follows. This object can be
used to store, update, delete, and search for objects in your database:
db = DB.GetDatabaseProxy (“TheSensor");
By doing this, the sensor does not lose data if Raspberry Pi is restarted.
For each timestamp, a collection of fields is reported. There are different types of
fields available: numerical, string, date and time, timespan, Boolean, and enumeration-
valued fields. Each field has a field name, field value of the corresponding type and the
optional readout type (if the value corresponds to a momentary value, peak value, status
value, and so on), a field status, or Quality of Service value and localization information.
Page 48
The export starts by calling the Start() method on the sensor data export module
and ends with a call to the End() method. Between these two, a sequence of StartNode()
and EndNode() method calls are made, one for each node to export. To simplify our
export, we then call another function to output data from an array of Record objects that
contain our data. We use the same method to export our momentary values by creating a
temporary Record object that would contain them:
Output.EndNode ();
}
Output.End ();
}
If a data field passes all these tests, it is exported by calling any of the instances of
the overloaded method ExportField(), available on the sensor data export object. Fields
are exported between the StartTimestamp() andEndTimestamp() method calls, defining
the timestamp that corresponds to the fields being exported:
Page 49
We can test the method by exporting some sensor data to XML using the
SensorDataXmlExport class. It implements the ISensorDataExport interface. The result
would look something like this if you export only momentary and historic day values.
Page 50