Wednesday, January 22, 2020

Do it yourself-1

Reading Temperature- Humidity DHT-11 Sensor using Arduino Uno

by
Likith. R - BCA 2nd YEAR, NCMS

Components Required 

  • Arduino UNO & Genuino UNO
  • DHT11 Temperature & Humidity Sensor (3 pins)
  • Jumper wires (generic)
  • Breadboard (generic)
  • Arduino UNO USB 2.0 Cable 2.0

Circuit

Steps 
Step 1: place the DHT11 sensor on the bread board.
• Step 2: connect the DHT11 sensor by using jumper wires as follows to the Arduino uno board.
• i> connect the 5v to the +ve pin of sensor using male to male jumper wire.
• ii> connect the A0 to the OUT pin of Sensor by male to male jumper wire.
• iii> leave the 3rd pin free.
• iv> connect the -ve pin to the ground using male to male jumper wire.
• Step 3: upload the code to the Arduino uno board.
• step 4: you will be able to view the temperature and humidity in tools > serial monitor or press ctrl+shift+M.

Code:

#include <dht.h>
#define dht_apin A0 // Analog Pin sensor is connected to
dht DHT;
void setup(){
  Serial.begin(9600);
  delay(500);//Delay to let system boot
  Serial.println("DHT11 Humidity & temperature Sensor\n\n");
  delay(1000);//Wait before accessing Sensor
}//end "setup()"
void loop(){
  //Start of Program 
    DHT.read11(dht_apin);
    
    Serial.print("Current humidity = ");
    Serial.print(DHT.humidity);
    Serial.print("%  ");
    Serial.print("temperature = ");
    Serial.print(DHT.temperature); 
    Serial.println("C  ");
    
    delay(5000);//Wait 5 seconds before accessing sensor again.
  //Fastest should be once every two seconds.
}// end loop()

Link to download dht library - https://www.brainy-bits.com/dht11-tutorial/


Result



No comments:

Post a Comment

AI IN CRYPTOGRAPHY

Written by: PALLAVI V (Final year BCA) 1.     ABSTRACT: The integration of AI in Cryptography represents a significant advancement in ...