group-icon
Arduino + Raspberry Pi Lovers
Discussion and Q&A about Arduino and Raspberry Pi projects.
186 Members
Join this group to post and comment.
Ashwani Kumar
Ashwani Kumar
Electronics and Communication
19 Jan 2019

DHT11 interfacing with Arduino UNO.

Dht11>>> HUMIDITY AND TEMPERATURE SENSOR.

DHT11 is a quit slow but still efficient sensor for taking data which performs the function of basic analog data exchange. There is a small chip inside this sensor which performs the function of analog to digital to analog conversion and gives the results for temperature as well as for humidity in digital form. This digital signal can be read easily through any micro-controller.

Now Coming to interfacing with Arduino>>>>

(For information about Arduino, kindly go with previous post in this grp)

 


Now programming😘

#include// DHT11 humidity sensor library

dht DHT; //Creating sensor object

#define DHT11_PIN 2 // Sensor is connected to Arduino pin 2

void setup()

{

  Serial.begin(9600); //setting baud rate

  Serial.println("   =====================================================");

  Serial.println("   ||   Welcome to Temperarue and Humidity Detector   ||");

  Serial.println("   =====================================================");

  Serial.println("");

  }

void loop()//method used to run the code repeatedly

{

  int chk = DHT.read11(DHT11_PIN); //Reading data from sensor

  Serial.print(" Humidity = ");//prints on the serial monitor

  Serial.print(DHT.humidity);// prints obtained humidity on serial port

  Serial.print(" g/m^3");

  Serial.print("    \tTemperature = ");//prints on the serial monitor

  Serial.print(DHT.temperature, 1);//prints obtained temperature on serial port

  Serial.println(" degrees");

  

  delay(2000);//adding the delay of 2 seconds

  }

Output.


Now Dht11 Characteristics>>