0% found this document useful (0 votes)
25 views41 pages

218R1A0433

kghk

Uploaded by

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

218R1A0433

kghk

Uploaded by

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

A

Internship Report On

“INTERNET OF THINGS”

BACHELOR OF TECHNOLOGY

In

ELECTRONICS AND COMMUNICATION ENGINEERING

By
Nandhini Gudime
218R1A0433

Submitted to
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

SAI RAJESWARI INSTITUTE OF TECHNOLOGY


(Affiliated To J.N.T.U Anantapuramu)

PRODDATUR – 516 362

2024-25
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
SAI RAJESWARI INSTITUTE OF TECHNOLOGY
(Affiliated To J.N.T.A University, Anantapuramu ,PRODDATUR – 516 362

CERTIFICATE

This is to certify that the Internship report entitled “INTERNET OF THINGS” is a


bonafide record submitted by Nandhini Gudime bearing Reg. No. 218R1A0433 in
Electronics and Communication Engineering for the academic year 2024-2025.

SENIOR FACULTY : HEAD OF THE DEPARTMENT


Mr. H RAGHUNATHA RAO M. Tech Dr. D SIVA M. Tech, Ph.D
Assistant Professor , Professor,

Dept.of ECE , Dept.of ECE,

SRIT SRIT
ACKLOWLEDGEMENT
An Endeavour of a long period can be successful only with the advice of many well wishers. I take
this opportunity to express my deep gratitude and appreciation to all those who encouraged for
successful completion of the Internship work.

I would like to thank Director of EXCELR Company for giving me the opportunity to do an internship within the

organization.

I deeply express my heartily gratitude and thanks to Mr. H Raghunatha Rao ,Internship Co-
Ordinator and all the faculty members of E.C.E for their valuable guidance, enriching thoughts and profound
knowledge, which brought my internship work completion.

My Special thanks to Dr. D SIVA M.Tech,,Ph.D, Head of Electronics & Communication Engineering
Department, Sai Rajeswari Institute of Technology, Proddatur. During the progress of Internship work, for
his timely suggestions and help inspite of his busy schedule.

I wish to express my sincere gratitude to Dr. PANDURANGAN RAVI Ph. D, Principal of Sai
Rajeswari Institute of Technology, Proddatur for his consistent help and encouragement to complete

I am very much thankful to Sri. B VEERA KALYAN REDDY, Hon’ Secretary and Correspondent

of Sai Rajeswari Educational trust for their help in providing good facilities in our college

Finally, I wish to convey my gratitude and express sincere thanks to all I.R.C (Internship Review
Committee) members, friends and lab technicians, one and all who have helped to complete the
Internship work successful.

INTERNSHIP ASSOCIATE

Nandhini Gudime

218R1A0433
ABSTRACT
The Internet of Things (IoT) refers to a network of interconnected devices that communicate and share
data with each other through the internet. These devices can range from everyday household items like
smart thermostats and home security systems to complex industrial machinery and medical equipment.
The core idea of IoT is to enhance the functionality and automation of devices by enabling them to
collect, exchange, and analyze data.

IoT technology relies on sensors, actuators, and communication protocols to transmit data. This data
can be used for various applications, such as improving energy efficiency, automating processes,
enhancing health monitoring, and optimizing logistics. With the integration of IoT, systems can make
intelligent decisions based on real-time data, leading to more efficient, responsive, and user-centric
experiences.

The significance of IoT lies in its potential to transform industries by enabling predictive maintenance,
smart cities, precision agriculture, and remote patient monitoring, among others. Despite its numerous
benefits, IoT faces challenges such as security vulnerabilities, data privacy concerns, and the need for
standardized protocols to ensure compatibility between devices. As IoT technology continues to evolve,
its role in shaping a connected and automated future becomes more prominent, promising enhanced
convenience, efficiency, and innovation across multiple sectors.
INDEX

S No Title Page No
ABSTRACT
Learning Objectives/Internship Objectives

WEEKLY OVERVIEW OF INTERNSHIP ACTIVITIES


CHAPTER-1
1 Introduction to Internet of Things (IoT) 1
CHAPTER-2
2 Introduction to Arduino 8-bit Microcontroller 2-3
CHAPTER-3
3
Proximity sensors 3-4
CHAPTER-4
4 Humidity and Temperature Sensors 4 -5
CHAPTER-5
5 Bluetooth Connection and Characters from 5-7
Arduino
CHAPTER-6
6 Introduction to Android Application Development 7-8
CHAPTER-7

7 Connecting DHT Sensor 9-10


CHAPTER-8
8 Introduction to HTML 11-12
CHAPTER-9
9 Programming ESP8266 Module through 13-15
Arduino
CHAPTER-10
10 NODEMCU - Open Source IoT Platform 16-17
CHAPTER-11
11 Interfacing DHT11 with ESP8266 NodeMCU 18-21
Using Web Server
CHAPTER-12

12 Introduction to Raspberry Pi 22-23

CHAPTER-13
13 Setting up Raspberry Pi 24-25
CHAPTER-14
14 MQTT and Mosquitto 26
15 Conclusion 27
16 Reference 28
INTERNET OF THINGS

CHAPTER – 1

Introduction to Internet of Things (IoT)


This The Internet of Things (IoT) stands as a transformative force, weaving a
digital fabric around our physical world. It's a dynamic network, where everyday
objects, empowered with sensors, software, and connectivity, seamlessly
communicate and exchange data over the vast expanse of the internet. At its heart are
the humble yet indispensable components: sensors and actuators. Sensors, the keen
observers of the environment, capture a multitude of data points—temperature
fluctuations, ambient light levels, motion patterns, and beyond.

Fig 1: IOT

Yet, the journey of data does not end at transmission. It embarks on a


transformative voyage through the realms of processing and storage, where raw data
is distilled into actionable insights. This processing may occur locally, within the
confines of the device itself, or on robust cloud-based platforms, harnessing the
computational prowess of remote servers and algorithms. These insights, in turn, fuel

Dept.of ECE, SRIT, PDTR Page 1


INTERNET OF THINGS

the engines of innovation, powering a myriad of applications and services that


permeate our lives.

CHAPTER - 2 Introduction to Arduino


8-bit Micro Controller
Arduino 8-bit Microcontrollers are foundational components in the landscape
of IoT (Internet of Things) development. These small yet powerful devices serve as
the brain of many IoT projects, enabling them to sense, process, and respond to data
in real-time. At the heart of Arduino's appeal lies its accessibility and versatility,
making it a popular choice for hobbyists, students, and professionals alike.
Equipped with a wide array of inputs and outputs, Arduino microcontrollers
can interface with an extensive range of sensors, actuators, and other peripherals,
allowing them to gather data from the physical world and enact changes in response.
This capability is fundamental to IoT applications, where the seamless integration of
hardware and software is paramount.

Fig 2: Arduino language


One of the defining features of Arduino is its user-friendly development
environment. With a simple yet powerful integrated development environment (IDE)

Dept.of ECE, SRIT, PDTR Page 2


INTERNET OF THINGS

and a vast ecosystem of libraries and resources, even those with minimal
programming experience can quickly bring their IoT ideas to life. This accessibility
lowers the barrier to entry for IoT innovation, empowering individuals from diverse
backgrounds to participate in the burgeoning field.

Chapter – 3 Proximity Sensors


Proximity sensors play a crucial role in the realm of IoT (Internet of Things),
enabling devices to detect the presence or absence of nearby objects or individuals without
physical contact. These sensors function by emitting electromagnetic fields or beams and
measuring changes in their properties, such as reflection, capacitance, or inductance, to
determine proximity.

In IoT applications, proximity sensors find diverse uses across various industries and
scenarios:

Smart Home Automation: Proximity sensors are employed in smart home devices to detect
human presence and activity. For instance, they can automatically turn on lights when
someone enters a room or adjust thermostats based on occupancy, enhancing energy
efficiency and user convenience.

Security Systems: In security systems, proximity sensors serve as a crucial component for
intrusion detection. They can trigger alarms or notifications when unauthorized individuals
approach restricted areas, helping to deter potential threats and enhance safety.

Dept.of ECE, SRIT, PDTR Page 3


INTERNET OF THINGS

Fig 3: Proximity Sensor


Industrial Automation: Proximity sensors are integral to industrial automation processes,
where they facilitate object detection, positioning, and conveyor belt control. They can detect
the presence of objects on assembly lines, trigger robotic actions, or ensure precise
positioning of machinery components.

CHAPTER – 4

Humidity and Temperature Sensors


Humidity and temperature sensors are fundamental components in IoT (Internet of
Things) systems, providing essential data for various applications across different industries.

These sensors enable devices to monitor and respond to changes in environmental conditions,

ensuring optimal performance, comfort, and safety. Here's how humidity and temperature

sensors contribute to IoT:

Indoor Climate Control: In smart homes and buildings, humidity and temperature sensors

play a key role in climate control systems. By continuously monitoring indoor conditions,

these sensors enable HVAC (Heating, Ventilation, and Air Conditioning) systems to adjust

Dept.of ECE, SRIT, PDTR Page 4


INTERNET OF THINGS

settings automatically, maintaining comfortable and healthy environments while optimizing

energy efficiency.

Fig 4: Arduino with sensor


Food and Beverage Industry: Humidity and temperature sensors are critical in food storage

and processing facilities. They help ensure that perishable goods are stored at the correct

temperature and humidity levels to prevent spoilage and maintain product quality.

CHAPTER – 5

Bluetooth Connection and Characters


from Arduino
Bluetooth connection and communication with Arduino boards are integral parts
of many IoT (Internet of Things) projects, enabling wireless data exchange between
Arduino devices and other Bluetooth-enabled devices such as smartphones, tablets, or
computers. Here's how Bluetooth connection and character communication with Arduino
contribute to IoT applications:

Dept.of ECE, SRIT, PDTR Page 5


INTERNET OF THINGS

Wireless Connectivity: Bluetooth technology allows Arduino boards to communicate


wirelessly with other devices over short distances. This wireless connectivity eliminates the
need for physical cables, making IoT systems more flexible and adaptable to various
deployment scenarios.

Sensor Data Transmission: Arduino boards equipped with sensors, such as temperature,
humidity, or motion sensors, can collect data from the environment and transmit it
wirelessly via Bluetooth. This allows real-time monitoring and analysis of environmental
conditions in IoT applications such as smart homes, environmental monitoring, and
industrial automation.
Control and Actuation: Bluetooth communication enables remote control and actuation
of Arduino-based devices. For example, Arduino-controlled actuators or motors can be
wirelessly controlled from a smartphone app or computer using Bluetooth commands.
This capability is useful in IoT applications like home automation, robotics, and smart
agriculture.
User Interface: Bluetooth connection facilitates interaction with Arduino devices
through user-friendly interfaces on Bluetooth-enabled devices such as smartphones or
tablets. Users can configure settings, monitor data, and receive notifications from
Arduino-based

IoT systems via Bluetooth-connected apps or web interfaces.

Data Logging and Visualization: Arduino boards can transmit sensor data to
Bluetoothenabled devices for logging and visualization. This allows users to analyse
historical data trends, generate reports, and make informed decisions based on real-time and
historical data. Data logging and visualization are essential for IoT applications like
environmental monitoring, energy management, and healthcare.

Dept.of ECE, SRIT, PDTR Page 6


INTERNET OF THINGS

Prototyping and Development: Bluetooth communication with Arduino boards


simplifies prototyping and development of IoT solutions. Developers can quickly iterate
and test their ideas by wirelessly connecting Arduino devices to smartphones or
computers for debugging, programming, and monitoring purposes.

Bluetooth connection and character communication with Arduino boards enhance the
capabilities of IoT systems by providing wireless connectivity, sensor data transmission,
remote control, user interaction, data logging, and prototyping support. By leveraging
Bluetooth technology, Arduino-based IoT projects can be more versatile, accessible, and
userfriendly, opening up opportunities for innovation and deployment in various domains.

CHAPTER – 6

Introduction to Android Application Development


Android application development plays a pivotal role in the realm of IoT (Internet of
Things), enabling users to interact with and control connected devices from their
smartphones or tablets. These applications serve as a gateway for users to access, monitor,
and manage IoT devices, offering a seamless and intuitive user experience. Here's an
introduction to Android application development in IoT:

User Interface: Android applications provide a user-friendly interface for interacting with
IoT devices. Through well-designed layouts, intuitive navigation, and interactive elements,
users can easily access device controls, view real-time data, and configure settings.

Device Integration: Android applications facilitate the integration of IoT devices into a
unified ecosystem. By leveraging APIs (Application Programming Interfaces) and SDKs
(Software Development Kits) provided by device manufacturers or IoT platforms,

Dept.of ECE, SRIT, PDTR Page 7


INTERNET OF THINGS

developers can enable seamless communication between Android devices and IoT devices,
allowing for data exchange and command execution.

Remote Control: Android applications enable users to remotely control IoT devices from
anywhere with an internet connection. Whether it's turning on smart lights, adjusting
thermostat settings, or monitoring security cameras, users can perform actions on their IoT
devices conveniently from their Android devices.

Data Visualization: Android applications allow users to visualize data collected from IoT
devices in meaningful ways. Through charts, graphs, and dashboards, users can gain insights
into environmental conditions, energy usage, or other relevant metrics, empowering them to
make informed decisions and optimize device settings.

Notifications and Alerts: Android applications can send notifications and alerts to users
based on events or conditions detected by IoT devices. Whether it's detecting motion,
monitoring temperature thresholds, or alerting about low battery levels, notifications keep
users informed and enable timely responses to potential issues.

Customization and Personalization: Android applications offer customization options to


tailor the user experience according to individual preferences. Users can customize device
settings, create schedules, or define automation rules to suit their specific needs and routines,
enhancing convenience and personalization in IoT applications.

Security: Android application development in IoT emphasizes security measures to protect


user data and ensure the integrity of IoT systems. By implementing secure communication
protocols, encryption, and authentication mechanisms, developers mitigate security risks and
safeguard against unauthorized access or data breaches.

Dept.of ECE, SRIT, PDTR Page 8


INTERNET OF THINGS

Android application development plays a critical role in enabling seamless interaction


and control of IoT devices. Through intuitive user interfaces, remote control capabilities,
data visualization, and security measures, Android applications enhance the usability,
functionality, and security of IoT solutions, driving innovation and adoption in diverse IoT
applications and industries

Dept.of ECE, SRIT, PDTR Page 9


INTERNET OF THINGS

CHAPTER – 7

Connecting DHT Sensor


Connecting a DHT (Digital Humidity and Temperature) sensor in an IoT (Internet of
Things) project typically involves interfacing the sensor with a microcontroller, such as an
Arduino, and transmitting the sensor data to an IoT platform or application for further
processing and analysis. Here's a basic guide on how to connect a DHT sensor in an IoT
setup:

Selecting the DHT Sensor: Choose a DHT sensor suitable for your project requirements.
DHT11 and DHT22 are common options, offering varying levels of accuracy and operating
ranges.

Hardware Setup: Connect the DHT sensor to your microcontroller according to its pinout.
Typically, the sensor requires connections for power (VCC), ground (GND), and data (OUT).
For Arduino, connect the VCC pin of the DHT sensor to the 5V pin of the Arduino, the GND
pin to the ground (GND) pin of the Arduino, and the data pin to any digital input/output
(GPIO) pin of the Arduino.

Dept.of ECE, SRIT, PDTR


INTERNET OF THINGS
Page

Fig 5: Connecting DHT Sensor with Arduino

Coding: Write a firmware program for the microcontroller to read data from the DHT
sensor. For Arduino, you can use the DHT library, which provides functions to read
humidity and temperature data from the sensor. Install the library if you haven't already.

Initialize the sensor in your Arduino sketch and specify the pin connected to the sensor. Use
library functions to read humidity and temperature values from the sensor. Optionally, you
can display the sensor data on an LCD display or serial monitor for testing purposes.

Testing: Upload the firmware code to your microcontroller. Verify that the sensor is
functioning correctly by monitoring the serial output or any connected display for humidity
and temperature readings. Ensure that the sensor readings are within expected ranges and
respond appropriately to changes in environmental conditions.

Integration with IoT Platform: Once the sensor is reading data reliably, integrate it with
your chosen IoT platform or application. Establish communication between the
microcontroller and the IoT platform using suitable communication protocols such as Wi-Fi,
Ethernet, or GSM.
Send the sensor data to the IoT platform at regular intervals or in response to specific events.
Configure the IoT platform to receive, process, and visualize the sensor data, enabling
realtime monitoring and analysis.

Security Considerations: Implement security measures to protect data transmission between


the microcontroller and the IoT platform, such as encryption and authentication. Ensure that
sensitive information is handled securely to prevent unauthorized access or data breaches.

By following these steps, you can successfully connect a DHT sensor in an IoT
project, enabling you to monitor humidity and temperature levels remotely and take
appropriate actions based on the sensor data.
INTERNET OF THINGS
Dept.of ECE, SRIT, PDTR Page 10

CHAPTER – 8

Introduction to HTML
HTML (Hypertext Markup Language) serves as the foundation for creating web pages in the
interface of IoT (Internet of Things) applications, providing structure and content to webbased
user interfaces. Here's an introduction to HTML for creating web pages in the interface of
IoT:

Structure: HTML defines the structure of a web page using elements such as <html>,
<head>, and <body>. These elements encapsulate different parts of the page, including
metadata, scripts, and content.

Content: HTML allows you to add various types of content to your web pages, including
text, images, videos, and hyperlinks. Content is enclosed within appropriate HTML tags, such
as <p> for paragraphs, <img> for images, and <a> for links.

Forms: HTML provides form elements (<form>, <input>, <button>, etc.) for capturing user
input. Forms are essential for IoT applications, allowing users to interact with devices by
entering data or selecting options.

Styling: While HTML defines the structure and content of a web page, styling is achieved
using CSS (Cascading Style Sheets). CSS allows you to control the appearance and layout of
HTML elements, including colors, fonts, margins, and positioning.

Scripting: HTML can incorporate client-side scripting languages like JavaScript to add
interactivity and dynamic behavior to web pages. JavaScript enables features such as form
validation, event handling, and asynchronous communication with IoT devices or servers.

Responsive Design: With the proliferation of various devices and screen sizes, it's crucial to
create web pages that adapt to different viewport sizes. HTML supports responsive design
INTERNET OF THINGS
principles, allowing you to create flexible and adaptive layouts using techniques like media
queries and flexible grid systems.

Dept.of ECE, SRIT, PDTR Page 11


INTERNET OF THINGS
Accessibility: HTML includes features for enhancing web accessibility, ensuring that web
content is usable by people with disabilities. Semantic HTML elements, proper use of
headings and landmarks, and attributes like alt for images contribute to improved
accessibility.

In the context of IoT, HTML is used to create user interfaces for monitoring and
controlling connected devices through web browsers. These interfaces enable users to interact
with IoT systems, view sensor data, adjust settings, and receive notifications. By leveraging
HTML, CSS, and JavaScript, IoT applications can deliver intuitive and responsive web
interfaces that enhance user experiences and facilitate seamless integration with IoT devices
and services. HTML serves as the backbone of web-based interfaces in IoT applications,
providing the necessary structure, content, and interactivity to create engaging and functional
user experiences. Combined with CSS and JavaScript, HTML enables the creation of
powerful and versatile interfaces that bridge the gap between users and IoT systems.

Dept.of ECE, SRIT, PDTR Page 14


INTERNET OF THINGS

CHAPTER – 9

Programming ESP8266 Module through Arduino


Programming the ESP8266 module through the Arduino IDE is a popular
method for developing IoT applications. The ESP8266 is a versatile Wi-Fi
module that can be programmed using the Arduino framework, allowing you to
leverage the Arduino ecosystem and libraries for your projects. Here's a
stepbystep guide to programming the ESP8266 module through Arduino:

Setup Arduino IDE: Download and install the Arduino IDE from the official
website: https://www.arduino.cc/en/software

Open the Arduino IDE and navigate to File > Preferences.

In the "Additional Board Manager URLs" field, add the following URL:

http://arduino.esp8266.com/stable/package_esp8266com_index.json

Click "OK" to save the preferences.

Install ESP8266 Board Package: Navigate to Tools > Board > Boards
Manager. Search for "esp8266" and install the "esp8266" board package by
ESP8266 Community.

Select ESP8266 Board: After installing the board package, navigate to Tools >
Board and select the appropriate ESP8266 board variant. Common options
include Node MCU .

Connect ESP8266 Module: Connect your ESP8266 module to your computer via

Dept.of ECE, SRIT, PDTR Page 15


INTERNET OF THINGS

USB-to-Serial adapter or a development board that includes USB-to-Serial


functionality. Ensure that the necessary drivers are installed for the USBtoSerial

adapter.

Fig 6: Arduino with ESP8266 Module

Verify Connection: Select the correct COM port for your ESP8266 module
under Tools > Port. To verify that the ESP8266 module is connected and
recognized by the Arduino IDE, select Tools > Get Board Info. You should see
information about the ESP8266 module displayed in the console.

Write and Upload Sketch: Write your Arduino sketch (program) using the
Arduino IDE. You can use familiar Arduino functions and libraries, as well as
specific ESP8266 libraries for Wi-Fi connectivity. Once your sketch is ready,
click the "Upload" button (right arrow icon) in the Arduino IDE to compile and
upload the sketch to the ESP8266 module. Monitor the upload progress in the
console, and ensure that the process completes successfully.

Dept.of ECE, SRIT, PDTR Page 16


INTERNET OF THINGS

Serial Monitor: After uploading the sketch, you can open the Serial Monitor
(Tools > Serial Monitor) to view debug messages and output from the ESP8266
module

Test the Program: Once uploaded, the program will start running on the
ESP8266 module. Test the functionality of your program and ensure that it
behaves as expected.

By following these steps, you can program the ESP8266 module through
the Arduino IDE and develop a wide range of IoT applications leveraging its
WiFi capabilities and the Arduino framework.

Dept.of ECE, SRIT, PDTR Page 17


INTERNET OF THINGS

CHAPTER – 10

NODEMCU - Open Source IoT Platform


NODEMCU is an open-source IoT (Internet of Things) platform that is based on the
ESP8266 Wi-Fi module. It combines the ESP8266 microcontroller with a Lua scripting
environment, making it easy to prototype IoT applications and interact with various sensors,
actuators, and other devices. Here's an overview of NODEMCU and its key features:

ESP8266 Microcontroller: NODEMCU is built around the ESP8266 microcontroller,


which features integrated Wi-Fi connectivity, making it ideal for IoT applications that
require wireless communication.

Lua Scripting Environment: NODEMCU provides a Lua scripting environment, allowing


developers to write and execute Lua scripts directly on the device. Lua is a lightweight
scripting language that is easy to learn and well-suited for rapid prototyping of IoT
applications.

Development Framework: NODEMCU offers a comprehensive development framework


that includes a set of built-in modules for GPIO (General Purpose Input/Output) control, WiFi
communication, timers, and other common IoT tasks. These modules simplify the
development process and enable developers to focus on building the desired functionality.

Interactive Development: With NODEMCU, developers can interactively execute Lua


commands and scripts directly on the device using a serial console interface. This interactive
development mode facilitates rapid experimentation and debugging during the development
process.

Dept.of ECE, SRIT, PDTR Page 18


INTERNET OF THINGS
Extensibility: NODEMCU is highly extensible, allowing developers to add custom functionality
and libraries as needed. It supports the use of additional Lua modules and libraries, as well as the
integration of third-party hardware and software components.

Community Support: NODEMCU benefits from a large and active community of


developers and enthusiasts who contribute to its development, share knowledge and
resources, and provide support through forums, documentation, and tutorials.

Integration with IoT Platforms: NODEMCU can be easily integrated with popular IoT
platforms and services, such as MQTT (Message Queuing Telemetry Transport), Blynk, and
ThingSpeak, enabling seamless communication with cloud-based applications and data
storage services.

Low Cost and Accessibility: NODEMCU is an affordable and accessible platform, making
it suitable for hobbyists, students, and professionals alike. Its low cost and ease of use make
it an attractive option for prototyping IoT projects and exploring the possibilities of
connected devices.

NODEMCU is a versatile and powerful open-source IoT platform that simplifies the
development of Wi-Fi-enabled IoT applications. With its Lua scripting environment,
comprehensive development framework, extensibility, and active community support,
NODEMCU empowers developers to create innovative IoT solutions with ease.

Dept.of ECE, SRIT, PDTR Page 19


INTERNET OF THINGS

CHAPTER - 11
Interfacing DHT11 with ESP8266 NodeMCU Using
Web Server
Interfacing a DHT11 sensor with an ESP8266 NodeMCU and creating a web server to display
the temperature and humidity readings is a popular IoT project. Below is a stepbystep guide to
accomplish this:

Hardware Setup:

Connect the DHT11 sensor to the NodeMCU board:

DHT11 VCC pin to NodeMCU 3.3V pin

DHT11 GND pin to NodeMCU GND pin

DHT11 data pin to a digital pin on NodeMCU (e.g., D2)

Install Necessary Libraries: In the Arduino IDE, go to Sketch > Include Library > Manage

Libraries.

Search for and install the following libraries:

DHT sensor library by Adafruit

ESP8266WebServer by ESP8266 Community

Dept.of ECE, SRIT, PDTR Page 20


INTERNET OF THINGS

Code:

#include <ESP8266WiFi.h>

#include <ESP8266WebServer.h>

#include <DHT.h>

// Replace with your Wi-Fi credentials const char* ssid

= "YourWiFiSSID"; const char* password =

"YourWiFiPassword";

#define DHTPIN D2 // Pin where the DHT11 sensor is connected

#define DHTTYPE DHT11 // Type of the DHT sensor

DHT dht(DHTPIN, DHTTYPE);

ESP8266WebServer server(80); void setup() {

Serial.begin(115200);

delay(10);

// Connect to Wi-Fi

Serial.println();

Serial.print("Connecting to ");

Dept.of ECE, SRIT, PDTR Page 21


INTERNET OF THINGS
Serial.println(ssid);
WiFi.begin(ssid, password); while

(WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }

Serial.println("");

Serial.println("WiFi connected");

// Initialize DHT sensor dht.begin();

// Define HTTP routes

server.on("/", handleRoot);

server.begin();

Serial.println("HTTP server started");

} void loop()

{ server.handleClient

();

} void handleRoot() { float temperature = dht.readTemperature(); // Read

temperature in Celsius float humidity = dht.readHumidity(); // Read humidity

String webpage = "<html><body>"; webpage += "<h1>ESP8266

DHT11 Web Server</h1>"; webpage +=

Dept.of ECE, SRIT, PDTR Page 22


INTERNET OF THINGS
"<p>Temperature: " + String(temperature) + " °C</p>"; webpage +=

"<p>Humidity: " + String(humidity) + " %</p>"; webpage +=


"</body></html>"; server.send(200, "text/html", webpage);

Upload the Code:

Connect your NodeMCU board to your computer via USB.


Select the appropriate board and port in the Arduino IDE. Click the "Upload" button to

upload the code to the NodeMCU board.

Access the Web Server: Once the upload is successful, open the serial monitor to view the IP
address of the NodeMCU board. Enter the IP address in a web browser on any device
connected to the same network. You should see a webpage displaying the temperature and
humidity readings from the DHT11 sensor. By following these steps, you can create a web
server using an ESP8266 NodeMCU and interface it with a DHT11 sensor to display
temperature and humidity readings in real-time.

Dept.of ECE, SRIT, PDTR Page 23


INTERNET OF THINGS

CHAPTER – 12 Introduction to Raspberry Pi


Raspberry Pi, a brainchild of the Raspberry Pi Foundation, represents a revolutionary
approach to computing accessibility and versatility. Positioned as a low-cost, single-board
computer, Raspberry Pi democratizes technology, transcending barriers to entry and opening
doors to a world of innovation and exploration. Its affordability has made it an indispensable
tool for a diverse array of users, ranging from students and educators to hobbyists and
professionals. Despite its modest price tag, Raspberry Pi packs a punch with its impressive
capabilities, proving to be a powerhouse in the realm of embedded computing.

Fig 7: Raspberry Pi
Beyond its cost-effectiveness, Raspberry Pi's versatility is one of its most compelling
features. These diminutive yet mighty boards serve as the cornerstone for a plethora of
projects across various domains. In classrooms, Raspberry Pi serves as an educational
catalyst, empowering students to delve into the realms of computer science, programming,
and electronics through hands-on experimentation. Its adaptability extends far beyond the
classroom, finding applications in home automation, IoT (Internet of Things) systems,
robotics, media centers, and beyond.

Dept.of ECE, SRIT, PDTR Page 24


INTERNET OF THINGS
Underpinning Raspberry Pi's versatility is its robust hardware architecture. With a
system-on-chip (SoC) design, featuring a CPU, GPU, RAM, and an array of connectivity
options such as USB, HDMI, Ethernet, Wi-Fi, and Bluetooth, Raspberry Pi offers a
comprehensive suite of tools for users to unleash their creativity. Furthermore, its GPIO
(General Purpose Input/Output) pins enable seamless interfacing with a myriad of sensors,
actuators, and other electronic components, facilitating endless possibilities for customization
and expansion.

The strength of Raspberry Pi lies not only in its hardware capabilities but also in its
vibrant community. Fueled by enthusiasts, developers, educators, and makers from around
the globe, the Raspberry Pi community thrives on collaboration, knowledge sharing, and
collective ingenuity. Online forums, social media groups, and dedicated websites serve as
hubs of inspiration, providing a wealth of resources, tutorials, and project ideas for users of
all skill levels.

As Raspberry Pi continues to evolve, the Foundation remains committed to its


mission of promoting computer science education and fostering digital literacy worldwide.
With each new iteration, Raspberry Pi pushes the boundaries of what's possible, inspiring
generations of innovators to dream big, tinker fearlessly, and unleash their creative potential.
In an everchanging world, Raspberry Pi stands as a beacon of empowerment, igniting a
passion for technology and driving the democratization of computing for all.

Chapter – 13

Dept.of ECE, SRIT, PDTR Page 25


INTERNET OF THINGS

Setting up Raspberry Pi
Setting up a Raspberry Pi for the first time is an exciting journey into the world of
affordable computing. To begin, gather all the necessary hardware including a Raspberry Pi board,
a microSD card (8GB or larger), a power supply, HDMI cable, keyboard, mouse, and a monitor or
TV with an

HDMI input. Next, download the latest version of Raspberry Pi OS


(formerly Raspbian) from the official website and use tools like SD Card Formatter and
Raspberry Pi Imager to prepare the microSD card with the operating system. Once the
microSD card is ready, insert it into the Raspberry Pi, connect peripherals like the monitor,
keyboard, and mouse, and power on the Raspberry Pi.

Fig 8: setting up raspberry Pi with SD card


Upon booting up, Raspberry Pi OS will guide you through the initial setup process,
prompting you to configure language settings, Wi-Fi connection, and other preferences. Take
this opportunity to enable SSH if you plan to access your Raspberry Pi remotely. Once the
setup is complete, you'll be greeted with the Raspberry Pi desktop environment where you

Dept.of ECE, SRIT, PDTR Page 26


INTERNET OF THINGS
can explore pre-installed applications and familiarize yourself with the system settings. Don't
forget to perform system updates to ensure you have the latest software and security patches.

With your Raspberry Pi set up and ready to go, the possibilities are endless. Whether
you're interested in programming, electronics, home automation, or gaming, there's a wealth
of resources and communities to support your Raspberry Pi journey. Explore various projects
and tutorials available online, and customize your Raspberry Pi to suit your needs and
interests. From educational endeavours to creative experiments, your Raspberry Pi opens
doors to a world of innovation and discovery.

Dept.of ECE, SRIT, PDTR Page 27


INTERNET OF THINGS

CHAPTER – 14

MQTT and Mosquitto


MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol
specifically designed for the efficient exchange of messages between devices in IoT (Internet
of Things) and M2M (Machine-to-Machine) applications. MQTT follows a publish-
subscribe model, where devices (clients) communicate with each other through a central
broker. Clients can publish messages to specific topics, and other clients can subscribe to
those topics to receive messages.

Fig 9: MQTT broker


Mosquitto is an open-source MQTT broker implementation that facilitates the
communication between MQTT clients. Developed by the Eclipse Foundation, Mosquitto
provides a lightweight and efficient MQTT broker that can be easily deployed on various
platforms, including Linux, Windows, and macOS. It supports the MQTT protocol versions
3.1 and 3.1.1, making it compatible with a wide range of MQTT clients and applications.

Together, MQTT and Mosquitto form a powerful combination for building scalable
and reliable IoT systems. MQTT enables efficient communication between devices, while
Mosquitto acts as the intermediary that facilitates the exchange of messages between MQTT
clients. With its lightweight design and support for various platforms, Mosquitto is widely

Dept.of ECE, SRIT, PDTR Page 28


INTERNET OF THINGS
used in IoT projects and applications, providing a robust and flexible MQTT broker solution
for managing communication in distributed IoT environments.

CONCLUSION

Through the internship in IoT, I embarked on a journey of discovery, learning, and


hands-on experimentation. From the foundational concepts of IoT to the practical
implementation of sensor interfacing and application development, I gained invaluable
insights and skills that transformed theoretical knowledge into real-world solutions. I learned
to interface various sensors like proximity sensors, humidity and temperature sensors, and
mastered the art of connecting them to microcontrollers such as Arduino and ESP8266
NodeMCU. Moreover, I honed my skills in Android application development, creating
intuitive interfaces to interact with IoT devices seamlessly.

Furthermore, I delved into the intricacies of MQTT and Mosquitto, understanding


their pivotal roles in enabling efficient communication and data exchange in IoT networks.
Through practical projects and hands-on experiences, I not only grasped the theoretical
aspects but also
implemented them, witnessing firsthand the power and potential of MQTTbased communication.

Overall, this internship provided me with a holistic learning experience, combining


theoretical knowledge with practical application. By conceptualizing, designing, and
implementing IoT projects, I not only learned about IoT concepts but also gained the
confidence to tackle real-world challenges. From sensor interfacing to application
development and communication protocols, I learned it, I did it, and I am equipped with the
expertise needed to excel in the dynamic field of IoT.

Dept.of ECE, SRIT, PDTR Page 29


INTERNET OF THINGS

REFERENCES

• https://www.raspberrypi.org/

• https://projects.raspberrypi.org/en/projects/raspberry-pi-getting-started

• https://mosquitto.org/

• https://www.raspberrypi.org/

• https://nodemcu.readthedocs.io/en/release/

• https://arduino-esp8266.readthedocs.io/en/latest/

• https://www.arduino.cc/

Dept.of ECE, SRIT, PDTR Page 30


INTERNET OF THINGS

CERTIFICATE

Dept.of ECE, SRIT, PDTR Page 31

You might also like