DHT11 uses a 3-pin type.
Wiring is as shown in the figure below. Obtained temperature and humidity from GPIO14.
Use the code in the repository below.
$ git clone https://github.com/szazo/DHT11_Python
$ cd DHT11_Python
$ python3 -m pip install .
Run the sample code.
$ python example.py
Last valid input: 2020-04-13 23:25:23.831141
Temperature: 21.1 C
Humidity: 50.0 %
Last valid input: 2020-04-13 23:25:29.914568
Temperature: 21.1 C
Humidity: 56.0 %
Last valid input: 2020-04-13 23:25:35.998205
Temperature: 21.2 C
Humidity: 69.0 %
The temperature and humidity are acquired every 6 seconds and displayed on the standard output. You can see that the temperature and humidity rise when you blow on it.
Recommended Posts