Ks0129 keyestudio EASY plug DHT11 Temperature and Humidity Sensor

From Keyestudio Wiki
Jump to: navigation, search
Keyestudio EASY plug DHT11 Temperature and Humidity Sensor

Introduction

The DHT11 is a basic, ultra low-cost digital temperature and humidity sensor.
It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and provides a pre-calibrated digital signal output.
This DHT11 sensor has fast response, anti-interference ability, excellent reliability and long term stability.


Specification

  • Connector: Easy plug
  • Supply Voltage: 5V
  • Relative Humidity and temperature measurement
  • Good for 20-90% humidity readings with 5% accuracy
  • Good for 0-50°C temperature readings ±2°C accuracy
  • Interface: Digital
  • Low Cost


Technical Details

  • Dimensions: 42mm*20mm*18mm
  • Weight: 5.6g


Connect It Up

Connect the EASY Plug DHT11 sensor to control board using an RJ11 cable. Then connect the control board to your PC with a USB cable.
thumb


Upload the Code

Copy and paste below code to Arduino IDE and upload.

#include <dht11.h>
dht11 DHT;
#define DHT11_PIN 9 
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(1000);
}

Code to Note:
Before compile the code, do remember to put the libraries needed inside the libraries folder of Arduino IDE directory.
Download all the libraries:
https://drive.google.com/open?id=1GIaSDErMAz5O6N_h9Ml_Zk4dRjR-WapT


What You Should See

Open the Serial monitor to see the temperature and humidity data.
thumb


Resources

Datasheet:
https://drive.google.com/open?id=16c0ZfBYkPR77hy53iIoWxFF7lu-q7crj

Download the libraries dht11:
https://drive.google.com/open?id=1GIaSDErMAz5O6N_h9Ml_Zk4dRjR-WapT

Download the code:
https://drive.google.com/open?id=1ugnlOI5qxP5vwVkLjCxEaCKTrk019owp


Buy from