LAB REPORT
Course Title: Embedded Systems and IoT Lab
Course Code: CSE-234
Topic Name: Temperature & Humidity Sensors interfacing
with Arduino.
Submitted To:
Avizit Nandi
Lecturer
Department of CSE
Daffodil International University
Submitted By:
Name:Joyanta Kumar Sarker
ID: 221-15-5250
Section: 61-T2
Department of CSE
Daffodil International University
Date of Submission: 07-08-2025
Lab Report No: 07
Lab Report Name: Temperature & Humidity Sensors interfacing with
Arduino.
Objective:
• To interface a DHT11 temperature and humidity sensor with the Arduino Uno.
• To read real-time temperature (°C) and humidity (%) data using the Arduino IDE.
• To understand the working principle and data communication of digital sensors.
• To implement sensor data display using the Serial Monitor.
• To build foundational skills for future projects in environmental monitoring and IoT.
Introduction:
In the era of smart systems and intelligent automation, monitoring environmental parameters like
temperature and humidity has become essential for numerous real-world applications. These
parameters are fundamental in domains ranging from agriculture, weather forecasting, and
healthcare monitoring, to HVAC systems, data centers, pharmaceutical storage, and smart home
automation. Their accurate detection and regulation are critical not just for human comfort and
safety, but also for the performance, stability, and longevity of electronic devices, machinery, and
biological specimens. To enable such monitoring, sensors like the DHT11 have emerged as affordable
and easy-to-use solutions for embedded system developers and engineering students. The DHT11 is
a digital sensor that combines two sensing elements:
✓ A thermistor to measure temperature.
✓ A capacitive humidity sensor to detect relative humidity.
To achieve efficient monitoring, the DHT11 sensor is often used due to its low cost, reliability, and
ease of interfacing. It combines a thermistor for temperature sensing and a capacitive sensor for
humidity, outputting data as a digital signal through a single wire. Although not the most accurate
sensor, its simplicity makes it ideal for educational and prototype-level projects. In this lab, we
interface the DHT11 sensor with an Arduino Uno to measure real-time temperature and humidity
values. By using the DHT library, the sensor’s data is read and displayed through the Serial Monitor
of the Arduino IDE. This experiment not only demonstrates the fundamentals of sensor interfacing
but also provides a practical foundation for future projects in IoT, automation, and environmental
monitoring.
Theory:
DHT11 Module features a temperature & humidity sensor complex with a calibrated digital signal
output. The exclusive digital-signal-acquisition technique and temperature & humidity sensing
technology ensure high reliability and excellent long-term stability. This sensor includes an NTC for
temperature measurement and a resistive-type humidity measurement component for humidity
measurement. These are connected to a high-performance 8-bit microcontroller, offering excellent
quality, fast response, anti-interference ability, and cost-effectiveness.
DHT11 Module Pinout-
The DHT11 module has a total of 3 pins. In which two are for power and one is for communication.
The pinout of a DHT11 Sensor module is as follows:
Figure-1: DHT11 Module
Working Principle of DHT11 Sensor-
The DHT11 sensor measures temperature and humidity using two key components:
✓ Temperature: It uses an NTC thermistor, whose resistance changes with temperature. As
temperature increases, the resistance decreases. The onboard MCU measures this resistance
change and calculates the temperature.
✓ Humidity: It uses a capacitive humidity sensor made of a moisture-holding substrate placed
between two electrodes. When the humidity increases, the substrate absorbs water, reducing
the resistance between the electrodes. This change is detected and converted into relative
humidity using the sensor's internal ADC.
The sensor then sends the temperature and humidity data digitally to the Arduino via a single-wire
serial protocol, as shown in the signal waveform.
Equipment:
• Arduino Uno
• USB Cable
• LED
• Resistor
• Breadboard
• Jumper Wires
• Temperature & Humidity sensor
• LCD Display
Circuit Diagram:
Figure-2: Simulated Output from Tinkercad (using LED, Register, Arduino & Sensor)
Figure-3: Arduino Code for Temperature & humidity sensor (using LED, Register, Arduino &
Sensor)
Code:
Figure-4: Arduino Code for Temperature & humidity sensor (using LCD Display, Register, Sensor &
Arduino)
Discussion:
In this experiment, we used an Arduino Uno to interface with the DHT11 sensor and successfully
obtained real-time temperature and humidity data. The Arduino code was written using the Arduino
IDE, and the functionality was extended by using the Adafruit DHT library, which simplified the
communication between the sensor and the microcontroller. The code begins by including the DHT.h
library, followed by the definition of the data pin and sensor type (DHT11). In the setup() function,
the serial communication is initialized at 9600 baud, and the DHT sensor is activated using
dht.begin(). In the loop() function, the program waits for 2 seconds between each reading to allow
the sensor to stabilize and then reads both temperature and humidity values using the functions
readTemperature() and readHumidity(). A key part of the code involves checking for invalid readings
using isnan() — this prevents displaying garbage values if the sensor fails to respond. Once the data
is validated, the output is printed in the Serial Monitor using Serial.print() functions.
Through this code, we learned how to:
✓ Use external libraries in Arduino.
✓ Handle digital sensor data acquisition.
✓ Implement real-time monitoring using Serial communication.
✓ Manage timing using delay () and ensure sensor refresh intervals.
This practical coding experience reinforces foundational skills in sensor interfacing, error handling,
and data display, all of which are crucial in modern embedded system development and IoT-based
applications.
Conclusion:
The integration of the DHT11 temperature and humidity sensor with the Arduino Uno successfully
demonstrated the basic principles of digital sensor interfacing and real-time data monitoring. This
experiment highlights the importance of accurate environmental data collection in various
applications such as weather stations, home automation, and IoT devices.
• Successfully interfaced the DHT11 sensor with the Arduino Uno.
• Accurately read and displayed real-time temperature (°C) and humidity (%) data.
• Gained understanding of digital sensor working principles and communication protocols.
• Implemented sensor data visualization through the Serial Monitor.
• Developed foundational skills applicable to environmental monitoring and IoT projects.
Overall, the experiment strengthened foundational skills essential for environmental monitoring
and IoT applications, paving the way for more complex sensor-based projects.