Outline
BME280を搭載した小型の環境センサモジュールで、気圧、湿度、温度を簡単に測定することが可能です。
Hardware setup
- raspberry pi
- BME280搭載 環境センサモジュール
Raspberry-pi | 配線 | BME280 |
---|---|---|
01 3.3V | <-> | VIN |
03 SDA | <-> | SDA |
05 SCL | <-> | SCL |
09 GND | <-> | GND |
ディレクトリ構成
home/
├ qwiic_bme280.py #ライブラリ
├ bme280_ex1.py:簡易サンプル
├ bme280_ex4.py:sensor setup付き
├ bme280_ex5.py:
└ atmospheric_mp.py:マルチプロセス
Installation
sudo pip install sparkfun-qwiic-bme280
run
cd BME280_Atmospheric_Sensor
python3 bme280_ex1.py
output sample
※より正確な測定値を得るためには校正が必要。
bme280_ex1.py
Humidity: 47.022
Pressure: 122247.848
Altitude: -5288.442
Temperature: 73.98
Humidity: 47.041
Pressure: 122444.332
Altitude: -5334.506
Temperature: 73.89
bme280_ex4.py
Humidity: 47.022
Pressure: 122247.848
Altitude: -5288.442
Temperature: 73.98
Humidity: 47.041
Pressure: 122444.332
Altitude: -5334.506
Temperature: 73.89
bme280_ex5.py
SparkFun BME280 Sensor Example 5
ID(0xD0): 0x60
Reset register(0xE0): 0x00
ctrl_meas(0xF4): 0x27
ctrl_hum(0xF2): 0x01
Displaying all regs:
0x08 0:0x96 0x70 0x89 0x52 0x0a 0x04 0x88 0x06 0xf0 0x6f 0x71 0x69 0x32 0x00 0x3e 0x8d
0x09 0:0xda 0xd6 0xd0 0x0b 0x90 0x1e 0xd7 0xff 0xf9 0xff 0xac 0x26 0x0a 0xd8 0xbd 0x10
0x0a 0:0x00 0x4b 0xf4 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x33 0x00 0x00 0xc0
0x0b 0:0x00 0x54 0x00 0x00 0x00 0x00 0x60 0x02 0x00 0x01 0xff 0xff 0x1f 0x4e 0x08 0x00
0x0c 0:0x00 0x40 0x27 0xff 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x0d 0:0x60 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x0e 0:0x00 0x74 0x01 0x00 0x12 0x28 0x03 0x1e 0xf0 0x41 0xff 0xff 0xff 0xff 0xff 0xff
0x0f 0:0xff 0x00 0x01 0x0c 0x27 0x00 0x00 0x51 0xb6 0x00 0x81 0xcb 0x00 0x68 0x11 0x80
Displaying concatenated calibration words:
dig_T1, uint16: 28656
dig_T2, int16: 26993
dig_T3, int16: 50
dig_P1, uint16: 36158
dig_P2, int16: 55002
dig_P3, int16: 3024
dig_P4, int16: 7824
dig_P5, int16: 65495
dig_P6, int16: 65529
dig_P7, int16: 9900
dig_P8, int16: 55306
dig_P9, int16: 4285
dig_H1, uint8: 75
dig_H2, int16: 372
dig_H3, uint8: 0
dig_H4, int16: 50
dig_H6, int8: 30
Humidity: 41.496
Pressure: 146789.895
Altitude: -10627.602
Temperature: 74.35
Humidity: 41.807
Pressure: 121438.535
Altitude: -5098.072
Temperature: 74.39
Humidity: 42.334
Pressure: 121353.621
Altitude: -5078.039
Temperature: 74.37
以上