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

Arduino UNO with DHT11 Sensor for Temperature and Humidity Monitoring

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

Circuit Documentation

Summary

This document provides a detailed overview of a simple circuit that interfaces an Arduino UNO with a DHT11 Humidity and Temperature Sensor. The Arduino UNO reads the environmental data from the DHT11 sensor and outputs the humidity and temperature readings through its serial interface.

Component List

Arduino UNO

DHT11 Humidity and Temperature Sensor

Wiring Details

Arduino UNO

DHT11 Humidity and Temperature Sensor

Documented Code

The following code is written for the Arduino UNO to interface with the DHT11 sensor. It initializes the sensor and reads the humidity and temperature data, which is then printed to the serial monitor.

#include "DHT.h"

#define DHTPIN A1          // Define the pin connected to the DHT11 data pin
#define DHTTYPE DHT11      // Define the type of DHT sensor

DHT dht(DHTPIN, DHTTYPE); // Initialize the DHT sensor

void setup() {
    Serial.begin(9600);   // Start the serial communication
    dht.begin();          // Initialize the sensor
}

void loop() {
    float hu = dht.readHumidity();          // Read humidity
    float te = dht.readTemperature();       // Read temperature

    if (isnan(hu) || isnan(te)) {
        Serial.println("Failed to read data"); // Check if any reads failed
    } else {
        Serial.print("Humidity: ");
        Serial.print(hu);
        Serial.print(" %\t");
        Serial.print("Temperature: ");
        Serial.print(te);
        Serial.println(" *C");
    }
}

The code includes error handling to check if the sensor fails to read data. If the data is successfully read, it prints the humidity and temperature to the serial monitor in a human-readable format.