Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO with DHT11 Temperature and Humidity Sensor

View and Edit Project In Cirkit DesignerImage of Arduino UNO with DHT11 Temperature and Humidity Sensor

Circuit Documentation

Summary of the Circuit

This circuit consists of an Arduino UNO microcontroller board interfaced with a KY-015 DHT11 temperature and humidity sensor. The Arduino UNO is responsible for reading the environmental data captured by the DHT11 sensor and outputting the information to the serial monitor. The sensor operates on a 5V supply, which is provided by the Arduino, and communicates with the Arduino through one of its digital pins.

Component List

Arduino UNO

KY-015 DHT11 Temperature and Humidity Sensor

Wiring Details

Arduino UNO

KY-015 DHT11 Temperature and Humidity Sensor

Documented Code

The following code is written for the Arduino UNO to interface with the KY-015 DHT11 temperature and humidity sensor. The code initializes the sensor and reads the temperature and humidity values, which are then printed to the serial monitor.

#include <Adafruit_Sensor.h>
#include <DHT.h>
#define DHTPIN 7     // Digital pin connected to the DHT sensor
#define DHTTYPE DHT11   // DHT 11
DHT dht(DHTPIN, DHTTYPE);

void setup() {
  // Initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  // Initialize the DHT sensor.
  dht.begin();
}

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();

  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t)) {
    Serial.println(F("Failed to read from DHT sensor!"));
    return;
  }

  // Compute heat index in Celsius (isFahrenheit = false)
  float hic = dht.computeHeatIndex(t, h, false);

  // Print the results to the serial monitor.
  Serial.print(F("Humidity: "));
  Serial.print(h);
  Serial.print(F("%  Temperature: "));
  Serial.print(t);
  Serial.print(F("°C "));
  Serial.print(F("Heat index: "));
  Serial.print(hic);
  Serial.println(F("°C "));
}

Note: The code defines DHTPIN as pin 7, which is a placeholder. In the actual circuit, the DHT sensor's signal pin is connected to pin D9 of the Arduino UNO. The code should be updated to reflect the correct pin number used in the circuit before uploading it to the Arduino.