DHT11 Temperature and Humidity Sensor

DHT11 Temperature and Humidity Sensor

DHT11
Temperature
Humidity
TRIOE
IoT
Embedded Systems

The DHT11 is a widely used sensor for measuring temperature and humidity. It is commonly used in weather stations, IoT projects, and environmental monitoring systems.

Quick Actions

1234

Downloads

567

Likes

Specifications

VCCPower supply (3.3V or 5V, depending on the module)
GNDGround (-)
DATAData communication pin

Sample Code

#include <DHT.h>

#define DHTPIN 2 // Pin where the DHT11 is connected
#define DHTTYPE DHT11 // DHT 11

DHT dht(DHTPIN, DHTTYPE);

void setup() {
Serial.begin(9600);
dht.begin();
}

void loop() {
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (it's a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();

// Check if any reads failed and exit early (to try again)
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}

// Compute heat index in Celsius (isFahreheit = false)
float hic = dht.computeHeatIndex(t, h, false);

Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" % ");
Serial.print("Temperature: ");
Serial.print(t);
Serial.print(" *C ");
Serial.print("Heat index: ");
Serial.print(hic);
Serial.println(" *C");

delay(2000);
}

Crash Course: Using the DHT11 Temperature and Humidity Sensor

Objective

Teach learners how to use the DHT11 sensor module to measure temperature and humidity, and integrate its readings with a TRIOE microcontroller.

Materials Required

  • DHT11 Temperature and Humidity Sensor Module
  • TRIOE
  • Breadboard and jumper wires
  • USB cable for programming the TRIOE
  • Computer with Arduino IDE installed

Steps

1Understand the DHT11 Sensor

  • The DHT11 measures: Temperature in degrees Celsius, Humidity as a percentage.
  • Pin Description: VCC: Power supply (3.3V or 5V), GND: Ground, DATA: Data communication pin.

2Set Up the Circuit

  • Connect the VCC pin to the TRIOE's 5V.
  • Connect the GND pin to the TRIOE's GND.
  • Connect the DATA pin to the TRIOE's digital pin 2.

3Install the DHT Library

  • Open the Arduino IDE.
  • Go to Sketch > Include Library > Manage Libraries.
  • Search for 'DHT sensor library' and install the library.
  • Also, install the 'DHT library' if prompted.

Video Tutorial: Using the DHT11 Temperature and Humidity Sensor

Video Player Placeholder

Common Applications

Application 1

Description of application 1.

Application 2

Description of application 2.

Application 3

Description of application 3.