DHT11 Temperature-Humidity Sensor
|
![Temperature-Humidity-Sensor](/w/upload/thumb/f/f4/Temperature-Humidity-Sensor_l.jpg/300px-Temperature-Humidity-Sensor_l.jpg)
Temperature-Humidity Sensor, DHT11 Onboard
|
|
|
|
|
|
|
|
|
|
|
Overview
This is a calibrated digital temperature and humidity module with an onboard sensor DHT11. It can be used for detecting ambient temperature and humidity, through the standard single-wire interface.
Specifications
- Sensor: DHT11
- Working Voltage: 3.3V-5.5V
- Temperature
- Resolution: 1°C
- Accuracy: ±2℃
- Measuring range : 0°C ~ 50°C
- Humidity
- Resolution: 1%RH
- Accuracy : ±5%RH (0~50°C)
- Measuring range : 20%RH ~ 90%RH (25°C)
- Operating voltage : 3.3V ~ 5.5 V
- Recommended storage condition
- Temperature : 10°C ~40°C
- Humidity : 60%RH or below
- Fixed Hole Size: 2.0mm
Pinouts
Pin
|
Description
|
DOUT |
Digital output
|
GND |
Power ground
|
VCC |
3.3V-5.5V
|
Use with Raspberry Pico
Hardware Connection
Sensor |
Pico |
Description
|
VCC |
3.3V |
Power input
|
GMD |
GND |
Power ground
|
DOUT |
GP15 |
Digital data output
|
![DHT11-Temperature-Humidity-Pico 1.jpg](/w/upload/thumb/8/80/DHT11-Temperature-Humidity-Pico_1.jpg/500px-DHT11-Temperature-Humidity-Pico_1.jpg)
Download examples
Use Raspberry Pi as the host device. Open a terminal and run the following commands to download the example.
sudo apt-get install p7zip-full
cd ~
sudo wget https://files.waveshare.com/upload/4/4a/Temperature-Humidity-Sensor-code.7z
7z x Temperature-Humidity-Sensor-code.7z -o./Temperature-Humidity-Sensor-code
cd ~/Temperature-Humidity-Sensor-code
cd Pico/c/build/
Examples
C codes
cd ~/Temperature-Humidity-Sensor-code/Pico/c/build
export PICO_SDK_PATH=../../pico-sdk
- Note that if the path of your SDK is different, you need to modify the command and use the correct path to export.
- Generate Makefile and build.
cmake ..
make -j9
- After building, a uf2 file is generated.
- Press and hold the button of Pico, connect it to Raspberry Pi then release the button.
- Copy/Drag the uf2 file to the portable disk (RPI-RP2) recognized.
cp main.uf2 /media/pi/RPI-RP2/
Micropython codes
Use in Windows
- 1. Press and hold the BOOTSET button on the Pico board, connect the Pico to the USB port of the computer through the Micro USB cable, and release the button after the computer recognizes a removable hard disk (RPI-RP2).
- 2. Copy the Rp2-pico-20210418-v1.15 file in the python directory to the recognized removable disk (RPI-RP2).
- 3. Open Thonny IDE (Note: Use the latest version of Thonny, otherwise there is no Pico support package, the latest version under Windows is v3.3.3).
- 4. Click Tools -> Settings -> Interpreter, and select Pico and the corresponding port as shown in the figure.
![Pico-lcd-0.96-img-config.png](/w/upload/c/cd/Pico-lcd-0.96-img-config.png)
- 5. File -> Open -> the corresponding .py file, click to run, as shown in the following figure:
Use in Raspberry Pi
- Flash the Micropython firmware first.
- Open the Thonny IDE (Menu -> Programming -> Thonny Python IDE).
- 【Optional】If the Thonny IDE in the Raspberry Pi is not the new version that supports Pico, please upgrade it first.
sudo apt upgrade thonny
- Configure Interpreter, choose Tools->Options... -> Interpreter, choose MicroPython(Raspberry Pi Pico) and the ttyACM0 port.
![400](/w/upload/a/a9/Pico-lcd-0.96-img-config2.png)
- Click File -> Open.. and browser the Micropython codes (Photo Interrupter Sensor.py) to run the codes.
Expected result
- The humidity and temperature data are printed to the serial port.
The STM32 examples are based on the STM32F103RBT6 and the STM32H743. The connection provided below is based on the STM32F103RB. If you need to use other STM32 boards, you may need to change the hardware connection and port the code yourself.
Use with STM32
Hardware connection
Sensor |
STM32 |
Description
|
VCC |
3.3V |
Power input
|
GMD |
GND |
Power ground
|
DOUT |
PA0 |
Digitial data output
|
![DHT11 Line 1.png](/w/upload/thumb/1/1e/DHT11_Line_1.png/500px-DHT11_Line_1.png)
Examples
The examples are developed based on the HAL libraries. Download the Demo codes archive to your PC. Unzip and find the STM32 project from Temperature-Humidity-Sensor-code\STM32\STM32F103RB\MDK-ARM.
- Open the DHT11 Sensor.uvprojx file by Keil
- Build and the project
- Program the project to your STM32 board.
- Connect the UART1 of your STM32 board to the PC and check the serial data with SSCOM software.
![DHT11 STM32 3.png](/w/upload/thumb/e/e5/DHT11_STM32_3.png/500px-DHT11_STM32_3.png)
The Arduino example is written for the Arduino UNO. If you want to connect it to other Arduino boards, you may need to change the connection.
Use with Arduino
Hardware connection
Sensor |
Arduino |
Description
|
VCC |
5V |
Power input
|
GMD |
GND |
Power ground
|
DOUT |
D2 |
Digital data output
|
![DHT11 Line 2.png](/w/upload/thumb/2/29/DHT11_Line_2.png/400px-DHT11_Line_2.png)
Examples
- Download the demo codes to your PC and unzip.
- Install the Arduino IDE on your PC.
- Go into Temperature-Humidity-Sensor-code/Arduino/Temperature_Humidity_Sensor.
- Run the Temperature_Humidity_Sensor.ino file.
- Select the correct Board and the Port.
![MQ5 Arduino 1.jpg](/w/upload/thumb/a/a9/MQ5_Arduino_1.jpg/500px-MQ5_Arduino_1.jpg)
- Build the project and upload it to the board.
- Open the serial monitor of the Arduino IDE or the SSCOM software and check the serial data.
![DHT11 Arduino 3.png](/w/upload/thumb/d/d7/DHT11_Arduino_3.png/500px-DHT11_Arduino_3.png)
Resources
FAQ
Answer:
Perhaps you'd like:
Color Sensor
|
|
{{{2}}}
|
{{{3}}}
|
{{{4}}}
|
{{{5}}}
|
{{{6}}}
|
{{{7}}}
|
{{{8}}}
|
{{{9}}}
|
{{{10}}}
|
{{{11}}}
|
{{{12}}}
|
{{{13}}}
|
{{{14}}}
|
{{{15}}}
|
{{{16}}}
|
{{{17}}}
|
{{{18}}}
|
{{{19}}}
|
{{{20}}}
|
{{{21}}}
|
{{{22}}}
|
{{{23}}}
|
{{{24}}}
|
{{{25}}}
|
{{{26}}}
|
{{{27}}}
|
{{{28}}}
|
{{{29}}}
|
{{{30}}}
|
{{{31}}}
|
{{{32}}}
|
{{{33}}}
|
{{{34}}}
|
{{{35}}}
|
{{{36}}}
|
{{{37}}}
|
{{{38}}}
|
{{{39}}}
|
{{{40}}}
|
{{{41}}}
|
{{{42}}}
|
{{{43}}}
|
{{{44}}}
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Support
If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)