Ramji Patel
Created October 17, 2020 © CC0

Arduino DHT11 Humidity and Temperature sensor

Arduino DHT11 sensor tutorial

AdvancedFull instructions provided80
Arduino DHT11 Humidity and Temperature sensor

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
DHT11 Temperature & Humidity Sensor (3 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
×1
RGB LCD Shield Kit, 16x2 Character Display
RGB LCD Shield Kit, 16x2 Character Display
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE
Arduino IDE 2.0 (beta)

Story

Read more

Schematics

Arduino and DHT11 circuit

pdf

Code

Arduino And DHT11 Code

C/C++
copy my code and paste it on your own editor
#include <DHT.h>
#include <LiquidCrystal.h>

DHT dht(3, DHT11);
LiquidCrystal lcd(5, 6, 7, 8, 9, 10);

bool cellciusFarenheit = false;

void setup() {
 dht.begin();
 lcd.begin(16, 2);
}

void loop() {
  // Wait a few seconds between measurements.
  delay(2000);

  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  // Read temperature as Celsius (the default)
  float t = dht.readTemperature();

 lcd.setCursor(0, 0);
 lcd.print("Temp:");

 if(cellciusFarenheit)
 {
  lcd.print(t);
  lcd.print("");
  lcd.print((char)223);
  lcd.print("C");
  cellciusFarenheit = false;
  }
  else
  {
    lcd.print((t*9.0) / 5.0 + 32.0);
    lcd.print("");
    lcd.print((char)223);
    lcd.print("F");
    cellciusFarenheit = true;
  }
lcd.setCursor(0, 1);
lcd.print("Humi:");
lcd.print(h);
lcd.print("%");
delay(5000);

 }

Credits

Ramji Patel
26 projects • 18 followers
Myself Ramji Patel. I am an Engineering student and pursuing my B-Tech from Institute of engineering and rural Technology Prayagraj, India.

Comments