Project.7 DHT11 Module ====================== Description ------------ This DHT11 sensor features calibrated digital signal output with the temperature and humidity sensor complex. Its technology ensures high reliability and excellent long-term stability. A high-performance 8-bit microcontroller is connected on the sensor. This sensor includes a resistive element and a sense of wet NTC temperature measuring devices.It has advantages of excellent quality, fast response, anti-interference ability and high cost performance. Each DHT11 sensor features extremely accurate calibration data of humidity calibration chamber. The calibration coefficients stored in the OTP program memory, internal sensors detect signals in the process, and we should call these calibration coefficients.The single-wire serial interface system is integrated to make it quick and easy.Qualities of small size, low power, and 20-meter signal transmission distance make it a wide applied application or even the most demanding one. Specification -------------- - Supply Voltage: +5 V - Temperature range: 0-50 °C error of ± 2 °C - Humidity: 20-90% RH ± 5% RH error - Interface: Digital Connect -------- .. image:: /img/connect/7_bb.png Code ----- .. code-block:: c #include int pinDHT11 = 2; SimpleDHT11 dht11; void setup() { Serial.begin(9600); } void loop() { // start working... Serial.println("================================="); Serial.println("Sample DHT11..."); // read with raw sample data. byte temperature = 0; byte humidity = 0; byte data[40] = {0}; if (dht11.read(pinDHT11, &temperature, &humidity, data)) { Serial.print("Read DHT11 failed"); return; } Serial.print("Sample RAW Bits: "); for (int i = 0; i < 40; i++) { Serial.print((int)data[i]); if (i > 0 && ((i + 1) % 4) == 0) { Serial.print(' '); } } Serial.println(""); Serial.print("Sample OK: "); Serial.print((int)temperature); Serial.print(" *C, "); Serial.print((int)humidity); Serial.println(" %"); // DHT11 sampling rate is 1HZ. delay(1000); } Phenomenon ----------- Wire it up well and upload the above code to Arduino. Then open the serial monitor and set the baud rate as 9600, finally you will see the current temperature and humidity value. .. image:: /img/phenomenon/7.jpg