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

Arduino UNO Based Temperature and Humidity Monitoring System

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based Temperature and Humidity Monitoring System

Circuit Documentation

Summary

This circuit is designed to monitor environmental conditions, specifically temperature and humidity, using a DHT11 Humidity and Temperature Sensor. The sensor's data is processed by an Arduino UNO microcontroller, which can then trigger a humidifier connected through a 1-Channel Relay based on the sensor readings. A resistor is included in the circuit for the proper operation of the DHT11 sensor. Power is supplied to the circuit via an MB102 Breadboard Power Supply Module, which can provide both 3.3V and 5V outputs.

Component List

Wiring Details

DHT11 Humidity and Temperature Sensor

Arduino UNO

Resistor (10k Ohms)

MB102 Breadboard Power Supply Module 3.3V/5V

1-Channel Relay (5V 10A)

Humidifier

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 library. The code initializes the sensor, reads temperature and humidity data, and prints the results to the serial monitor. The relay control logic to turn on/off the humidifier based on the sensor readings would be implemented in the main loop, but this part of the code is not provided in the input.

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

uint32_t delayMS;

void setup() {
  Serial.begin(9600);
  dht.begin();
  Serial.println(F("DHTxx Unified Sensor Example"));
  sensor_t sensor;
  dht.temperature().getSensor(&sensor);
  Serial.println(F("------------------------------------"));
  Serial.println(F("Temperature Sensor"));
  Serial.print  (F("Sensor Type: ")); Serial.println(sensor.name);
  Serial.print  (F("Driver Ver:  ")); Serial.println(sensor.version);
  Serial.print  (F("Unique ID:   ")); Serial.println(sensor.sensor_id);
  Serial.print  (F("Max Value:   ")); Serial.print(sensor.max_value); Serial.println(F("°C"));
  Serial.print  (F("Min Value:   ")); Serial.print(sensor.min_value); Serial.println(F("°C"));
  Serial.print  (F("Resolution:  ")); Serial.print(sensor.resolution); Serial.println(F("°C"));
  Serial.println(F("------------------------------------"));
  dht.humidity().getSensor(&sensor);
  Serial.println(F("Humidity Sensor"));
  Serial.print  (F("Sensor Type: ")); Serial.println(sensor.name);
  Serial.print  (F("Driver Ver:  ")); Serial.println(sensor.version);
  Serial.print  (F("Unique ID:   ")); Serial.println(sensor.sensor_id);
  Serial.print  (F("Max Value:   ")); Serial.print(sensor.max_value); Serial.println(F("%"));
  Serial.print  (F("Min Value:   ")); Serial.print(sensor.min_value); Serial.println(F("%"));
  Serial.print  (F("Resolution:  ")); Serial.print(sensor.resolution); Serial.println(F("%"));
  Serial.println(F("------------------------------------"));
  delayMS = sensor.min_delay / 1000;
}

void loop() {
  delay(delayMS);
  sensors_event_t event;
  dht.temperature().getEvent(&event);
  if (isnan(event.temperature)) {
    Serial.println(F("Error reading temperature!"));
  }
  else {
    Serial.print(F("Temperature: "));
    Serial.print(event.temperature);
    Serial.println(F("°C"));
  }
  dht.humidity().getEvent(&event);
  if (isnan(event.relative_humidity)) {
    Serial.println(F("Error reading humidity!"));
  }
  else {
    Serial.print(F("Humidity: "));
    Serial.print(event.relative_humidity);
    Serial.println(F("%"));
  }
}

The code includes the necessary library headers, defines the pin and sensor type, initializes the sensor, and then in the loop function, it reads the temperature and humidity data and prints it to the serial monitor. The delayMS variable is used to ensure that the sensor is not read more frequently than its minimum sampling rate.