Introduction: Arduino – DHT11 Sensor

Picture of Arduino – DHT11 Sensor

Hi Guys,

This is my first Arduino tutorial, even though I know there’s huge number of Arduino articles and apprentices videos easy available online, I decided to make my own, to help anyone of us start with basic of Arduino and Electronics.


This tutorial covers the basic low cost DHT11 [Humidity and Temperature sensors inbuilt] and also very common sensor for Arduino projects. The chip inside the DHT11 perform all the heavy task and only output a digital signal with humidity and temperature, compatible with any MCUs, ideal for those who want some basic data logging stuffs, Home Automation and more.

DHT11 Specifications:

· 3 to 5V power

· Max. 2.5mA during conversion

· Humidity range 20-80% with 5% accuracy

· Temperature range 0-50°C with ±2°C accuracy


· VCC (3 to 5V power)

· Data out

· NC


Parts Required:

You will need the following to make the circuit.

· 1 x Arduino Uno

· 1 x DHT11

· 1 x 10KΩ Resistor

· Jumper Wires

Step 1: ​Schematic:

Picture of ​Schematic:

Here’s how to connect the DHT11 to Arduino.

Step 2: ​Source Code:

Here’s the codes for this project.

1. Download the DHT Library from Adafruit repository.

2. Unzip the DHT library and rename the extracted folder to DHT.

3. Copy this folder to the following path to install the DHT library.

C:\Program Files (x86)\Arduino\libraries

4. Upload below code.

You should see the humidity and temperature on the serial monitor once the sketch has been successfully uploaded to Arduino.

Step 3: ​Demonstration:

Picture of ​Demonstration:

You should see the humidity and temperature on the serial monitor once the sketch has been successfully uploaded to Arduino.

Thanks for reading,


sathwik2000 (author)2017-09-12

i am not getting some error in compiling

alexander_th made it! (author)2017-07-16

I made it and it works.

Now i'll try it on ESP8266 NodeMCU.

pdiddydirty (author)2015-12-28

Enjoyed your instruct able but I have a question? I have one of these sensors but it is a three pronged. How would I run this program? I am attaching a link as well:

Avishek Hardin made it! (author)pdiddydirty2015-12-29

Hello pdiddydirty,

Greeting, I believe the KY-015 is same as DHT11, the only
difference I noticed is

  • DHT11 got 4 pins

  • KY-015 got 3 pins only, pin number 3 has been omitted
    from the module for simplicity.

Grateful if you could connect the circuit as below schematic.

[S] --> Arduino Pin2

[Middle] --> Arduino VCC 5v

[-] --> Arduino GND

Upload the sketch I posted and test. Note the BaudRate should be set to 9600 on the serial monitor.

Let us know the outcome. Good Luck...

Thank you for the the help! That helps a lot. The code stats the same right?

Hello pdiddydirty,

Yes, sure you can use same sketch.

Hey I tried your code and I got a "exit status 1 error compiling ." What am I doing wrong?

theoriginalrage (author)2016-01-10

I made this one. It was pretty straightforward. Great job.

Batimeh (author)2015-12-27

i want to learn about arduino

Avishek Hardin (author)Batimeh2015-12-28

Hello Batimeh, thanks for your time to read my Instructable, am also learning Arduino. My current reference is where you can easily start. Huge number of apprentices
videos available on youtube, please check out Jeremy Blum Arduino Tutorial, worth it link below.

DIY Hacks and How Tos (author)2015-12-27

Great sensor project.

Thanks a lot Jason.

About This Instructable



More by Avishek Hardin:Lightweight Arduino GSM Mobile Phone.Arduino GPS Speed Camera DetectorArduino - DHT11 and OLED V3.0
Add instructable to: