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

Arduino UNO Based Temperature and Humidity Monitoring System

Image of Arduino UNO Based Temperature and Humidity Monitoring System

Circuit Documentation

Summary

This circuit is designed to measure temperature and humidity using a DHT11 sensor interfaced with an Arduino UNO. The DHT11 sensor is a digital temperature and humidity sensor that provides calibrated digital output. A pull-up resistor is used on the data line of the DHT11 sensor to ensure a stable data transfer to the Arduino UNO. The Arduino UNO is programmed to read the sensor data, process it, and output the temperature and humidity readings to the serial monitor.

Component List

DHT11 Humidity and Temperature Sensor

  • Description: A digital sensor that measures ambient temperature and humidity.
  • Pins: VDD (Power Supply), DATA (Data Output), NULL (No Connection), GND (Ground).

Arduino UNO

  • Description: A microcontroller board based on the ATmega328P.
  • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5 (Analog Input), SCL, SDA, AREF, D0-D13 (Digital I/O).

Resistor

  • Description: A passive two-terminal electrical component that implements electrical resistance as a circuit element.
  • Properties: 10,000 Ohms resistance.

Comment

  • Description: A placeholder or annotation within the circuit design, not an actual physical component.

Wiring Details

DHT11 Humidity and Temperature Sensor

  • VDD: Connected to the 5V output on the Arduino UNO.
  • DATA: Connected to digital pin D2 on the Arduino UNO through a 10k Ohm pull-up resistor.
  • GND: Connected to the ground (GND) on the Arduino UNO.

Arduino UNO

  • 5V: Provides power to the DHT11 sensor.
  • D2: Receives the data signal from the DHT11 sensor with a pull-up resistor in the line.
  • GND: Common ground used by the DHT11 sensor and the pull-up resistor.

Resistor

  • pin1: Connected to the DATA pin of the DHT11 sensor.
  • pin2: Connected to digital pin D2 on the Arduino UNO.

Documented Code

The code for the Arduino UNO is written in C++ and is designed to interface with the DHT11 sensor using the Adafruit DHT sensor library. The code initializes the sensor, reads temperature and humidity data, and prints the values to the serial monitor.

#include "Adafruit_Sensor.h"
#include "DHT.h"
#include "DHT_U.h"

#define DHTPIN 2     // Digital pin connected to the DHT sensor
#define DHTTYPE    DHT11     // DHT 11

DHT_Unified dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600);
  dht.begin();
  Serial.println(F("DHTxx Unified Sensor Example"));
  // Print temperature sensor details.
  sensor_t sensor;
  dht.temperature().getSensor(&sensor);
  Serial.println(F("------------------------------------"));
  Serial.println(F("Temperature Sensor"));
  // Print the sensor details.
}

void loop() {
  // Delay between measurements.
  delay(dht.temperature().min_delay);
  // Get temperature event and print its value.
  sensors_event_t event;
  dht.temperature().getEvent(&event);
  if (!isnan(event.temperature)) {
    Serial.print(F("Temperature: "));
    Serial.print(event.temperature);
    Serial.println(F("°C"));
  }
  // Get humidity event and print its value.
  dht.humidity().getEvent(&event);
  if (!isnan(event.relative_humidity)) {
    Serial.print(F("Humidity: "));
    Serial.print(event.relative_humidity);
    Serial.println(F("%"));
  }
}

The code includes the necessary libraries for the DHT sensor and defines the pin to which the sensor is connected. It initializes the sensor in the setup() function and continuously reads the temperature and humidity in the loop() function, printing the results to the serial monitor. The isnan() function checks if the value read is 'not a number', which is a way to handle potential errors in reading the sensor.

The additional code files DHT.h, DHT_U.h, DHT.cpp, DHT_U.cpp, Adafruit_Sensor.h, and Adafruit_Sensor.cpp are part of the Adafruit DHT sensor library and provide the necessary functions and definitions to interface with the DHT11 sensor. These files should be included in the Arduino project to compile and upload the code successfully to the Arduino UNO.