iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
😸

Measuring Temperature and Humidity with Raspberry Pi Zero W

に公開

I tried measuring the room temperature and humidity using a Raspberry Pi.
The sensor I newly purchased this time is the DHT11 temperature and humidity sensor.

https://www.amazon.co.jp/KKHMF-温湿度センサーモジュール-デュポンワイヤーが付き-Arduino-Raspberry/dp/B082M3CTWG/ref=sr_1_5?__mk_ja_JP=カタカナ&keywords=dht11+raspberry&qid=1583850440&s=industrial&sr=1-5

The model I bought came with jumper wires and a built-in resistor, making it an easy type where you just plug the jumper wires into the Raspberry Pi.

Wiring was a bit of a struggle.
In the end, it worked when I connected the sensor terminal labeled "+" to the "5V" pin (Physical pin 2), the one labeled "out" to the "GPIO 4" pin (Physical pin 7), and the one labeled "-" to the "GND" pin (Physical pin 6).


To measure temperature and humidity, you can clone and run the following code:

https://github.com/szazo/DHT11_Python

However, since I'm using the GPIO 4 pin, I need to modify dht11_example.py as follows:

- instance = dht11.DHT11(pin=14)
+ instance = dht11.DHT11(pin=4)

If it works, records will be taken.


I am considering building a system that allows me to check this temperature and humidity data at any time via Slack or a website.

Discussion