Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino UNO with DHT11 Sensor for Temperature and Humidity Monitoring

Image 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

  • Description: A microcontroller board based on the ATmega328P.
  • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13.
  • Purpose: Acts as the central processing unit of the circuit, reading sensor data and communicating it to a computer or other devices via serial communication.

DHT11 Humidity and Temperature Sensor

  • Description: A basic, low-cost digital temperature and humidity sensor.
  • Pins: VDD, DATA, NULL, GND.
  • Purpose: Measures the ambient humidity and temperature and provides the data to the Arduino UNO.

Wiring Details

Arduino UNO

  • 5V: Connected to the VDD of the DHT11 sensor to provide power.
  • GND: Connected to the GND of the DHT11 sensor to complete the power circuit.
  • A1: Connected to the DATA pin of the DHT11 sensor to read the sensor data.

DHT11 Humidity and Temperature Sensor

  • VDD: Connected to the 5V pin of the Arduino UNO for power supply.
  • DATA: Connected to the A1 pin of the Arduino UNO for data communication.
  • GND: Connected to the GND pin of the Arduino UNO to complete the power circuit.

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.