Skip to main content

BME-280 sensor device driver with Micropython support (I2C + SPI)

Project website

Git repository

This driver runs on regular Python and on Micropython.

It has support for both I2C and SPI bus.

Example

import bme280

try:
    # Connect to BME-280 via I2C.
    bme = bme280.BME280(i2cBus=0)

    # Synchronously trigger a MODE_FORCED conversion and return the result.
    temperature, humidity, pressure = bme.readForced(filter=bme280.FILTER_2,
                                                     tempOversampling=bme280.OVSMPL_4,
                                                     humidityOversampling=bme280.OVSMPL_4,
                                                     pressureOversampling=bme280.OVSMPL_4)

    # Print the result.
    print(f"{temperature:.1f} *C; {humidity * 100:.1f} % rel. hum.; {pressure / 100:.1f} hPa")

except bme280.BME280Error as e:
    print(f"BME280 error: {e}")

License

Copyright (c) 2020-2022 Michael Büsch m@bues.ch

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Metadata

Release files for bme280-upy 1.0

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

Source distribution (sdist)

Source distribution for bme280-upy 1.0
File Size Uploaded Provenance Actions
bme280-upy-1.0.tar.gz 16.0 kB Without provenance Details for bme280-upy-1.0.tar.gz

Release files / bme280-upy-1.0.tar.gz

Download URL bme280-upy-1.0.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ca9399b8dd380665c6d0135d78d3d70194830c5f17a5b2cf1348b36921e76ea1
BLAKE2b-256 checksum
How to use checksums
5c635e95a625a8ce18788d40c73041b1c7bdaec9abe8963734237f20be642aba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Security for bme280-upy 1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0 This release

1 release file No provenance

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