Temperature & humidity sensor DHT11 interface with Arduino

DHT11 is a cheap & easy option for temperature & humidity measurement for DIY projects & beginner experiments. It is likely suitable for domestic environment control, weather monitoring unit & gardening/farming monitoring stations. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, gives output as digital signal which can be connected to Arduino digital IO pin directly. The only drawback of DHT11 is slow response for updated values. You can download DHT11 datasheet from here.

Technical Specifications

  • Operating Voltage: 3V to 5.5V DC
  • Current consumption: Measurement 0.3mA, standby 60μ A
  • Accuracy: At 25℃, ± 2℃ & ± 5% RH
  • Sampling period: more than 2 seconds
  • Measurement Range: 20-95% RH & 0-50℃
  • Resolution: 8 Bit for temperature & 8 Bit for humidity
  • Response time: 6 to 15 seconds for humidity & 6 to 30 seconds for temperature.

The DHT11 measures relative humidity which means the amount of water vapor in air vs. the saturation point of water vapor in air. At the saturation point, water vapor starts to condense and accumulate on surfaces forming dew. The saturation point changes with air temperature. Cold air can hold less water vapor before it becomes saturated, and hot air can hold more water vapor before it becomes saturated.


DHT11 module available in market is having 3 pins, actually sensor is having 4 pins but module designed to connect with arduino easily by removing 1 pin which is not required (Few makers sell module with 4 wire). Connections shown in diagram is as below:

(Colors are mentioned for reference only, Refer pin numbers & connect wires carefully)

Test Code

You can download this code from here.

How this code works: As mentioned in code, pin no. 7 is defined as DHT11_PIN variable. In setup loop, baud rate is assigned at 9600 to read DHT11 values on serial monitor available in Arduino IDE software. Next loop is written to move DHT11 values in variable and print on serial monitor. Just copy the code and paste in Arduino IDE, set your Arduino board & COM Port, upload it, here you go with values on serial monitor. So, it is too easy to get temperature & humidity using DHT11 sensor. For further expansion, you can connect LCDs, OLEDs to display and can send data wireless using HC-05 Bluetooth sensor and many more wireless options.

I hope this tutorial will be helpful for basic temperature & humidity measurement. In future you can interface LCD and wireless interfaces with this type of sensors. Give your feedback about this tutorial in Contact, Your feedback will be appreciated.

Subscribe BYB on FacebookTwitterInstagram & Telegram for latest updates.

Leave a Reply

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