0% found this document useful (0 votes)
38 views

Io TQB

Uploaded by

cat365looksgood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Io TQB

Uploaded by

cat365looksgood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

All 6-8 marks questions:

Module 1: (long Q)
1. Explain working of IoT and its components
Ans) : The Internet of Things (IoT) is a network of interconnected devices that can
communicate and exchange data with each other over the internet without human intervention.
1. Sensors and Actuators: Sensors are devices that collect data from the environment,
such as temperature, humidity, light, motion, etc. Actuators, on the other hand, are
devices that can control physical processes, such as turning on/off lights,
opening/closing valves, etc.
2. Connectivity: IoT devices need a way to connect to the internet to transmit and receive
data. This can be achieved through various means such as Wi-Fi, cellular networks,
Bluetooth, Zigbee, etc.
3. Networking: IoT devices communicate with each other and with central servers or cloud
platforms using standard networking protocols like TCP/IP, MQTT, CoAP, etc.
4. Security: Security is a critical aspect of IoT systems to ensure that data remains
confidential, devices are not compromised, and the system is protected against
cyber-attacks.
5. User Interface: IoT systems often have a user interface through which users can interact
with the devices, monitor their status, and control their behavior. This can be a mobile
app, web dashboard, or other types of interfaces.
6. Cloud Platform: Many IoT applications leverage cloud platforms for storing and
processing data. Cloud platforms provide scalable storage, computational power, and
analytics capabilities for handling large volumes of IoT data.

2.Explain the drivers behind the new IoT network architecture


➔ Ans): Scalability: Traditional network architectures struggle to cope with the
massive scale of IoT devices and the data they generate. The new architecture
aims to provide scalability to accommodate millions or even billions of devices
efficiently.
➔ Low Power Consumption: Many IoT devices are battery-powered and need to
operate for extended periods without recharging. Therefore, the new architecture
focuses on reducing power consumption to prolong device lifetimes and
minimize maintenance requirements.
➔ Low Latency: Certain IoT applications, such as real-time monitoring and control
systems, require low latency to ensure timely responses. The new architecture
aims to minimize latency through optimized network designs and protocols.
➔ Security: IoT devices often collect sensitive data and can be vulnerable to various
security threats. The new architecture prioritizes security measures such as
encryption, authentication, and access control to protect data and devices from
unauthorized access and malicious attacks.
➔ Interoperability: As the number and variety of IoT devices continue to grow,
interoperability becomes crucial for seamless communication and integration
across different platforms and vendors. The new architecture promotes
standardization and interoperable protocols to facilitate device connectivity and
data exchange.
➔ Edge Computing: With the proliferation of IoT devices, there's a need to process
data closer to the source to reduce latency and bandwidth usage. The new
architecture incorporates edge computing capabilities to analyze and act on data
locally before sending it to centralized servers.

3.Explain the role of ioT cloud in iot project implementation


➔ Ans): Data Collection and Storage: IoT devices generate vast amounts of data,
including sensor readings, telemetry data, and operational metrics. The IoT cloud
acts as a central repository for collecting, storing, and organizing this data in a
scalable and reliable manner. Cloud-based storage solutions offer flexibility in
handling large volumes of data and provide options for both real-time and
historical data storage.
➔ Data Processing and Analysis: The IoT cloud enables organizations to derive
actionable insights from the raw data collected from IoT devices. Cloud-based
analytics services offer powerful tools for processing, analyzing, and visualizing
IoT data in real-time or batch processing modes. These analytics capabilities
empower businesses to monitor device performance, detect anomalies, optimize
operations, and make data-driven decisions.
➔ Device Management and Control: The IoT cloud provides centralized
management capabilities for remotely monitoring and controlling IoT devices
deployed in the field. Device management platforms enable tasks such as
provisioning, configuration, firmware updates, and troubleshooting, thereby
simplifying device lifecycle management and enhancing operational efficiency.
Additionally, cloud-based control interfaces allow users to interact with and
command IoT devices from anywhere with an internet connection.
➔ Scalability and Elasticity: Cloud-based IoT platforms offer scalability and
elasticity to accommodate growing numbers of devices and increasing data
volumes. Organizations can easily scale their IoT deployments up or down based
on demand without the need for upfront infrastructure investments. Cloud
providers offer pay-as-you-go pricing models, allowing businesses to align costs
with usage and avoid over-provisioning resources.
➔ Security and Compliance: Security is a paramount concern in IoT deployments,
given the potential risks associated with unauthorized access, data breaches,
and device tampering. The IoT cloud provides built-in security features and
compliance mechanisms to safeguard IoT data, applications, and infrastructure.
These include encryption, authentication, access control, identity management,
and security monitoring tools to detect and respond to security threats
proactively.
➔ Integration with Enterprise Systems: The IoT cloud facilitates seamless
integration with existing enterprise systems, such as CRM, ERP, and business
intelligence platforms. Integration APIs, connectors, and middleware enable data
exchange and interoperability between IoT applications and backend systems,
enabling organizations to leverage IoT insights to enhance business processes,
customer experiences, and strategic decision-making.

4.Illustrate the challenges of IoT project implementation(refer gcr)


5.Illustrate the IoTWF architecture
Ans) : In 2014 the IoTWF architectural committee (led by Cisco, IBM, Rockwell Automation, and
others) published a seven-layer IoT architectural reference model.

➔ Physical Devices and Controllers Layer: The first layer of the IoT Reference
Model is the physical devices and controllers layer. This layer is home to the
“things” in the Internet of Things, including the various endpoint devices and
sensors that send and receive information.
➔ Connectivity Layer: In the second layer of the IoT Reference Model, the focus is
on connectivity. The most important function of this IoT layer is the reliable and
timely transmission of data.
➔ Edge Computing Layer: Edge computing is the role of Layer 3. Edge computing is often
referred to as the “fog” layer
Mainly focuses on Data Analysis and Transformation.

6.Illustrate the simplified IoT architecture


Ans):

➔ Edge of the IoT: The edge of the IoT is where the action is. It includes a wide array of
sensors, actuators, and devices—those system end-points that interact with and
communicate real-time data from smart products and services.
➔ Fog computing: Fog computing allows computing, decision-making and action-taking to
happen via IoT devices and only pushes relevant data to the cloud.
➔ IoT Cloud: An IoT cloud is a massive network that supports IoT devices and applications.
An IoT cloud also includes the services and standards necessary for connecting,
managing, and securing different IoT devices and applications.

7.Illustrate the OneM2M architecture


Ans) :

The oneM2M architecture divides IoT functions


into three major domains:
● the application layer
● the services layer
● and the network layer.

➔ Applications layer: The oneM2M architecture gives major attention to connectivity


between devices and their applications.
➔ Service layer: This layer is shown as a horizontal framework across the vertical industry
Applications.
➔ Network layer: This is the communication domain for the IoT devices and endpoints.
It includes the devices themselves and the communications network that links them.
Module 2: (long Q)

1.Explain the characteristics of a smart object.


Ans):

2. Explain the different types of sensors with examples of each.


Ans): Sensors are crucial components of IoT systems, as they enable devices to
perceive and collect data from the physical world. Here are different types of sensors
commonly used in IoT applications, along with examples of each:

1. Temperature Sensors:
● Type: Temperature sensors measure the temperature of their
surroundings.
● Examples: Thermistors, thermocouples, digital temperature sensors (e.g.,
DS18B20), infrared (IR) temperature sensors.
2. Humidity Sensors:
● Type: Humidity sensors measure the relative humidity of the air.
● Examples: Capacitive humidity sensors, resistive humidity sensors,
hygrometers.
3. Proximity Sensors:
● Type: Proximity sensors detect the presence or absence of objects in
close proximity to the sensor.
● Examples: Infrared (IR) proximity sensors, ultrasonic sensors, capacitive
proximity sensors, inductive proximity sensors.
4. Motion Sensors:
● Type: Motion sensors detect movement or changes in position.
● Examples: Passive Infrared (PIR) motion sensors, accelerometers,
gyroscopes, Doppler radar sensors.
5. Light Sensors:
● Type: Light sensors measure the intensity or brightness of ambient light.
● Examples: Photodiodes, phototransistors, light-dependent resistors
(LDRs), ambient light sensors.
6. Pressure Sensors:
● Type: Pressure sensors measure the pressure of gases or liquids.
● Examples: Piezoresistive pressure sensors, capacitive pressure sensors,
piezoelectric pressure sensors, strain gauge pressure sensors.
7. Gas Sensors:
● Type: Gas sensors detect the presence and concentration of specific
gasses in the environment.
● Examples: Carbon monoxide (CO) sensors, carbon dioxide (CO2) sensors,
methane (CH4) sensors, volatile organic compound (VOC) sensors.
8. Sound Sensors:
● Type: Sound sensors capture sound waves and measure sound intensity
or frequency.
● Examples: Microphones, piezoelectric sensors, ultrasonic sensors.

3. Explain the different types of actuators with examples of each.


Ans): Actuators are devices that convert electrical signals or commands into physical
actions or movements. Here are different types of actuators commonly used in IoT
applications, along with examples of each:

1. Electric Motors:
● Type: Electric motors convert electrical energy into mechanical motion.
● Examples: DC motors, stepper motors, servo motors, brushed motors,
brushless motors.
● Applications: Electric motors are used in various IoT applications for tasks
such as driving wheels in robotics, opening and closing valves, controlling
fans and pumps, and moving mechanical parts.
2. Solenoid Valves:
● Type: Solenoid valves control the flow of fluids or gases by opening or
closing a valve in response to an electrical signal.
● Examples: Electrically-operated solenoid valves, pneumatic solenoid
valves, hydraulic solenoid valves.
● Applications: Solenoid valves are used in IoT systems for applications
such as irrigation control, water distribution, gas regulation, and fluid
handling in industrial processes.
3. Relays:
● Type: Relays are electromechanical switches that control the flow of
electrical power to other devices.
● Examples: Electromechanical relays (EMRs), solid-state relays (SSRs).
● Applications: Relays are used in IoT applications for tasks such as turning
on/off lights, controlling heating or cooling systems, switching power
sources, and activating alarms or sirens.
4. Linear Actuators:
● Type: Linear actuators convert rotational motion into linear motion to
move objects along a straight path.
● Examples: Electric linear actuators, pneumatic linear actuators, hydraulic
linear actuators.
● Applications: Linear actuators are used in IoT systems for tasks such as
opening and closing doors, adjusting window blinds, extending/retracting
mechanical arms, and positioning objects in industrial automation.
5. Pneumatic Actuators:
● Type: Pneumatic actuators use compressed air to generate mechanical
motion.
● Examples: Pneumatic cylinders, pneumatic rotary actuators.
● Applications: Pneumatic actuators are used in IoT applications for tasks
such as actuating valves, moving conveyor belts, controlling pneumatic
grippers, and powering robotic arms.
4. Differentiate between sensor and actuators.

Ans):

5. Explain WSN
● Ans): Wireless Sensor Networks (WSNs) are a key component of the Internet of
Things (IoT) ecosystem.
● WSNs enable real-time data collection, processing, and transmission over
wireless communication networks. Here's an explanation of WSN in IoT:
➔ Sensor Nodes: WSNs comprise small, low-power sensor nodes equipped
with sensors, processing units, communication interfaces, and power
sources (usually batteries or energy harvesting modules).
➔ Communication: Sensor nodes communicate wirelessly with each other to
relay data to a central location or gateway node.
➔ Data Collection and Processing: Sensor nodes continuously collect data
from their environment using built-in sensors. The data can include
temperature, humidity, pressure, light intensity, sound levels, and more.
➔ Challenges: WSNs face challenges such as limited energy resources,
communication constraints (e.g., bandwidth, range, reliability), scalability
issues, data security and privacy concerns, and network deployment and
maintenance costs.

6. Explain the criteria for connecting smart object in IoT project(refer gcr)
7. List out the different constrained networks
➔ Low-Power Wide-Area Network (LPWAN)
➔ Wireless Sensor Networks (WSN)
➔ Bluetooth Low Energy (BLE)
➔ Zigbee
➔ 6LoWPAN (IPv6 over Low-Power Wireless Personal Area Network)

8. Explain IEEE 802.15.4


Ans): IEEE 802.15.4 - An older but foundational wireless protocol for connecting smart objects.
IEEE 802.15.4 is a technical standard which defines the operation of low-rate wireless personal
area networks (LR-WPANs).
IEEE 802.15.4 is a low-data rate wireless personal area network (WPAN) and is at the PHY and
MAC layer, used by many IoT protocols, such as ZigBee, and WirelessHART.
➔ Low Power Consumption: One of the primary features of IEEE 802.15.4 is its
emphasis on low power consumption.
➔ Low Data Rate: IEEE 802.15.4 is optimized for low-data-rate communications,
which is often sufficient for many IoT applications.
➔ Mesh Networking: IEEE 802.15.4 supports mesh networking topologies, allowing
devices to relay data through multiple hops.
➔ MAC Layer: IEEE 802.15.4 specifies the MAC layer, which manages access to the
shared communication medium, handles data framing, and provides
mechanisms for addressing, channel access, and error detection.
➔ Security: IEEE 802.15.4 includes provisions for security, such as encryption and
authentication, to protect data transmitted over the network from unauthorized
access and tampering.
9.Compare the wireless technologies with power consumption and distance
parameters.(refer gcr)

10. Explain the types of constrained devices with an example of each.

Ans) : Constrained devices in IoT refer to devices with limited resources such as
processing power, memory, and energy.

Here are some types of constrained devices along with examples:

➔ Low-Power Microcontrollers: These devices are equipped with


microcontrollers that have limited processing capabilities and memory,
but they excel in low-power operation.
➔ Wireless Sensor Nodes: These devices are designed to sense and collect
data from the environment, such as temperature, humidity, light, and
motion.
➔ RFID Tags: RFID (Radio-Frequency Identification) tags are small electronic
devices that consist of a chip and an antenna for wireless communication.
➔ Actuator Nodes: These devices are responsible for controlling physical
devices or actuators based on commands received from the network.
➔ Smart Meters: Smart meters are devices used for measuring and
monitoring utility consumption, such as electricity, water, or gas.

Module 3: (Long Q)
1. Explain the properties of a smart devices
➔ Ans): Security and Privacy: Smart devices implement security measures to
protect data, prevent unauthorized access, and ensure user privacy. This
includes encryption, authentication, access control, secure boot
mechanisms, and secure communication protocols.
➔ Remote Management and Updates: Smart devices can be remotely
managed, configured, and updated over the air (OTA) using firmware
updates or configuration changes.
➔ Interoperability

IoT devices use standardized protocols and technologies to


ensure they can communicate with each other and other systems.
Interoperability is one of the key characteristics of the Internet of
Things (IoT). It refers to the ability of different IoT devices and
systems to communicate and exchange data with each other,
regardless of the underlying technology or manufacturer.

➔ Architecture : IoT Architecture cannot be homogeneous in nature. It


should be hybrid, supporting different manufacturers ‘ products to
function in the IoT network.

➔ 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 changing contexts


and scenarios. Assume a camera meant for surveillance. It should be
adaptable to work in different conditions and different light situations
(morning, afternoon, and night).

2. Illustrate about the the Arduino Uno board and its components
Ans): The Arduino Uno is one of the most popular development boards used in
IoT and embedded systems projects. It's based on the ATmega328
microcontroller and features a simple yet powerful design suitable for beginners
and advanced users alike. Let's explore its key components and their relevance in
IoT applications:

3. ATmega328 Microcontroller: At the heart of the Arduino Uno is the ATmega328


microcontroller. This 8-bit AVR microcontroller from Atmel (now Microchip)
provides the processing power and I/O capabilities necessary for controlling
sensors, actuators, and communicating with other devices in IoT applications.
4. Digital Input/Output Pins: The Arduino Uno features a set of digital input/output
(I/O) pins, typically labeled from D0 to D13. These pins can be configured as
digital inputs to read sensor data or as digital outputs to control LEDs, motors,
relays, and other actuators in IoT devices.
5. Analog Input Pins: In addition to digital I/O pins, the Arduino Uno includes several
analog input pins, labeled from A0 to A5. These pins allow the board to read
analog sensor values, such as temperature, light intensity, or voltage levels, using
the built-in analog-to-digital converter (ADC).
6. USB Interface: The Arduino Uno features a USB interface that allows it to
communicate with a computer for programming and serial communication. This
interface is used to upload sketches (programs) to the board and to exchange
data with IoT applications running on a host computer or connected devices.
7. Power Connector and Regulator: The Arduino Uno can be powered via USB
connection or an external power supply connected to the barrel jack. It includes a
built-in voltage regulator that ensures stable operation by converting the input
voltage (typically 7-12V) to the 5V required by the microcontroller and other
components on the board.
8. Reset Button: The Arduino Uno has a reset button that allows users to restart the
microcontroller, either to reload the program or reset its state. This button is
useful for troubleshooting and debugging IoT applications.

9. Illustrate the different types of microcontroller boards for Iot.


➔ Ans): Arduino Boards - Arduino Uno, Arduino Nano, Arduino Mega
➔ Raspberry Pi- Raspberry Pi Zero W, Raspberry Pi ¾,
➔ ESP8266 and ESP32 Boards - NodeMCU (ESP8266), ESP32 DevKit,
➔ Particle Boards - Particle Photon, Particle Electron
➔ Micro:bit - BBC micro:bit
10. Illustrate the Raspberry Pi and its main components.
Ans):
The Raspberry Pi is a series of single-board computers (SBCs) developed by the
Raspberry Pi Foundation. It's widely used in IoT applications due to its
affordability, versatility, and extensive community support. Let's explore the main
components of the Raspberry Pi and their relevance in IoT:
➔ Processor (CPU): The Raspberry Pi features a central processing unit
(CPU) that provides the computational power necessary for running
applications and processing data.
➔ Memory (RAM): Raspberry Pi boards are equipped with random-access
memory (RAM) for temporary storage of data and program instructions.
➔ Storage (SD Card): The primary storage medium for Raspberry Pi boards is
typically a microSD card slot, where users can insert a microSD card to
store the operating system, applications, and data.

Input/Output (I/O) Ports:

● USB Ports: Raspberry Pi boards feature multiple USB ports for connecting
peripherals such as keyboards, mice, storage devices, and USB-based sensors or
actuators in IoT projects.
● Ethernet Port: Many Raspberry Pi models include an Ethernet port for wired
network connectivity, allowing the board to communicate with other devices on a
local network or access the internet.
● HDMI Port: The HDMI port enables Raspberry Pi boards to connect to displays,
monitors, or TVs for visual output, making it easier to interact with graphical user
interfaces (GUIs) or display sensor data.
➔ Real-Time Clock (RTC): While not included by default, Raspberry Pi boards
can be equipped with external real-time clock (RTC) modules to maintain
accurate timekeeping even when the board is powered off.

11. Explain the different option of User interface in IoT(refer gcr)


12. Differentiate between Arduino Uno and Raspberry Pi
Ans):
In the year 2005, the
classrooms of the In the year 2012, Eben
Interactive Design Upton first introduced the
Institute in Ivrea, Raspberry Pi device in
Italy, first introduced February.
the Arduino board.

Control unit of the The control unit of


Arduino is from the Raspberry Pi is from the
Atmega family. ARM family.

While Raspberry Pi is
Arduino is based on
based on a
a microcontroller.
microprocessor.

While Raspberry Pi
It is designed to
computes data and
control the electrical
produces valuable
components
outputs, and controls
connected to the
components in a system
circuit board in a
based on the outcome of
system.
its computation.
Arduino boards have While Raspberry Pi
a simple hardware boards have a complex
and software architecture of hardware
structure. and software.

CPU architecture: 8
CPU architecture: 64 bit.
bit.

It uses very little While Raspberry Pi


RAM, 2 kB. requires more RAM, 1 GB.

While Raspberry Pi clocks


It clocks a processing
a processing speed of 1.4
speed of 16 MHz.
GHz.

While Raspberry Pi is
It is cheaper in cost.
expensive.
It has a higher I/O While Raspberry Pi has a
current drive lower I/O current drive
strength. strength.

Explain the main services for cloud, how can it be used in IoT?
Ans): Cloud computing enables users to perform computing tasks using
services provided over the Internet. The use of the Internet of Things in
conjunction with cloud technologies has become a kind of catalyst: the
Internet of Things and cloud computing are now related to each other.
Benefits And Functions of IoT Cloud:
➔ IoT Cloud Computing provides many connectivity options, implying
large network access. People use a wide range of devices to gain
access to cloud computing resources: mobile devices, tablets,
laptops.
➔ Developers can use IoT cloud computing on-demand. In other words, it

is a web service accessed without special permission or any help. The

only requirement is Internet access.

➔ As the number of IoT devices and automation in use grows, security

concerns emerge. Cloud solutions provide companies with reliable

authentication and encryption protocols.

Cloud computing encompasses the delivery of data to data centers over the

Internet. IBM divides cloud computing into six different categories:


1. Platform as a Service (PaaS) –

The cloud contains everything you need to build and deliver cloud

applications so there is no need to maintain and buy equipment,

software, etc.

2. Software as a Service (SaaS) –

In this case, applications run in the cloud and other companies

operate devices that connect to users’ computers through a web

browser.

3. Infrastructure as a Service (IaaS) –

IaaS is an option providing companies with storage, servers,

networks and hubs processing data for each use.

4. Public cloud –

Companies manage spaces and provide users with quick access

through the public network.

5. Private cloud –

The same as a public cloud, but only one person has access here,

which can be an organization, an individual company, or a user.

6. Hybrid cloud –

Based on a private cloud, but provides access to a public cloud.


Module 4:( Short and long questions)
1. What is the sudo command?
Ans): In IoT applications, the sudo command is often used when performing
administrative tasks on devices running Unix-like operating systems (e.g.,
Linux-based IoT gateways, Raspberry Pi, BeagleBone, etc.).
2. Write the command to create a user with admin right.
Ans): sudo adduser <username>
sudo usermod -aG sudo <username>
3. List the different types of editors command
➔ Ans): Vim
➔ Nano
➔ Emacs
➔ Visual Studio Code (VS Code)
4. Write the command to shut down the server with specified time and message
Ans): sudo shutdown -h +30 "System will shut down in 30 minutes for maintenance"

5. Write the syntax of if-else statements in python.


Ans): temperature = 25

if temperature > 30:


print("It's hot outside.")
else:
print("It's not too hot outside.")

6. Explain the different looping statements in python


➔ Ans): For Loop: The For loop is used to iterate over a sequence (such as
a list, tuple, string, or range) or any iterable object in Python.
Syntax: for item in iterable:
# Code block to execute for each item in the iterable
statement1
Statement2
Example: fruits = ["apple", "banana", "cherry"]
for fruit in fruits:
print(fruit)
Output: apple
banana
Cherry
➔ While Loop:
● The while loop is used to execute a block of code repeatedly as long as a
specified condition is True.

Syntax: while condition:

# Code block to execute as long as the condition is True

statement1

Statement2

Example: num = 0

while num < 5:

print(num)

num += 1

Output: 0

➔ Break Statement:
● The break statement is used to exit a loop prematurely, regardless of the loop's
condition.

Example: for num in range(10):

if num == 5:
break print(num)

Output:

➔ Continue Statement:
● The continue statement is used to skip the current iteration of a loop and
proceed to the next iteration.

Example: for num in range(5):

if num == 2:

continue

print(num)

Output:

7. Explain the different data structures in python


Ans):
In Python, data structures are used to store and organize data efficiently, allowing
for easy retrieval, manipulation, and analysis.Here are some of the most
commonly used data structures in Python IoT development:

➔ Lists: Lists are ordered collections of items, where each item can be of any data
type (including other lists).
Example : fruits = ["apple", "banana", "cherry"]
➔ Tuples: Tuples are ordered collections of items similar to lists, but they are
immutable, meaning that once created, their elements cannot be changed
or modified.
point = (10, 20)

➔ Dictionaries: Dictionaries are unordered collections of key-value pairs,


where each key is associated with a value.
Example: person = {"name": "John", "age": 30, "city": "New York"}
➔ Sets: Sets are unordered collections of unique items, meaning that
duplicate elements are not allowed.
colors = {"red", "green", "blue"}

8. Explain exception handling in python


Ans): Exception handling in Python is a mechanism used to handle errors and
exceptions that occur during the execution of a program.

➔ Try-Except Blocks: Python uses try-except blocks to handle exceptions. Code


that may raise an exception is placed inside a try block, and the handling of the
exception is defined in one or more except blocks.

try:

# Code that may raise an exception

statement1

statement2

...

except ExceptionType:

# Code to handle the exception


handle_exception()

➔ Exception Types:
● Python defines several built-in exception types, such as TypeError, ValueError,
IOError, KeyError, etc., which correspond to specific error conditions.

try:

result = 10 / 0 # This will raise a ZeroDivisionError

except ZeroDivisionError:

print("Division by zero error occurred")

➔ Multiple Except Blocks: You can use multiple except blocks to handle different
types of exceptions separately.

try:

result = int("abc") # This will raise a ValueError

except ValueError:

print("Invalid conversion to integer")

except Exception as e:

print("An error occurred:", e)

➔ Finally Block: You can optionally include a finally block after the try-except
blocks.

try:

file = open("example.txt", "r")

# Code to read from the file


except FileNotFoundError:

print("File not found")

finally:

file.close() # Always close the file, even if an exception occurs

9. Explain class and object in python with a suitable example(refer gcr)


10. Write python code to check the humidity and temperature , draw the circuit diagram for
the same
Ans): pip install Adafruit_DHT
import Adafruit_DHT

# Set the DHT sensor type (DHT11, DHT22, or AM2302)


sensor = Adafruit_DHT.DHT11

# Set the GPIO pin connected to the DHT sensor


pin = 4 # Example pin number (change to the actual pin number)

# Attempt to read the humidity and temperature from the sensor


humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)

# Check if the reading was successful


if humidity is not None and temperature is not None:
print('Temperature: {:.1f}°C'.format(temperature))
print('Humidity: {:.1f}%'.format(humidity))
else:
print('Failed to read data from DHT sensor')

Module 5:
1. Explain the different types of the data analytics
Ans): In IoT (Internet of Things), data analytics plays a crucial role in extracting
valuable insights and actionable intelligence from the vast amounts of data
generated by connected devices. There are several types of data analytics
techniques used in IoT to analyze and interpret this data. Here are some of the
main types:

2. Descriptive Analytics:
a. Descriptive analytics focuses on summarizing historical data to describe
what has happened in the past. It involves simple statistical analysis and
visualization techniques to understand patterns, trends, and anomalies in
the data.
b. Example: Generating reports, dashboards, and charts to visualize sensor
data over time.
3. Diagnostic Analytics:
a. Diagnostic analytics aims to identify the root causes of past events or
anomalies by analyzing historical data in more detail.
b. Example: Investigating the reasons behind equipment failures or system
malfunctions by analyzing sensor data and maintenance records.
4. Predictive Analytics:
a. Predictive analytics uses statistical modeling and machine learning
algorithms to forecast future events or trends based on historical data
patterns.
b. Example: Building predictive maintenance models to predict equipment
failures before they occur based on sensor data and maintenance logs.
5. Prescriptive Analytics:
a. Prescriptive analytics goes beyond predictive analytics by recommending
specific actions or interventions to optimize outcomes.
b. Example: Recommending optimal routes for delivery vehicles based on
real-time traffic conditions, weather forecasts, and historical delivery data.
6. Real-time Analytics:
a. Real-time analytics involves analyzing data as it is generated in real-time
to derive immediate insights and take timely actions.
b. Example: Monitoring sensor data from industrial equipment to detect
anomalies or performance issues in real-time and trigger automatic alerts
or responses.
7. Edge Analytics:
a. Edge analytics refers to performing analytics and processing data directly
at the edge of the network, close to where data is generated, instead of
sending it to a centralized cloud or data center.
b. Example: Running machine learning algorithms on edge devices (e.g., IoT
gateways, edge servers) to analyze sensor data locally and send only
relevant insights to the cloud for further processing.
8. Explain the types of data classifications
Ans): In IoT (Internet of Things), data classifications refer to categorizing the data
generated by connected devices based on various attributes such as sensitivity,
importance, and usage. Data classification helps organizations manage and
prioritize data effectively, ensuring that appropriate security measures, storage
solutions, and access controls are applied. Here are some common types of data
classifications in IoT:

1. Sensitivity Classification:
a. Sensitivity classification categorizes data based on its level of sensitivity
or confidentiality. It helps identify which data requires higher levels of
protection and access control to prevent unauthorized disclosure or
misuse.
b. Example: Personal identifiable information (PII), financial data, health
records, and proprietary business information may be classified as
sensitive data.

2. Criticality Classification:

c. Criticality classification categorizes data based on its criticality to


business operations or decision-making processes. It helps prioritize
resources and efforts for managing and safeguarding data based on its
importance and impact on organizational goals.
d. Example: Real-time sensor data from critical infrastructure systems (e.g.,
power grids, transportation networks) may be classified as critical data
due to its impact on public safety and service availability.

3. Retention Classification:

e. Retention classification categorizes data based on its retention


requirements or lifecycle stages. It helps define policies and procedures
for storing, archiving, and disposing of data in compliance with regulatory
requirements and organizational needs.
f. Example: Regulatory compliance mandates may require organizations to
retain certain types of data (e.g., audit logs, transaction records) for a
specific period to meet legal and regulatory obligations.

4. Usage Classification:

g. Usage classification categorizes data based on its intended use or


purpose within the organization. It helps ensure that data is used
appropriately and ethically, aligning with organizational objectives and
stakeholder expectations.
h. Example: Operational data collected from IoT devices for monitoring and
control purposes may be classified differently from analytical data used
for business intelligence and decision support.

5. Access Classification:

i. Access classification categorizes data based on the level of access rights


and permissions required to interact with it. It helps enforce access
controls and authentication mechanisms to protect data from
unauthorized access, modification, or deletion.
j. Example: Role-based access control (RBAC) may be implemented to
restrict access to sensitive data only to authorized users with specific
roles or privileges.

6. Quality of Service (QoS) Classification:

k. QoS classification categorizes data based on its quality of service


requirements, such as reliability, availability, and latency. It helps prioritize
data transmission and processing based on the application's performance
needs and user expectations.
l. Example: Real-time sensor data for critical applications (e.g., autonomous
vehicles, medical devices) may require low latency and high reliability,
while non-critical data may tolerate higher latency and occasional packet
loss.

9. Explain the different data analysis tools(refer gcr)


10. Explain the usage of ML and AI in IoT(not imp)
11. Write a program to blink LEDs, draw the circuit diagram for the same
Ans): int LEDpin = 13;
int delayT = 1000;
void setup() {
// put your setup code here, to run once:
pinMode(LEDpin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LEDpin, HIGH);
delay(delayT);
digitalWrite(LEDpin, LOW);
delay(delayT);
}

12. Write a program to open and close gate, draw the circuit diagram for the same
Ans): #include <Servo.h>

Servo servoMain; // Define our Servo

int trigpin = 10;

int echopin = 11;

int distance;
float duration;

float cm;

void setup()

servoMain.attach(9); // servo on digital pin 10

pinMode(trigpin, OUTPUT);

pinMode(echopin, INPUT);

void loop()

digitalWrite(trigpin, LOW);

delay(2);

digitalWrite(trigpin, HIGH);

delayMicroseconds(10);

digitalWrite(trigpin, LOW);

duration = pulseIn(echopin, HIGH);

cm = (duration/58.82);

distance = cm;

if(distance<60)
{

servoMain.write(180); // Turn Servo back to center position (90


degrees)

delay(3000);

else{

servoMain.write(0);

delay(50);

You might also like