DHT11 Temperature and Humidity Sensor Tutorial PDF

Summary

This document provides information about a DHT11 temperature and humidity sensor. It details how the sensor works, including its pinout, data transmission, and temperature/humidity measurement. The document gives a basic understanding to use the component with Arduino and shows a basic implementation using the Arduino IDE. There is a brief introduction and also a project challenge.

Full Transcript

TEMPERATURE AND HUMIDITY MODULE SENSOR (DHT11) What is DHT11? The DHT-11 is a digital-output relative humidity and temperature sensor. It uses cacapacitive humidity sensor and a thermistor to measure the surrounding air. These sensors contain a chip that does analog to digital conversion and spit...

TEMPERATURE AND HUMIDITY MODULE SENSOR (DHT11) What is DHT11? The DHT-11 is a digital-output relative humidity and temperature sensor. It uses cacapacitive humidity sensor and a thermistor to measure the surrounding air. These sensors contain a chip that does analog to digital conversion and spit out a digital signal with the temperature and humidity. This makes them very easy to use with any microcontroller. The DHT11 is a basic, digital sensor that measures: 1\. Temperature: In degrees Celsius, with an accuracy of ±2°C and a range of 0°C to 50°C. 2\. Humidity: In percentage (% RH), with an accuracy of ±5% and a range of 20% to 90%. It combines a resistive humidity sensing component and a thermistor (temperature sensor), along with a digital signal processing chip to provide a calibrated digital output. PINOUT AND DESCRIPTION The DHT11 has 4 pins: 1\. VCC: Power supply (3.3V to 5.5V). 2\. Data: Serial data output (connect to a microcontroller pin). 3\. NC: Not connected (leave this pin unconnected or ignored) 4\. GND: Ground. How Does the DHT11 Work? A. Temperature Measurement: The DHT11 uses a negative temperature coefficient (NTC) thermistor to measure temperature. As the temperature increases, the resistance of the thermistor decreases. The internal chip converts this resistance into a digital temperature reading. B. Humidity Measurement: It uses a capacitive humidity sensor with two electrodes and a substrate that absorbs moisture. Changes in capacitance correspond to changes in humidity. The internal processor converts the signal to a digital humidity value. C. Data Transmission: The DHT11 communicates with a microcontroller using a single-wire digital interface (proprietary protoc Data is transmitted as a 40-bit sequence, consisting of: 8 bits for humidity integer part 8 bits for humidity decimal part 8 bits for temperature integer part 8 bits for temperature decimal part 8 bits for checksum (error-checking). INSTALLING LIBRARIES To read from the DHT sensor, we\'ll use the DHT library from Adafruit. To use this library you also need to install the Adafruit Unified Sensor library. Follow the next steps to install those libraries: Open your Arduino IDE and go to Sketch \> Include Library \> Manage Libraries. The Library Manager should open. Search for \"DHT\" on the Search box and install the DHT library from Adafruit. CHALLENGE ACTIVITY Challenge Overview: Objective: Use the DHT11 sensor to monitor the temperature, and control an LED based on the temperature value. If the temperature is above 25°C, turn the LED on. If the temperature is below 25°C, turn the LED off. Components Required: 1\. Arduino Uno (or any compatible Arduino board) 2\. DHT11 sensor 3\. LED (standard 5mm LED) 4\. 220Ω resistor (for LED current limiting). 5\. Breadboard 6\. Jumper wires. 7\. DHT11 sensor library installed in Arduino IDE. \#include // Define the DHT11 sensor pin and type \#define DHTPIN 2 // Data pin of DHT11 \#define DHTTYPE DHT11 // Sensor type is DHT11 // Initialize the DHT sensor DHT dht (DHTPIN, DHTTYPE); // Define the LED pin \#define LED\_PIN 13 // Pin where the LED is connected void setup() { // Start serial communication Serial.begin(9600); // Initialize the DHT sensor dht.begin(); // Set the LED pin as output pinMode(LED\_PIN, OUTPUT); } void loop() { // Read the temperature from DHT11 sensor (in Celsius) float temperature = dht.readTemperature(); // Check if the sensor reading failed if (isnan(temperature)) { Serial.println(\"Failed to read from DHT sensor!\"); return; } // Print temperature to Serial Monitor Serial.print(\"Temperature: \"); Serial.print(temperature); Serial.println(\" °C\"); // Turn on the LED if temperature is above 25°C, else turn it off if (temperature \> 25) { digitalWrite(LED\_PIN, HIGH); // LED ON } else { digitalWrite(LED\_PIN, LOW); // LED OFF } // Wait for 2 seconds before the next reading delay(2000); } Challenges to Extend: 1\. Adjust Temperature Threshold: Change the threshold to any other temperature, such as 30°C or 18°C, depending on your project 2\. Add more LEDs: You could add more LEDs and make the system control them based on different temperature ranges 3\. Use a buzzer: Add a buzzer to sound an alarm when the temperature exceeds a certain threshold. PERFORMANCE TASK RUBRICS 10 POINTS - Sensor Interfacing (Correct and functional connection and reading from the water level sensor to the Arduino) 10 POINTS - Component Integration (Properly integrates specified components (LED, LCD, and/or buzzer) with correct wiring and response to water level changes.) 10 POINTS - Functionality (Program functions as specified in the challenge, accurately responding to changes in water levels with intended actions (alerts, displays, etc..) 5 POINTS - Code Efficiency & Organization (Code is well- organized, uses efficient logic, and includes comments where needed for readability) 5 POINTS - Time Completion (Completes the task within the allotted 1-hour timeframe) 40 POINTS - TOTAL SCORE THANK YO

Use Quizgecko on...
Browser
Browser