0
2

More than 3 years have passed since last update.

DHT11とRaspberry Piで温湿度を取得

Posted at

DHT11は3ピンタイプを使用。

配線は下図のように。
GPIO14から温湿度を取得。

lchika_ブレッドボード.png

下記リポジトリのコードを利用。

$ git clone https://github.com/szazo/DHT11_Python
$ cd DHT11_Python
$ python3 -m pip install .

サンプルコードを実行。

$ 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 %

6秒おきに温湿度を取得して標準出力に表示する。
ハーっと息を吹きかけたりすると温湿度が上がるのが確認できる。

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2