[PYTHON] Get temperature and humidity with DHT11 and Raspberry Pi

DHT11 uses a 3-pin type.

Wiring is as shown in the figure below. Obtained temperature and humidity from GPIO14.

lchika_ブレッドボード.png

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

Get temperature and humidity with DHT11 and Raspberry Pi
Record temperature and humidity with systemd on Raspberry Pi
Measure temperature and humidity with Raspberry Pi3 and visualize with Ambient
Raspberry + am2302 Measure temperature and humidity with temperature and humidity sensor
Easily make a TweetBot that notifies you of temperature and humidity with Raspberry Pi + DHT11.
Production of temperature control system with Raspberry Pi and ESP32 (1)
Measure and compare temperature with Raspberry Pi and automatically generate graph
Creating a temperature / humidity monitor with Raspberry Pi (pigpio version)
Pet monitoring with Rekognition and Raspberry pi
Get BITCOIN LTP information with Raspberry PI
Get GrovePi + sensor value with Raspberry Pi and store it in kintone
[Python + PHP] Make a temperature / humidity / barometric pressure monitor with Raspberry Pi
MQTT RC car with Arduino and Raspberry Pi
Use Grove-Temperature & Humidity Sensor (DHT11) on Raspberry Pi
Get CPU information of Raspberry Pi with Python
DigitalSignage with Raspberry Pi
Measure temperature, humidity, etc. with SensorTag and send it to Ambient via Raspberry Pi 3 to graph it Part 2
Production of temperature control system with Raspberry Pi and ESP32 (2) Production of transmission device
Measure CPU temperature of Raspberry Pi with Python
Creating a temperature control system with Raspberry Pi and ESP32 (3) Recipient Python file
Machine learning with Raspberry Pi 4 and Coral USB Accelerator
Easy IoT to start with Raspberry Pi and MESH
Ubuntu 20.04 on raspberry pi 4 with OpenCV and use with python
Getting Started with Yocto Project with Raspberry Pi 4 and WSL2
Troubleshoot with installing OpenCV on Raspberry Pi and capturing
Simulate temperature measurement with Raspberry Pi + Flask + SQLite + Ajax
Mutter plants with Raspberry Pi
Create a web surveillance camera with Raspberry Pi and OpenCV
Python beginner opens and closes interlocking camera with Raspberry Pi
Check! Get sensor data via Bluetooth with Raspberry Pi ~ Preparation
Create an LCD (16x2) game with Raspberry Pi and Python
I tried connecting Raspberry Pi and conect + with Web API
How to get temperature from switchBot thermo-hygrometer using raspberry Pi
Make a BLE thermometer and get the temperature with Pythonista3
Get the weather using the API and let the Raspberry Pi speak!
[Raspberry Pi] Stepping motor control with Raspberry Pi
Use vl53l0x with Raspberry Pi (python)
Servo motor control with Raspberry Pi
MQTT on Raspberry Pi and Mac
Serial communication with Raspberry Pi + PySerial
Try L Chika with raspberry pi
VPN server construction with Raspberry Pi
Try moving 3 servos with Raspberry Pi
Using a webcam with Raspberry Pi
Christmas classic (?) Lighting a Christmas tree with Raspberry Pi and Philips Hue
Notify LINE of body temperature from BLE thermometer with Raspberry Pi # 1
Notify LINE of body temperature from BLE thermometer with Raspberry Pi # 2
Make a thermometer with Raspberry Pi and make it viewable with a browser Part 4
Make a Kanji display compass with Raspberry Pi and Sense Hat
Graph display of household power consumption with 3GPI and Raspberry Pi
Get US stock price from Python with Web API with Raspberry Pi
Get weather information using Yahoo! Open Local Platform (YOLP) and let Raspberry Pi talk with AquesTalkPi
Send the temperature, humidity, etc. measured by SensorTag to Ambient via Raspberry Pi 3 and graph it.
Use BME280 temperature / humidity / barometric pressure sensor from Python on Raspberry Pi 2
Measure SIM signal strength with Raspberry Pi
[Raspberry Pi] Add a thermometer and a hygrometer
Hello World with Raspberry Pi + Minecraft Pi Edition
Build a Tensorflow environment with Raspberry Pi [2020]
Try fishing for smelt with Raspberry Pi
Programming normally with Node-RED programming on Raspberry Pi 3
Improved motion sensor made with Raspberry Pi