Use BME280 temperature / humidity / barometric pressure sensor from Python on Raspberry Pi 2

Switch Science has released the BME280 temperature / humidity / barometric pressure sensor. Humidity can also be measured compared to the same Bosch BMP180. If you have one BME280, you can use it conveniently as an environmental sensor. Unfortunately, Bosch only publishes C's BME280_driver and [How to use](http://trac.switch-science.com/wiki/ BME280) page and The New Bosch BME280 (Temp, Humidity, BMP) I could only find the sample code of Arduino on my blog. Rewriting with Python for Raspberry Pi is a difficult task, and thankfully Switch Science wrote a Python library in haste.

Breadboard wiring

While looking at the Arduino schematic in How to use, wire the Raspberry Pi 2 as follows. As a result of checking, Vcore and Vio to be wired to 3.3V are connected on the board, so it seems that only one of them is required.

SDI      (BME280)  -> GPIO2 P03 (Raspberry Pi SDA1)
SCK      (BME280)  -> GPIO3 P05 (Raspberry Pi SCL1)
GND,SDO  (BME280)  -> GND  P09 (Raspberry Pi)
Vio,CSB  (BME280)  -> 3.3v P01 (Raspberry Pi)

bme280-plus.png

After wiring the jumper wire, check with i2cdetect. I'm using a 0x76 address.

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

Sample code

You can find sample Python code in the Switch Science BME280 repository. Create an appropriate directory and download it.

$ mkdir ~/python_apps/ss
$ cd !$
$ wget https://raw.githubusercontent.com/SWITCHSCIENCE/BME280/master/Python27/bme280_sample.py

Run the sample code.

$ sudo python bme280_sample.py
temp : 28.18  ℃
pressure :  995.69 hPa
hum :  60.62 %

The following data was acquired.

Recommended Posts

Use BME280 temperature / humidity / barometric pressure sensor from Python on Raspberry Pi 2
Use Grove-Temperature & Humidity Sensor (DHT11) on Raspberry Pi
[Python + PHP] Make a temperature / humidity / barometric pressure monitor with Raspberry Pi
Using the 1-Wire Digital Temperature Sensor DS18B20 from Python on a Raspberry Pi
Use the Grove sensor on the Raspberry Pi
Detect temperature using python on Raspberry Pi 3!
Use Raspberry Pi Python to TMP36 analog temperature sensor and MCP3008 AD converter
Record temperature and humidity with systemd on Raspberry Pi
Try using the temperature sensor (LM75B) on the Raspberry Pi.
Ubuntu 20.04 on raspberry pi 4 with OpenCV and use with python
Use NeoPixel on Raspberry Pi
Use kintone API SDK for Python on Raspberry Pi (easily store data in kintone from Raspberry Pi)
Detect "temperature (using A / D converter)" using python on Raspberry Pi 3!
Use vl53l0x with Raspberry Pi (python)
Use python on Raspberry Pi 3 to illuminate the LED (Hello World)
About the error I encountered when trying to use Adafruit_DHT from Python on a Raspberry Pi
Detect "brightness" using python on Raspberry Pi 3!
Adafruit Python BluefruitLE works on Raspberry Pi.
Run servomotor on Raspberry Pi 3 using python
Use PIR motion sensor with raspberry Pi
Working with GPS on Raspberry Pi 3 Python
Use python on Raspberry Pi 3 to light the LED with switch control!
Try tweeting arXiv's RSS feed on twitter from Raspberry Pi with python
I connected the thermo sensor to the Raspberry Pi and measured the temperature (Python)
Detect slide switches using python on Raspberry Pi 3!
How to use Raspberry Pi pie camera Python
Detect magnet switches using python on Raspberry Pi 3!
Make DHT11 available on Raspberry Pi + python (memo)
Sound the buzzer using python on Raspberry Pi 3!
Display CPU temperature every 5 seconds on Raspberry Pi 4
Raspberry + am2302 Measure temperature and humidity with temperature and humidity sensor
Get temperature and humidity with DHT11 and Raspberry Pi
Use python on Raspberry Pi 3 and turn on the LED when it gets dark!
Connect to MySQL with Python on Raspberry Pi
Build a Python development environment on Raspberry Pi
Measure CPU temperature of Raspberry Pi with Python
Install PyCall on Raspberry PI and try using GPIO's library for Python from Ruby
From setting up Raspberry Pi to installing Python environment
How to use the Raspberry Pi relay module Python
Try debugging Python on Raspberry Pi with Visual Studio.
Measure temperature and humidity with Raspberry Pi3 and visualize with Ambient
Install pyenv on Raspberry Pi and version control Python
Output to "7-segment LED" using python on Raspberry Pi 3!
Use thingsspeak from python
Use fluentd from python
pigpio on Raspberry pi
Use MySQL from Python
Use MySQL from Python
Use BigQuery from python.
Cython on Raspberry Pi
Use mecab-ipadic-neologd from python
VScode intellisense doesn't work on Raspberry Pi OS 64bit! (Python)
Run AWS IoT Device SDK for Python on Raspberry Pi
Access google spreadsheet using python on raspberry pi (for myself)
I tried using the DS18B20 temperature sensor with Raspberry Pi
Creating a temperature / humidity monitor with Raspberry Pi (pigpio version)
How to get temperature from switchBot thermo-hygrometer using raspberry Pi
Use matplotlib on Ubuntu 12 & Python
Use MySQL from Anaconda (python)
Raspberry Pi + Python + OpenGL memo
raspberry pi 1 model b, python