1 - UNIT III Notes by George
1 - UNIT III Notes by George
They are entering an era of the “Internet of Things” (abbreviated as IoT).There are 2
definitions: First one is defined by Vermesan and second by Pe˜na-L´opez
1. The Internet of Things as simply an interaction between the physical and digital worlds. The
digital world interacts with the physical world using a plethora of sensors and actuators.
2. Another is the Internet of Things is defined as a paradigm in which computing and
networking capabilities are embedded in any kind of conceivable object.
They use these capabilities to query the state of the object and to change its state if possible.
• In common parlance, the Internet of Things refers to a new kind of world where almost
all the devices and appliances that we use are connected to a network.
• We can use them collaboratively to achieve complex tasks that require a high degree of
intelligence.
• For this intelligence and interconnection, IoT devices are equipped with embedded
sensors, actuators, processors, and transceivers.
• IoT is not a single technology; rather it is an agglomeration of various technologies
that work together in tandem.
• Sensors and actuators are devices, which help in interacting with the physical
environment.
• The data collected by the sensors has to be stored and processed intelligently in order
to derive useful inferences from it.
• Note that we broadly define the term sensor; a mobile phone or even a microwave oven
can count as a sensor as long as it provides inputs about its current state (internal state
+ environment).
• An actuator is a device that is used to effect a change in the environment such as the
temperature controller of an air conditioner.
• The storage and processing of data can be done on the edge of the network itself or in
a remote server.
• If any preprocessing of data is possible, then it is typically done at either the sensor or
some other proximate device.
• The processed data is then typically sent to a remote server.
• The storage and processing capabilities of an IoT object are also restricted by the
resources available, which are often very constrained due to limitations of size, energy,
power, and computational capability.
• As a result the main research challenge is to ensure that we get the right kind of data at
the desired level of accuracy.
• Along with the challenges of data collection, and handling, there are challenges in
communication as well.
• The communication between IoT devices is mainly wireless because they are generally
installed at geographically dispersed locations.
• The wireless channels often have high rates of distortion and are unreliable.
• In this scenario reliably communicating data without too many retransmissions is an
important problem and thus communication technologies are integral to the study of
IoT devices.
• We can directly modify the physical world through actuators or we may do something
virtually. For example, we can send some information to other smart things.
• The process of effecting a change in the physical world is often dependent on its state
at that point of time. This is called context awareness. Each action is taken keeping in
consideration the context because an application can behave differently in different
contexts.
• For example, a person may not like messages from his office to interrupt him when he
is on vacation. Sensors, actuators, compute servers, and the communication network
form the core infrastructure of an IoT framework. However, there are many software
aspects that need to be considered.
• First, we need a middleware that can be used to connect and manage all of these
heterogeneous components. We need a lot of standardization to connect many different
devices.
• The Internet of Things finds various applications in health care, fitness, education,
entertainment, social life, energy conservation, environment monitoring, home
automation, and transport systems.
Architecture of IoT
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. That is why, we have many more layered architectures proposed in the literature. One
is the fivelayer architecture, which additionally includes the processing and business layers [3–
6]. The five layers are perception, transport, processing, application, and business layers (see
Figure 1). 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. The business layer is out of the scope of this
paper. Hence, we do not discuss it further.
Core IoT Functional Stack
The IoT network must be designed to support its unique requirements and constraints.
This section provides an overview of the full networking stack, from sensors all the way to the
applications layer.
The Core IoT Functional Stack IoT networks are built around the concept of “things,”
or smart objects performing functions and delivering new connected services. These objects
are “smart” because they use a combination of contextual information and configured goals to
perform actions. These actions can be self-contained (that is, the smart object does not rely on
external systems for its actions); however, in most cases, the “thing” interacts with an external
system to report information that the smart object collects, to exchange with other objects, or
to interact with a management platform. In this case, the management platform can be used to
process data collected from the smart object and also guide the behavior of the smart object.
From an architectural standpoint, several components have to work together for an IoT network
to be operational: “Things” layer: At this layer, the physical devices need to fit the constraints
of the environment in which they are deployed while still being able to provide the information
needed. Communications network layer: When smart objects are not self-contained, they need
to communicate with an external system. In many cases, this communication uses a wireless
technology. This layer has four sublayers: Access network sublayer: The last mile of the IoT
network is the access network. This is typically made up of wireless technologies such as
802.11ah, 802.15.4g, and LoRa. The sensors connected to the access network may also be
wired. Gateways and backhaul network sublayer: A common communication system organizes
multiple smart objects in a given area around a common gateway. The gateway communicates
directly with the smart objects. The role of the gateway is to forward the collected information
through a longer-range medium (called the backhaul) to a headend central station where the
information is processed. This information exchange is a Layer 7 (application) function, which
is the reason this object is called a gateway. On IP networks, this gateway also forwards packets
from one IP network to another, and it therefore acts as a router. Network transport sublayer:
For communication to be successful, network and transport layer protocols such as IP and UDP
must be implemented to support the variety of devices to connect and media to use. IoT network
management sublayer: Additional protocols must be in place to allow the headend applications
to exchange data with the sensors. Examples include CoAP and MQTT.
Application and analytics layer: At the upper layer, an application needs to process the
collected data, not only to control the smart objects when necessary, but to make intelligent
decision based on the information collected and, in turn, instruct the “things” or other systems
to adapt to the analyzed conditions and change their behaviors or parameters. The following
sections examine these elements and help you architect your IoT communication network.
Layer 1: Things: Sensors and Actuators Layer
Most IoT networks start from the object, or “thing,” that needs to be connected.From
an architectural standpoint, the variety of smart object types, shapes, and needs drive the variety
of IoT protocols and architectures. There are myriad ways to classify smart objects. One
architectural classification could be:
Battery-powered or power-connected: This classification is based on whether the object
carries its own energy supply or receives continuous power from an external power source.
Battery- powered things can be moved more easily than linepowered objects. However,
batteries limit the lifetime and amount of energy that the object is allowed to consume, thus
driving transmission range and frequency.
Mobile or static: This classification is based on whether the “thing” should move or always
stay at the same location. A sensor may be mobile because it is moved from one object to
another (for example, a viscosity sensor moved from batch to batch in a chemical plant) or
because it is attached to a moving object (for example, a location sensor on moving goods in a
warehouse or factory floor). The frequency of the movement may also vary, from occasional
to permanent. The range of mobility (from a few inches to miles away) often drives the possible
power source.
Low or high reporting frequency: This classification is based on how often the object should
report monitored parameters. A rust sensor may report values once a month. A motion sensor
may report acceleration several hundred times per second. Higher frequencies drive higher
energy consumption, which may create constraints on the possible power source (and therefore
the object mobility) and the transmission range.
Simple or rich data: This classification is based on the quantity of data exchanged at each
report cycle. A humidity sensor in a field may report a simple daily index value (on a binary
scale from 0 to 255), while an engine sensor may report hundreds of parameters, from
temperature to pressure, gas velocity, compression speed, carbon index, and many others.
Richer data typically drives higher power consumption. This classification is often combined
with the previous to determine the object data throughput (low throughput to high throughput).
You may want to keep in mind that throughput is a combined metric. A medium-throughput
object may send simple data at rather high frequency (in which case the flow structure looks
continuous), or may send rich data at rather low frequency (in which case the flow structure
looks bursty).
Report range: This classification is based on the distance at which the gateway is located. For
example, for your fitness band to communicate with your phone, it needs to be located a few
meters away at most. The assumption is that your phone needs to be at visual distance for you
to consult the reported data on the phone screen. If the phone is far away, you typically do not
use it, and reporting data from the band to the phone is not necessary. By contrast, a moisture
sensor in the asphalt of a road may need to communicate with its reader several hundred meters
or even kilometers away.
Object density per cell: This classification is based on the number of smart objects (with a
similar need to communicate) over a given area, connected to the same gateway. An oil pipeline
may utilize a single sensor at key locations every few miles. By contrast, telescopes like the
SETI Colossus telescope at the Whipple Observatory deploy hundreds, and sometimes
thousands, of mirrors over a small area, each with multiple gyroscopes, gravity, and vibration
sensors.
Layer 2: Communications Network Layer
Once you have determined the influence of the smart object form factor over its transmission
capabilities (transmission range, data volume and frequency, sensor density and mobility), you
are ready to connect the object and communicate. Compute and network assets used in IoT can
be very different from those in IT environments. The difference in the physical form factors
between devices used by IT and OT is obvious even to the most casual of observers. What
typically drives this is the physical environment in which the devices are deployed. What may
not be as inherently obvious, however, is their operational differences. The operational
differences must be understood in order to apply the correct handling to secure the target assets.
Temperature variances are an easily understood metric. The cause for the variance is easily
attributed to external weather forces and internal operating conditions. Remote external
locations, such as those associated with mineral extraction or pipeline equipment can span from
the heat of the Arabian Gulf to the cold of the Alaskan North Slope. Controls near the furnaces
of a steel mill obviously require heat tolerance, and controls for cold food storage require the
opposite. In some cases, these controls must handle extreme fluctuations as well. These
extremes can be seen within a single deployment. For example, portions of the Tehachapi,
California, wind farms are located in the Mojave Desert, while others are at an altitude of 1800
m in the surrounding mountains. As you can imagine, the wide variance in temperature takes a
special piece of hardware that is capable of withstanding such harsh environments. Humidity
fluctuations can impact the long-term success of a system as well. Well heads residing in the
delta of the Niger River will see very different conditions from those in the middle of the
Arabian Desert. In some conditions, the systems could be exposed to direct liquid contact such
as may be found with outdoor wireless devices or marine condition deployments. Less obvious
are the operating extremes related to kinetic forces. Shock and vibration needs vary based on
the deployment scenario. In some cases, the focus is on low amplitude but constant vibrations,
as may be expected on a bushing-mounted manufacturing system. In other cases, it could be a
sudden acceleration or deceleration, such as may be experienced in peak ground acceleration
of an earthquake or an impact on a mobile system such as high-speed rail or heavy-duty earth
moving equipment. Solid particulates can also impact the gear. Most IT environments must
contend with dust build-up that can become highly concentrated due to the effect of cooling
fans. In less-controlled IT environments, that phenomenon can be accelerated due to higher
concentrations of particulates. A deterrent to particulate build-up is to use fan less cooling,
which necessitates a higher surface area, as is the case with heat transfer fins. Hazardous
location design may also cause corrosive impact to the equipment. Caustic materials can impact
connections over which power or communications travel. Furthermore, they can result in
reduced thermal efficiency by potentially coating the heat transfer surfaces. In some scenarios,
the concern is not how the environment can impact the equipment but how the equipment can
impact the environment. For example, in a scenario in which volatile gases may be present,
spark suppression is a critical design criterion. There is another class of device differentiators
related to the external connectivity of the device for mounting or industrial function. Device
mounting is one obvious difference between OT and IT environments. While there are rack
mount environments in some industrial spaces, they are more frequently found among IT type
assets. Within industrial environments, many compute and communication assets are placed
within an enclosed space, such as a control cabinet where they will be vertically mounted on a
DIN (Deutsches Institut für Normung) rail inside. In other scenarios, the devices might be
mounted horizontally directly on a wall or on a fence. In contrast to most IT-based systems,
industrial compute systems often transmit their state or receive inputs from external devices
through an alarm channel. These may drive an indicator light (stack lights) to display the status
of a process element from afar. This same element can also receive inputs to initiate actions
within the system itself. Power supplies in OT systems are also frequently different from those
commonly seen on standard IT equipment. A wider range of power variations are common
attributes of industrial compute components. DC power sources are also common in many
environments. Given the criticality of many systems, it is often required that redundant power
supplies be built into the device itself. Extraneous power supplies, especially those not
inherently mounted, are frowned upon, given the potential for accidental unplugging. In some
utility cases, the system must be able to handle brief power outages and still continue to operate.
Access Network Sublayer
There is a direct relationship between the IoT network technology you choose and the
type of connectivity topology this technology allows. Each technology was designed with a
certain number of use cases in mind (what to connect, where to connect, how much data to
transport at what interval and over what distance). These use cases determined the frequency
band that was expected to be most suitable, the frame structure matching the expected data
pattern (packet size and communication intervals), and the possible topologies that these use
cases illustrate. As IoT continues to grow exponentially, you will encounter a wide variety of
applications and special use cases. For each of them, an access technology will be required.
IoT sometimes reuses existing access technologies whose characteristics match more or less
closely the IoT use case requirements. Whereas some access technologies were developed
specifically for IoT use cases, others were not. One key parameter determining the choice of
access technology is the range between the smart object and the information collector. Figure
2-9 lists some access technologies you may encounter in the IoT world and the expected
transmission distances. PAN (personal area network): Scale of a few meters. This is the
personal space around a person. A common wireless technology for this scale is Bluetooth.
HAN (home area network): Scale of a few tens of meters. At this scale, common wireless
technologies for IoT include ZigBee and Bluetooth Low Energy (BLE). NAN (neighbourhood
area network): Scale of a few hundreds of meters. The term NAN is often used to refer to a
group of house units from which data is collected. FAN (field area network): Scale of several
tens of meters to several hundred meters. FAN typically refers to an outdoor area larger than a
single group of house units. The FAN is often seen as “open space” (and therefore not secured
and not controlled). A FAN is sometimes viewed as a group of NANs, but some verticals see
the FAN as a group of HANs or a group of smaller outdoor cells. As you can see, FAN and
NAN may sometimes be used interchangeably. In most cases, the vertical context is clear
enough to determine the grouping hierarchy. LAN (local area network): Scale of up to 100 m.
This term is very common in networking, and it is therefore also commonly used in the IoT
space when standard networking technologies (such as Ethernet or IEEE 802.11) are used.
Other networking classifications, such as MAN (metropolitan area network, with a range of up
to a few kilometers) and WAN (wide area network, with a range of more than a few kilometers),
are also commonly used.
Network Transport Sublayer
The previous section describes a hierarchical communication architecture in which a
series of smart objects report to a gateway that conveys the reported data over another medium
and up to a central station. However, practical implementations are often flexible, with multiple
transversal communication paths. For example, consider the case of IoT for the energy grid.
Your house may have a meter that reports the energy consumption to a gateway over a wireless
technology. Other houses in your neighborhood (NAN) make the same report, likely to one or
several gateways. The data to be transported is small and the interval is large (for example, four
times per hour), resulting in a low-mobility, low throughput type of data structure, with
transmission distances up to a mile. Several technologies (such as 802.11ah, 802.15.4, or
LPWA) can be used for this collection segment. Other neighborhoods may also connect the
same way, thus forming a FAN.
IoT Network Management Sublayer
IP, TCP, and UDP bring connectivity to IoT networks. Upper-layer protocols need to
take care of data transmission between the smart objects and other systems. Multiple protocols
have been leveraged or created to solve IoT data communication problems. Some networks
rely on a push model (that is, a sensor reports at a regular interval or based on a local trigger),
whereas others rely on a pull model (that is, an application queries the sensor over the network),
and multiple hybrid approaches are also possible.
Layer 3: Applications and Analytics Layer
Once connected to a network, your smart objects exchange information with other
systems. As soon as your IoT network spans more than a few sensors, the power of the Internet
of Things appears in the applications that make use of the information exchanged with the
smart objects. Analytics Versus Control Applications Multiple applications can help increase
the efficiency of an IoT network. Each application collects data and provides a range of
functions based on analyzing the collected data. It can be difficult to compare the features
offered. Chapter 7, “Data and Analytics for IoT,” provides an in-depth analysis of the various
application families. From an architectural standpoint, one basic classification can be as
follows: Analytics application: This type of application collects data from multiple smart
objects, processes the collected data, and displays information resulting from the data that was
processed. The display can be about any aspect of the IoT network, from historical reports,
statistics, or trends to individual system states. The important aspect is that the application
processes the data to convey a view of the network that cannot be obtained from solely looking
at the information displayed by a single smart object. Control application: This type of
application controls the behavior of the smart object or the behavior of an object related to the
smart object. For example, a pressure sensor may be connected to a pump. A control application
increases the pump speed when the connected sensor detects a drop in pressure. Control
applications are very useful for controlling complex aspects of an IoT network with a logic that
cannot be programmed inside a single IoT object, either because the configured changes are
too complex to fit into the local system or because the configured changes rely on parameters
that include elements outside the IoT object.
Step 1: Purpose & Requirements Specification • The first step in IoT system design
methodology is to define the purpose and requirements of the system. In this step, the system
purpose, behavior and requirements (such as data collection requirements, data analysis
requirements, system management requirements, data privacy and security requirements, user
interface requirements, ...) are captured.
Step 2: Process Specification • The second step in the IoT design methodology is to define the
process specification. In this step, the use cases of the IoT system are formally described based
on and derived from the purpose and requirement specifications.
Step 3: Domain Model Specification • The third step in the IoT design methodology is to define
the Domain Model. The domain model describes the main concepts, entities and objects in the
domain of IoT system to be designed. Domain model defines the attributes of the objects and
relationships between objects. Domain model provides an abstract representation of the
concepts, objects and entities in the IoT domain, independent of any specific technology or
platform. With the domain model, the IoT system designers can get an understanding of the
IoT domain for which the system is to be designed.
Step 4: Information Model Specification • The fourth step in the IoT design methodology is to
define the Information Model. Information Model defines the structure of all the information
in the IoT system, for example, attributes of Virtual Entities, relations, etc. Information model
does not describe the specifics of how the information is represented or stored. To define the
information model, we first list the Virtual Entities defined in the Domain Model. Information
model adds more details to the Virtual Entities by defining their attributes and relations.
Step 5: Service Specifications • The fifth step in the IoT design methodology is to define the
service specifications. Service specifications define the services in the IoT system, service
types, service inputs/output, service endpoints, service schedules, service preconditions and
service effects.
Step 6: IoT Level Specification • The sixth step in the IoT design methodology is to define the
IoT level for the system.
Step 7: Functional View Specification • The seventh step in the IoT design methodology is to
define the Functional View. The Functional View (FV) defines the functions of the IoT systems
grouped into various Functional Groups (FGs). Each Functional Group either provides
functionalities for interacting with instances of concepts defined in the Domain Model or
provides information related to these concepts.
Step 8: Operational View Specification • The eighth step in the IoT design methodology is to
define the Operational View Specifications. In this step, various options pertaining to the IoT
system deployment and operation are defined, such as, service hosting options, storage options,
device options, application hosting options, etc.
Step 9: Device & Component Integration • The ninth step in the IoT design methodology is
the integration of the devices and components.
Step 10: Application Development • The final step in the IoT design methodology is to develop
the IoT application.
IoT vs Computers
• One big difference between IoT devices and computers is that the main function of IoT
devices is not to compute(not to be a computer) and the main function of a computer is
to compute functions and to run programs. But on IoT devices that is not its main point,
it has some other function besides that.
• As an example like in cars, the function of IoT devices are not to compute anti-lock
breaking or to do fuel injection, their main function from the point of view of a user is
to be driven and to move you from place to place and the computer is just to help that
function.
• For example, The main function of the car is not to compute like anti-lock breaking or
to do fuel injection their main function from the point of view of a user is to drive, to
move you from place to place. But when we embed software in it then the software can
be able for fuel limit detection.
First developed in the 1960s for aerospace and the military, embedded computing
systems continue to support new applications through numerous feature enhancements and
costto-performance improvements of microcontrollers and programmable logic devices.
Today, embedded computing systems control everyday devices which we don’t generally think
of as “computers”: digital cameras, automobiles, smart watches, home appliances, and even
smart garments. These embedded computing systems are commonly found in consumer,
industrial, automotive, medical, commercial, and military applications.
Unlike general-purpose computers, embedded control systems are typically designed
to perform specific tasks. The embedded computing system designer’s task is to identify the
set of components that will implement the system’s functional, performance, usability, and
reliability requirements, typically within tight cost and development timeline constraints.
Accordingly, the selection of a microcontroller and its characteristics, including data processing
capabilities, speed, peripherals, and power consumption, is one of the earliest and most critical
aspects of system design.
Part of the designer’s responsibility involves being aware of trends in their particular
industry and taking advantage of relevant components and techniques. Let’s look for examples
among the top industries for microcontroller applications, the Internet of Things.
Embedded System Hardware
The embedded system can be of type microcontroller or type microprocessor. Both of
these types contain an integrated circuit (IC). The essential component of the embedded system
is a RISC family microcontroller like Motorola 68HC11, PIC 16F84, Atmel 8051 and many
more. The most important factor that differentiates these microcontrollers with the
microprocessor like 8085 is their internal read and writable memory. The essential embedded
device components and system architecture are specified below.
As we know IoT is the technology which will provide communication between things, between
things and people using internet and IP enabled protocols. As we have seen in IoT tutorial any
IoT compliant system will have two major parts viz. front end and back end. Front end provides
connectivity with physical world and consists of sensors while backend consists of processing
and network connectivity interfaces.
Typical IoT system on chip support more than one RATs (Radio Access Technologies). It will
have following modules.
• Transmit and receive switch.
• RF part mainly consists of Trasmitter, receiver, oscillator and amplifiers.
• Memories i.e. Program memory, data memory to store the code and data
• Physical layer(baseband processing) either on FPGA or on processor based on complexity
and latency requirement.
• MAC layer and upper protocol stacks TCP/IP etc. running on processor
• ADC and DAC to provide interface between digital baseband and analog RF portions.
• Various interfaces such as SDIO, USB, SPI etc to provide interface with the host.
• Other peripherals such as UART, I2C, GPIO, WDT etc. to use the IoT SoC for various
connections.
As IoT system on chip supports multiple wireless protocols and RF hardware to support
multiple frequency bands, following factors need to be carefully analyzed and to be optimized.
• Power-consumption
•Data-throughput
• Device-size
• Performance in terms of latency and other factors
Figure depicts one such IoT System on Chip model no. RS9113,which has been designed and
developed by Redpine Signals recently. It supports WLAN (802.11n), Bluetooth version 4.0
and Zigbee (802.15.4-2006) in the same chip. Hence the IoT device can be connected with any
of the said wireless technology based networks.
This IoT SoC (system on chip in IoT) can be used for numerous applications as mentioned
below:
• Mobile
• M2M-Communication
• Real time location finding tags
• Thermostats • Smart meters
• Wireless sensor devices
• Serial to WiFi converter
• Voice Over WiFi compliant phones
• Home automation
• Health care devices and equipments
Building Blocks of IoT
Four things form basic building blocks of the IoT system –sensors, processors, gateways,
applications. Each of these nodes has to have its own characteristics in order to form an useful
IoT system.
Sensors:
These form the front end of the IoT devices. These are the so-called “Things” of the system.
Their main purpose is to collect data from its surroundings (sensors) or give out data to its
surrounding (actuators).
• These have to be uniquely identifiable devices with a unique IP address so that they can be
easily identifiable over a large network.
• These have to be active in nature which means that they should be able to collect real-time
data. These can either work on their own (autonomous in nature) or can be made to work by
the user depending on their needs (user-controlled).
• Examples of sensors are gas sensor, water quality sensor, moisture sensor, etc.
Processors:
• Processors are the brain of the IoT system. Their main function is to process the data
captured by the sensors and process them so as to extract the valuable data from the
enormous amount of raw data collected. In a word, we can say that it gives intelligence
to the data.
• Processors mostly work on real-time basis and can be easily controlled by applications. These
are also responsible for securing the data – that is performing encryption and decryption of
data.
• Embedded hardware devices, microcontroller, etc are the ones that process the data because
they have processors attached to it.
Gateways:
• Gateways are responsible for routing the processed data and send it to proper locations for its
(data) proper utilization.
• In other words, we can say that gateway helps in to and fro communication of the data. It
provides network connectivity to the data. Network connectivity is essential for any IoT system
to communicate.
• LAN, WAN, PAN, etc are examples of network gateways.
Applications:
• Applications form another end of an IoT system. Applications are essential for proper
utilization of all the data collected.
• These cloud-based applications which are responsible for rendering the effective meaning to
the data collected. Applications are controlled by users and are a delivery point of particular
services.
• Examples of applications are home automation apps, security systems, industrial control hub,
etc.
In a nutshell, from the figure we can determine that the information gathered by the
sensing node (end node) is processed first then via connectivity it reaches the embedded
processing nodes that can be any embedded hardware devices and are processed there as well.
It then passes through the connectivity nodes again and reaches the remote cloud based
processing that can be any software and is sent to the application node for the proper applied
usage of the data collected and also for data analysis via big data.
6.Introduction to Arduino
Arduino is a project, open-source hardware, and software platform used to design and
build electronic devices. It designs and manufactures microcontroller kits and single-board
interfaces for building electronics projects.
The designs of Arduino boards use a variety of controllers and microprocessors.
The Arduino board consists of sets of analog and digital I/O (Input / Output) pins, which are
further interfaced to breadboard, expansion boards, and other circuits. Such boards feature
the model, Universal Serial Bus (USB), and serial communication interfaces, which are used
for loading programs from the computers.
It also provides an IDE (Integrated Development Environment) project, which is based on the
Processing Language to upload the code to the physical board.
The projects are authorized under the GPL and LGPL. The GPL is named as GNU General
Public License. The licensed LGPL is named as GNU Lesser General Public License. It
allows the use of Arduino boards, it's software distribution, and can be manufactured by
anyone.
o Finger button
o Button for motor activation
o Light as a sensors
o LED button
o Designing
o The Building of electronic devices
What is Arduino?
Arduino is a software as well as hardware platform that helps in making electronic projects. It
is an open-source platform and has a variety of controllers and microprocessors. There are
various types of Arduino boards used for various purposes.
The Arduino is a single circuit board, which consists of different interfaces or parts. The board
consists of the set of digital and analog pins that are used to connect various devices and
components, which we want to use for the functioning of the electronic devices.
The analog pins in Arduino are mostly useful for fine-grained control. The pins in the Arduino
board are arranged in a specific pattern. The other devices on the Arduino board are USB port,
small components (voltage regulator or oscillator), microcontroller, power connector, etc.
Features
o Arduino programming is a simplified version of C++, which makes the learning process
easy.
o The Arduino IDE is used to control the functions of boards. It further sends the set of
specifications to the microcontroller.
o Arduino does not need an extra board or piece to load new code.
o Arduino can read analog and digital input signals.
o The hardware and software platform is easy to use and implement.
Arduino Boards
There are variety of Arduino board used for different purposes. The board varies in I/O
pins, size, etc. The various components present on the Arduino boards are Microcontroller,
Digital Input/Output pins, USB Interface and Connector, Analog Pins, Reset Button, Power
button, LED's, Crystal Oscillator, and Voltage Regulator. Some components may differ
depending on the type of board.
o Arduino UNO
o Arduino Nano
o Arduino Mega
o Arduino Due
o Arduino Bluetooth
Shields
o Shields are defined as the hardware device that can be mounted over the board to
increase the capabilities of the projects.
o The shield is shown below:
o The shield together with Arduino can make the projects even smarter and simpler. For
example, Ethernet shields are used to connect the Arduino board to the Internet.
o The shields can be easily attached and detached from the Arduino board. It does not
require any complex wiring.
Arduino IDE
The Arduino IDE is an open-source software, which is used to write and upload code
to the Arduino boards. The IDE application is suitable for different operating systems such
as Windows, Mac OS X, and Linux. It supports the programming languages C and C++. Here,
IDE stands for Integrated Development Environment.
The program or code written in the Arduino IDE is often called as sketching. We need to
connect the Genuino and Arduino board with the IDE to upload the sketch written in the
Arduino IDE software. The sketch is saved with the extension '.ino.'
Toolbar Button
The icons displayed on the toolbar are New, Open, Save, Upload, and Verify.
It is shown below:
Upload
The Upload button compiles and runs our code written on the screen. It further uploads
the code to the connected board. Before uploading the sketch, we need to make sure that the
correct board and ports are selected.
It also need a USB connection to connect the board and the computer. Once all the above
measures are done, click on the Upload button present on the toolbar.
The latest Arduino boards can be reset automatically before beginning with Upload. In the
older boards, we need to press the Reset button present on it. As soon as the uploading is done
successfully, we can notice the blink of the Tx and Rx LED.
If the uploading is failed, it will display the message in the error window.
It do not require any additional hardware to upload our sketch using the Arduino Bootloader.
A Bootloader is defined as a small program, which is loaded in the microcontroller present on
the board. The LED will blink on PIN 13.
Open
The Open button is used to open the already created file. The selected file will be opened in
the current window.
Save
New
Verify
The Verify button is used to check the compilation error of the sketch or the written code.
Serial Monitor
The serial monitor button is present on the right corner of the toolbar. It opens the serial
monitor.
When it connect the serial monitor, the board will reset on the operating system Windows,
Linux, and Mac OS X. If we want to process the control characters in our sketch, we need to
use an external terminal program. The terminal program should be connected to the COM port,
which will be assigned when we connect the board to the computer.
Arduino shields are the boards, which are plugged over the Arduino board to expand its
functionalities. There are different varieties of shields used for various tasks, such as Arduino
motor shields, Arduino communication shields, etc.
Shield is defined as the hardware device that can be mounted over the board to increase the
capabilities of the projects. It also makes our work easy. For example, Ethernet shields are used
to connect the Arduino board to the Internet.
The pin position of the shields is similar to the Arduino boards. It can also connect the modules
and sensors to the shields with the help of the connection cable.
Types of Shields
o Ethernet shield
o Xbee Shield
o Proto shield
o Relay shield
o Motor shield
o LCD shield
o Bluetooth shield
o Capacitive Touchpad Shield
Ethernet shield
o The Ethernet shields are used to connect the Arduino board to the Internet. We need to
mount the shield on the top of the specified Arduino board.
o The USB port will play the usual role to upload sketches on the board.
o The latest version of Ethernet shields consists of a micro SD card slot. The micro SD
card slot can be interfaced with the help of the SD card library.
o It can also connect another shield on the top of the Ethernet shield. It means that we can
also mount two shields on the top of the Arduino board.
Xbee Shield
o It can communicate wirelessly with the Arduino board by using the Xbee Shield with
Zigbee.
o It reduces the hassle of the cable, which makes Xbee a wireless communication model.
o The Xbee wireless module allows us to communicate outdoor upto 300 feet and indoor
upto 100 feet.
o It can also be used with different models of Xbee.
Proto shield
o Proto shields are designed for custom circuits.
o It can solder electronic circuits directly on the shield.
o The shield consists of two LED pads, two power lines, and SPI signal pads.
o The IOREF (Input Output voltage REFerence) and GND (Ground) are the two power
lines on the board.
o It can also solder the SMD (Surface Mount Device) ICs on the prototyping area. A
maximum of 24 pins can be integrated onto the SMD area.
Relay shield
o The Arduino digital I/O pins cannot bear the high current due to its voltage and current
limits. The relay shield is used to overcome such situation. It provides a solution for
controlling the devices carrying high current and voltage.
o The shield consists of four relays and four LED indicators.
o It also provides NO/NC interfaces and a shield form factor for the simple connection to
the Arduino board.
o The LED indicators depicts the ON/OFF condition of each relay.
o The relay used in the structure is of high quality.
o The NO (Normally Open), NC (Normally Closed), and COM pins are present on each
relay.
o The applications of the Relay shield include remote control, etc.
Motor shield
o The motor shield helps us to control the motor using the Arduino board.
o It controls the direction and working speed of the motor. We can power the motor shield
either by the external power supply through the input terminal or directly by the
Arduino.
o It can also measure the absorption current of each motor with the help of the motor
shield.
o The motor shield is based on the L298 chip that can drive a step motor or two DC
motors. L298 chip is a full bridge IC. It also consists of the heat sinker, which increases
the performance of the motor shield.
o It can drive inductive loads, such as solenoids, etc.
o The operating voltage is from 5V to 12V.
LCD shield
o The keypad of LCD (Liquid Crystal Display) shield includes five buttons called as up,
down, left, right, and select.
o There are 6 push buttons present on the shield that can be used as a custom menu control
panel.
o It consists of the 1602 white characters, which are displayed on the blue backlight LCD.
o The LED present on the board indicates the power ON.
o The five keys present on the board helps us to make the selection on menus and from
board to our project.
Bluetooth shield
o The Bluetooth shield can be used as a wireless module for transparent serial
communication.
o It includes a serial Bluetooth module. D0 and D1 are the serial hardware ports in the
Bluetooth shield, which can be used to communicate with the two serial ports (from D0
to D7) of the Arduino board.
o It can install Groves through the two serial ports of the Bluetooth shield called a Grove
connector. One Grove connector is digital, while the other is analog.
Sketch − The first new terminology is the Arduino program called “sketch”.
Structure
Arduino programs can be divided in three main parts: Structure, Values (variables and
constants), and Functions.
• Setup( ) function
• Loop( ) function
• PURPOSE − The setup() function is called when a sketch starts. Use it to initialize the
variables, pin modes, start using libraries, etc. The setup function will only run once, after
each power up or reset of the Arduino board.
• INPUT
• OUTPUT
• RETURN
• PURPOSE − After creating a setup() function, which initializes and sets the initial values,
the loop() function does precisely what its name suggests, and loops consecutively,
allowing your program to change and respond. Use it to actively control the Arduino board.
• INPUT
• OUTPUT
• RETURN
Data Types
Data types in C refers to an extensive system used for declaring variables or functions
of different types. The type of a variable determines how much space it occupies in the storage
and how the bit pattern stored is interpreted.
void
The void keyword is used only in function declarations. It indicates that the function is expected
to return no information to the function from which it was called.
Void Loop ( ) {
// rest of the code
}
Boolean
A Boolean holds one of two values, true or false. Each Boolean variable occupies one
byte of memory.
boolean val = false ; // declaration of variable with type boolean and initialize it with false
boolean state = true ; // declaration of variable with type boolean and initialize it with true
Char
A data type that takes up one byte of memory that stores a character value. Character
literals are written in single quotes like this: 'A' and for multiple characters, strings use double
quotes: "ABC".
Char chr_a = ‘a’ ;//declaration of variable with type char and initialize it with character a
Char chr_c = 97 ;//declaration of variable with type char and initialize it with character 97
unsigned char
Unsigned char is an unsigned data type that occupies one byte of memory. The
unsigned char data type encodes numbers from 0 to 255.
Unsigned Char chr_y = 121 ; // declaration of variable with type Unsigned char and initialize
it with character y
byte
A byte stores an 8-bit unsigned number, from 0 to 255.
byte m = 25 ;//declaration of variable with type byte and initialize it with 25
int
Integers are the primary data-type for number storage. int stores a 16-bit (2-byte) value.
This yields a range of -32,768 to 32,767 (minimum value of -2^15 and a maximum value of
(2^15) - 1).
int counter = 32 ;// declaration of variable with type int and initialize it with 32
Unsigned int
Unsigned ints (unsigned integers) are the same as int in the way that they store a 2 byte
value. Instead of storing negative numbers, however, they only store positive values, yielding
a useful range of 0 to 65,535 (2^16) - 1). The Due stores a 4 byte (32-bit) value, ranging from
0 to 4,294,967,295 (2^32 - 1).
Unsigned int counter = 60 ; // declaration of variable with
type unsigned int and initialize it with 60
Word
On the Uno and other ATMEGA based boards, a word stores a 16-bit unsigned number.
On the Due and Zero, it stores a 32-bit unsigned number.
word w = 1000 ;//declaration of variable with type word and initialize it with 1000
Long
Long variables are extended size variables for number storage, and store 32 bits (4
bytes), from -2,147,483,648 to 2,147,483,647.
Long velocity = 102346 ;//declaration of variable with type Long and initialize it with
102346
pinMode() Function
The pinMode() function is used to configure a specific pin to behave either as an input
or an output. It is possible to enable the internal pull-up resistors with the mode INPUT_PULLUP.
Additionally, the INPUT mode explicitly disables the internal pull-ups.
void setup () {
pinMode(button , INPUT_PULLUP);
// set the digital pin as input with pull-up resistor
pinMode(button , OUTPUT); // set the digital pin as output
}
void setup () {
If (digitalRead(button ) == LOW) // if button pressed {
digitalWrite(LED,HIGH); // turn on led
delay(500); // delay for 500 ms
digitalWrite(LED,LOW); // turn off led
delay(500); // delay for 500 ms
}
}
digitalWrite() Function
The digitalWrite() function is used to write a HIGH or a LOW value to a digital pin.
If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the
corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW. If the pin
is configured as an INPUT, digitalWrite() will enable (HIGH) or disable (LOW) the internal
pullup on the input pin. It is recommended to set the pinMode() to INPUT_PULLUP to enable
the internal pull-up resistor.
Void loop() {
digitalWrite (pin ,value);
}
• pin − the number of the pin whose mode you wish to set
• value − HIGH, or LOW.
Example
void setup () {
pinMode(LED, OUTPUT); // set the digital pin as output
}
void setup () {
digitalWrite(LED,HIGH); // turn on led
delay(500); // delay for 500 ms
digitalWrite(LED,LOW); // turn off led
delay(500); // delay for 500 ms
}
analogRead( ) function
Arduino is able to detect whether there is a voltage applied to one of its pins and report
it through the digitalRead() function. There is a difference between an on/off sensor (which
detects the presence of an object) and an analog sensor, whose value continuously changes. In
order to read this type of sensor, we need a different type of pin.
In the lower-right part of the Arduino board, you will see six pins marked “Analog In”.
These special pins not only tell whether there is a voltage applied to them, but also its value.
By using the analogRead() function, we can read the voltage applied to one of the pins.
This function returns a number between 0 and 1023, which represents voltages between
0 and 5 volts. For example, if there is a voltage of 2.5 V applied to pin number 0, analogRead(0)
returns 512.
analogRead() function Syntax
analogRead(pin);
• pin − the number of the analog input pin to read from (0 to 5 on most boards, 0
to 7 on the Mini and Nano, 0 to 15 on the Mega)
Example
void setup() {
Serial.begin(9600); // setup serial
}
void loop() {
val = analogRead(analogPin); // read the input pin
Serial.println(val); // debug value
}
analogReference() Function
Configures the reference voltage used for analog input (i.e. the value used as the top of
the input range). The options are −
• DEFAULT − The default analog reference of 5 volts (on 5V Arduino boards) or 3.3
volts (on 3.3V Arduino boards)
• INTERNAL − An built-in reference, equal to 1.1 volts on the ATmega168 or
ATmega328 and 2.56 volts on the ATmega8 (not available on the Arduino Mega)
• INTERNAL1V1 − A built-in 1.1V reference (Arduino Mega only)
• INTERNAL2V56 − A built-in 2.56V reference (Arduino Mega only)
• EXTERNAL − The voltage applied to the AREF pin (0 to 5V only) is used as the
reference.
analogReference (type);
type − can use any type of the follow (DEFAULT, INTERNAL, INTERNAL1V1,
INTERNAL2V56, EXTERNAL)
Do not use anything less than 0V or more than 5V for external reference voltage on the
AREF pin. If you are using an external reference on the AREF pin, you must set the analog
reference to EXTERNAL before calling the analogRead() function. Otherwise, you will short
the active reference voltage (internally generated) and the AREF pin, possibly damaging the
microcontroller on your Arduino board.
Alternatively, you can connect the external reference voltage to the AREF pin through a
5K resistor, allowing you to switch between external and internal reference voltages.
Note that the resistor will alter the voltage that is used as the reference because there is an
internal 32K resistor on the AREF pin. The two act as a voltage divider. For example, 2.5V
applied through the resistor will yield 2.5 * 32 / (32 + 5) = ~2.2V at the AREF pin.
Example
int analogPin = 3;// potentiometer wiper (middle terminal) connected to analog pin 3
int val = 0; // variable to store the read value
void setup() {
Serial.begin(9600); // setup serial
analogReference(EXTERNAL); // the voltage applied to the AREF pin (0 to 5V only)
// is used as the reference.
}
void loop() {
val = analogRead(analogPin); // read the input pin
Serial.println(val); // debug value
}
• Another piece of software, called AVR Dude (for Downloader UploaDEr) starts
when we press the upload button. This software sends the .hex file to the
ATMega328 on the Arduino board. On the chip resides the bootloader. This
bootloader was put there on purpose by the folks at Arduino and works with AVR
Dude to get the .hex into the flash memory on the chip.
Sensors
▪ Electronic elements
▪ Converts physical quantity/ measurements into electrical signals
▪ Can be analog or digital
Types of Sensors
▪ Temperature
▪ Humidity
▪ Compass
▪ Light
▪ Sound
▪ Accelerometer
PIN 4- Ground
▪ Arduino supports a special library for the DHT11 and DHT22 sensors
▪ Provides function to read the temperature and humidity values from the data pin
dht.readHumidity()
dht.readTemperature()
▪ Connect pin 1 of the DHT to the 3.3 V supply pin in the board
▪ Data pin (pin 2) can be connected to any digital pin, here 12
▪ Connect pin 4 to the ground (GND) pin of the board
Sketch: DHT_SENSOR
▪ Search for DHT SENSOR
▪ Select the “DHT sensor library” and install it
#include <DHT.h>; DHT dht(8, DHT22);
float humidity;
float temperature; value
void setup()
{
Serial.begin(9600); dht.begin();
}
Actuators
▪ Mechanical/Electro-mechanical device
▪ Converts energy into motion
▪ Mainly used to provide controlled motion to other components
▪ Uses different combination of various mechanical structures like screws, ball bearings,
gears to produce motion.
Types of Motor Actuators
▪ Servo motor
▪ Stepper motor
▪ Hydraulic motor
▪ Solenoid
▪ Relay
▪ AC motor
Servo Motor
▪ High precision motor
▪ Provides rotary motion 0 to 180 degree
▪ 3 wires in the Servo motor
▪ Black or the darkest one is Ground
▪ Red is for power supply
▪ Yellow for signal pin
Servo Library on Arduino
▪ Arduino provides different library- SERVO to operate the servo motor
▪ Create an instance of servo to use it in the sketch
Servo myservo;
Sketch: SERVO_ACTUATOR
#include <Servo.h>
//Including the servo library for the program
int servoPin = 12;
Servo ServoDemo; // Creating a servo object
void setup() {
// The servo pin must be attached to the servo before it can be used
ServoDemo.attach(servoPin);
}
void loop(){
//Servo moves to 0 degrees
ServoDemo.write(0); delay(1000);
// Servo moves to 90 degrees
ServoDemo.write(90); delay(1000);
// Servo moves to 180 degrees
ServoDemo.write(180); delay(1000);
}
• Create an instance of Servo
• The instance must be attached to the pin before being used in the code
• Write() function takes the degree value and rotates the motor accordingly.
▪ Connect the Ground of the servo to the ground of the Arduino board.
▪ Connect the power supply wire to the 5V pin of the board.
▪ Connect the signal wire to any digital output pin (we have used pin 8).
Board Setup
▪ Connect the board to the PC
▪ Set the port and board type
▪ Verify and upload the code
▪ The motor turns 0, 90 and 180 degrees with a delay of 1 second each.