How does work DHT 11 sensor with the Arduino

How does work DHT 11 sensor with the Arduino

Hello guys, Welcome back to another article from SriTu Hobby. Today we are going to talk about the DHT11 sensor. Let’s first see what is a DHT11 sensor. Primarily we can measure both temperature and humidity through this. You can use this sensor for home ecosystems, farm, and garden monitoring systems. 

Let’s see how this sensor works.

How to measure Temperature

The temperature is measured by a temperature gauge called NTC embedded in the DHT11 sensor.

How to measure Humidity

The DHT 11 sensor incorporates a substrate containing surface moisture and electrons to measure the humidity level. When water vapor is absorbed from the substrate, ions are released from the substrate, increasing the conductivity between the electrodes. The difference in resistance between the two electrodes is proportional to the relative humidity. Higher relative humidity reduces the resistance between the electrodes and lower relative humidity increases the resistance between the electrodes. The amount of water vapor can be measured by the electrical resistance between the two electrodes.

DHT 11 sensor details

  • Humidity readings with 5% accuracy.
  • Temperature readings ±2°C accuracy.
  • Body size 15.5mm x 12mm x 5.5mm.
  • 2.5mA max current use.
  • Low cost.

We can see this DHT11 sensor in the market in two ways. We will identify these two types separately.

1. Here we can see four main pins. Of these, we only need three pins. This cannot be used directly for our project. A pull-up resistor should be used for that. For that, we can use a 10k resistor. The DATA pin must be connected to the VCC pin.

    How does work DHT 11 sensor with the Arduino

    2 This is a module that incorporates a DHT11 sensor and is easy to use, as it does not require an external pull-up resistor.

    How does work DHT 11 sensor with the Arduino

    Ok now test the functionality of this using the sensor we introduced earlier. The necessary equipment for this is given below. They can be easily purchased from the links below.

    Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

    OK let’s do this project step by step.

    Step 1

    Firstly, identify these components.

    Step 2

    Now connect these components using the circuit diagram below. You can connect this sensor to any digital pin or analog pin.

    How does work DHT 11 sensor with the Arduino

    Step 3

    Now let’s look at the code required for this. For this, we first need the DHT11 Library. Download it from this link and install it on the Arduino IDE.

    • The complete program of this project – Download
    /*how to work DHT11 sensor.
      Serial monitor readings.
      created by the SriTu Tech team.
      Read the code below and use it for any of your creation
    */
    #include <DHT.h>
    DHT value(2,DHT11);
    void setup() {
      Serial.begin(9600);
      value.begin();
    }
    
    void loop() {
      double h = value.readHumidity();//get humidity
      double t = value.readTemperature();//get tempereture
      Serial.print("Humidity = ");
      Serial.print(h);//print humidity
      Serial.print("t");//tab space
      Serial.print("Temperature = ");
      Serial.println(t);//print temperature
      delay(1000);//delay
    }

    In this code, the library is included first. Then an object called “value” is created and the name of the sensor and the pin associated with the sensor are entered.

    #include <DHT.h>
    DHT value(2,DHT11);

    In the void setup, the serial monitor and DHT11 sensor are enabled.

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

    In the void loop, the temperature and humidity values are read and those values are included in two double variables. Finally, the values are displayed on the serial monitor.

    void loop() {
      double h = value.readHumidity();//get humidity
      double t = value.readTemperature();//get tempereture
      Serial.print(“Humidity = “);
      Serial.print(h);//print humidity
      Serial.print(“t”);//tab space
      Serial.print(“Temperature = “);
      Serial.println(t);//print temperature
      delay(1000);//delay
    }

    Step 4

    Now, select the board and port. After, click the upload button.

    Now, you can values on the Serial monitor. The full video guide is below. So, we hope to see you in the next tutorial. Have a good day.

    How does work DHT 11 sensor with the Arduino

    Similar Posts

    Leave a Reply

    Your email address will not be published. Required fields are marked *