Introduction
The DH-11 Sensor by Kuongshun Electronics is a reliable and cost-effective device designed to measure ambient temperature and humidity levels. It is widely used in applications such as weather monitoring systems, HVAC (Heating, Ventilation, and Air Conditioning) systems, and smart home automation. The sensor provides digital output, making it easy to interface with microcontrollers like Arduino, Raspberry Pi, and other embedded systems.
This sensor is ideal for projects requiring basic environmental monitoring, offering a balance of accuracy, simplicity, and affordability.
Technical Specifications
The following are the key technical details of the DH-11 Sensor:
- Manufacturer Part ID: DH-11 Sensor
- Operating Voltage: 3.3V to 5.5V DC
- Current Consumption: 0.3mA (measuring), 60µA (standby)
- Temperature Range: 0°C to 50°C (±2°C accuracy)
- Humidity Range: 20% to 90% RH (±5% accuracy)
- Output Signal: Digital (1-wire protocol)
- Sampling Rate: 1 Hz (1 reading per second)
- Dimensions: 15.5mm x 12mm x 5.5mm
- Operating Life: >500,000 measurements
Pin Configuration and Descriptions
The DH-11 Sensor has a 4-pin interface, but typically only 3 pins are used in most applications. Below is the pinout:
Note: Some DH-11 modules may include a pull-up resistor on the DATA pin. If not, you may need to add an external 10kΩ pull-up resistor.
Usage Instructions
How to Use the DH-11 Sensor in a Circuit
- Power the Sensor: Connect the VCC pin to a 3.3V or 5V power source and the GND pin to the ground.
- Connect the DATA Pin: Attach the DATA pin to a digital input pin on your microcontroller. Use a 10kΩ pull-up resistor if one is not already included on the module.
- Read Data: Use a compatible library or write a custom 1-wire protocol to read temperature and humidity data from the sensor.
Example Circuit
Below is an example of how to connect the DH-11 Sensor to an Arduino UNO:
- VCC → 5V on Arduino
- DATA → Digital Pin 2 on Arduino
- GND → GND on Arduino
Arduino Code Example
Here is a sample Arduino sketch to read data from the DH-11 Sensor using the DHT library:
#include <DHT.h>
// Define the pin where the DH-11 DATA pin is connected
#define DHTPIN 2
// Define the type of DHT sensor (DHT11 in this case)
#define DHTTYPE DHT11
// Initialize the DHT sensor
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600); // Start serial communication at 9600 baud
dht.begin(); // Initialize the DHT sensor
Serial.println("DH-11 Sensor Initialized");
}
void loop() {
delay(2000); // Wait 2 seconds between readings
// Read temperature and humidity values
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
// Check if the readings are valid
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from DH-11 Sensor!");
return;
}
// Print the results to the Serial Monitor
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
}
Important Considerations and Best Practices
- Sampling Rate: The DH-11 Sensor has a sampling rate of 1 Hz. Avoid reading data more frequently than once per second to ensure accurate results.
- Environmental Conditions: The sensor is designed for indoor use. Avoid exposing it to extreme temperatures, high humidity, or direct water contact.
- Pull-Up Resistor: Ensure a 10kΩ pull-up resistor is connected to the DATA pin if not already included on the module.
- Wiring Length: Keep the wiring between the sensor and the microcontroller as short as possible to minimize signal degradation.
Troubleshooting and FAQs
Common Issues and Solutions
No Data Output:
- Ensure the sensor is powered correctly (3.3V to 5.5V).
- Verify the pull-up resistor on the DATA pin.
- Check the wiring connections for loose or incorrect connections.
Incorrect or NaN Readings:
- Ensure the sampling rate is not faster than 1 Hz.
- Verify that the sensor is operating within its specified temperature and humidity range.
- Check for electromagnetic interference (EMI) from nearby devices.
Sensor Not Responding:
- Confirm that the correct pin is defined in the code.
- Test the sensor with a different microcontroller or port to rule out hardware issues.
FAQs
Q1: Can the DH-11 Sensor measure negative temperatures?
No, the DH-11 Sensor is designed to measure temperatures in the range of 0°C to 50°C.
Q2: How accurate is the DH-11 Sensor?
The temperature accuracy is ±2°C, and the humidity accuracy is ±5%. For applications requiring higher precision, consider using the DHT22 sensor.
Q3: Can I use the DH-11 Sensor outdoors?
The DH-11 Sensor is not waterproof and is intended for indoor use. If used outdoors, ensure it is housed in a protective enclosure.
Q4: What is the maximum cable length for the DH-11 Sensor?
The recommended maximum cable length is 20 meters. For longer distances, use a shielded cable and reduce the pull-up resistor value to 5kΩ.
By following this documentation, you can effectively integrate the DH-11 Sensor into your projects for reliable temperature and humidity monitoring.