iTranslated by AI
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.
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:
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