Home ARDUINO Which weather Sensors is suitable for your Electronics project DHT22 or DH11

Which weather Sensors is suitable for your Electronics project DHT22 or DH11

0

I have always wanted to know if there is any real difference between the temperature and humidity sensors, especially DHT11 and DHT22.

This tutorial introduces low-cost DHT temperature and humidity sensors. These sensors are very basic and slow, but great for amateurs who want to do basic data logging. The DHT sensor consists of two parts, a capacitive humidity sensor and a thermistor.

Overview

These sensors are very popular with electronics enthusiasts because they are very cheap but still provide good performance. The following are the main specifications and differences for these two sensors:

The DHT22 is a more expensive version and obviously has better specifications. The temperature measurement range is -40 to +125 degrees Celsius with an accuracy of ±0.5 degrees, while the DHT11 temperature range is 0 to 50 degrees Celsius with an accuracy of ±2 degrees. In addition, the DHT22 sensor has a better humidity measurement range from 0 to 100% with an accuracy of 2-5%, while the DHT11 has a humidity range of 20% to 80% with an accuracy of 5%.

Ok, now let’s see how these sensors work. They consist of a humidity sensing component, an NTC temperature sensor (or thermistor) and an IC on the back of the sensor.

The principle of DHT11-DDHT22 work

To measure humidity, they use a humidity sensing assembly with two electrodes with a moisturizing substrate between them. Therefore, as the humidity changes, the conductivity of the substrate changes, or the resistance between the electrodes changes. This change in resistance is measured and processed by the IC so that it can be read by the microcontroller.

Humidity sensor work, principle

For the humidity sensor measure temperature, these sensors use an NTC temperature sensor or a thermistor.

The thermistor is actually a variable resistor that changes its resistance as temperature changes. These sensors are made by sintering a semiconductor material such as ceramic or polymer to provide greater resistance change with little temperature variation. The term “NTC” means “negative temperature coefficient”, which means that the resistance decreases with increasing temperature.

Thermistor works, principle

DHT11 and DHT22

We have two versions of DHT sensors that look a bit similar and have the same pinout, but with different features. These are following specs for these sensors

DHT11

  • Ultra low cost
  • 3 to 5V power and I/O.
  • Maximum current during conversion is 2.5mA (when requesting data)
  • Suitable for 20-80% humidity readings with an accuracy of 5%
  • Suitable for 0-50 ° C temperature reading ± 2 ° C accuracy
  • The sampling rate does not exceed 1 Hz (once per second)
  • Body size 15.5mm x 12mm x 5.5mm
  • 4 pins with a pitch of 0.1″

DHT22

  • low cost
  • 3 to 5V power and I/O.
  • Maximum current during conversion is 2.5mA (when requesting data)
  • Suitable for 0-100% humidity readings with an accuracy of 2-5%
  • Suitable for temperature readings from -40 to 80 °C ± 0.5 ° C accuracy
  • The sampling rate does not exceed 0.5 Hz (every 2 seconds)
  • Body size 15.1mm x 25mm x 7.7mm
  • 4 pins with a pitch of 0.1″

As you can see, the DHT22 is more accurate and better in a larger range. Both use a single digital pin and are “slow” because you can’t query them every two or two times.

Something used in this project

Hardware requirements

  • Arduino UNO and Genuino UNO
  • DHT22 temperature sensor
  • DHT11 temperature and humidity sensor
  • Software requirements
  • Arduino IDE
  • DHT liberation

Abstract

When I see the difference between price and specification, I think it’s just about the scope. I decided to test both of them to find out the truth.

After this small project and many tests, I found that there are huge differences in accuracy and data.

Wiring

Connect all content as described below

DHT11 Test

DHT22 Test

Upload source code

#include “DHT.h”

 

#define DHTPIN 3     // what digital pin we’re connected to

 

// Uncomment whatever type you’re using!

//#define DHTTYPE DHT11   // DHT 11

#define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321

//#define DHTTYPE DHT21   // DHT 21 (AM2301)

 

// Connect pin 1 (on the left) of the sensor to +5V

// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1

// to 3.3V instead of 5V!

// Connect pin 2 of the sensor to whatever your DHTPIN is

// Connect pin 4 (on the right) of the sensor to GROUND

// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

 

// Initialize DHT sensor.

// Note that older versions of this library took an optional third parameter to

// tweak the timings for faster processors.  This parameter is no longer needed

// as the current DHT reading algorithm adjusts itself to work on faster procs.

DHT dht(DHTPIN, DHTTYPE);

 

void setup() {

Serial.begin(9600);

Serial.println(“DHTxx test!”);

 

dht.begin();

}

 

void loop() {

// Wait a few seconds between measurements.

delay(2000);

 

// Reading temperature or humidity takes about 250 milliseconds!

// Sensor readings may also be up to 2 seconds ‘old’ (its a very slow sensor)

float h = dht.readHumidity();

// Read temperature as Celsius (the default)

float t = dht.readTemperature();

// Read temperature as Fahrenheit (isFahrenheit = true)

float f = dht.readTemperature(true);

 

// Check if any reads failed and exit early (to try again).

if (isnan(h) || isnan(t) || isnan(f)) {

Serial.println(“Failed to read from DHT sensor!”);

return;

}

 

// Compute heat index in Fahrenheit (the default)

float hif = dht.computeHeatIndex(f, h);

// Compute heat index in Celsius (isFahreheit = false)

float hic = dht.computeHeatIndex(t, h, false);

 

Serial.print(“Humidity: “);

Serial.print(h);

Serial.print(” %\t”);

Serial.print(“Temperature: “);

Serial.print(t);

Serial.print(” *C “);

Serial.print(f);

Serial.print(” *F\t”);

Serial.print(“Heat index: “);

Serial.print(hic);

Serial.print(” *C “);

Serial.print(hif);

Serial.println(” *F”);

}

Advertisements

LEAVE A REPLY

Please enter your comment!
Please enter your name here