Skip to main content

Introduction

Documentation Status Discord Build Status Code Style: Ruff

I2C and SPI driver for the Bosch BME280 Temperature, Humidity, and Barometric Pressure sensor

Installation and Dependencies

This driver depends on:

Please ensure that the driver and all dependencies are available on the CircuitPython filesystem. This can be most easily achieved by downloading and installing the latest Adafruit library and driver bundle on your device.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install adafruit-circuitpython-bme280

To install system-wide (this may be required in some cases):

sudo pip3 install adafruit-circuitpython-bme280

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-bme280

Installing to a connected CircuitPython Device

Some devices, eg. the QT-PY, are very limited in memory. The BME280 library contains two variants - basic and advanced - which give different levels of functionality.

Installing the BME280 library could have the following outcomes:

  • It installs successfully and your code runs successfully. Woo-hoo! Continue with your amazing project.

  • It installs successfully and your code fails to run with a memory allocation error. Try one of the following:

    • If your code.py is large, especially if it has lots of comments, you can shrink it into a .mpy file instead. See the Adafruit Learn Guide on shrinking your code.

    • Only use the basic BME280 implementation, and remove the following file: <CIRCUITPY>/lib/adafruit_bme280/advanced.mpy where <CIRCUITPY> is the mounted location of your device. Make sure that your code only uses the basic implementation.

Usage Example

import board
import time
from adafruit_bme280 import basic as adafruit_bme280

# Create sensor object, using the board's default I2C bus.
i2c = board.I2C()   # uses board.SCL and board.SDA
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)

# change this to match the location's pressure (hPa) at sea level
bme280.sea_level_pressure = 1013.25

while True:
    print("\nTemperature: %0.1f C" % bme280.temperature)
    print("Humidity: %0.1f %%" % bme280.relative_humidity)
    print("Pressure: %0.1f hPa" % bme280.pressure)
    print("Altitude = %0.2f meters" % bme280.altitude)
    time.sleep(2)

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Metadata

Release files for adafruit-circuitpython-bme280 2.6.32

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adafruit-circuitpython-bme280 2.6.32
File Size Uploaded
adafruit_circuitpython_bme280-2.6.32.tar.gz 29.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for adafruit-circuitpython-bme280 2.6.32
File Interpreter ABI Platform
adafruit_circuitpython_bme280-2.6.32-py3-none-any.whl Python 3 none any Details

Total release size: 42.2 kB

Release files / adafruit_circuitpython_bme280-2.6.32.tar.gz

Download URL adafruit_circuitpython_bme280-2.6.32.tar.gz
Size 29.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b7eda0bd859a18a266d80758c25311b5045a4b6d63c4d4e2300896655d6ad032
BLAKE2b-256 checksum
How to use checksums
02f556eb55c9fe507747956d62a8dd68616b30dda8212f8c7e2d02e2b69c5525
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / adafruit_circuitpython_bme280-2.6.32-py3-none-any.whl

Download URL adafruit_circuitpython_bme280-2.6.32-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f72a5bb9a3b61367a0fed2ad354841af373aaf7887c28477f6a789b228d34d05
BLAKE2b-256 checksum
How to use checksums
9ba73125fa328d95cfe74110e0dbb63a38b444a24098d0094d052708084f4df9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

2.6.32 This release

2 release files

2.6.31

2 release files

2.6.30

2 release files

2.6.29

2 release files

2.6.28

2 release files

2.6.27

2 release files

2.6.25

2 release files

2.6.23

2 release files

2.6.22

2 release files

2.6.21

2 release files

2.6.20

2 release files

2.6.19

2 release files

2.6.18

2 release files

2.6.17

2 release files

2.6.16

2 release files

2.6.15

2 release files

2.6.13

1 release file

2.6.12

1 release file

2.6.11

1 release file

2.6.10

1 release file

2.6.9

1 release file

2.6.8

1 release file

2.6.7

1 release file

2.6.6

1 release file

2.6.5

1 release file

2.6.4

1 release file

2.6.3

1 release file

2.6.2

1 release file

2.6.1

1 release file

2.6.0

1 release file

2.5.4

1 release file

2.5.3

1 release file

2.5.2

1 release file

2.5.1

1 release file

2.5.0

1 release file

2.4.3

1 release file

2.4.2

1 release file

2.4.1

1 release file

2.4.0

1 release file

2.3.3

1 release file

2.3.2

1 release file

2.3.1

1 release file

2.3.0

1 release file

2.2.2

1 release file

2.2.1

1 release file

2.2.0

1 release file

2.1.0

1 release file

2.0.5

1 release file

2.0.3

1 release file

2.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page