Humidity Sensor/DHT22 Setup

DHT22 requires both pigpio and DHTXXD libraries to be installed. To initialize do the following:

Get the pigpio library and install it

sudo apt-get install pigpio python-pigpio python3-pigpio

Then download DHTXXD into a directory

mkdir DHT22
cd DHT22

unzip the file


Compile the DHTXXD

gcc -Wall -pthread -o DHTXXD test_DHTXXD.c DHTXXD.c -lpigpiod_if2

once done, the program DHTXXD will be available in this directory: /home/pi/DHT22/DHTXXD
Remember this, you will need to recall this for later.

Now connect the DHT22 as shown
DHT22 Wiring diagram

Enabling GPIO

Before getting data from the DHT22, you will need to enable GPIO pins by running the following command:

sudo pigpiod

This must be done manually at every boot, unless you enable the daemon to run at boot. This can be done by using the following command at the command line:

sudo systemctl enable pigpiod

This will now run at every boot.

Add DHT22 to hub

Now add the DHT22 device, either through temperature or humidity sensor screens. You will see something similar to the following:

Note you must fill out the path to the DHT22 compiled program, as made earlier.


Further, be sure to put the BCM pin number where data is connected. This is the number from the breakout module, not the specific GPIO pin it's plugged into.

Once these are uploaded, you will see the temperature sensor delivering information as shown:

A Note about connections

In some cases the DHT sensors might not receive enough power from the breakout board or ribbon cables. You may test to see if the sensor is getting power and delivering information by running the DHTXXD program directly. From the directory you compiled it in, run

./DHTXXD -g17

where -g## is the BCM pin 17 for the device, and you should return some data.

If you get the result

Your device is not communicating and you may need to change how it is hooked up. You may need to bypass the ribbon cable, or use another +3.3v power source. Note that both DHT22 and DHT11 require 2.5mA max current to poll data.

DHT11 and DHT22

Tigase IoT One Cloud is compatible with the DHT11 and DHT22 devices, they are similar and will both provide the same information however, the DHT22 provides slightly more accurate results, and allows for more frequent data transmission.

Field DHT11 DHT22
Temp range 0-50C -40-80C
Temp Accuracy +/- 2C +/- .5C
Humidity range 20-80% 0-100%
Humidity Accuracy 5% 2-5%
Max Data Sample Rate 1 Hz .5 Hz

Temperature and Humidity

The same sensor can be used for both Temperature and Humidity samplings, and you may setup 2 devices on the same pin to poll both.