Arduino UNO Based Temperature and Humidity Monitoring System
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to collect temperature and humidity measurements using a DHT11 sensor interfaced with an Arduino UNO microcontroller. The data from the sensor is processed by the Arduino and output to a serial monitor. A pull-up resistor is included in the data line of the DHT11 sensor to ensure reliable communication. The circuit is powered by the 5V output from the Arduino UNO.
Component List
DHT11 Humidity and Temperature Sensor
- Description: A sensor that measures ambient humidity and temperature.
- Pins: VDD (Power), DATA (Data Output), NULL (No Connection), GND (Ground).
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: Digital I/O Pins (D0-D13), Analog Input Pins (A0-A5), Power Pins (3.3V, 5V, GND, Vin), I2C Pins (SCL, SDA), SPI Pins (MOSI, MISO, CLK), and others.
Resistor
- Description: A passive two-terminal electrical component that implements electrical resistance as a circuit element.
- Value: 10,000 Ohms (10kΩ).
Servo
- Description: An actuator that enables precise control of angular position.
- Pins: GND (Ground), VCC (Power), PULSE (Control Signal).
SD SDHC Card Module
- Description: A memory card interface used for data storage.
- Pins: 3V3 (Power), CS (Chip Select), MOSI (Master Out Slave In), CLK (Clock), MISO (Master In Slave Out), GND (Ground).
Inductive Sensor
- Description: A sensor used to detect metallic objects without contact.
- Pins: Black (Output), Blue (Ground), Red (Power).
Wiring Details
DHT11 Humidity and Temperature Sensor
- VDD connected to 5V (Arduino UNO)
- DATA connected to D2 (Arduino UNO) through a 10kΩ Resistor
- GND connected to GND (Arduino UNO)
Arduino UNO
- 5V and GND used to power the DHT11 sensor
- D2 used as the data input from the DHT11 sensor
Resistor
- One end connected to D2 (Arduino UNO)
- The other end connected to DATA (DHT11 Humidity and Temperature Sensor)
Servo
- GND connected to GND (Arduino UNO or common ground)
- VCC connected to a suitable power supply (5V if compatible)
- PULSE connected to a PWM-capable pin on the Arduino UNO
SD SDHC Card Module
- 3V3 connected to 3.3V (Arduino UNO or external power supply)
- CS, MOSI, CLK, MISO connected to corresponding SPI pins on the Arduino UNO
- GND connected to GND (Arduino UNO or common ground)
Inductive Sensor
- Black (Output) connected to an input pin on the Arduino UNO
- Blue (Ground) connected to GND (Arduino UNO or common ground)
- Red (Power) connected to a suitable power supply (check sensor specifications)
Documented Code
/**
* This example demonstrates how to collect temperature and humidity measurements
* from the Adafruit DHT11 sensor. Measurements are printed out to the serial monitor.
*
* - Make sure to first install the following libraries through the Arduino Library Manager:
* - DHT Sensor Library (by Adafruit)
* - Adafruit Unified Sensor (by Adafruit)
* - When you open the serial monitor to view measurements from the DHT11, make sure
* that you select 9600 baud so that the serial monitor can receive data from the Arduino.
*
* This example was originally written by Adafruit Industries LLC.
*/
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#define DHTPIN 2 // Digital pin connected to the DHT sensor
// Uncomment the type of sensor in use:
#define DHTTYPE DHT11 // DHT 11
DHT_Unified dht(DHTPIN, DHTTYPE);
uint32_t delayMS;
void setup() {
Serial.begin(9600);
// Initialize device.
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"));
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("------------------------------------"));
// Print humidity sensor details.
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("------------------------------------"));
// Set delay between sensor readings based on sensor details.
delayMS = sensor.min_delay / 1000;
}
void loop() {
// Delay between measurements.
delay(delayMS);
// Get temperature event and print its value.
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"));
}
// Get humidity event and print its value.
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("%"));
}
}
This code is designed to be uploaded to the Arduino UNO microcontroller. It initializes the DHT11 sensor and reads temperature and humidity data, which is then printed to the serial monitor. The code includes detailed comments and requires the Adafruit DHT sensor library and the Adafruit Unified Sensor library to be installed.