Design and Construction of Iot Based Humidity and Temperature Control Using Arduino
Design and Construction of Iot Based Humidity and Temperature Control Using Arduino
BY
TO
SEPTEMBER, 2023
CERTIFICATION
This is to certify that this project titled " Design and Construction of IoT Based Humidity and
Temperature Control Using Arduino” was submitted by [STUDENT Name] with
Matriculation number 21010131[0XX] under the supervision of Engr. ADERANTI A. T. in
the Department of Computer Engineering Technology, School of Engineering Technology,
Gateway ICT Polytechnic, Saapade, Ogun State, Nigeria. In partial fulfilment of the
requirement for the award of Higher National Diploma (HND) in Computer Engineering
Technology.
ii
DEDICATION
This project is lovingly dedicated to my parents, whose unwavering faith in me has been my
guiding light. To my siblings, for their endless love and belief in my dreams. And to all those
who have been a beacon of hope and encouragement in my academic journey, your silent
prayers and unspoken support have been the pillars of my strength. This endeavour is a
testament to your love, guidance, and faith.
iii
ACKNOWLEDGEMENT
All praise and adoration go to Almighty God for His unwavering blessings and guidance
throughout my academic journey. His steadfastness has been the anchor for the realization of
this project.
Heartfelt thanks to my parents for their endless love, unwavering support, and belief in my
abilities. Their sacrifices have been my guiding light, illuminating my path towards academic
achievement.
My appreciation also extends to all the lecturers, academics, and non-academic staff of the
Department of Computer Engineering Technology. Their mentorship, dedication, and
commitment to nurturing young minds have significantly enriched my learning experience.
Lastly, my sincere thanks to my family, friends, and well-wishers who have always been there
for me, offering words of encouragement and believing in my vision. Your unwavering
support has made all the difference.
iv
ABSTRACT
This report elaborates on the design and construction of an IoT-based humidity and
temperature control system using the Arduino platform. At the heart of the system is the
DHT11 sensor, which provides real-time data on ambient temperature and humidity. This data
is then processed by the Arduino, which, in turn, determines the necessary actions to maintain
the desired environmental conditions. These actions are relayed to the end-user via an LCD
display and can also be controlled or overridden manually. The project utilized the ESP8266
for Wi-Fi capabilities, ensuring the data is not only displayed locally but also transmitted
wirelessly for remote monitoring. The complete system is housed in a wooden casing for
protection and aesthetics. The entire design process, from the initial conceptualization to the
final construction, involved rigorous testing and iterative refinement to ensure optimal
performance and reliability. The report also delves deep into the challenges faced during the
implementation phase, the methodologies adopted, and the results achieved, thereby
providing a comprehensive overview of the project.
Keywords: IoT, Arduino, DHT11 sensor, Humidity control, Temperature control, ESP8266,
LCD display, Wireless communication, System design, Remote monitoring.
v
TABLE OF CONTENTS
CERTIFICATION..........................................................................................................................II
DEDICATION...............................................................................................................................III
ACKNOWLEDGEMENT.............................................................................................................IV
ABSTRACT....................................................................................................................................V
TABLE OF CONTENTS..............................................................................................................VI
LIST OF FIGURES....................................................................................................................VIII
CHAPTER ONE..............................................................................................................................1
1.1 BACKGROUND OF THE STUDY............................................................................1
1.2 AIMS OF THE PROJECT..........................................................................................3
1.4 SCOPE OF THE STUDY...........................................................................................4
1.5 NEED FOR THE SYSTEM........................................................................................4
1.6 MOTIVATION............................................................................................................5
CHAPTER TWO.............................................................................................................................6
2.0 LITERATURE REVIEW............................................................................................6
2.1 BASICS OF MICROCONTROLLER........................................................................6
2.2 BASICS OF MICROCONTROLLER........................................................................8
2.3 HISTORICAL DEVELOPMENT OF THE MICROCONTROLLER.......................8
2.3.1 GENERAL ARCHITECTURE OF A MICROCONTROLLER.............................9
2.4 ARCHITECTURE TYPES.......................................................................................10
2.5 COMPUTER AND THE EMBEDDED SYSTEM...................................................10
2.6 ADVANTAGES OF IOT-BASED MICROCONTROLLER SYSTEMS IN HOME
AUTOMATION...................................................................................................................11
2.7 CHALLENGES AND CONCERNS OF IMPLEMENTING IOT-BASED
MICROCONTROLLER SYSTEMS IN HOME AUTOMATION.....................................12
CHAPTER THREE.......................................................................................................................14
3.1 METHODOLOGY....................................................................................................14
3.2 SYSTEM BLOCK DIAGRAM.................................................................................15
3.2.1 ARDUINO UNO...................................................................................................16
3.2.2 DHT11 SENSOR...................................................................................................17
3.2.3 1602 LCD SCREEN..............................................................................................17
vi
3.3 CIRCUIT DIAGRAM...............................................................................................18
3.4 SOFTWARE IMPLEMENTATION.........................................................................20
3.4.1 ARDUINO IDE:....................................................................................................20
3.4.2 CODE LOGIC:......................................................................................................20
3.5 CODE STRUCTURE AND FLOW..........................................................................21
3.5.1 INITIALIZATION:...............................................................................................21
3.5.2 MAIN LOOP:........................................................................................................21
3.5.3 DECISION MAKING AND ACTION:................................................................22
3.5.4 LCD DISPLAY UPDATE:....................................................................................22
3.5.5 ERROR HANDLING AND ALERTS:.................................................................23
3.6 INTERFACES AND COMMUNICATION.............................................................23
3.6.1 SERIAL COMMUNICATION WITH LCD:........................................................24
3.6.2 DHT11 SENSOR INTERFACE:...........................................................................24
3.6.3 ESP8266 WI-FI MODULE COMMUNICATION:..............................................24
3.6.5 INTERRUPTS AND EVENT HANDLING:........................................................25
CHAPTER FOUR.........................................................................................................................26
4.0 SYSTEM TESTING AND RESULTS......................................................................26
4.1 HARDWARE SETUP...............................................................................................26
4.2 IMPLEMENTATION CHALLENGES....................................................................26
4.3 SYSTEM TESTING BENCHMARKS.....................................................................27
4.4 PERFORMANCE DISCUSSION.............................................................................28
4.5 IMPLEMENTATION CHALLENGES AND SOLUTIONS...................................29
4.6 OPTIMIZATIONS....................................................................................................30
4.7 RESULTS INTERPRETATION...............................................................................30
CHAPTER FIVE...........................................................................................................................32
5.0 CONCLUSION AND RECOMMENDATION........................................................32
5.1 CONCLUSION.........................................................................................................32
5.2 RECOMMENDATIONS..........................................................................................32
REFERENCES..............................................................................................................................34
vii
LIST OF FIGURES
viii
CHAPTER ONE
1.0 INTRODUCTION
Historically, environmental control systems were more reactive than proactive. Traditional
methodologies relied heavily on manual interventions and periodic checks. However, as the
demand for precision and instantaneous responses grew, there was a pressing need to
automate and refine these control systems. Enter the world of IoT, which transformed these
rudimentary systems into advanced, self-regulating networks that can autonomously adapt to
changing conditions, thereby ensuring optimal results at all times (Aziz 2018).
Building on the foundational capabilities of Arduino, smart housing solutions have further
demonstrated the broad applicability of IoT-based systems. As ZAFAR & Affandi (2022)
have pointed out, innovations like the ESP8266 have revolutionized home environments,
making them responsive to external factors. These advancements are not merely about
1
convenience or comfort; they represent a proactive approach to energy conservation,
sustainability, and improved living standards.
However, the benefits of these systems extend beyond residential settings. In agricultural
domains, for instance, maintaining optimal temperature and humidity levels can significantly
influence crop yield, growth rate, and overall quality. Automated IoT-based systems help
farmers mitigate the challenges posed by unpredictable climatic changes, ensuring that crops
grow in near-ideal conditions. Furthermore, in industrial sectors, especially those involving
sensitive goods, such as pharmaceuticals, precise environmental control is paramount to
ensure product quality and safety.
In essence, the design and construction of an IoT-based humidity and temperature control
system using Arduino are not merely technological endeavours. They represent the
amalgamation of science, technology, and real-world needs, aiming to enhance quality,
productivity, and sustainability in various domains (Aziz 2018).
The proliferation of IoT in environmental monitoring has ushered in a new era where devices
communicate and collaborate seamlessly. Leveraging this, the Arduino platform, with its
accessible and user-friendly interface, has become a linchpin in these monitoring systems. Its
adaptability and compatibility with a variety of sensors, especially DHT11, make it an ideal
candidate for such applications (Winarno and Affandi 2022).
Beyond the hardware components, the real essence of an IoT-based system lies in its ability
to make informed decisions autonomously. Cloud integration has further bolstered these
systems, offering real-time data analytics, storage, and visualization. With data being
transferred to cloud platforms, users can remotely monitor and control environmental
parameters, ensuring a prompt response to any anomalies (Zafar, et al. 2018).
However, like every innovation, these IoT systems are not without challenges. From ensuring
secure data transmission to mitigating the risk of system failures, developers and researchers
are in a perpetual quest to refine and enhance these monitoring systems. Yet, the strides made
in the realm of IoT-based environmental control, especially when integrated with the Arduino
platform, have been commendable, and the trajectory only points upward.
As the world grapples with challenges like climate change and resource scarcity, the
significance of such systems is further magnified. They offer a glimmer of hope, presenting
2
solutions that not only optimize resource utilization but also promote sustainable practices.
By continuously monitoring and adjusting to environmental changes, these systems play a
pivotal role in conserving resources, reducing wastage, and ensuring the well-being of the
environment (Aziz 2018).
In summary, the paradigm shift towards IoT-based humidity and temperature control systems,
underscored by platforms like Arduino and sensors like DHT11, represents the future of
environmental monitoring. They exemplify the harmonious confluence of technology and
environment, leading the way towards a sustainable, efficient, and connected world.
The primary aim of this project is to design and construct an IoT-based system for effective
humidity and temperature control utilizing the Arduino platform. The specific objectives of
the project include:
i. Integration of DHT11 Sensor with Arduino: Accurately measure and monitor the
temperature and humidity levels in real-time.
ii. Development of a User Interface: Offer easy visualization of the collected data
through LCD screens and potentially, a web interface.
iii. Implementation of Automatic Control Mechanisms: Activate corrective measures
when deviations from set parameters are detected.
iv. Remote Monitoring and Control: Provide the ability for users to oversee and adjust
the environmental conditions remotely using IoT capabilities.
v. Incorporation of Alerts and Notifications: Send proactive alerts to users in case of
significant deviations or system malfunctions.
vi. Scalability and Integration: Design the system for easy scalability, allowing for the
addition of more sensors and control mechanisms in the future.
The project faced some constraints which might affect its overall effectiveness and
functionality. These limitations include:
1. Hardware Limitations: The project heavily relies on the capabilities of Arduino and the
DHT11 sensor. Any inherent limitations in these components directly affect the scope of
3
our system. For instance, the DHT11 sensor has a specific range and accuracy which can
affect the precision of our readings (Zafar, et al. 2018).
2. Connectivity Issues: Being an IoT-based project, any disruptions or limitations in internet
connectivity can hinder real-time data transmission and remote monitoring capabilities.
3. Environmental Constraints: The wooden casing, although providing a level of protection,
may not be entirely resistant to extremely harsh environmental conditions.
4. Research Limitations: The available research papers, including those cited for this project,
primarily focus on certain aspects of IoT and Arduino. They do not cover all possible
scenarios or issues that could arise in such systems. For instance, while Winarno and
Affandi (2022) discussed the implementation of a smart house prototype, the specificity
of their study may not encompass all the challenges faced in our humidity and
temperature control system.
The study revolves around the design and construction of an IoT-based system to control and
monitor temperature and humidity using Arduino. The primary components, as mentioned,
include the Arduino microcontroller and the DHT11 sensor. The areas this study will cover
include:
4
1.5 NEED FOR THE SYSTEM
1.6 MOTIVATION
The motivation behind this project arises from the increasing demand for smart and
automated environmental control systems, especially in sectors like agriculture and
warehousing. As the world leans more towards automation and real-time monitoring, there's
an increasing demand for cost-effective, efficient, and user-friendly systems. The idea is to
integrate the vast potential of IoT with the flexibility and functionality of Arduino to create a
system that can potentially revolutionize environmental monitoring (Winarno and Affandi
2022).
5
CHAPTER TWO
The integration of the Internet of Things (IoT) with contemporary technology has forged a
significant transformation in the way devices interact with the physical world. At the heart of
IoT is the capability to seamlessly connect everyday objects to the internet, enhancing their
responsiveness and efficiency. Particularly in environmental monitoring and control, the
relevance of IoT becomes pronounced when intertwined with microcontrollers such as
Arduino.
Zafar et al. (2018) have highlighted an intriguing facet of this technological marriage. In their
research, they presented an IoT-based real-time environmental monitoring system powered by
Arduino, delineating its effectiveness in providing a controlled environmental setting (Zafar,
et al. 2018). Another noteworthy exploration by Winarno and Affandi (2022) delved into the
construction of a smart house prototype. Their work utilized the ESP8266 in conjunction with
IoT to underscore the real-world applicability of these integrative systems (Winarno and
Affandi 2022). Further, Aziz's study in 2018 brought to the fore the nuances of web server-
based monitoring systems that employ the ESP8266 node MCU module. His research
emphasized the seamless data monitoring and subsequent decision-making processes intrinsic
to IoT frameworks (Aziz 2018).
In light of the mounting significance of IoT and its synergy with Arduino-centric systems for
environmental monitoring, a thorough review of the literature becomes imperative. This
chapter endeavours to provide a panoramic view of the role of microcontrollers within IoT-
driven temperature and humidity control systems. As we navigate through this chapter, the
subsequent segments will unravel the workings of microcontrollers, trace their historical
trajectory, and detail their integration within the wider canvas of IoT, as reflected in recent
research explorations.
The realm of Internet of Things (IoT) has prominently featured the integration of
microcontrollers, given their ability to process and relay information efficiently. For instance,
Zafar et al. (2018) in their research highlighted the profound potential of the Arduino
microcontroller in crafting an IoT-based real-time environmental monitoring system. This
system adeptly measured critical environmental parameters such as temperature and
humidity, showcasing the versatile and multifunctional nature of microcontrollers in
monitoring applications.
Furthermore, beyond just the processing capabilities, the connectivity options that some
modern microcontrollers offer can reshape the dynamics of system interactions. The
ESP8266, as discussed by Winarno and Affandi (2022), is not just a microcontroller; it boasts
built-in Wi-Fi functionalities, making it particularly suited for IoT applications, like their
showcased smart house prototype.
It's imperative to note that the transformation of isolated systems to globally connected
entities isn't merely a result of advancing hardware alone. The underlying software platforms
and algorithms, which often go unnoticed, play a significant role. For instance, the Arduino
platform, as detailed in both studies by Zafar et al. (2018), offers an open-source platform,
empowering developers with a versatile set of tools to draft and refine their control
algorithms, tailored explicitly for specific applications.
7
we envision control systems, seamlessly merging the physical and digital realms. Through the
works of Zafar et al. (2018), Winarno and Affandi (2022), and Aziz (2018), we recognize the
evolutionary trajectory of microcontrollers, from simple processing units to the globally
connected powerhouses that drive today's IoT solutions.
A significant development in the realm of microcontrollers is the integration of IoT. With the
advent of IoT, these microcontrollers can now communicate and share data over the internet,
thereby offering more dynamic and intelligent control solutions. Arduino, as highlighted by
Zafar et al. (2018), has been at the forefront of this evolution, providing an open-source
electronics platform that's both user-friendly and extendable (Zafar, et al. 2018). The Arduino
microcontroller, based on flexible hardware and software, has been designed for hobbyists,
artists, designers, and anyone interested in creating interactive environments or objects.
The integration of microcontrollers with IoT is a relatively recent chapter in this journey. The
advent of IoT has turned ordinary microcontrollers into smart, connected devices capable of
interacting in real-time with their surroundings and other devices. For instance, Winarno and
Affandi's (2022) exploration around the ESP8266 highlights the potential of combining
powerful microcontrollers with IoT capabilities, creating systems that are not only responsive
but also intuitive (Winarno and Affandi 2022). Similarly, Aziz's (2018) study accentuates the
8
prowess of microcontrollers when leveraged in conjunction with web servers, creating
monitoring systems that are robust, scalable, and smart (Aziz 2018).
As we delve further into the rich tapestry of microcontroller history, it becomes evident that
their continuous evolution, coupled with the transformative power of IoT, has paved the way
for a future where smart, connected devices will become the norm rather than the exception.
Processor (CPU): It's the brain of the microcontroller, responsible for fetching, decoding,
and executing instructions. The efficiency and speed of the microcontroller largely depend on
the CPU's performance.
Memory: Microcontrollers have two types of memory - RAM (Random Access Memory)
and ROM (Read-Only Memory). While RAM is volatile and is used for temporary storage of
data, ROM is non-volatile and usually contains the firmware or the program that the
microcontroller will execute.
I/O Ports: These are interfaces that allow the microcontroller to connect and communicate
with external devices. They can be digital or analog based on the nature of the device they are
interfacing with.
Clock Oscillator: This component generates a clock signal, which determines the speed at
which the CPU operates.
Timers and Counters: They are utilized for measuring time intervals and counting external
events.
The ESP8266, as mentioned in the work of Winarno and Affandi (2022), is an excellent
representation of this architecture, tailored with built-in Wi-Fi capabilities. This not only
makes the device efficient in processing but also proficient in communication (Winarno and
Affandi 2022).
9
2.4 ARCHITECTURE TYPES
There are various types of architectures used in designing microcontrollers, each tailored for
specific requirements and applications. Two of the most commonly used are:
Harvard Architecture: In this design, the device has separate memory and buses for
instructions and data, enabling it to fetch both instruction and data at the same time. This
simultaneous operation allows for faster processing speeds.
Von Neumann Architecture (or Princeton): Contrary to Harvard, this architecture uses a
single bus for both data and instructions. As a result, the device fetches instruction and data
sequentially, which might be slower compared to the Harvard architecture.
The choice between the two primarily depends on the requirements of the specific application
and the expected performance. For instance, real-time systems that need quick responses
might prefer Harvard for its speed.
In the realm of IoT-based microcontroller systems, the architecture must also account for
connectivity and communication. Devices like the ESP8266, highlighted in Winarno and
Affandi's study (2022), blend traditional microcontroller architecture with wireless
communication components, thus making them suitable for modern IoT applications
(Winarno and Affandi 2022). Similarly, the ESP8266 node MCU module's architecture, as
discussed by Aziz (2018), demonstrates the intricate balance between processing power and
connectivity in today's microcontroller designs (Aziz 2018).
The dawn of home automation was not just the result of the development of smart devices but
was deeply rooted in the evolution of computers and embedded systems. At the heart of these
technologies is the computer, a ubiquitous tool that has transformed from large mainframe
machines to compact microcontrollers and processors.
Embedded systems are specialized computing systems that are designed to perform dedicated
functions or tasks. Unlike general-purpose computers that can run a wide variety of
applications, an embedded system is optimized to execute specific applications or functions.
An essential component of home automation solutions, embedded systems provide the
10
intelligence and control in devices ranging from smart thermostats to security cameras and
automated door locks.
One significant advantage of using embedded systems in home automation is their efficiency.
Since these systems are dedicated to specific tasks, they can be optimized to reduce energy
consumption, ensuring that smart homes are not only convenient but also energy efficient.
The introduction of microcontrollers, such as the Arduino and ESP8266, has further
revolutionized the domain. These compact devices can be easily integrated into home
appliances, offering intelligent features and connectivity (Zafar, et al. 2018) (Aziz 2018)..
For instance, the integration of the Arduino microcontroller into an appliance enables it to
interact with other devices, gather data from its environment using sensors, and even
communicate with cloud services for remote monitoring and control (Winarno and Affandi
2022). The Arduino platform, with its simplicity and vast supporting community, provides an
ideal foundation for hobbyists and professionals alike to create IoT-based home automation
projects.
With the increasing integration of the Internet of Things (IoT) in home automation, embedded
systems play a crucial role in interfacing physical devices with digital platforms. They act as
the bridge, allowing for real-time data gathering and remote actuation of devices, fostering
the realization of truly smart homes. As the boundaries between computers and embedded
systems continue to blur, the resulting synergy promises to bring more advanced and
integrated solutions to the realm of home automation.
The incorporation of IoT-based microcontroller systems, such as Arduino and ESP8266, into
home automation has brought about a plethora of benefits that have fundamentally
transformed the way we live. Some of the notable advantages include:
11
thermostats, security systems, and other devices can be adjusted without being
physically present.
ii. Energy Efficiency: Smart devices can optimize energy usage based on real-time data.
For instance, a smart thermostat can adjust heating or cooling based on the room's
occupancy, ensuring optimal energy consumption (Zafar, et al. 2018).
iii. Improved Security: With IoT, security systems can notify homeowners in real-time
about potential breaches or suspicious activities. Moreover, systems can be set to
simulate occupancy, deterring potential intruders.
iv. Cost Savings: Over time, the energy savings from optimized device usage can lead to
significant reductions in utility bills.
v. Seamless Integration: IoT devices can communicate with one another, creating an
integrated system where devices can work in tandem, enhancing the overall efficiency
and user experience (Aziz 2018).
vi. Customization: Homeowners can set preferences and routines tailored to their
lifestyles, ensuring that the system operates based on their individual needs.
vii. Future Scalability: As new devices and technologies emerge, they can be easily
integrated into the existing IoT-based home automation system, ensuring the home
remains at the forefront of technological advancements.
12
4. Reliability: IoT devices are dependent on continuous internet connectivity. Any
disruption in the connection can impede the system's functionality.
5. Initial Costs: Setting up a comprehensive IoT-based home automation system can be
expensive initially, although the costs might be offset by long-term benefits and
savings.
6. Data Privacy: With devices continuously collecting data, there are concerns about
how this data is used and who has access to it.
7. Maintenance: Regular software updates are essential to keep the devices functioning
optimally and securely. This requires ongoing attention and may pose challenges for
less tech-savvy homeowners (Winarno and Affandi 2022).
13
CHAPTER THREE
3.1 METHODOLOGY
The development of the IoT-based humidity and temperature control system using Arduino
was initiated through a structured methodology. The steps adopted were meticulously
designed to ensure the system's efficiency and robustness. The methodology encompassed:
Hardware Configuration: Post design, the actual assembly of components began. Detailed
attention was paid to ensure every connection was optimized for maximum efficiency and
minimal error probability.
Software Development: The Arduino IDE was employed to script the operational logic. The
software was programmed to consistently fetch data from DHT11, interpret the readings, and
exhibit them on the LCD. Furthermore, conditions were coded for the system to react when
the environmental parameters shifted beyond set limits.
IoT Integration: The final stage involved integrating the constructed system with IoT
features. This allowed for remote monitoring, ensuring users could access real-time data from
anywhere through internet-enabled devices.
14
3.2 SYSTEM BLOCK DIAGRAM
The block diagram provides a bird's eye view of the system's architecture, allowing for a
concise understanding of how each component interacts within the system.
Flow:
15
3.2.1 Arduino Uno
The heart of the system, the Arduino Uno, is based on the ATmega328P. It serves as the
primary processing unit, handling data interpretation from the DHT11 sensor and dictating
the appropriate responses based on the developed software logic (Zafar, et al. 2018).
16
3.2.2 DHT11 Sensor
The DHT11 sensor stands as the frontline component, responsible for accurate temperature
and humidity readings. Its incorporation into the system ensures real-time environmental data
acquisition.
The 1602 LCD screen is implemented to provide users with an immediate visual
representation of the temperature and humidity readings. The screen is interfaced with the
Arduino Uno, receiving and displaying data processed by the Arduino. Its incorporation not
only provides real-time feedback to the user but also aids in system debugging during the
developmental phase.
17
Figure 3. 4: 1602 LCD Screen Diagram (LastMinuteEngineers.com 2023)
The circuit design serves as the physical foundation for the IoT-based humidity and
temperature control system. By incorporating the Arduino microcontroller with the DHT11
sensor, we have a centralized system that interprets and processes environmental data.
18
Figure 3. 5: Circuit Diagram for the IoT-based humidity and temperature control using
Arduino
Circuit Description:
1. Arduino Microcontroller: This serves as the brain of the system. It gathers data from the
DHT11 sensor, processes this data, and sends the necessary control signals to activate or
deactivate certain functions based on predefined conditions.
2. DHT11 Sensor: An efficient and compact sensor responsible for detecting and measuring
the current temperature and humidity in the environment. It sends this data in a digital
format to the Arduino.
3. LCD Display (1602 LCD Screen): This component provides real-time feedback by
displaying the current temperature and humidity levels. It gets its data directly from the
Arduino.
4. Power Supply: A stable power source is essential for the smooth operation of the system.
5. Connection Wires: These ensure seamless data transmission between the components.
6. ESP8266 Wi-Fi Module: This module enables wireless communication. The Arduino
can send data, such as temperature and humidity values, to a remote device or server
using this module.
19
7. Relay Module: Controlled by the Arduino, the relay module is used to activate or
deactivate the cooling device. If the temperature exceeds a set threshold, the Arduino will
trigger the relay module to turn on the cooling device.
The DHT11 sensor is connected to one of the digital pins of the Arduino. The sensor
continuously measures the humidity and temperature, sending the data to the Arduino. The
Arduino then processes this data, deciding if any action (like activating a fan or heater) is
needed. This decision-making process is based on a pre-defined set of conditions. For
instance, if the temperature exceeds a set threshold, a cooling function might be activated.
The software component is crucial for the intelligent operation of our system. It aids in data
interpretation, decision-making, and execution of the necessary control actions.
The Arduino Integrated Development Environment (IDE) is the primary platform for coding,
compiling, and uploading the control script to the Arduino board (Zafar, et al. 2018). It's user-
friendly and supports C and C++, enabling precise control over the hardware components.
The software logic is designed to be both responsive and predictive. When the DHT11 sensor
sends data to the Arduino, the code evaluates this data against predefined conditions. If the
current conditions do not match the optimal settings, the Arduino sends control signals to
correct the situation. For example, if the room's humidity is too high, a dehumidifier might be
activated. Similarly, a heater could be turned on if the temperature drops below a set level.
All these actions and decisions are logged and displayed on the LCD screen for real-time
monitoring.
The software also includes error-handling protocols. In cases where the sensor data is
inconsistent or falls outside of expected ranges, alerts can be triggered, ensuring the safety
and reliability of the system (Aziz 2018).
20
3.5 CODE STRUCTURE AND FLOW
The software design and the coding structure are paramount for the effective execution of any
embedded system, especially in an IoT setup. The logic must be robust, flexible, and efficient
to ensure a responsive system that can adapt to different environmental scenarios.
3.5.1 Initialization:
This is the initial setup where all the required libraries are imported, and initial parameters are
set. The pins to which the DHT11 sensor and LCD are connected are defined, and the initial
state of the system is established.
#include <DHT.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // initialize the library with the numbers of the
interface pins
In the main loop, data from the DHT11 sensor is continuously read. This data is then
processed, and decisions are made based on the conditions set.
void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(t);
21
lcd.print(" C");
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.print(h);
lcd.print(" %");
Based on the readings, specific actions are taken. For instance, if the temperature is beyond a
set threshold, some action is executed.
if (t > 25) {
if (h > 70) {
The LCD is updated in real-time, displaying the latest readings of temperature and humidity.
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(t);
lcd.print(" C");
22
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.print(h);
lcd.print(" %");
To ensure reliability, the system must handle potential errors, such as when the DHT11 sensor
is not functioning correctly.
if (isnan(h) || isnan(t)) {
lcd.setCursor(0, 0);
lcd.print("Error reading");
lcd.setCursor(0, 1);
return;
This code structure ensures that the system is not only monitoring but also proactively
responding to changes in the environment. This real-time feedback and adjustment
mechanism are essential for maintaining the desired temperature and humidity levels (Zafar,
et al. 2018) (Winarno and Affandi 2022).
For a home automation system centered on humidity and temperature control, seamless
communication and interfacing between various components is essential. Effective
monitoring and control actions rely heavily on this interplay of hardware and the data they
share.
23
3.6.1 Serial Communication with LCD:
The Liquid Crystal Display (LCD) in this setup communicates with the Arduino over the I2C
protocol. This reduces the number of pins required for interfacing and simplifies the
connection.
#include <LiquidCrystal_I2C.h>
The above lines of code initialize the LCD over I2C and define its configuration. With this
setup, temperature and humidity values can be printed directly onto the LCD.
The DHT11, our primary sensor for temperature and humidity measurements, communicates
with the Arduino over a single digital pin. This one-wire interface allows for easy integration
and minimal wiring complexity.
The ESP8266 Wi-Fi module provides wireless communication capabilities. This module
communicates with the main Arduino board through a serial connection.
The I2C protocol is a method to communicate between multiple devices using just two wires:
SDA (data line) and SCL (clock line). It's especially useful for connecting peripherals like the
LCD in our setup. Given that I2C can support multiple devices on the same two lines, it
offers flexibility and scalability to the system.
24
3.6.5 Interrupts and Event Handling:
For real-time responsiveness, the system leverages Arduino's interrupt capabilities. If any
sudden change occurs in the temperature or humidity, an interrupt can be triggered, ensuring
immediate action.
In summary, the communication and interfaces, especially with the added I2C capability,
ensure a real-time, responsive, and accurate monitoring and control mechanism (Aziz 2018)
(Winarno and Affandi 2022).
25
CHAPTER FOUR
The hardware setup forms the backbone of our system. Ensuring that each component is
optimally configured is crucial for the seamless operation of the entire unit.
Arduino Uno: As the primary microcontroller, the Arduino Uno reads data from the DHT11
sensor and processes this information. Given its compatibility and ease of integration with
various modules, it plays a central role in this setup (Aziz 2018).
DHT11 Sensor: This component detects the temperature and humidity levels. It's crucial to
place it in a location where it won't be affected by direct sunlight or other environmental
distortions. Proper calibration ensures that the data gathered is accurate and reliable (Zafar, et
al. 2018).
1602 LCD Screen: Used for displaying the real-time data gathered from the DHT11 sensor,
it’s important that this LCD is clearly visible and positioned in a location easily accessible to
the user (Winarno and Affandi 2022).
I2C Module: Given the protocol's importance for communication between the Arduino Uno
and the LCD, ensuring this module's secure connection and setup is paramount.
ESP8266: This Wi-Fi module is critical for transmitting the processed data to the cloud. It
should be positioned in a location with a stable Wi-Fi connection to ensure uninterrupted data
transmission (Aziz 2018).
Power Supply: A consistent and uninterrupted power source is vital. Any fluctuations or
interruptions can lead to data loss or inaccurate readings.
Every design and construction process encounters challenges, and our project was no
exception. Addressing these challenges was vital to ensure the system's efficient and accurate
functioning.
26
Sensor Calibration: Ensuring that the DHT11 sensor provided accurate readings was a
primary challenge. Calibration in different environmental conditions was necessary to ensure
its accuracy across various scenarios (Zafar, et al. 2018).
Wi-Fi Connectivity: The ESP8266 module occasionally faced connectivity issues, especially
in areas with weak Wi-Fi signals. This impacted the real-time data transmission to the cloud.
LCD Display Limitations: The 1602 LCD, though efficient, had a limited display capacity.
Presenting data in a concise yet understandable manner required careful consideration
(Winarno and Affandi 2022).
I2C Communication: Ensuring seamless communication between the Arduino Uno and the
LCD via the I2C protocol was challenging, particularly when managing potential data
collisions or ensuring synchronous communication.
Power Management: Given that the system was intended for continuous operation, ensuring
efficient power management without overheating or overloading any component was critical.
Integration with Webserver: Ensuring the consistent and correct transmission of data to the
webserver required intricate coding and periodic validation checks (Aziz 2018).
Given the complexity and interconnectedness of the system components, establishing clear
testing benchmarks was imperative. These benchmarks ensured that the system's performance
met the predefined standards.
Response Time: Measuring the time it took from when a change in humidity or temperature
was detected to when the data was displayed on the LCD and transmitted to the cloud.
Accuracy: Validating the readings from the DHT11 sensor against a standard, ensuring its
accuracy and reliability.
Wi-Fi Transmission: Evaluating the consistency and speed of data transmission via the
ESP8266 module to the cloud platform.
27
LCD Display: Confirming the legibility, update speed, and accuracy of the displayed
information on the 1602 LCD screen.
Power Consumption: Monitoring the system's power consumption to ensure efficient and
sustainable operation.
User Interface on Web Server: Ensuring the data displayed on the web server is user-
friendly, easily interpretable, and updates in real-time.
Sensor Readings: The DHT11, pivotal to the system, is known for its consistent and reliable
readings, as corroborated by Zafar et al. (2018). During the course of this project, it was
observed that its real-time monitoring capability showed only minor deviations, mostly
within accepted tolerance levels.
LCD Display Efficiency: The 1602 LCD screen, while fulfilling its intended role, did pose
occasional challenges due to its limited display area. This limitation was especially evident
during instances where more elaborate data representation was required.
Power Efficiency: From the outset, the system was engineered for energy efficiency.
However, during simultaneous operation of multiple modules or during peak data
transmissions, there was a discernible increase in power consumption.
User Feedback on Web Interface: Preliminary feedback from users regarding the web
interface was predominantly positive. The majority appreciated the real-time updates and
found the layout intuitive, aiding in easy data interpretation.
29
Solution: Regular testing and revising the code ensured data transmission without
hitches.
4.6 OPTIMIZATIONS
Post initial setup and testing, certain optimizations were introduced to enhance system
performance.
Code Refinement: Regular code reviews and updates ensured the software's efficiency and
responsiveness.
Enhanced Wi-Fi Transmission: Firmware updates on the ESP8266 ensured faster and more
reliable data transmission.
The culmination of this project produced tangible results which were then analyzed to assess
the system's efficacy.
Real-time Web Updates: The system efficiently updated temperature and humidity readings
on the web interface, corroborating with the capabilities highlighted by Aziz (2018).
User Interaction: The ease of interaction, both with the LCD and the web interface, was
evident from user testimonials and the user-centric design approach inspired by Winarno &
Affandi (2022).
30
Figure 3. 7: Analytical Results Overview (before implementation)
31
CHAPTER FIVE
5.1 CONCLUSION
The project, focusing on the design and construction of an IoT-based humidity and
temperature control system using Arduino, has shown significant promise and utility in real-
world scenarios. The integrated DHT11 sensor provided reliable temperature and humidity
readings, demonstrating its value as a trustworthy environmental monitoring tool, as
supported by the studies of Zafar et al. (2018).
The ESP8266 module facilitated real-time data transmission to the web interface, enabling
users to monitor environmental conditions in real-time. The capability of ESP8266, as
presented in the literature by Aziz (2018), corroborated our project findings, highlighting its
effectiveness in IoT implementations.
Furthermore, the inclusion of an LCD screen, even with its display limitations, offered a
direct, on-site feedback mechanism. The challenges encountered during the project, from
sensor calibration to connectivity issues, not only tested the robustness of our design but also
paved the way for potential improvements. The solutions derived, inspired by various sources
like Winarno & Affandi (2022), demonstrated adaptability and innovation.
In essence, the culmination of this project has successfully demonstrated the feasibility and
applicability of Arduino-based IoT systems in effectively monitoring and controlling
environmental conditions.
5.2 RECOMMENDATIONS
1. Enhanced Sensor Integration: Future iterations of this project could consider the inclusion
of more advanced sensors than DHT11 to improve accuracy and range of environmental
monitoring.
2. Improved Connectivity: Considering alternative modules or complementing ESP8266
with other connectivity options might provide more stable and expansive coverage,
especially in larger implementation areas.
32
3. User Interface Upgrades: The web interface and LCD display can be enhanced for more
intuitive user interaction, drawing inspiration from the user-centric designs emphasized
by Winarno & Affandi (2022).
4. Power Optimization: With the current power consumption observed, future versions could
explore more efficient power management solutions or integrate alternative power
sources like solar panels.
5. Expandable Modules: The system can be made modular, allowing users to seamlessly add
more environmental monitoring components or other sensors in the future, broadening its
application spectrum.
In conclusion, while the current system has demonstrated efficacy and utility, there remains
ample scope for enhancements and upgrades, ensuring that it remains adaptable to evolving
user needs and technological advancements.
33
REFERENCES
Arduino. 2023. Arduino UNO Rev3 with Long Pins _ Arduino Documentation. Accessed 09
27, 2023. https://docs.arduino.cc/retired/boards/arduino-uno-rev3-with-long-pins.
Aziz, D. A. 2018. "Webserver based smart monitoring system using ESP8266 node MCU
module." Int. J. Sci. Eng. Res 9 (6): 801-808.
Components101. 2023. DHT11 Sensor Pinout, Features, Equivalents & Datasheet. Accessed
09 27, 2023. https://components101.com/sensors/dht11-temperature-sensor.
Winarno, A., and M. Affandi. 2022. "Design and Construction of Smart House Prototype
Based Internet of Things (Iot) Using Esp8266." BEST: Journal of Applied Electrical,
Science, & Technology 4 (1): 11-14.
Zafar, S., G. Miraj, R. Baloch, D. Murtaza, and K. Arshad. 2018. "An IoT Based Real-Time
Environmental Monitoring System Using Arduino and Cloud Service." Engineering,
Technology & Applied Science Research 8 (4): 3238-3242.
34