Nothing Special   »   [go: up one dir, main page]

Lab - Manual - Iot 22

Download as pdf or txt
Download as pdf or txt
You are on page 1of 35

FACULTY OF TECHNOLOGY AND ENGINEERING

DEVANG PATEL INSTITUTE OF ADVANCE TECHNOLOGY AND


RESEARCH

DEPARTMENT OF COMPUTER ENGINEERING

A.Y. 2023-24 [ODD]

LAB MANUAL

CE444: INTERNET OF THINGS


Semester: ___________________________ Academic Year: ___________________________
Subject Code: ___________________________ Subject Name: ___________________________
Student Id: ___________________________ Student Name: ___________________________

PRACTICAL INDEX
Sr. Aim Assignment Completion Grade Assessment Signature
No. Date Date Date
1 Introduction and demonstrate
LED on-off using tinker cad.
2 Analyse the performance of PIR
sensor on tinker cad.
3 Introduction to Arduino IDE
tools and ESP32/Node MCU.
a. Arduino IDE configuration.
b. ESP 32 understanding.
4 Demonstrate LED blinking
program on Node MCU.
5 Introduction to different sensor
and interfacing.
a. DHT11.
b. Soil moisture sensor.
c. LM35.
d. MQ2 (Gas sensor).
e. Jumper Cable.
f. Display.
g. Breadboard.
6 Develop a hardware and get
temperature and humidity data
using
Mobile application.
a. ESP32.
b. DHT11/LM35.
c. Blynk IOT application.
7 Study on MQTT protocol on
cloud
8 Study on Raspberry pi
hardware.
9 Implement MQTT protocol
using Raspberry pi using cloud
platform.
10 Introduction to Jetson Nano
Hardware.
11 Project: Sign Language
Recognition

20DCE022 CE444: Internet of Things 1


PRACTICAL - 1
Aim: Introduction and demonstrate LED on-off using tinker cad.
Code:

void setup()
{
pinMode(13, OUTPUT);
}

void loop()
{
digitalWrite(13, HIGH);
delay(1000);

digitalWrite(13, LOW);
delay(1000);
}

Output:

Fig 1.1 LED Off

20DCE022 CE444: Internet of Things 2


Fig 1.2 LED On
Conclusion: In this practical we successfully designed an LED blink circuit using Arduino code and
delay ().
Grade:
Signature:
Remarks:

20DCE022 CE444: Internet of Things 3


PRACTICAL - 2
Aim: Analyse the performance of PIR sensor on tinker cad.
Code:

void setup() {
pinMode(2, INPUT);
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
}

void loop() {
int motionDetected = digitalRead(2);

if (motionDetected == HIGH) {
digitalWrite(13, HIGH);
}
else {
digitalWrite(13, LOW);
}
}

Output:

Fig 2.1 No Motion Detected, LED Off

20DCE022 CE444: Internet of Things 4


Fig 2.2 Motion Detected, LED On
Conclusion: In this practical we created a motion-activated LED circuit using a PIR sensor on a
breadboard. This basic project introduced us to Arduino, sensor interfacing, and simple programming.
Grade:
Signature:
Remarks:

20DCE022 CE444: Internet of Things 5


PRACTICAL - 3
Aim: Introduction to Arduino IDE tools and ESP32/Node MCU.
a. Arduino IDE configuration.
b. ESP 32 understanding.
Theory:
A. Arduino IDE configuration:
Arduino IDE, which stands for "Integrated Development Environment," is a software
application used for programming and developing applications for Arduino microcontroller-based
boards and other compatible microcontroller platforms. It provides a user-friendly and beginner-
friendly interface for writing, compiling, and uploading code to these devices.
Go to https://www.arduino.cc/en/software and download Arduino IDE as per your operating
system.
After downloading complete, open the installer and start installation process of Arduino IDE.
Installation process is shown in below images:

Fig 3.1 Licence Agreement

20DCE022 CE444: Internet of Things 6


Fig 3.2 Installation Option

Fig 3.3 Installation Location

20DCE022 CE444: Internet of Things 7


Fig 3.4 Installing

Fig 3.5 Installation Complete

20DCE022 CE444: Internet of Things 8


B. ESP 32 Understanding:
The ESP32 is a popular and versatile microcontroller-based system-on-chip (SoC) developed
by Espressif Systems. It is a successor to the ESP8266 and offers significant improvements in
terms of processing power, connectivity options, and other features. The ESP32 is widely used in
various IoT (Internet of Things) applications, smart devices, and DIY projects due to its
capabilities.
Key features of the ESP32 include:
Dual-core processor: The ESP32 comes with two CPU cores, which allows it to handle multiple
tasks efficiently.
Wi-Fi connectivity: The ESP32 provides built-in Wi-Fi support, making it easy to connect to
wireless networks and the internet. It supports both 2.4 GHz and 5 GHz Wi-Fi bands.
Bluetooth support: In addition to Wi-Fi, the ESP32 also features built-in Bluetooth (Bluetooth
4.2 and Bluetooth Low Energy), enabling communication with other Bluetooth devices and
peripherals.
GPIO (General Purpose Input/Output) pins: The ESP32 provides a large number of GPIO
pins, allowing it to interface with various sensors, actuators, and other external components.
Analog-to-digital converters (ADC): The ESP32 includes several ADC channels, which can be
used to read analog sensor values.
Low-power modes: The ESP32 supports different low-power modes, which can be useful for
energy-efficient applications and battery-powered devices.
Conclusion: In this practical we learn about installation and setup for Arduino IDE and ESp32/Node
MCU microcontroller.
Grade:
Signature:
Remarks:

20DCE022 CE444: Internet of Things 9


PRACTICAL - 4
Aim: Demonstrate LED blinking program on Node MCU.
Code:

#include "Arduino.h"

// On a NodeMCU board, the built-in LED is on GPIO pin 2


#define LED_BUILTIN 2

void setup()
{
Serial.begin(14440);
// Initialize LED digital pin as an output.
pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
Serial.println("NodeMCU blink!");
// Turn the LED on (the built-in LED on a NodeMCU board is active low)
digitalWrite(LED_BUILTIN, LOW);
// Wait for a second
delay(1000);
// Turn the LED off (the built-in LED on a NodeMCU board is active low)
digitalWrite(LED_BUILTIN, HIGH);
// Wait for a second
delay(1000);
}

Conclusion: In this practical we learn about how to implement LED blinking program using Node
MCU
Grade:
Signature:
Remarks:

20DCE022 CE444: Internet of Things 10


PRACTICAL - 5
Aim: Introduction to different sensor and interfacing.
a. DHT11
b. Soil moisture sensor.
c. LM35
d. MQ2 (Gas sensor)
e. Jumper Cable
f. Display
g. Breadboard
Theory:
A. DHT11:

The DHT11 sensor is a basic and affordable digital temperature and humidity sensor
that is commonly used for measuring environmental conditions in various applications. It's
often used in hobbyist projects, home automation, weather stations, and other scenarios where
simple temperature and humidity measurements are needed.
Key features of the DHT11 sensor include:
Temperature Measurement: The DHT11 sensor can measure temperature in the range of 0°C
to 50°C (32°F to 122°F) with an accuracy of around ±2°C.
Humidity Measurement: It can measure relative humidity in the range of 20% to 90% with
an accuracy of around ±5%.
Digital Output: The sensor communicates using a digital signal protocol, which means it
outputs the data as digital values that can be read by microcontrollers or other digital devices.
Single-Wire Interface: The DHT11 sensor uses a single-wire interface for both power supply
and data communication. This makes it relatively easy to integrate into various electronic
projects.
Low Power Consumption: The sensor has low power consumption, making it suitable for
battery-powered applications.
Simple Usage: The sensor's protocol is relatively easy to work with, and there are libraries
available for various microcontroller platforms that simplify the integration process.
Limitations: While the DHT11 is cost-effective and easy to use, it has some limitations such
as limited accuracy compared to more advanced sensors. Its response time can also be relatively
slow.
Notable Alternatives: If higher accuracy and faster response times are required, the DHT22
(also known as AM2302) is a more advanced version of the DHT11 that offers better
performance in terms of temperature and humidity measurements.

20DCE022 CE444: Internet of Things 11


B. Soil moisture sensor:
A soil moisture sensor is a device used to measure the moisture content of soil. It's
commonly employed in agricultural, gardening, and landscaping applications to help determine
when plants need to be watered. By providing real-time data about the soil's moisture level,
these sensors can assist in optimizing irrigation systems and conserving water resources.
Here's some key information about soil moisture sensors:
Principle of Operation: There are several methods used in soil moisture sensors to measure
the water content of soil. Some common methods include measuring electrical resistance,
capacitance, or using time domain reflectometry (TDR). Each method has its own advantages
and limitations.
Types of Soil Moisture Sensors:
• Volumetric Soil Moisture Sensors: These sensors measure the proportion of water
volume in the soil. They provide a more accurate measurement of moisture content, but
they can be relatively expensive and complex.
• Tensiometers: Tensiometers measure the suction or tension that the soil exerts on
water. They are useful for understanding how easily plants can extract water from the
soil.
• Capacitance Sensors: These sensors measure the dielectric constant of the soil, which
changes with moisture content. They are commonly used in both agricultural and
residential applications.
• Resistance Sensors: These sensors measure the electrical resistance of the soil, which
decreases with higher moisture content. They are often affordable and easy to use but
may not be as accurate as other methods.
Placement: Soil moisture sensors are typically inserted into the soil at various depths to
provide a profile of moisture content. The depth at which the sensors are placed depends on
the root zone of the plants being monitored.
Calibration: Proper calibration is essential to ensure accurate readings. Different soil types
and environmental conditions can influence the readings, so it's important to calibrate the
sensor based on the specific soil it will be used with.
Integration: Soil moisture sensors are commonly integrated with microcontrollers, data
loggers, or automation systems. They provide data that can be used to make informed decisions
about irrigation scheduling.
Benefits: Using soil moisture sensors can lead to more efficient water usage, healthier plant
growth, and reduced risk of overwatering or underwatering. This can result in better yields for
agriculture, cost savings, and environmental benefits.
Limitations: Soil moisture sensors may have limitations, such as measurement accuracy being
affected by soil composition, temperature, and electrical conductivity. Regular maintenance
and occasional recalibration might be necessary.
Maintenance: Proper maintenance is important to ensure accurate readings. Sensors should be
cleaned and checked for proper functioning periodically.

20DCE022 CE444: Internet of Things 12


C. LM35:
The LM35 is a popular analog temperature sensor that can be used to measure
temperature in various applications. It's a straightforward and relatively low-cost sensor that
provides accurate temperature readings with a linear output voltage.
Here are some key points about the LM35 sensor:
Working Principle: The LM35 sensor is based on the principle that the voltage across a
temperature-sensitive diode (junction) changes linearly with temperature. The LM35 generates
an analog output voltage that is directly proportional to the temperature it is exposed to.
Temperature Range: The LM35 sensor is available in various versions with different
temperature ranges. The most common version covers a temperature range of approximately -
55°C to +150°C. There are also extended range versions available.
Output Voltage: The output voltage of the LM35 changes at a rate of 10 mV per degree
Celsius change in temperature. This linear relationship simplifies the conversion of the analog
output to temperature readings.
Accuracy: The LM35 is known for its relatively high accuracy compared to some other
temperature sensors. Its typical accuracy is around ±0.5°C at room temperature.
Supply Voltage: The LM35 can be powered using a wide range of supply voltages, typically
from 4V to 30V. This flexibility makes it compatible with various microcontrollers and analog
systems.
Calibration: While the LM35 provides good accuracy, it's a good practice to calibrate the
sensor if precise temperature measurements are required. Calibration involves comparing the
sensor's output to a known reference temperature.
Analog Output: The LM35 produces an analog voltage output, which means it can be read
directly by analog-to-digital converters (ADCs) of microcontrollers or other analog systems.
Package Types: The LM35 sensor is available in different package types, including TO-92
(similar to a transistor package), making it easy to integrate into various circuits and
applications.
Applications: The LM35 sensor is widely used in applications that require temperature
monitoring and control. It can be found in weather stations, thermostats, industrial equipment,
automotive systems, and more.
Simplicity: The LM35 is relatively simple to use and requires minimal external components.
However, if higher accuracy or digital output is needed, more advanced temperature sensors
like the digital thermometers based on the DS18B20 sensor might be preferred.

D. MQ2 (Gas Sensor):


The MQ-2 gas sensor is a widely used module for detecting various gases in the
environment. It's commonly employed in applications that require gas detection and
monitoring, such as gas leakage detection, safety alarms, and environmental sensing.
Here are some key details about the MQ-2 gas sensor:

20DCE022 CE444: Internet of Things 13


Gas Detection: The MQ-2 sensor is designed to detect a range of gases, including but not
limited to methane, butane, LPG (liquefied petroleum gas), hydrogen, alcohol, smoke, and
various flammable and combustible gases.
Working Principle: The MQ-2 sensor operates on the principle of chemical resistance. It
contains a sensitive layer made of a metal oxide semiconductor that changes its electrical
conductivity when exposed to specific gases. Different gases cause different changes in
resistance.
Analog Output: The MQ-2 sensor provides an analog voltage output that is proportional to
the concentration of the detected gas. Higher gas concentrations result in higher analog voltage
levels.
Preheating: The sensor requires a warm-up or preheating time before it stabilizes and provides
accurate readings. This warm-up period is typically a few minutes.
Sensitivity Adjustment: Some versions of the MQ-2 sensor module include a potentiometer
to adjust the sensor's sensitivity. This allows you to fine-tune its response to different gas
concentrations.
Calibration: Calibration is important to ensure accurate gas concentration measurements.
Calibration involves correlating the sensor's analog output with known gas concentrations
under controlled conditions.
Cross-Sensitivity: One limitation of the MQ-2 sensor is its potential for cross-sensitivity to
multiple gases. The sensor's response to one gas can be affected by the presence of other gases.
Integration: The analog output of the MQ-2 sensor can be connected to an analog-to-digital
converter (ADC) on a microcontroller or other data acquisition systems. Some versions of the
sensor also offer digital outputs.
Applications: The MQ-2 gas sensor is commonly used in gas leak detection systems for
homes, factories, and commercial buildings. It's also used in safety alarms, fire detection
systems, automotive emissions monitoring, and air quality monitoring.
Safety Considerations: While the MQ-2 sensor can be useful for detecting potentially
hazardous gases, it's important to note that it might not be suitable for applications requiring
high precision or critical safety measurements. Adequate ventilation and safety measures
should be taken when dealing with potentially harmful gases.

E. Jumper Cable:
Jumper cables, also known as jumper wires or simply jumpers, are essential electronic
components used to create temporary connections between electronic components on
breadboards, circuit boards, or other prototyping platforms. They're commonly used in
electronics projects and experiments to establish electrical connections without the need for
soldering.
Here's some key information about jumper cables:
Purpose: Jumper cables are used to connect various components like microcontrollers, sensors,
LEDs, resistors, and other electronic elements on a breadboard or prototyping board. They
enable you to quickly prototype and test circuits.

20DCE022 CE444: Internet of Things 14


Types: Jumper cables come in various forms:
• Male-to-Male: Both ends have pins or connectors that can be inserted into female
headers or holes.
• Male-to-Female: One end has pins, and the other end has sockets or connectors to fit
onto male headers or pins.
• Female-to-Female: Both ends have sockets or connectors to attach to male headers or
pins.
Length and Flexibility: Jumper cables come in different lengths, typically ranging from a few
inches to several inches. Some are rigid, while others have flexible wires that make it easier to
route connections in tight spaces.
Colour Coding: Jumper cables are often color-coded to help identify connections. Common
colors include red for positive voltage, black or brown for ground, and other colors for various
signal lines.
Connector Types: Jumper cables usually have standard connectors like single-pin or multi-
pin male and female headers, commonly used in electronics prototyping.
Materials: The cables are typically made from flexible wires with insulated coatings. The
connectors can be made of plastic or metal, with some being designed for durability.
Reusable: Jumper cables are reusable components, allowing you to quickly modify and
rearrange your circuits as needed.
Breadboarding: Breadboards are often used in conjunction with jumper cables. The cables
connect components on the breadboard without the need for soldering, making experimentation
easier.
Applications: Jumper cables are widely used in educational settings, hobbyist projects, rapid
prototyping, and electronics experimentation.
Safety: When using jumper cables, ensure that you handle them carefully and avoid creating
short circuits that could damage components or devices.

F. Display:
In the realm of the Internet of Things (IoT), a variety of display technologies are utilized
to facilitate user interaction, data visualization, and feedback. The choice of display type often
depends on factors such as power consumption, visibility, form factor, and the specific
application's requirements.
Here are some common types of displays used in IoT devices:
OLED (Organic Light Emitting Diode) Displays: OLED displays are known for their vibrant
colours, high contrast ratios, and thin form factor. They emit light directly, which eliminates
the need for a backlight, resulting in energy efficiency. OLED displays are commonly found
in wearable devices, smartwatches, fitness trackers, and some industrial IoT applications.
AMOLED (Active Matrix Organic Light Emitting Diode) Displays: AMOLED displays
enhance the performance of OLED displays by incorporating an active matrix for better pixel

20DCE022 CE444: Internet of Things 15


control. They offer fast response times, high refresh rates, and deep blacks. AMOLED displays
are often used in premium smartphones, smartwatches, and virtual reality headsets.
TFT-LCD (Thin Film Transistor - Liquid Crystal Display) Displays: TFT-LCD displays
offer improved image quality and faster refresh rates compared to traditional LCDs. They are
commonly used in applications where colour reproduction and higher resolutions are essential.
TFT-LCD displays can be found in various IoT devices, including smart home control panels,
digital signage, and medical monitoring devices.
Flexible Displays: Flexible displays are capable of bending or curving to fit unconventional
form factors. These displays can be integrated into wearable devices, curved surfaces, and IoT
devices with unique designs.
LED Segment Displays: LED segment displays are commonly used for numerical or
alphanumeric information display. They consist of multiple LED segments that can be
individually controlled to display numbers, letters, or simple symbols. These displays are often
seen in IoT devices like digital clocks, temperature indicators, and numeric displays in
industrial settings.
Touchscreen Displays: Touchscreen displays combine a visual interface with touch-sensitive
capabilities, enabling direct user interaction. Capacitive and resistive touchscreens are
commonly used, allowing users to interact with the device using gestures, swipes, and touches.
Touchscreen displays are prevalent in smartphones, tablets, home automation panels, and
interactive kiosks.

G. Breadboard:
A breadboard, also known as a protoboard or solderless breadboard, is a fundamental
tool used in electronics for quickly and easily assembling and testing electronic circuits without
soldering. It's widely used by hobbyists, students, and professionals to prototype and
experiment with circuits before committing to a permanent design.
Here's an overview of what a breadboard is and how it's used:
Structure and Components: A typical breadboard consists of a rectangular plastic housing
with a grid of interconnected holes. These holes are arranged in rows and columns, and each
row is electrically connected while the columns are isolated from each other. The board
typically has two main sections separated by a gap in the middle: the terminal strips and the
main breadboard area.
Terminal Strips: The terminal strips are located on the sides of the breadboard and are used
for power distribution. They usually have multiple interconnected rows where you can insert
wires or components to provide power and ground connections. One side might be used for
power (usually red for positive and black for ground), and the other side for the opposite power
polarity.
Main Breadboard Area: The main area of the breadboard is where you place and connect
components to create your circuit. The holes in this area are interconnected in a specific pattern,
usually referred to as "tie points." These interconnected holes in a row are used to create
electrical connections between components.

20DCE022 CE444: Internet of Things 16


Inserting Components: To create a circuit on a breadboard, you insert the leads of components
(like resistors, LEDs, capacitors, etc.) into the interconnected holes. Components are placed
across the gap in the middle of the breadboard, with one lead on each side, allowing you to
connect them to different rows while still maintaining electrical connections.
Jumper Wires: Jumper wires are used to make connections between different rows and
columns on the breadboard. They allow you to create complex circuits by bridging various tie
points on the board.
Prototyping and Experimentation: Breadboards are essential for prototyping and testing
circuits before soldering components onto a printed circuit board (PCB). Since components can
be easily inserted, rearranged, and replaced, breadboards are great for iterative design and
troubleshooting.
Temporary Nature: It's important to note that breadboard connections are temporary and can
sometimes be less reliable than soldered connections. Vibrations or movement can lead to
intermittent connections. For permanent designs, components are usually soldered onto a PCB.
Compatibility: Breadboards are compatible with a wide range of electronic components, such
as resistors, capacitors, transistors, ICs (integrated circuits), LEDs, and more.
Conclusion: In this practical we learn about different types of sensor.
Grade:
Signature:
Remarks:

20DCE022 CE444: Internet of Things 17


PRACTICAL - 6
Aim: Develop a hardware and get temperature and humidity data using Mobile application.
a. ESP32.
b. DHT11/LM35.
c. Blynk IOT application.
Code:

const int analogIn = A0;


int humiditysensorOutput = 0;

int RawValue = 0;
double Voltage = 0;
double tempC = 0;
double tempF = 0;

void setup()
{
Serial.begin(9600);
pinMode(A1, INPUT);
}

void loop()
{

RawValue = analogRead(analogIn);
Voltage = (RawValue / 1023.0) * 5000;
tempC = (Voltage - 500) * 0.1;

Serial.print("Temperature in C = ");
Serial.print(tempC, 1);
humiditysensorOutput = analogRead(A1);
Serial.print("\t Humidity: ");
Serial.print(map(humiditysensorOutput, 0, 1023, 10, 70));
Serial.println("%");

delay(5000);
}

20DCE022 CE444: Internet of Things 18


Output:

Fig 6.1 Circuit Off

Fig 6.2 Circuit On

20DCE022 CE444: Internet of Things 19


Fig 6.3 Serial Monitor Output

Fig 6.4 Mobile Application Output


Conclusion: In this practical implement mobile application to display temperature and humidity data
using different types of sensors.
Grade:
Signature:
Remarks:

20DCE022 CE444: Internet of Things 20


PRACTICAL - 7
Aim: Study on MQTT protocol on cloud.
Theory:
Introduction:
MQTT is a lightweight open-source messaging network protocol that transports messages
between devices. It employs a publish/subscribe communication model to provide resource-
constrained network clients with a simple way to distribute telemetry information in low-
bandwidth environments.
MQTT was designed for connections with devices in remote locations where a “small code
footprint” is required or the network bandwidth is limited. It is a good choice for wireless networks
that experience varying levels of latency due to occasional bandwidth limitations or unreliable
connections.
MQTT started as an IBM proprietary protocol used to communicate with SCADA systems in
the Oil and Gas industry. It is now an open-source protocol that is overseen by the Organization
for the Advancement of Structured Information Standards (OASIS). The MQ in MQTT stands for
“Message Queuing”; however, there is no message queuing in MQTT communication anymore.
The protocol now provides publish-and-subscribe messaging and has become popular with smart
automation systems.
Today, MQTT is one of the leading open-source protocols used in fog and edge computing,
and for connecting the Internet of Things (IoT). In addition to MQTT, there are other popular
messaging protocols that support IoT applications. These include Advanced Message Queuing
Protocol (AMQP), Constrained Application Protocol (CoAP), Extensible Messaging and Presence
Protocol (XMPP), Data Distribution Service (DDS), ZigBee, and Z-Wave.
MQTT architecture and protocol overview:
MQTT is a very simple publish/subscribe protocol designed for lightweight machine-to-
machine (M2M) communications. The MQTT architecture is made up of the following key parts:
MQTT broker and MQTT client.
MQTT broker (server): An MQTT broker or server is software running on a computer that
receives messages from external sources–publishers, and then routes them to the appropriate
destination-– subscribers. The computer can be a Raspberry Pi, an on-premise desktop PC, or a
cloud-based server running open-source or proprietary software. One of the most popular open-
source message brokers is the Mosquito broker. You can have your own instance of Mosquito
running on your own PC. But rather than using the Mosquito on a local PC, there are readily
available cloud-based servers such as Eclipse IoT, ThingMQ, CloudMQTT, and Heroku that
implement the Mosquito broker. They’re particularly useful in situations where you want your
IoT projects to be controllable over the Internet.
Depending on the implementation, a broker can manage up to thousands of simultaneously
connected MQTT clients. Therefore, when choosing an MQTT broker, you should consider
factors such as scalability and integration. In addition to receiving and routing messages to clients,
the broker also delivers other capabilities such as:

20DCE022 CE444: Internet of Things 21


Quality of Service (QoS): The QoS feature allows the MQTT protocol to provide additional
messaging qualities of service that ensure that the message in transit is delivered as required by
the service.
Store and Forward: Just as the name implies, MQTT provides support for storing persistent
messages on the broker.
Security: MQTT broker may require username and password authentication from clients to
connect for security. To ensure the privacy of messages in transit, the TCP connection may be
encrypted with SSL/TLS.
MQTT client (publishers and subscribers): MQTT clients can be any device or application
ranging from a simple Arduino microcontroller to a full cloud-hosted application server that runs
an MQTT library and connects to an MQTT broker over a network. MQTT clients can be either a
publisher, a subscriber, or both. These two functions can be implemented in the same MQTT
client.

Fig 7.1 MQTT Working Principle

How MQTT publish-subscribe model works:

MQTT’s communication model avoids direct connections between devices by relaying data
through a central server called the broker. This is really desirable in IoT because it’s easy to add
new devices without touching the existing infrastructure, and since new devices only need to
communicate with the broker, they don’t actually need to be compatible with the other clients.

When a device (or client) wants to send data to a server (or broker) it is called a publish. When
the operation is reversed, it is called a subscribe. Multiple clients can connect to the broker and
subscribe to topics that they are interested in. Clients can also publish messages to specific topics
of their interest through the broker. The broker is a common interface for devices to connect to,
and exchange, data.

20DCE022 CE444: Internet of Things 22


The publish/subscribe messaging model works somewhat like a TV station. A TV station
broadcasts a TV program using a specific channel and a viewer tunes into that channel to view the
broadcast. There is no direct connection between the broadcast station and the viewer.

Another useful analogy is the post office, where instead of a device sending messages directly
to the recipient device(s) as in a peer-peer connection, they are sent to the post office (the broker),
and the broker forwards it to everyone that needs that message. The big difference is that MQTT
doesn’t use the address of the intended recipient, rather it uses a subject line called the ‘topic”. If
anyone wants a copy of that message, all they need do is to subscribe to that topic. And if a broker
receives a message on a topic for which there are no current subscribers, the broker discards the
message unless the publisher of the message designated the message as a retained message.

For example, let’s say you have a setup where a humidity sensor needs to send its readings to
the broker. And on the other end, a computer and a mobile device need to receive this humidity
value. In order to get the readings across to the receiving devices, the MQTT publish/subscribe
data flow process goes through the following steps:

Firstly, the humidity sensor defines the topic it wants to publish on, in this case, “Humidity”.
Then, it publishes the message “humidity value”. Secondly, the computer and mobile device at
the receiving end subscribes to the topic “Humidity”. This enables them to receive the message
that the humidity sensor has published–humidity value. As stated earlier, the role of the broker
here is to take the message “humidity value” and deliver it to the receiving computer and mobile
device

Fig 7.2 MQTT for Humidity Sensor.


Conclusion: In this practical we learn about MQTT protocol and its architecture.
Grade:
Signature:
Remarks:

20DCE022 CE444: Internet of Things 23


PRACTICAL - 8
Aim: Study on Raspberry pi hardware.
Theory:
Introduction:
The Raspberry Pi is a series of small, affordable, single-board computers (SBCs) developed by
the Raspberry Pi Foundation. These computers are designed for educational purposes, tinkering,
and various practical applications. Raspberry Pi hardware has evolved over the years, with
multiple models offering different capabilities.

Fig 8.1 Raspberry Pi Hardware


Here's an overview of the hardware components and features commonly found in Raspberry Pi
boards:
Processor (CPU): Raspberry Pi boards typically use ARM-based processors. The specific CPU
model varies between different generations and models. The more recent models, like the
Raspberry Pi 4 and Raspberry Pi 400, feature quad-core processors with higher clock speeds,
offering improved performance.
Memory (RAM): Raspberry Pi boards come with varying amounts of RAM, with models ranging
from 256MB to 8GB. More RAM allows for better multitasking and performance for applications.
Storage: Raspberry Pi boards do not have built-in storage. Instead, they use microSD cards for
the operating system and data storage. Some models also feature USB ports for connecting
external storage devices like USB flash drives or external hard drives.
Video Output: Raspberry Pi boards typically include HDMI ports for connecting to displays or
monitors. Older models may have composite video output for older TVs.
Audio Output: Raspberry Pi boards feature audio output via HDMI or a 3.5mm audio jack.

20DCE022 CE444: Internet of Things 24


USB Ports: Raspberry Pi boards have USB ports for connecting peripherals such as keyboards,
mice, webcams, and USB storage devices. The number of USB ports may vary between models,
with newer models having more ports, including USB 3.0.
Network Connectivity: Most Raspberry Pi boards have an Ethernet port for wired network
connections. Some models, like the Raspberry Pi 4, also have built-in Wi-Fi and Bluetooth
capabilities.
GPIO (General-Purpose Input/Output):
Raspberry Pi boards include a GPIO header with multiple pins for hardware interfacing and DIY
projects. These pins can be programmed to control and interact with external hardware
components like sensors, LEDs, and motors.
Power Supply: Raspberry Pi boards require a micro-USB or USB-C power supply, depending on
the model. Power requirements vary between models, so it's important to use the correct power
adapter.
Operating System (OS): Raspberry Pi boards typically run a variety of Linux-based operating
systems, including Raspberry Pi OS (formerly Raspbian) and third-party distributions. You can
install different operating systems on a microSD card and boot the Raspberry Pi from it.
Form Factor: Raspberry Pi boards have a credit card-sized form factor, making them compact
and portable. Some models, like the Raspberry Pi Zero, are even smaller.
Accessories: To use a Raspberry Pi, you'll need additional accessories like a power supply,
microSD card, keyboard, mouse, and monitor.
Camera and Display Ports (on some models): Certain Raspberry Pi models have dedicated CSI
(Camera Serial Interface) and DSI (Display Serial Interface) connectors for attaching camera
modules and displays.
Cooling: Depending on usage, some Raspberry Pi boards may benefit from passive or active
cooling solutions to prevent overheating.
Expansion Boards (HATs): Raspberry Pi HATs (Hardware Attached on Top) are add-on boards
that can extend the functionality of a Raspberry Pi. They connect to the GPIO header and offer
features like additional sensors, motor drivers, and more.
Conclusion: In this practical we learn about Raspberry Pi hardware and its characteristics and working
principle.
Grade:
Signature:
Remarks:

20DCE022 CE444: Internet of Things 25


PRACTICAL - 9
Aim: Implement MQTT protocol using Raspberry pi using cloud platform.
Theory:
Introduction:
The Raspberry Pi is a series of small, affordable, single-board computers (SBCs) developed by
the Raspberry Pi Foundation. These computers are designed for educational purposes, tinkering,
and various practical applications. Raspberry Pi hardware has evolved over the years, with
multiple models offering different capabilities.
Gateway to cloud demonstration:
A gateway is a device that connects its client devices to Cloud IoT Core and performs several
tasks on their behalf, such as:
• Communicating with Cloud IoT Core
• Connecting to the internet when the device can't directly connect itself, such as a ZigBee
or Bluetooth device
• Authenticating to Cloud IoT Core when the device can't send its own credentials, or when
you want to add a layer of security by using the credentials of both the device and the
gateway
• Publishing telemetry events, getting configuration data or setting device state
• Storing and processing data
• Translating protocols, you can manage gateways in the same way as any other device: they
can publish their own telemetry data, report state, and receive configuration data. Cloud
IoT Core supports gateway connections and communication over both MQTT and HTTP.
You can manage gateways in the same way as any other device: they can publish their own
telemetry data, report state, and receive configuration data. Cloud IoT Core supports gateway
connections and communication over both MQTT and HTTP.

Fig 9.1 Google Cloud Platform

20DCE022 CE444: Internet of Things 26


Step-1: Creating the topic:
The first step is to create a Topic in Google Pub/Sub so that we can publish messages to that
topic.

Fig 9.2 Creating the topic


Step-2: Set up the trigger:
Navigate inside the created topic (Test_Topic) and click on the “Trigger Google Function”
option. It will let you create a Google Function with the created topic as the trigger.

Fig 9.3 Set up the trigger

20DCE022 CE444: Internet of Things 27


Step-3: Create the Google function (print_message_pubsub_test):
The first screen lets you name the Google function and set up the topic as the trigger. We
will be using Python to create the function that simply captures the pushed data and send them
to Webhook.site.
Also, we’ll be utilizing the requests library to create a POST request to send the data.

Fig 9.4 Create the Google function (print_message_pubsub_test)

import base64
import requests

def get_quote(event, context):


message = base64.b64decode(event['data']).decode('utf-8')
url = "https://webhook.site/xxxxxxx-xxxx-xxxx-xxxx-739c28ebd7ad"
request_headers = {"Content-type": "application/json"}
request_data = {"quote": message}
response = requests.post(url, data=request_data,headers=request_headers)
print(response.status_code)
print(response.text)

Once the function is deployed successfully, you will notice that it indicates the Test_Topic
as the trigger for the function.

20DCE022 CE444: Internet of Things 28


Fig 9.5 print_message_pubsub_test
Step-4: Set up the publisher:
In this step, let’s create a simple Python program to act as the publisher. We will utilize
the google cloud pubsub_v1 library to create a Publisher client and get a random inspirational
quote from quotable.io. Then we will publish a concatenated string of the author and quote to
the topic (Test_Topic)

from google.oauth2 import service_account


from google.cloud import pubsub_v1
import requests
# Create Authentication Credentials
project_id = "test-applications-xxxxx"
topic_id = "Test_Topic"
gcp_credentials = service_account.Credentials.from_service_account_file('test-
applications- xxxx-xxxxxxxxxx.json')
# Create Publisher Client
publisher = pubsub_v1.PublisherClient(credentials=gcp_credentials)
topic_path = publisher.topic_path(project_id, topic_id)
# Get a Random Quote
response = requests.get("https://api.quotable.io/random")
json_response = response.json()
message = f"{json_response['author']} - {json_response['content']}"# Publish the Message
data = message.encode("utf-8")
future = publisher.publish(topic_path, data)# Print Result
print(f"Published messages to {topic_path} - {future.result()}.")

When we run the “message_publish” script, it will publish the data to the Test_Topic and
trigger the Google Cloud Function (print_message_pubsub_test), which will send the data to
the Webhook site. We can see the messages published to the topic within the Pub/Sub topic

20DCE022 CE444: Internet of Things 29


Fig 9.6 Messages
We can see all the messages that were received by the Webhook.site as shown below.

Fig 9.7 Messages on Site


Conclusion: In this practical we implement MQTT protocol on cloud platform using raspberry pi
hardware.
Grade:
Signature:
Remarks:

20DCE022 CE444: Internet of Things 30


PRACTICAL - 10
Aim: Introduction to Jetson Nano Hardware.
Theory:
Introduction:
The Jetson Nano is a compact and affordable single-board computer (SBC) developed by
NVIDIA, designed for AI (artificial intelligence) and robotics applications. It is part of the Jetson
family of products, which includes more powerful devices like the Jetson Xavier and Jetson AGX
Xavier, but the Nano is an excellent choice for hobbyists, students, and developers who want to
experiment with AI and machine learning on a budget.

Fig 10.1 Jetson Nano


Here's an introduction to the hardware of the Jetson Nano:
CPU and GPU: The Jetson Nano features a quad-core ARM Cortex-A57 CPU and a Maxwell-
based NVIDIA GPU with 128 CUDA cores. This combination provides a good balance of
processing power for AI workloads.
Memory: It comes with 4GB of LPDDR4 RAM, which is sufficient for many AI and robotics
tasks.
Storage: The board includes a microSD card slot for storage. You can install the operating system
and store data on a microSD card.
Connectivity: The Jetson Nano has various connectivity options, including:
Gigabit Ethernet: For high-speed network connections.

20DCE022 CE444: Internet of Things 31


Wi-Fi (optional): You can add Wi-Fi connectivity via a USB Wi-Fi dongle.
Bluetooth (optional): You can add Bluetooth support via a USB Bluetooth dongle.
USB ports: It has four USB 3.0 ports for connecting peripherals like a keyboard, mouse, or
camera.
Display Output: It supports HDMI and DisplayPort for connecting to displays, making it suitable
for applications that require visual outputs.
Camera Interface: The Jetson Nano features a MIPI CSI-2 (Camera Serial Interface 2) connector,
which allows you to connect compatible cameras for computer vision applications.
GPIO and Expansion Header: The board has a 40-pin GPIO header, similar to the Raspberry
Pi, which allows for hardware interfacing and customization.
Power Supply: The board is powered via a 5V/4A DC input. You can use a standard 5V power
adapter to power the Jetson Nano.
Operating System: NVIDIA provides a custom Ubuntu-based Linux distribution for the Jetson
Nano, which includes the necessary libraries and tools for AI development.
AI and Deep Learning: The Jetson Nano is optimized for AI and deep learning workloads, thanks
to its GPU and NVIDIA's software libraries like CUDA and cuDNN. You can run popular deep
learning frameworks like TensorFlow, PyTorch, and Caffe on it.
AI Software Support: NVIDIA also provides JetPack, a software development kit (SDK) that
includes libraries and tools for building and deploying AI applications on the Jetson Nano.
Form Factor: The Jetson Nano comes in a compact form factor, making it suitable for integration
into various projects and robotics platforms.
The Jetson Nano is a versatile and powerful SBC for AI and robotics enthusiasts, offering a
balance between affordability and performance. It has gained popularity in the maker and
developer communities for its ability to handle AI workloads efficiently while being cost-
effective.
Conclusion: In this practical we learn about Jetson Nano hardware and its characteristics and working
principle.
Grade:
Signature:
Remarks:

20DCE022 CE444: Internet of Things 32


PRACTICAL - 11
Project: Project: Sign Language Recognition
Introduction:

• A Sign Language Recognition Deep Learning Model Solution is a comprehensive system


designed to understand and interpret sign language gestures, making communication more
accessible for Deaf-mute individuals and bridging the gap between the Deaf and hearing
communities.

Problem statement:

• Recent studies show that up to 2% to 3% of the Indian population suffers a degree of speech,
language or communication need.
• Only a very small fraction (0.25%) of Deaf individuals have access to education that
prioritizes sign language, which is crucial for communication within the Deaf community.
Additionally, there's a severe shortage of registered interpreters, with only 250 available for
the 18 million Deaf people in India. A Sign Language Recognition .

Technology stack:
• Windows 10+ OS
• Python 3.9+
• Tensorflow 1.5.1
• Mediapipe

DEPENDENCIES:

• OpenCV: For image and video preprocessing tasks.


• NumPy: For numerical operations and data manipulation.
• Pandas: For data loading and manipulation.
• Scikit-learn: For evaluation metrics and data preprocessing.
• Matplotlib or Seaborn: For data visualization.

Use cases:
• Communication for Deaf-mute Individuals
• Sign Language Accessibility in Media
• Job Accessibility
• Medical Interpreting
• Emergency Services.

20DCE022 CE444: Internet of Things 33


Solution:

• the process of sign language recognition using deep learning involves collecting keypoints
with MediaPipe Holistic, training a neural network with LSTM layers to understand
sequential data, and performing real-time detection with OpenCV.
• This technology has the potential to enhance communication and accessibility for the
hearing-impaired community, making communication more inclusive and efficient.

20DCE022 CE444: Internet of Things 34

You might also like