Arduino Uno Humidity Sensor Project

Humidity and temperature are common parameters to measure environmental conditions. In this Arduino based project we are going to measure ambient temperature and humidity and display it on a 16x2 LCD screen. A combined temperature and himidity sensor DHT11 is used with Arduino uno to develop this Celsius scale thermometer and percentage scale humidity measurement project. In one of my previous project, I have also developed a digital thermometer using temperature sensor LM35.


This project consists of three sections - one senses the humidity and temperature by using humidity and temperature sensor DHT11. The second section reads the DHTsensor module’s output and extracts temperature and humidity values into a suitable number in percentage and Celsius scale. And the third part of the system displays humidity and temperature on LCD.

Arduino Humidity and Temperature Sensor Block Diagram

Working of this project is based on single wire serial communication. First arduino send a start signal to DHT module and then DHT gives a response signal containing temperature and humidity data. Arduino collect and extract in two parts one is humidity and second is temperature and then send them to 16x2 LCD.


Here in this project we have used a sensor module namely DHT11. This module features a humidity and temperature complex with a calibrated digital signal output means DHT11 sensor module is a combined module for sensing humidity and temperature which gives a calibrated digital output signal. DHT11 gives us very precise value of humidity and temperature and ensures high reliability and long term stability. This sensor has a resistive type humidity measurement component and NTC type temperature measurement component with an 8-bit microcontroller inbuilt which has a fast response and cost effective and available in 4-pin single row package.

DHT11 sensor

DHT11 module works on serial communication i.e. single wire communication. This module sends data in form of pulse train of specific time period. Before sending data to arduino it needs some initialize command with a time delay. And the whole process time is about 4ms. A complete data transmission is of 40-bit and data format of this process is given below:

8-bit integral RH data + 8-bit decimal RH data + 8-bit integral T data + 8-bit decimal T data + 8-bit check sum.


Complete Process

First of all arduino sends a high to low start signal to DHT11 with 18µs delay to ensure DHT’s detection. And then arduino pull-up the data line and wait for 20-40µs for DHT’s response. Once DHT detects starts signal, it will send a low voltage level response signal to arduino of time delay about 80µs. And then DHT controller pull up the data line and keeps it for 80µs for DHT’s arranging of sending data.


When data bus is at low voltage level it means that DHT11 is sending response signal. Once it is done, DHT again makes data line pull-up for 80µs for preparing data transmission.

Data format that is sending by DHT to arduino for every bit begins with 50µs low voltage level and length of high voltage level signal determines whether data bit is “0” or “1”.

Arduino Uno DHT11

One important thing is to make sure pull up resistor value because if we are placing DHT sensor at <20 meter distance, 5k pull up resistor is recommended. If placing DHT at longer the 20 meter then use appropriate value pull up resistor.


Circuit Diagram and Explanation

Arduino Humidity Sensor Circuit Diagram

A liquid crystal display is used for displaying temperature and humidity which is directly connected to arduino in 4-bit mode. Pins of LCD namely RS, EN, D4, D5, D6 and D7 are connected to arduino digital pin number 2, 3, 4, 5, 6 and 7. And a DHT11 sensor module is also connected to digital pin 12 of arduino with a 5k pull-up resistor.


Programming Description

In programming, we are going to use pre-built libraries for DHT11 sensor and LCD display module. 

Header file

Then we haved defined pins for LCD and DHT sensor and initialized all the things in setup. Then in a loop by using dht function reads DHT sensor and then using some dht functions we extract humidity and temperature and display them on LCD.

Humidity and Temperature value program

Here degree symbol is created by using custom character method.

degree symbol


#include<dht.h>      // Including library for dht
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

#define dht_dpin 12 

dht DHT;

byte degree[8] = 

void setup()
 lcd.begin(16, 2);
 lcd.createChar(1, degree);
 lcd.print("   Humidity   ");
 lcd.print("  Measurement ");
 lcd.print("Circuit Digest ");

void loop()
  lcd.print("Humidity: ");
  lcd.print(DHT.humidity);   // printing Humidity on LCD
  lcd.print(" %");
  lcd.print(DHT.temperature);   // Printing temperature on LCD


Comments (18)

  • ain adinan's picture
    ain adinan

    hi. i want to know name of the parts that you use because the are not same as mine. what proteus you used? i also have a problem regarding the arduino libraries in proteus. i could'nt find the arduino's part in proteus library. i've check that my proteus 8 does'nt have the library folder after installed. please help me. thank you

    Sep 29, 2015
  • Jayant's picture

    You can clearly see the parts used, Arduino Uno, 16X2 LCD and DHT11 Temperature and humidity sensor. Proteus doesn't come with Arduino installed, you need to add Arduino Library in Proteus. Library folder can be found at Proteus 8 Professional\Data\LIBRARY

    Oct 06, 2015
  • Mirna-Fayez's picture

    but the created arduino doesn't have a ground nor vcc ?

    Nov 16, 2015
  • Aashrav's picture

    How I can add dht11.h file because this header file is not in my library.?

    Jan 27, 2016
  • DP's picture

    I have both the DHT sensor library as well as the LCD library but your code won't compile. Why?

    Feb 11, 2016
  • Wambat's picture

    I get a compile error
    temp_humid_display:7: error: 'dht' does not name a type
    dht DHT;

    Apr 01, 2016
  • saddam khan's picture
    saddam khan

    Add DHT library in arduino IDE and then try again....

    Apr 03, 2016
  • rashed's picture

    How to download dht11 function in arduino?

    Jun 14, 2016
  • rashed's picture

    Can I directly run this project without testing in Proteus?

    Jun 14, 2016
  • isha's picture

    nothing iis clear......everything is blank!!!!!!
    wat to do?????????????

    Oct 24, 2016
  • ALORA's picture

    can any one send me the Proteus Simulation of this project ?

    Dec 29, 2016
  • Victor's picture

    I downloaded peoteus arduino library but it doesn't have 5v,3v,GND and VIN pinouts. What should i do ?

    Jan 09, 2017
  • Naman Chauhan's picture
    Naman Chauhan

    its showing up errors even after adding libraries. the error message is :
    Arduino: 1.8.1 (Windows 7), Board: "Arduino/Genuino Uno"

    sketch_jan11a:5: error: no matching function for call to 'DHT::DHT()'

    DHT dht;


    C:\Users\user\Desktop\sketch_jan11a\sketch_jan11a\sketch_jan11a.ino:5:5: note: candidates are:

    In file included from C:\Users\user\Desktop\sketch_jan11a\sketch_jan11a\sketch_jan11a.ino:1:0:

    C:\Users\user\Documents\Arduino\libraries\DHT-sensor-library-master/DHT.h:40:4: note: DHT::DHT(uint8_t, uint8_t, uint8_t)

    DHT(uint8_t pin, uint8_t type, uint8_t count=6);


    C:\Users\user\Documents\Arduino\libraries\DHT-sensor-library-master/DHT.h:40:4: note: candidate expects 3 arguments, 0 provided

    C:\Users\user\Documents\Arduino\libraries\DHT-sensor-library-master/DHT.h:38:7: note: constexpr DHT::DHT(const DHT&)

    class DHT {


    C:\Users\user\Documents\Arduino\libraries\DHT-sensor-library-master/DHT.h:38:7: note: candidate expects 1 argument, 0 provided

    C:\Users\user\Documents\Arduino\libraries\DHT-sensor-library-master/DHT.h:38:7: note: constexpr DHT::DHT(DHT&&)

    C:\Users\user\Documents\Arduino\libraries\DHT-sensor-library-master/DHT.h:38:7: note: candidate expects 1 argument, 0 provided

    C:\Users\user\Desktop\sketch_jan11a\sketch_jan11a\sketch_jan11a.ino: In function 'void loop()':

    sketch_jan11a:32: error: 'class DHT' has no member named 'read11'



    sketch_jan11a:35: error: 'class DHT' has no member named 'humidity'

    lcd.print(dht.humidity); // printing Humidity on LCD


    sketch_jan11a:39: error: 'class DHT' has no member named 'temperature'

    lcd.print(dht.temperature); // Printing temperature on LCD


    exit status 1
    no matching function for call to 'DHT::DHT()'

    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.

    Jan 11, 2017
  • Rahul Ramesh's picture
    Rahul Ramesh

    Problem solved Sometimes higher version of dht library file is not supported so use lower version like 1.0.0 by adafruit and try it. Happy coding.

    Apr 18, 2017
  • mohamed abdel-hamid's picture
    mohamed abdel-hamid

    I tried to use the lower version 1.0.0 nut still give error : 'dht' does not name a type !!

    Apr 28, 2017
  • sukumar's picture

    i need abstract of this project

    Jul 26, 2017

Leave a comment