Introduction
This DHT11 Temperature and Humidity Sensor features a calibrated digital output temperature and humidity sensor module. Its technology ensures high reliability and excellent long-term stability. A high-performance 8-bit microcontroller is connected. This sensor includes a resistive element and wet NTC temperature measuring devices. It has excellent quality, fast response, anti-interference ability and high cost performance advantages.
Each DHT11 sensors features extremely accurate calibration of humidity calibration chamber. The calibration coefficients stored in the OTP program memory. Internal sensors detect signals in the process in accordance with their calibration coefficients. The single-wire serial interface system is integrated to become quick and easy to use. The small size, low power, and signal transmission distance up to 20 meters makes it useful in a variety of applications and even the most demanding applications. The product is 4-pin single row pin package. Convenient connections and special packages can be provided according to users need.
Specification
- Supply Voltage: +5 V
- Temperature range :0-50 °C error of ± 2 °C
- Humidity :20-90% RH ± 5% RH error
- Interface: Digital
Tutorial
Connecting diagram
Sample Code
Please download the DHTLib to your Arduino library first.
#include <dht11.h>
dht11 DHT;
#define DHT11_PIN 4
void setup(){
Serial.begin(9600);
Serial.println("DHT TEST PROGRAM ");
Serial.print("LIBRARY VERSION: ");
Serial.println(DHT11LIB_VERSION);
Serial.println();
Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)");
}
void loop(){
int chk;
Serial.print("DHT11, \t");
chk = DHT.read(DHT11_PIN); // READ DATA
switch (chk){
case DHTLIB_OK:
Serial.print("OK,\t");
break;
case DHTLIB_ERROR_CHECKSUM:
Serial.print("Checksum error,\t");
break;
case DHTLIB_ERROR_TIMEOUT:
Serial.print("Time out error,\t");
break;
default:
Serial.print("Unknown error,\t");
break;
}
// DISPLAT DATA
Serial.print(DHT.humidity,1);
Serial.print(",\t");
Serial.println(DHT.temperature,1);
delay(2000);
}
Trouble shooting
More question and cool idea, visit DFRobot Forum
More Documents
``