Let’s Measure Temperature & Humidity ～Ver.DHT11 by Python～
This is a translation of a page written in Japanese.
I write pages in English that are visited by many people from EN-US.
I don’t usually use English, but I try to write in English.
I think that using the strange English, but please forgive me.
|Raspberry Pi||Raspberry Pi 4|
|Jumper line||Jumper line|
|Bread board||Bread board|
Confirmation of reading method
We’ll measure temperature & humidity using DHT11.
First, check datasheet how to use DHT11. (how to connect , how to receive data)
But, you don’t have to read datasheet this time.
DHT11 library for python has been published in github.
Use it , thinking thank you.
Measure temperature & humidity
We get library in github.
git clone https://github.com/szazo/DHT11_Python.git
I think you have directory ‘DHT11_Python’.
example.py in it is python program use to measure.
Device connection is shown in the figure below.
With this connection is easy because not necessary change program.
Let’s run program.
Measure result is displayed when executed.
Program is measure per 6 seconds until you stop it.
python example.py Last valid input: 2019-10-28 13:24:32.887710 Temperature: 23.6 C Humidity: 46.0 %
Measure result seem to have large error.
At the END
I was able to measure temperature & humidity with cheap device.
I think, maybe it will be a little more accurate when change high performance device.
Try it is create easily when You don’t write program from scratch.
I wrote it in English for first time.
I think you hard to read it but forgive me.