The DHT sensors are fairly well known hobbyist sensors for measuring relative humidity and temperature using a capacitive humidity sensor, and a thermistor. While they are slow, one reading every ~2 seconds, they are reliable and good for basic data logging. Communication is based on a custom protocol which uses a single wire for data.
Note
|
The DHT-11 and DHT-22 sensors are the most common. They use the same protocol but have different characteristics, the DHT-22 has better accuracy, and has a larger sensor range than the DHT-11. The sensor is available from a number of retailers. |
See Figure 1 for wiring instructions.
Note
|
One of the pins (pin 3) on the DHT sensor will not be connected, it is not used. |
You will want to place a 10 kΩ resistor between VCC and the data pin, to act as a medium-strength pull up on the data line.
Connecting UART0 of Pico to Raspberry Pi as in Figure 1 and you should see something similar to Figure 2 in minicom
when connected to /dev/serial0
on the Raspberry Pi.
Connect to /dev/serial0
by typing,
$ minicom -b 115200 -o -D /dev/serial0
at the command line.
A list of files with descriptions of their function;
- CMakeLists.txt
-
Make file to incorporate the example in to the examples build tree.
- dht.c
-
The example code.
Item |
Quantity |
Details |
Breadboard |
1 |
generic part |
Raspberry Pi Pico |
1 |
|
10 kΩ resistor |
1 |
generic part |
M/M Jumper wires |
4 |
generic part |
DHT-22 sensor |
1 |
generic part |