Stufin
Home Quick Cart Profile

DHT11 Humidity and Temperature Sensor

Buy Now on Stufin

Humidity Measurement

Measures relative humidity (RH) from 20% to 90% with an accuracy of 5%.

Temperature Measurement

Measures temperature from 0C to 50C with an accuracy of 2C.

Digital Output

Sends digital signals to the microcontroller or other compatible devices.

Single-Bus Digital InterfaceUses a single bus for communication, which simplifies the connection and reduces the number of pins required.

Low Power Consumption

Operates at a low voltage (3.3V to 5V) and consumes minimal power (typically 0.5mA).

Compact Size

Has a small form factor, making it suitable for use in compact devices and designs.

Reliability

Provides high accuracy and reliability in various environments.

Technical Specifications

Operating Voltage

3.3V to 5V

Operating Current

0.5mA

Humidity Measurement Range

20% to 90% RH

Temperature Measurement Range

0C to 50C

Accuracy

+ Humidity5% RH
+ Temperature2C

Response Time

+ Humidity5 seconds
+ Temperature15 seconds

Communication Protocol

Single-bus digital interface

Dimensions

15mm x 12mm x 5.5mm

Weight

Approximately 2g

Typical Applications

Weather stations

Home automation systems

IoT projects

Environmental monitoring

Industrial automation

Medical devices

Interface and Connection

The DHT11 sensor has four pins
VCC (Power supply)Connect to a 3.3V or 5V power source.
GND (Ground)Connect to the ground.
DATA (Data output)Connect to a digital input pin on the microcontroller or other compatible devices.
NC (No connection)Not used.

Notes and Precautions

The DHT11 sensor is sensitive to environmental factors, such as air pressure and airflow. Ensure proper installation and calibration for accurate measurements.

Avoid exposing the sensor to direct sunlight, high temperatures, or extreme humidity levels, which may affect its performance and accuracy.

Use a voltage regulator or a power supply module to ensure a stable power supply to the sensor.

Pin Configuration

  • DHT11 Humidity and Temperature Sensor Pinout and Connection Guide
  • The DHT11 is a popular low-cost digital humidity and temperature sensor widely used in various IoT applications. It has four pins, which are explained below:
  • Pinout:
  • 1. VCC (Power Pin)
  • Function: Supplies power to the sensor
  • Voltage: 3.3V to 5V (typical operating voltage: 5V)
  • Connection: Connect to the positive terminal of your power source (e.g., an Arduino board's 5V pin or a battery's positive terminal)
  • 2. Data (Signal Pin)
  • Function: Transmits temperature and humidity data to the microcontroller
  • Connection: Connect to a digital input pin on your microcontroller (e.g., an Arduino board's digital pin)
  • 3. NC (No Connection)
  • Function: Not connected internally; reserved for future use or for a different version of the sensor
  • Connection: Leave this pin unconnected
  • 4. GND (Ground Pin)
  • Function: Provides a ground reference for the sensor
  • Connection: Connect to the negative terminal of your power source (e.g., an Arduino board's GND pin or a battery's negative terminal)
  • Connection Structure:
  • To connect the DHT11 sensor to your microcontroller (e.g., Arduino):
  • 1. Connect the VCC pin of the DHT11 to the 5V pin on the Arduino board.
  • 2. Connect the GND pin of the DHT11 to the GND pin on the Arduino board.
  • 3. Connect the Data pin of the DHT11 to a digital input pin on the Arduino board (e.g., D2, D3, D4, etc.).
  • 4. Leave the NC pin unconnected.
  • Note:
  • Make sure to use a pull-up resistor (typically 10k) between the Data pin and the VCC pin to ensure stable communication.
  • When using the DHT11 with an Arduino board, you'll need to use a library (e.g., DHTlib) to communicate with the sensor and read temperature and humidity data.
  • By following this pinout and connection guide, you'll be able to successfully integrate the DHT11 humidity and temperature sensor into your IoT project.

Code Examples

DHT11 Humidity and Temperature Sensor Documentation
The DHT11 is a low-cost, digital humidity and temperature sensor that provides precise and reliable measurements. This sensor is widely used in IoT applications, such as weather stations, home automation, and industrial control systems.
Technical Specifications:
Temperature Range: 0C to 50C (32F to 122F)
 Humidity Range: 20% to 80% RH
 Temperature Accuracy: 2C (3.6F)
 Humidity Accuracy: 5% RH
 Operating Voltage: 3.3V to 5.5V
 Communication Protocol: 1-Wire
Pinout:
The DHT11 sensor has three pins:
VCC (Pin 1): Connect to 3.3V or 5V power supply
 DATA (Pin 2): Connect to digital pin on the microcontroller
 GND (Pin 3): Connect to ground
Code Examples:
### Example 1: Using the DHT11 with an Arduino Board
In this example, we will use the DHT11 library for Arduino to read the temperature and humidity values.
```c++
#include <DHT.h>
#define DHTPIN 2     // Digital pin connected to the DHT11 sensor
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
  Serial.begin(9600);
  dht.begin();
}
void loop() {
  int h = dht.readHumidity();
  int t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
Serial.print("Humidity: ");
  Serial.print(h);
  Serial.print(" %	");
  Serial.print("Temperature: ");
  Serial.print(t);
  Serial.println(" C");
  delay(2000);
}
```
### Example 2: Using the DHT11 with a Raspberry Pi (Python)
In this example, we will use the python-dht library to read the temperature and humidity values using a Raspberry Pi.
```python
import Adafruit_DHT
sensor = Adafruit_DHT.DHT11
pin = 4  # GPIO pin connected to the DHT11 sensor
while True:
    humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
if humidity is not None and temperature is not None:
        print("Humidity: {:.1f}%".format(humidity))
        print("Temperature: {:.1f}C".format(temperature))
    else:
        print("Failed to retrieve data from sensor!")
```
Note: Make sure to install the necessary libraries and dependencies before running the code examples.
Tips and Tricks:
Make sure to connect the DHT11 sensor to a 3.3V or 5V power supply and avoid using it with 1.8V or lower voltages.
 Use a 1k resistor between the VCC and DATA pins to prevent voltage spikes and ensure reliable communication.
 The DHT11 sensor has a built-in pull-up resistor, so you don't need an external pull-up resistor.
 The sensor's accuracy and reliability can be affected by temperature and humidity fluctuations, so make sure to provide a stable operating environment.