{"id":18054131,"url":"https://github.com/mbuesch/bme280-upy","last_synced_at":"2026-05-10T02:51:56.010Z","repository":{"id":153373884,"uuid":"531981306","full_name":"mbuesch/bme280-upy","owner":"mbuesch","description":"BME-280 sensor device driver with Micropython and Linux support (I2C + SPI)","archived":false,"fork":false,"pushed_at":"2023-09-30T20:38:57.000Z","size":64,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T02:31:00.117Z","etag":null,"topics":["bme280","bme280driver","i2c","micropython","raspberry-pi","spi"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbuesch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-09-02T15:29:54.000Z","updated_at":"2024-05-01T12:44:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"1dc85fb3-3019-4d9f-b388-fee346df0171","html_url":"https://github.com/mbuesch/bme280-upy","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbuesch%2Fbme280-upy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbuesch%2Fbme280-upy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbuesch%2Fbme280-upy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbuesch%2Fbme280-upy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbuesch","download_url":"https://codeload.github.com/mbuesch/bme280-upy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247307592,"owners_count":20917505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bme280","bme280driver","i2c","micropython","raspberry-pi","spi"],"created_at":"2024-10-31T00:09:24.050Z","updated_at":"2026-05-10T02:51:50.971Z","avatar_url":"https://github.com/mbuesch.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BME-280 sensor device driver with Micropython and Linux support (I2C + SPI)\n\n[Project website](https://bues.ch/)\n\n[Git repository](https://bues.ch/cgit/bme280-upy.git)\n\nThis driver runs on Micropython and on regular Python (e.g. Raspberry Pi or other Linux devices).\n\nIt has support for both I2C and SPI bus.\n\n# Example: I2C\n\n    import bme280\n\n    try:\n        # Connect to BME-280 via I2C-0 hardware with default pinning:\n        bme = bme280.BME280(i2cBus=0)\n\n        # Alternatively:\n        # Connect to BME-280 via I2C-0 hardware with custom pinning (not supported by all microcontrollers):\n        #bme = bme280.BME280(i2cBus={ \"index\": 0, \"scl\": 1, \"sda\": 0 })\n\n        # Alternatively:\n        # Connect to BME-280 via software I2C with custom pinning (not supported by all microcontrollers):\n        #bme = bme280.BME280(i2cBus={ \"scl\": 1, \"sda\": 0 })\n\n        # Alternatively:\n        # Connect to BME-280 via pre-initialized Micropython bus object:\n        #bme = bme280.BME280(i2cBus=machine.I2C(0, ...))\n\n        # Synchronously trigger a MODE_FORCED conversion and return the result.\n        temperature, humidity, pressure = bme.readForced(filter=bme280.FILTER_2,\n                                                         tempOversampling=bme280.OVSMPL_4,\n                                                         humidityOversampling=bme280.OVSMPL_4,\n                                                         pressureOversampling=bme280.OVSMPL_4)\n\n        # See help(bme280.BME280) for documentation and more methods.\n\n        # Print the result.\n        print(f\"{temperature:.1f} *C; {humidity * 100:.1f} % rel. hum.; {pressure / 100:.1f} hPa\")\n\n    except bme280.BME280Error as e:\n        print(f\"BME280 error: {e}\")\n\n# Example: SPI\n\n    import bme280\n\n    try:\n        # Connect to BME-280 via SPI-0 hardware with default pinning and pin 5 as chip select:\n        bme = bme280.BME280(spiBus=0, spiCS=5)\n\n        # Alternatively:\n        # Connect to BME-280 via SPI-0 hardware with custom pinning (not supported by all microcontrollers):\n        #bme = bme280.BME280(spiBus={ \"index\": 0, \"sck\": 1, \"mosi\": 2, \"miso\": 3 }, spiCS=5)\n\n        # Alternatively:\n        # Connect to BME-280 via software SPI with custom pinning (not supported by all microcontrollers):\n        #bme = bme280.BME280(spiBus={ \"sck\": 1, \"mosi\": 2, \"miso\": 3 }, spiCS=5)\n\n        # Alternatively:\n        # Connect to BME-280 via pre-initialized Micropython bus object:\n        #bme = bme280.BME280(spiBus=machine.SPI(0, ...), spiCS=machine.Pin(5, ...))\n\n        # Synchronously trigger a MODE_FORCED conversion and return the result.\n        temperature, humidity, pressure = bme.readForced(filter=bme280.FILTER_2,\n                                                         tempOversampling=bme280.OVSMPL_4,\n                                                         humidityOversampling=bme280.OVSMPL_4,\n                                                         pressureOversampling=bme280.OVSMPL_4)\n\n        # See help(bme280.BME280) for documentation and more methods.\n\n        # Print the result.\n        print(f\"{temperature:.1f} *C; {humidity * 100:.1f} % rel. hum.; {pressure / 100:.1f} hPa\")\n\n    except bme280.BME280Error as e:\n        print(f\"BME280 error: {e}\")\n\n# Example: Context Manager\n\nThe BME280 instance can also be used as Context Manager (Python `with` statement).\n\n    import bme280\n\n    try:\n        with bme280.BME280(i2cBus=0) as bme:\n            temperature, humidity, pressure = bme.readForced(filter=bme280.FILTER_2,\n                                                             tempOversampling=bme280.OVSMPL_4,\n                                                             humidityOversampling=bme280.OVSMPL_4,\n                                                             pressureOversampling=bme280.OVSMPL_4)\n            # ...\n    except bme280.BME280Error as e:\n        print(f\"BME280 error: {e}\")\n\n# Example: Normal mode\n\nThe driver also supports normal mode, where the bme280 does all measurements on its own in the background.\nSee the datasheet for more information about normal mode.\n\n    import bme280\n\n    try:\n        with bme280.BME280(i2cBus=0) as bme:\n            # Start in normal mode with specified measurement interval (standby time).\n            bme.start(mode=bme280.MODE_NORMAL,\n                      standbyTime=bme280.T_SB_10ms,\n                      filter=bme280.FILTER_2,\n                      tempOversampling=bme280.OVSMPL_4,\n                      humidityOversampling=bme280.OVSMPL_4,\n                      pressureOversampling=bme280.OVSMPL_4)\n\n            while True:\n                # Read the most recent values from the device.\n                temperature, humidity, pressure = bme.read()\n\n                # ... do something else here and let the bme280 run measurements in the mean time.\n\n    except bme280.BME280Error as e:\n        print(f\"BME280 error: {e}\")\n\n# License\n\nCopyright (c) 2020-2023 Michael Büsch \u003cm@bues.ch\u003e\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along\nwith this program; if not, write to the Free Software Foundation, Inc.,\n51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbuesch%2Fbme280-upy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbuesch%2Fbme280-upy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbuesch%2Fbme280-upy/lists"}