HOW to Use DHT11 Sensor to Detect Temperature And Humidity with Microbit
Overview
This DHT11 temperature and humidity sensor is a composite sensor which contains a calibrated digital signal output of the temperature and humidity. Its technology ensures high reliability and excellent long-term stability.
In this experiment, we connected the signal end of the DHT11 temperature and humidity sensor to P0 of the micro: bit motherboard, and read the relevant data and calculate the temperature and humidity value in the current environment using a specific formula. We will display the calculated value on the serial monitor.
Components needed:
-
micro: bit motherboard * 1
-
Keyestudio Micro bit sensor V2 expansion board * 1
-
USB cable * 1
-
DHT11 temperature and humidity sensor * 1
-
Dupont jumper wire*3
-
Premium Battery Holder 6-cell AA*1
-
1.5V AA Battery*6
Connection Diagram
Test Code
Set test code with library file
Add library file in the following block
Search “DHT11”,as shown below, choose the first pattern, then automatically download and install library file.
After installing successfully, the corresponding block will be shown in the edit code column.
Test Results
Wire up according to connection diagram. plug in external power and upload code to micro:bit,Open CoolTerm, click Options and select SerialPort, set COM port and baud rate(115200). Click OK and Connect.
When DHT11 temperature and humidity sensor detects the temperature and humidity value, the results will be shown on CoolTerm monitor.