LoginSignup
0
1

More than 3 years have passed since last update.

Raspberry Pi とANBE BME280で気温・湿度・気圧を取得

Last updated at Posted at 2020-03-21

TR;TD

Raspberry PiにANBE BME280を取り付けるのに成功したので、その記録

買ったもの

BME280

ANBEのやつ。
自室とベランダの両方を計測したかったので2つ入りを購入。
IMG_4864.JPG

ジャンパワイヤー(メス・メス)

前回間違えてオスメスのジャンパワイヤを買ったので、メスメスのジャンパワイヤを購入。

作業

はんだ付け

がんばる。下手だけど。
IMG_4865 (1).JPG

接続

ここを参考にさせてもらい、前回買ったRaspberry Pi Zero HWに接続する。
IMG_4867.JPG

1番目(VCC)と6番目(SDO)は何も接続しない。

2番目(GND) => 9番ピン
3番目(SCK/SCL) => 5番ピン
4番目(SDA/SOI) => 3番ピン
5番目(CSB) => 1番ピン

と接続する。

接続確認

$ sudo apt-get install -y i2c-tools
(中略)
$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- 76 --  

76ってなってればOKらしい。

計測してみる

ありがとう。スイッチサイエンス

$ git clone https://github.com/SWITCHSCIENCE/samplecodes.git
$ sudo pip install smbus2
$ python samplecodes/BME280/Python27/bme280_sample.py
temp : 18.63  ℃
pressure : 1011.76 hPa
hum :  45.17 %

まとめ

ハードウェアー頑張ったので、次はソフトウェアーがんばる。

0
1
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
1