Engineer Jagat

IT & Engineering Stuff

DHT11 Temperature and Humidity Sensor Arduino Code

July 29, 2020
DHT11 Temperature and Humidity Sensor Arduino Code

DHT 11 sensor is Temperature and Humidity Sensor, fetch a value from the environment. DHT 11 Sensor is useful for making Weather Station like projects.

But in this project, you just learn how to fetch data from the environment using DHT 11 and display in Serial Monitor.

To develop this project we are going to use these components :

  • Arduino Uno
  • DHT 11 Sensor
  • Breadboard 
  • Jumper Wire

Step-by-Step

Step 1: Setup

We do not need to set up a bunch of tools just install Arduino IDE for Code, Debug, and Burn the Code.

Step 2: Code

#define DHT11PIN 3
dht11 DHT11;
void setup()
{
  Serial.begin(9600);
}
void loop()
{
  Serial.println();
  int chk = DHT11.read(DHT11PIN);
  Serial.print("Humidity (%): ");
  Serial.println((float)DHT11.humidity, 2);
  Serial.print("Temperature (C): ");
  Serial.println((float)DHT11.temperature, 2);
  delay(2000);
}

Step 3: Wiring

DHT 11 Sensor Circuit Diagram
DHT 11 Sensor Circuit Diagram
Share with Friends
Copyright © 2020-2021 Engineer Jagat All rights reserved. Developed by Ravindra Rana