Organize and Share your Electronics the way you want. Sign-Up for a free account now. It takes only 30 seconds!

How to Set Up the DHT11 Humidity Sensor on an Arduino

How to Set Up the DHT11 Humidity Sensor on an Arduino

Scott Campbell from Circuitbasics.com has set up this temperature and humidity sensor using an Arduino and DHT11 sensors.

Because of their low cost and small size, DHT11 humidity and temperature sensors are perfect for lots of different DIY electronics projects. Some projects where the DHT11 would be useful include remote weather stations, home environment control systems, and agricultural/garden monitoring systems. The DHT11 is a digital sensor that lets you easily get relative humidity and temperature readings in your projects. In this post, I’ll first go into a little background on what humidity is, then I’ll explain how the DHT11 measures humidity. After that, I’ll show you how to connect the DHT11 to the Arduino and give you some example code so you can use the DHT11 in your own projects.

DHT11 Technical Specifications:

  • Humidity Range: 20-90% RH
  • Humidity Accuracy: ±5% RH
  • Temperature Range: 0-50 °C
  • Temperature Accuracy: ±2% °C
  • Operating Voltage: 3V to 5.5V

What is Relative Humidity?

The DHT11 humidity and temperature sensor measures relative humidity (RH) and temperature. Relative humidity is the ratio of water vapor in air vs. the saturation point of water vapor in air. The saturation point of water vapor in air changes with temperature. Cold air can hold less water vapor before it is saturated, and hot air can hold more water vapor before it is saturated. The formula for relative humidity is as follows:

Relative Humidity = (density of water vapor / density of water vapor at saturation) x 100%

Basically, relative humidity is the amount of water in the air compared to the amount of water that air can hold before condensation occurs. It’s expressed as a percentage.  For example, at 100% RH condensation (or rain) occurs, and at 0% RH, the air is completely dry.

How the DHT11 Measures Humidity and Temperature

The DHT11 calculates relative humidity by measuring the electrical resistance between two electrodes. The humidity sensing component of the DHT11 is a moisture holding substrate (usually a salt or conductive plastic polymer) with the electrodes applied to the surface. When water vapor is absorbed by the substrate, ions are released by the substrate which increases the conductivity between the electrodes. The change in resistance between the two electrodes is proportional to the relative humidity. Higher relative humidity decreases the resistance between the electrodes while lower relative humidity increases the resistance between the electrodes. Inside the DHT11 you can see electrodes applied to a substrate on the front of the chip:

Arduino-DHT11-2

 

The DHT11 converts the resistance measurement to relative humidity on an IC mounted to the back of the unit and transmits the humidity and temperature readings directly to the Arduino. This IC also stores the calibration coefficients and controls the data signal transmission between the DHT11 and the Arduino:

Arduino-DHT11-2r

 

The temperature readings from the DHT11 come from a surface mounted NTC temperature sensor (thermistor) built into the unit. To learn more about thermistors and how to use them on the Arduino, check out our Arduino Thermistor Temperature Sensor Tutorial.

The DHT11 uses one signal wire to transmit sensor readings to the Arduino digitally. The power comes from separate 5V and ground wires. A 5K – 10K Ohm pull-up resistor is connected from the signal line to 5V to make sure the signal level stays high by default (see the data sheet for specifics on how the signal is sent).

There are two different variations of the DHT11 sensor you might come across. One type has four pins, and the other type is mounted to a small PCB that has three pins. The PCB mounted version with three pins is nice since it includes a surface mounted 10K Ohm pull-up resistor for the signal line:

Arduino-DHT11-3

 

How to Set Up the DHT11 on an Arduino

The DHT11 is really easy to connect to the Arduino:

Arduino-DHT11-4

 

 

Code for Serial Monitor Output of Readings

Before we can use the DHT11 on the Arduino, we need to install the DHTLib library, which contains all of the functions we will need to get the humidity and temperature readings from the sensor. It’s easy to install. Just download the DHTLib.zip file below, and open up the Arduino IDE. Then go to Sketch>Include Library>Add Library and select the DHTLib.zip file.

 

All pictures and videos are courtesy of Scott Campbell. Thank you Scott.

To read rest of the article and to download all codes, visit Circuitbasics.com original article here.







 

More Articles to Read

Peeqo is a desktop bot that communicates through GIFs
Peeqo is a desktop bot that communicates through GIFs
Serial seven segment LED display shield
Serial seven segment LED display shield
An Arduino round word clock
An Arduino round word clock
The Sandwich-o-Matic will make your lunch automatically
The Sandwich-o-Matic will make your lunch automatically
An Arduino-controlled automated whiskey distillery
An Arduino-controlled automated whiskey distillery
The Rex800 looks like a dinosaur Terminator
The Rex800 looks like a dinosaur Terminator
Wrist thrusters let you fly through the water effortlessly
Wrist thrusters let you fly through the water effortlessly
Adjusting clock with alarm, hygrometer & thermometer on 1.8″ ST7735 display
Adjusting clock with alarm, hygrometer & thermometer on 1.8″ ST7735 display
Adding an “extra sense” with rangefinders
Adding an “extra sense” with rangefinders
This wireless game controller looks like a rug
This wireless game controller looks like a rug
How to run your ESP8266 for years on a battery
How to run your ESP8266 for years on a battery
Making beats on a tiny Arduino DJ controller
Making beats on a tiny Arduino DJ controller
This Arduino machine will judge how sick your ollies are
This Arduino machine will judge how sick your ollies are
Turn an old payphone into a boombox for ’90s hits
Turn an old payphone into a boombox for ’90s hits
QuadBot is a 3D-printable walking robot for everyone
QuadBot is a 3D-printable walking robot for everyone
An Arduino tachometer for your older vehicle
An Arduino tachometer for your older vehicle
Harry Potter fans create a fully-functioning smart wand
Harry Potter fans create a fully-functioning smart wand
A 3D-printed lunar phase clock for your nightstand
A 3D-printed lunar phase clock for your nightstand
Create your own Red Dwarf Talkie Toaster replica
Create your own Red Dwarf Talkie Toaster replica
The Orbitalochka is a solar-powered satellite synth
The Orbitalochka is a solar-powered satellite synth

Top


Shares