How to Use the DHT-11 Sensor- Arduino Tutorial

About: Arduino Tutorials by Codebender.cc Team

Intro: How to Use the DHT-11 Sensor- Arduino Tutorial

The DHT-11 is a digital-output relative humidity and temperature sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air. Compared to the DHT22, this sensor is less precise, less accurate and works in a smaller range of temperature and humidity, but its smaller and less expensive.

Technical details:

  • Power: 3-5V
  • Current: 2.5mA
  • Humidity: 20-95%, ±5% accuracy
  • Temperature: 0 to 50°C, ±2°C accuracy

You can find DHT-22 tutorialhere.

In this tutorial you will learn how to use this sensor with Arduino uno. The room temperature & humidity will be printed to serial monitor.


So, let's get started!

Step 1: What You Will Need

For this tutorial you will need:

  • Arduino uno
  • Breadboard
  • DHT-11

Step 2: The Circuit

The connections are pretty easy, see the image above with the breadboard circuit schematic.

Step 3: The Code

Here's the code, embedded using codebender!

Try downloading the codebender plugin and clicking on the "Run on Arduino" button to program your Arduino board with this sketch. Below you will also find codebender serial monitor, press connect button to start receiving data from the sensor.

Step 4: Well Done!

You have successfully completed one more Arduino "How to" tutorial and you learned how to use the DHT-11 sensor.

I hope you liked this, let me know in the comments. There will be more of them, so make sure to click Follow button!

Share

    Recommendations

    • Audio Contest 2018

      Audio Contest 2018
    • Electronics Tips & Tricks Challenge

      Electronics Tips & Tricks Challenge
    • Optics Contest

      Optics Contest

    10 Discussions

    0
    None
    akalesagar16

    1 year ago

    Hey that was really informative. I saw it here and then I tried it. I thought why not interface it with various controller like PIC, AVR, 8051, ARM, TI Launchpad.

    0
    None
    sathwik2000

    1 year ago

    Arduino: 1.8.4 (Windows Store 1.8.8.0) (Windows 10), Board: "Arduino/Genuino Uno"

    sss:8: error: 'DHT' does not name a type

    DHT dht(DHTPIN, DHTTYPE);

    ^

    C:\Users\SATHWIK\Documents\Arduino\dht\sss\sss.ino: In function 'void setup()':

    sss:18: error: expected unqualified-id before '.' token

    dht.begin();

    ^

    C:\Users\SATHWIK\Documents\Arduino\dht\sss\sss.ino: In function 'void loop()':

    sss:25: error: expected primary-expression before '.' token

    hum = dht.readHumidity();

    ^

    sss:26: error: expected primary-expression before '.' token

    temp= dht.readTemperature();

    ^

    Multiple libraries were found for "dht.h"

    Used: C:\Users\SATHWIK\Documents\Arduino\libraries\DHT

    Not used: C:\Users\SATHWIK\Documents\Arduino\libraries\DHTLib

    exit status 1

    'DHT' does not name a type

    This report would have more information with

    "Show verbose output during compilation"

    option enabled in File -> Preferences.

    0
    None
    TiagoP29

    1 year ago

    Love this project, as i've built one for myself and works great but id like to add an lcd but cant seem to write the right code for this?

    Any help?

    0
    None
    shinchan2788

    1 year ago

    didn't work for me ... the temperature and humidity values are '0' .....

    0
    None
    Raphango

    3 years ago on Introduction

    It gives me this error:

    I tried to copy-paste this code to my Arduino 1.7.6 and it doesn't work either.. =T

    The funny thing is that the Serial Monitor on your instructable works perfectly... =(

    2015-08-15 16_47_04-Início.png
    1 reply
    0
    None
    codebender_ccRaphango

    Reply 3 years ago on Introduction

    Hi! If you are receiving values on serial monitor that means programming is done... maybe is just an error system message. I will inform our developing team to check this out. Thank you!

    0
    None
    codebender_ccRaphango

    Reply 3 years ago on Introduction

    Hello, please copy-paste the error message here. Also check your connections one more time. I just test it again and it's working fine with my arduino uno board and DHT-11 sensor.