What is the main purpose of the DHT11 and DHT22 sensors?
They measure humidity and temperature in the environment.
Click to reveal answer
beginner
How do you connect a DHT sensor to an Arduino board?
Connect the sensor's power pin to 5V, ground pin to GND, and data pin to a digital input pin on the Arduino.
Click to reveal answer
beginner
Which Arduino library is commonly used to read data from DHT11/DHT22 sensors?
The DHT sensor library by Adafruit is commonly used.
Click to reveal answer
intermediate
What is the difference between DHT11 and DHT22 sensors?
DHT22 is more accurate and measures a wider range of humidity and temperature than DHT11.
Click to reveal answer
intermediate
Why do you need to add a delay between readings when using DHT sensors?
Because the sensor needs time to stabilize and provide accurate readings; reading too fast can cause errors.
Click to reveal answer
Which pin on the Arduino should the data pin of a DHT sensor be connected to?
AA digital input/output pin
BThe 5V power pin
CThe ground pin
DThe analog input pin only
✗ Incorrect
The data pin connects to a digital input/output pin to send and receive data.
What is the typical delay time recommended between DHT sensor readings?
A2 seconds
B10 seconds
C1 millisecond
DNo delay needed
✗ Incorrect
A delay of about 2 seconds is recommended to allow the sensor to stabilize.
Which sensor is more accurate and supports a wider range: DHT11 or DHT22?
ANeither measures temperature
BDHT11
CBoth are the same
DDHT22
✗ Incorrect
DHT22 is more accurate and supports a wider range of humidity and temperature.
Which Arduino library is commonly used to read DHT sensors?
AWire library
BServo library
CDHT sensor library
DSPI library
✗ Incorrect
The DHT sensor library by Adafruit is designed for these sensors.
What does the DHT sensor measure?
ALight intensity
BHumidity and temperature
CSound levels
DPressure
✗ Incorrect
DHT sensors measure humidity and temperature.
Explain how to set up and read data from a DHT11 or DHT22 sensor using Arduino.
Think about wiring, library usage, and timing.
You got /5 concepts.
Describe the differences between the DHT11 and DHT22 sensors and when you might choose one over the other.
Consider accuracy, range, and cost.
You got /5 concepts.
Practice
(1/5)
1. What does the DHT11 sensor measure in an Arduino project?
easy
A. Humidity and temperature
B. Light intensity
C. Sound levels
D. Distance
Solution
Step 1: Understand sensor purpose
The DHT11 sensor is designed to measure environmental conditions.
Step 2: Identify measured values
It specifically measures humidity and temperature, not light, sound, or distance.
Final Answer:
Humidity and temperature -> Option A
Quick Check:
DHT11 measures humidity and temperature [OK]
Hint: Remember DHT sensors measure air humidity and temperature [OK]
Common Mistakes:
Confusing DHT11 with light or sound sensors
Thinking it measures distance
Assuming it measures pressure
2. Which of the following is the correct way to include the DHT library in an Arduino sketch?
easy
A. #include "dht11.h"
B. #include
C. #include <dht_sensor>
D. #include
Solution
Step 1: Recall library inclusion syntax
Arduino libraries are included with #include and angle brackets for installed libraries.
Step 2: Identify correct library name
The standard DHT library is included as #include <DHT.h>.
Final Answer:
#include <DHT.h> -> Option D
Quick Check:
Use #include <DHT.h> to include DHT library [OK]
Hint: Use angle brackets and correct case for library names [OK]
Common Mistakes:
Using wrong file names
Using quotes instead of angle brackets
Incorrect capitalization
3. What will be the output of this Arduino code snippet if the sensor reading is successful?
float h = dht.readHumidity();
float t = dht.readTemperature();
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C");
medium
A. Error reading sensor
B. Humidity: % Temperature: *C
C. Humidity: 45.00 % Temperature: 23.00 *C
D. Humidity: NaN % Temperature: NaN *C
Solution
Step 1: Understand sensor reading functions
The functions readHumidity() and readTemperature() return float values if successful.
Step 2: Analyze Serial output
The code prints humidity and temperature values with labels and units, separated by tab.
Final Answer:
Humidity: 45.00 % Temperature: 23.00 *C -> Option C
Quick Check:
Successful read prints values with labels [OK]
Hint: Successful reads print numbers, errors show NaN or messages [OK]
Common Mistakes:
Expecting error message on success
Ignoring units in output
Confusing NaN with valid numbers
4. Identify the error in this Arduino code snippet for reading DHT sensor data:
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
if (humidity == NULL || temperature == NULL) {
Serial.println("Failed to read from DHT sensor!");
}
medium
A. Using NULL to check float values is incorrect
B. Missing semicolon after readTemperature()
C. Serial.println syntax is wrong
D. Variables humidity and temperature should be int
Solution
Step 1: Understand data types and checks
readHumidity() and readTemperature() return float, not pointers, so NULL is invalid.
Step 2: Correct way to check errors
Use isnan() function to check if readings failed (NaN means not a number).
Final Answer:
Using NULL to check float values is incorrect -> Option A
Quick Check:
Check floats with isnan(), not NULL [OK]
Hint: Use isnan() to check float errors, not NULL [OK]
Common Mistakes:
Checking floats against NULL
Assuming int type for sensor data
Syntax errors in Serial print
5. You want to display temperature in Fahrenheit using DHT22 sensor readings in Arduino. Which code snippet correctly converts Celsius to Fahrenheit after reading temperature?