Professional Documents
Culture Documents
Unit-1-1
Unit-1-1
FUNDAMENTALS OF IoT
PART – A
1. What is an IoT?
Internet of Things (IoT) is a network of physical objects or people called "things" that
are embedded with software, electronics, network, and sensors that allows these objects
to collect and exchange data.
The goal of an IoT is to extend to internet connectivity from standard devices like
computer, mobile, tablet to relatively dumb devices like a toaster.
1
Improved Data Collection: Traditional data collection has its limitations and its design
for passive use. IoT facilitates immediate action on data.
Reduced Waste: IoT offers real-time information leading to effective decision making &
management of resources.
Improved Customer Engagement: IoT allows to improve customer experience by
detecting problems and improving the process.
Raspberry Pi Arduino
Multitasking and suitable for complex Runs one program at a time, used for
projects repetitive work
Suitable for software projects Suitable for hardware projects
3
No limiting to programming language Limited to Arduini, C/C++
Need to connect external hardware and
Built-in Ethernet port for networking
implement coding
Act as a server and communicate to other Excels in controlling small devices like
computers, connected devices. sensors, motors, and lights
PART – B & C
Connectivity
Connectivity is an important requirement of the IoT infrastructure. Things of IoT should
be connected to the IoT infrastructure. Anyone, anywhere, anytime can connect, this
should be guaranteed at all times.
For example, connection between people through internet devices like mobile phones
and other gadgets, also connection between Internet devices such as routers, gateways,
sensors, etc.
Intelligence and Identity
The extraction of knowledge from the generated data is very important. For example, a
sensor generates data, but that data will only be useful if it is interpreted properly. Each
IoT device has a unique identity. This identification is helpful in tracking the equipment
and at times for querying its status.
Scalability
The number of elements connected to the IoT zone is increasing day by day. Hence, an
IoT setup should be capable of handling the massive expansion. The data generated as
an outcome is enormous, and it should be handled appropriately.
Dynamic and Self-Adapting (Complexity)
IoT devices should dynamically adapt themselves to the changing contexts and
scenarios. Assume a camera meant for the surveillance. It should be adaptable to work
in different conditions and different light situations (morning, afternoon, night).
Architecture
IoT architecture cannot be homogeneous in nature. It should be hybrid, supporting
different manufacturers ‘products to function in the IoT network. IoT is not owned by
anyone engineering branch. IoT is a reality when multiple domains come together.
Safety
There is a danger of the sensitive personal details of the users getting compromised
when all their devices are connected to the internet. This can cause a loss to the user.
Hence, data security is the major challenge. Besides, the equipment involved is huge.
IoT networks may also be at the risk. Therefore, equipment safety is also critical.
Self-Configuring
This is one of the most important characteristics of IoT. IoT devices are able to upgrade
their software in accordance with requirements with a minimum of user participation.
Additionally, they can set up the network, allowing for the addition of new devices to an
already-existing network.
4
2. Describe an IoT architecture in detail.
Perception/Sensing Layer
The first layer of any IoT system involves “things” or endpoint devices that serve
as a conduit between the physical and the digital worlds. Perception refers to the
physical layer, which includes sensors and actuators that are capable of
collecting, accepting, and processing data over the network. Sensors and
actuators can be connected either wirelessly or via wired connections. The
architecture does not limit the scope of its components nor their location.
Network Layer
Network layers provide an overview of how data is moved throughout the
application. This layer contains Data Acquiring Systems (DAS) and
Internet/Network gateways. A DAS performs data aggregation and conversion
functions (collecting and aggregating data from sensors, then converting analog
data to digital data, etc.). It is necessary to transmit and process the data collected
by the sensor devices. That’s what the network layer does. It allows these devices
to connect and communicate with other servers, smart devices, and network
devices. As well, it handles all data transmissions for the devices.
Processing Layer
The processing layer is the brain of the IoT ecosystem. Typically, data is
analyzed, pre-processed, and stored here before being sent to the data center,
where it is accessed by software applications that both monitor and manage the
5
data as well as prepare further actions. This is where Edge IT or edge analytics
enters the picture.
Application Layer
User interaction takes place at the application layer, which delivers application-
specific services to the user. An example might be a smart home application
where users can turn on a coffee maker by tapping a button in an app or a
dashboard that shows the status of the devices in a system. There are many ways
in which the Internet of Things can be deployed such as smart cities, smart
homes, and smart health.
Stages of an IoT
Stage 1 (Sensors/Actuators)
Sensors are used to collect the data from the environment and help in turning that data
into meaningful information that can be further used for the analysis.
The role of actuators helps in studying the change that is recorded by the sensors. It is
one of the most basic steps that deals with establishing all the physical devices that can
capture the data.
The sensors and the actuators carry out the sensing and actuating process.
Stage 2 (Data Acquisition Systems)
The data which is captured by the sensors and actuators is in analog form, and to
change this analog data into digital data, we need to have a mechanism in place. To
work out on this process, the internet gateway is used. With the use of Data Acquisition
Systems, the analog data can be converted into a digital system and form. It helps in
aggregation and conversion functions.
Stage 3 (Edge Analytics)
The stage deals with the preprocessing and pre analytics of the data before sending it
into the actual systems. The edge IT system will be located at the sensors’ actual site
and the actuators, not located far from the actual data centers.
The data captured by the sensors and actuators are not always important for the
organization; hence only the required data is processed and sent to the server and the
data centers.
Stage 4 (Cloud Analytics)
Once the data is done with the preprocessing and the analysis, and all the loopholes are
removed from the data, the processed data is sent to the data centers and the servers
6
that can be used for the final analysis and reporting purposes. The data can be sent to
the physical servers or the data centers that are placed away from the sensors and
actuators, possibly very far away from these two. The data can be analyzed and sent for
the final processing either to cloud-based servers or data centers, or physical servers.
The processing and analysis can be in-depth in nature regardless of the platform,
whether physical or cloud-based. The cloud platform helps in reducing the hardware
cost, but at the same time, data security is also concern.
Working of IoT
Sensors/Devices: Sensors or devices are a key component that helps to collect live
data from the surrounding environment. All this data may have various levels of
complexities. It could be a simple temperature monitoring sensor, or it may be in the form
of the video feed.
A device may have various types of sensors which performs multiple tasks apart from
sensing.
Example: A mobile phone is a device which has multiple sensors like GPS, camera but
our smartphone is not able to sense these things.
Connectivity:
An internet of things (IoT) gateway is a physical device or software program
It serves the connection point between the cloud and controllers, sensors and
intelligent devices.
All data moving between IoT devices and the cloud passes through an IoT gateway,
which can be either a dedicated hardware appliance or software program
All the collected data is sent to a cloud infrastructure.
The sensors should be connected to the cloud using various mediums of
communications. These communication mediums include mobile or satellite networks,
Bluetooth, WI-FI, WAN, etc.
Data Processing: Once that data is collected, and it gets to the cloud, the software
performs processing on the gathered data. This process can be just checking the
temperature, reading on devices like AC or heaters. However, it can sometimes also be
very complex like identifying objects, using computer vision on video.
7
User Interface: The information needs to be available to the end-user in some way
which can be achieved by triggering alarms on their phones or sending them notification
through email or text message. The user sometimes might need an interface which
actively checks their IOT system.
For example, the user has a camera installed in his home. He wants to access video
recording and all the feeds with the help of a web server.
However, it's not always one-way communication. Depending on the IoT application and
complexity of the system, the user may also be able to perform an action which may
create cascading effects.
For example, if a user detects any changes in the temperature of the refrigerator, with the
help of IOT technology the user should able to adjust the temperature with the help of
their mobile phone
8
Big Data Analytics
Collection of data whose volume, velocity or variety is too large and difficult to store,
manage, process and analyse the data using traditional databases.
It involves data cleansing, processing and visualization
Lots of data is being collected and warehoused
Web data, e-commerce
purchases at department/ grocery stores
Bank/Credit Card transactions
Social Network
Variety Includes different types of data
Structured
Unstructured
Semi Structured
All of above
Velocity Refers to speed at which data is processed
Batch
Real-time
Streams
Volume refers to the amount of data
Terabyte
Records
Transactions
Files
Tables
Embedded systems:
Embedded system
Embedded system is a combination of hardware and software system used to perform
special tasks.
Embedded system includes microcontroller or microprocessor, memory (RAM, ROM),
networking unit, input / output units and storage. It collects the data analyse and sends
the data to internet.
The Internet of Things (IoT) describes the network of physical objects —“things”— that
are embedded with sensors, software and other technologies for the purpose of
connecting and exchanging data with other devices and systems over the internet.
9
Features of Smart Object
Example
Smartphones. Smart fridge, Smart TV, Alexa voice assistant, Micro-controllers.
Non-Smart Objects
Non-smart objects are generally those objects which do not have intelligence
and processing capabilities. Sensors and actuators are non-smart devices.
Sensors
Sensors are those electronic devices which are made of sensitive cells and have
capabilities to measure or sense some physical or scientific quantity like
temperature, pressure, the measure of any toxic gas, etc.
Actuators
Actuators are those electronic devices which perform a specific task by collecting
the information by sensors or like sensors over the internet. We can divide
actuator into two parts
A sensor is a device that detects the change in the environment and responds to
some output on the other system. A sensor converts a physical phenomenon into a
measurable analog voltage (or sometimes a digital signal) converted into a human-
readable display or transmitted for reading or further processing.
IoT sensor data is the data collected by devices found in the Internet of Things
(IoT). These devices can be anything from a thermostat in a device to a car. The internet
part of IoT means that these devices can connect, collect, and send data across
networks where it can be analyzed and acted upon.
10
Sensor data can vary and multiple devices collect different types of data. Devices can
measure anything from temperature, numbers of individuals in a room, activity levels,
and how much water is in the soil.
Sensor Classification
Passive Sensor – It cannot independently sense the input. Ex- Accelerometer, soil
moisture, water level and temperature sensors.
Active Sensor – Independently sense the input. Example- Radar, sounder and laser
altimeter sensors.
Analog Sensor – Analog sensors are those which produce an analog signal based on
what they sense. Example - Light sensors (LDRs), sound sensors, pressure sensors,
and analog temperature sensors.
Digital Sensor – Digital sensors produce digital signals when performing a
measurement. Example – Passive infrared (PIR) sensor and digital temperature
sensor.
Scalar Sensor – The sensor which produce output signal/voltage which is proportional
to magnitude of quantity to be measured is known as scalar sensor.
Example – Temperature sensor, Color sensor, pressure sensor, strain sensor etc.
Vector Sensor – The sensor which produce output signal/voltage which is proportional
to magnitude, direction as well as orientation of quantity being measured is known as
Vector sensor.
Example – Sound sensor, image sensor, velocity sensor, acceleration sensor etc
Sensor Characteristics
When choosing sensors for our IoT platform, there are five characteristics we should
consider.
Accuracy - Accuracy is the ability of a sensor to provide a true measurement of
whatever the sensor is monitoring. There is an uncertainty with the measurement, usually
represented as a percentage of full scale.
Repeatability - Repeatability is the ability of a sensor to provide a constant output when
there is a constant input, when acquiring a new sample.
Linearity - Linearity is a measure of how well the sensor’s response curve approaches a
straight line.
Sensitivity - A sensor’s sensitivity is the amount the input to the sensor must change to
detect any change in the output.
Environmental Impact - Changes in the environment can impact the performance and
accuracy of a sensor. For example, some sensors are particularly sensitive to
temperature and humidity.
The set of devices that respond and have the capabilities to capture data, follow the
instructions can be considered as the IoT Hardware. The following fall into such
categories where they not only collect data but also respond to instructions based on the
processed data.
Chips: This is much a broader classification that contains all the electrical and electronic
appliances such as microcontrollers, chips, integrated circuits, radio frequency systems,
etc.
11
Sensors: Sensors, which are one of the base components of an IoT system, have three
modules - Power Management modules, Sensing modules, and Energy modules.
Actuators: These devices provide the motion to a data collection system such as the
solenoids, comb drives, etc to fetch details based on movements.
Standard devices: Standard devices constitute the generally used devices such as
Tablets, Smartphones, Switches, Routers and etc. Each of these devices has its own set
of settings that allow them to collect data.
Single-Board Computers
Single-board Computers, also called systems-on-a-chip, are small full-fledged
computers.
It has memory and storage.
It has peripherals that comply a regular standard (usually USB).
They include everything needed to make them work (usually only needing a
power adapter to our house power line)
They can run an operating system completely
A Raspberry Pi is a single-board-computer or system-on-a-chip and it runs a
complete Linux operating system.
An IoT platform manages the connectivity of the devices and allows developers to build
new mobile software applications. It facilitates the collection of data from devices and
enables business transformation. It connects different components, ensuring an
uninterrupted flow of communication between the devices.
Arduino
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.
Most of the Arduino consists of 14 digital I/O pins.
12
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.
Applications
Few applications of the Arduino Uno boards are:
Robotics and Control Systems
Home and Industry Automation
Traffic Light Countdown Timer
Underground Cable Fault Recognition
Controlling of Electrical Appliances using IR
Parking Lot Counter
Weighing Machines
Medical Instrument
Emergency Light for Railways
Auto Intensity Control of Street Lights
Biotechnology
Agriculture
Pros
Inexpensive
Cross-platform
Simple, clear programming environment
Open source and extensible software and hardware
Large support of community
Cons
Memory limitations
Less powerful
Processing power is weaker than the microcontroller
Requires effort to accomplish some tasks such as scheduling and database
storage
13
Raspberry Pi
A small, fully functional computer that can be plugged into a computer monitor, keyboard,
and mouse. It has all qualities of a PC- a dedicated processor, memory, and a graphics
driver. It even has its own operating system called Raspberry Pi OS which is an
optimized version of Linux.
Features
Superior software implementation
64-bit Quad-core processor
Large RAM (latest Raspberry Pi 4 Model B Board has up to 8G of RAM)
Processor speed- 700MHz- 1.5GHz
Raspberry Pi has 40 input/output pins.
It can be connected to the Internet.
It can run all kinds of applications (including MS Office and Email).
It contains everything- CPU (Central Processing Unit), GPU (Graphics Processing
Unit), Ethernet port, GPIO (General-purpose Input/Output) pins, and power source
connector.
Applications of Raspberry Pi
Media Streamer
Arcade machine
Tablet computer
Home automation
Carputer
Internet radio
Controlling robots
Cosmic Computer
Hunting for meteorites and Coffee
Raspberry based projects
Advantages
Following are some of the main advantages of Raspberry Pi
It is very easy to connect to the internet
Entire Linux software stack is available
Can be programmed using a variety of programming languages
Disadvantages
Following are some of the main limitations of Raspberry Pi.
14
Accessing hardware is not real-time. If the CPU is busy, then interfacing with the
hardware can be delayed.
Does not have enough power to drive inductive loads.
There is no inbuilt Analog to Digital converter available.
The hardware design is not open source. Even though it is not a big deal, for
some people it might a deal-breaker.
NodeMCU
NodeMCU is an open source platform based on ESP8266 which can connect objects
and let data transfer using the Wi-Fi protocol. In addition, by providing some of the
most important features of microcontrollers such as GPIO, PWM, ADC, and etc, it
can solve many of the project’s needs alone.
The general features of this board are as follows:
Easy to use
Programmability with Arduino IDE or IUA languages
Available as an access point or station
practicable in Event-driven API applications
Having an internal antenna
Containing 13 GPIO pins, 10 PWM channels, I2C, SPI
Applications of NodeMCU
Geolocation using ESP8266
ESP8266 based wireless server
Pressure Sensors on Railway Tracks
Air Pollution Meter
Humidity and temperature monitoring
Wi-Fi controlled robot
Temperature logging system
M2M using ESP8266
Make our personal assistant
Pros
Provided inbuilt WiFi functionality
Cost-effective
Integrated support for WIFI network
Low energy consumption
Cons
It is a 3.3V device, so it may not be compatible with some peripherals
Lack of official documentation
WiFi code takes a lot of CPU power
15
9. Write the difference between Arduino and Raspberry Pi.
16
10. How to read Analog Sensors using Arduino?
The Arduino has built-in analog and digital input and output (I/O) pins that we can
interface to a variety of sensors and devices.
The difference between analog and digital sensors is that an analog sensor collects
readings over a range of values, and a digital sensor only reads a HIGH or LOW
signal (a bit of data).
The majority of analog sensors for Arduino are wired and programmed the same. So, once
we learn how to wire and read data from one analog sensor, we’ll be able to wire and
program thousands of additional sensors to collect a whole bunch of data. For this example,
consider a wiring and programming a light-dependent resistor (LDR) also known as a photo
resistor.
The first step is to connect the analog sensor to the Arduino. Analog sensors for Arduino
have three wires (Ground, Signal, Power). Refer to the sensor’s datasheet to figure out
which wire is which. Then, connect the ground wire to GND on the Arduino. Next, attach the
Signal wire to an analog pin on the Arduino. Lastly, connect the power wire to the 5V on the
Arduino.
void setup(){
pinMode(ldr, INPUT); //initialize ldr sensor as INPUT
Serial.begin(9600); //begin the serial monitor at 9600 baud
}
The Arduino UNO has a baud rate of 9600. We can use the begin method to start the Serial
Monitor. Now, we’re ready to write the Arduino code to collect readings from our analog
sensor.
17
Step 3. Write code to collect readings from Analog Sensors
Next, collect a sensor reading using the analogRead(ldr) method, and store it in an integer
variable. I called this variable “data.”
Use a few print statements to show the readings in the Serial monitor.
Serial.print() will print data horizontally across the screen. Serial.println() will print data
vertically down the screen. I used both to label the data while making it easy to read.
void loop(){
int data=analogRead(ldr);
Serial.print(“ldr reading=“);
Serial.println(data);
delay(1000);
}
Finally, add a delay. This prevents the Arduino from taking readings faster than we can see
them. Feel free to adjust this delay to whatever interval makes sense for our application.
Once we have the test code written, save the sketch and upload it to the Arduino. Open up
the serial monitor and we should see values from 0-1023 depending on how bright or dark
the area is.
Some sensors require a unit conversion. For example, it’s easier to understand what
temperature it is when the units are in Celsius or Fahrenheit. Furthermore, with our LDR we
could convert the unit readings into a brightness percentage. That way when we analyze
the data, we can check for conditions based on 25% bright, 100% bright, or a unit that
makes more sense for the application.
Most datasheets specify formulas that we can use to make these conversions. We don’t
always have to “make up” a unit for our sensor.
Once we have an understanding of how data is collected from our analog sensor, we can
use the readings to make decisions.
We’ll use conditional statements to check to see if a condition is TRUE or FALSE. Then,
based on that condition, we’ll react accordingly.
Example
If the condition is LIGHT, then let’s write the word “daylight” to the Serial Monitor.
Otherwise, write the word “nighttime” to the Serial Monitor.
void lightCheck(){
reading = analogRead(ldr);
if(reading >= threshold){ //this condition means the readings are light
Serial.println("daylight");
}
else{
Serial.println("nighttime");
}
delay(1000);
}
Then, we’ll call lightCheck() in our loop() method. Here’s how it should work.
19