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

ESP32-Based Temperature and Humidity Monitor with DHT11 Sensor

View and Edit Project In Cirkit DesignerImage of ESP32-Based Temperature and Humidity Monitor with DHT11 Sensor

Circuit Documentation

Summary of the Circuit

This circuit consists of an ESP32 microcontroller interfaced with a DHT11 temperature and humidity sensor. The ESP32 reads data from the DHT11 sensor and outputs the temperature and humidity readings to the Serial Monitor. The DHT11 sensor's DATA pin is connected to one of the GPIO pins on the ESP32, and its power supply pins (VCC and GND) are connected to the corresponding power pins on the ESP32.

Component List

ESP32

DHT11

Wiring Details

ESP32

DHT11

Documented Code

ESP32 Code

/*
 * This Arduino Sketch reads temperature and humidity data from a DHT11 sensor
 * connected to an ESP32 microcontroller. The DHT11 sensor's DATA pin is
 * connected to GPIO 26 of the ESP32. The sensor's VCC and GND are connected
 * to the ESP32's VIN and GND respectively.
 */

#include <DHT.h>

#define DHTPIN 26     // Pin where the DHT11 is connected
#define DHTTYPE DHT11 // DHT 11

DHT dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600);
  dht.begin();
}

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

  // Reading temperature or humidity takes about 250 milliseconds!
  float h = dht.readHumidity();
  float t = dht.readTemperature();

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

  // Print the results to the Serial Monitor.
  Serial.print("Humidity: ");
  Serial.print(h);
  Serial.print(" %\t");
  Serial.print("Temperature: ");
  Serial.print(t);
  Serial.println(" *C ");
}

Filename: sketch.ino

(Note: The second code input provided was identical to the first and seems to be a duplicate, so it has not been included in this documentation.)