BME280とBMP280の区別

更新日2021-09-08 (水) 14:52:21
作成日2021年9月8日

amazonから以下の製品を購入した。湿度も測定できるように書かれていたが、BMP280は湿度が測定できないようだ。

https://www.amazon.co.jp/gp/product/B07VMQSK9Y/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1

そこで、BME280とBMP280の区別方法をメモしておく。配線はI2Cで使用するようにしてある。

Python

  • Raspberry Pi確認
$cat /etc/debian_version
10.8
  • smbus2のインストール

smbus2が必要と思いRaspberrypi2 8.0に入れたがsmbus確認を確認したが、,里茲Δ砲覆辰拭Raspberrypi2 10.8ではsmbus2が利用できた。細かくは未調査。

$ sudo pip3 install smbus2
Downloading/unpacking smbus2
  Downloading smbus2-0.4.1-py2.py3-none-any.whl
Installing collected packages: smbus2
Successfully installed smbus2
Cleaning up...

チップIPを表示するPythonで確認

  • smbusの確認

smbusはPythonからI2Cを使用するモジュールのようだ。バージョンによって宣言を変える。

$ python -m pip list | grep smbus
smbus (1.1)
$ python -m pip list | grep smbus
smbus2            0.4.1

プログラム

  • chipID.py
##,里箸
from smbus import SMBus

##△里箸
from smbus2 import SMBus

bus_number  = 1
bus = SMBus(bus_number)
i2c_address = 0x76
bus.write_byte_data(i2c_address, 0xE0, 0xB6)
print("CHIP ID: ", hex(bus.read_byte_data(i2c_address, 0xD0)) )
  • BME280のとき
$ python chipID.py
('CHIP ID: ', '0x60')
  • BMP280のとき
$ python chipID.py
('CHIP ID: ', '0x58')

コマンドで直接表示する方法(アドレス0x60を確認)

  • BME280
$ i2cdump -y 1 0x76
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
80: 89 50 89 4b 62 33 6f 06 b3 6d ae 65 32 00 eb 8d    ?P?Kb3o??m?e2.??
90: e7 d5 d0 0b 71 1a e7 ff f9 ff ac 26 0a d8 bd 10    ????q??.?.?&????
a0: 00 4b 3b 00 00 00 00 00 00 00 00 00 33 00 00 c0    .K;.........3..?
b0: 00 54 00 00 00 00 60 02 00 01 ff ff 1f 71 03 00    .T....`?.?..?q?.
c0: 00 00 27 ff 00 00 00 00 01 00 00 00 00 00 00 00    ..'.....?.......
d0: 60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    `...............
^^^^^^←このアドレスで区別(0x60⇒BME280 0x58⇒BMP280)
e0: 00 70 01 00 13 01 00 1e 59 41 ff ff ff ff ff ff    .p?.??.?YA......
f0: ff 00 01 00 27 a0 00 56 c9 00 84 23 00 78 45 80    ..?.'?.V?.?#.xE?
  • BMP280
$ i2cdump -y 1 0x76
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
80: 95 6e 90 67 49 7a e0 00 f0 69 e4 66 18 fc 22 92    ?n?gIz?.?i?f??"?
90: 3b d6 d0 0b 2d 06 72 01 f9 ff 8c 3c f8 c6 70 17    ;???-?r??.?<??p?
a0: 00 00 82 00 00 00 00 00 00 00 00 00 33 00 00 c0    ..?.........3..?
b0: 00 54 00 00 00 00 60 02 00 01 ff 82 13 60 03 00    .T....`?.?.??`?.
c0: 00 00 00 ff 00 00 00 00 00 00 00 00 00 00 00 00    ................
d0: 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    X...............
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
f0: 00 00 00 00 00 00 00 80 00 00 80 00 00 00 00 00    .......?..?.....

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2021-09-08 (水) 14:52:21 (19d)