{"id":13802418,"url":"https://github.com/robert-hh/BME280","last_synced_at":"2025-05-13T13:30:54.826Z","repository":{"id":53521305,"uuid":"157090982","full_name":"robert-hh/BME280","owner":"robert-hh","description":"Micropython driver for the BME280 sensor, target platform Pycom devices","archived":false,"fork":false,"pushed_at":"2025-04-16T09:56:30.000Z","size":48,"stargazers_count":114,"open_issues_count":2,"forks_count":29,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-16T10:55:37.261Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robert-hh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-11T15:04:36.000Z","updated_at":"2025-04-16T09:56:33.000Z","dependencies_parsed_at":"2024-10-30T12:35:34.192Z","dependency_job_id":null,"html_url":"https://github.com/robert-hh/BME280","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robert-hh%2FBME280","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robert-hh%2FBME280/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robert-hh%2FBME280/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robert-hh%2FBME280/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robert-hh","download_url":"https://codeload.github.com/robert-hh/BME280/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253949992,"owners_count":21989288,"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":[],"created_at":"2024-08-04T00:01:44.095Z","updated_at":"2025-05-13T13:30:54.819Z","avatar_url":"https://github.com/robert-hh.png","language":"Python","readme":"# BME280 Micropython driver for the BME280 sensor\n\nThis is a driver for the Bosch BME280 temperature/pressure/humidity sensor,\nfor use with MicroPython boards. It is also compatible with\nthe BMP280 which provides the same interface but temperature + pressure only.\n\nTwo different variants of the library are supplied. bme280_int.py uses integer\narithmetic, bme280_float.py uses float arithmetic for the compensation  of the\nraw values. The results are (almost) the identical, but the format of the\nreturned values differs.\n\n## About the BME280\n\nThe Bosch BME280 Environmental Sensor is a combined temperature, pressure and\nhumidity sensor. It can communicate via I2C or SPI; this driver uses I2C.\n\nSee the datasheet at https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme280-ds002.pdf\nfor details.\n\n## Class\n\nbme = BME280(mode=BME280_OSAMPLE_8, address=BME280_I2CADDR, i2c=i2c)\n\n`mode` is the setting for oversampling of the humidity value. It must be either a single\nint or a tuple of 3 ints, specifying (mode_hum, mode_temp, mode_pressure). `address` is the i2c\naddress used, and i2c must be a I2C object.\n\n## Properties\n\n### values = BME280.values\n\nThe `values` property is a convenience function that provides a tuple of\nhuman-readable string values to quickly check that the sensor is working.\nIn practice, the method to use is `read_compensated_data()` which returns\na `(temperature, pressure, humidity)`-tuple\n\n### altitude = bme.altitude\nAltitude in m. The altitude is calculated based on the value given to\nthe property sealevel (see below). Obviously, this value does not have to be the\nsealevel pressure, but any pressure you may select, for instance to measure\naltitude difference in general.\n\n### bme.sealevel = sealevel\n### sealevel = bme.sealevel\nSetting and getting the pressure for altitude calculation.\nThe default is 101325 Pa, but you can use your local\nQNH in Pa, or set a local pressure to determine altitude difference.\n\n### dew_point = bme.dew_point\nReturns the dew_point temperature (°C) calculated from the actual temperature and humidity.\n\n## Methods\n\n### values = read_compensated_data(result = None)\n\nValues is an array of either integers (bme280_int.py) of floats (bme280_float.py),\nholding the values of temperature, pressure and humidity.\nThe format differs for integers and floats:\n\n#### Integer formats:\n* `temperature`:  the temperature in hundredths of a degree Celsius. For example,\nthe value 2534  indicates a temperature of 25.34 degrees.\n* `pressure`: the atmospheric pressure. This 32-bit value consists of 24 bits\nindicating the integer value, and 8 bits indicating the fractional value. To get\na value in Pascals, divide the return value by 256. For example, a value of\n24674867 indicates 96386.2Pa, or 963.862hPa.\n* `humidity`: the relative humidity. This 32-bit value consists of 22 bits\nindicating the integer value, and 10 bits indicating the fractional value.\nTo get a value in %RH, divide the return value by 1024. For example, a value of\n47445 indicates 46.333%RH.\n\n#### Float formats\n* `temperature`:  the temperature in degree Celsius.\n* `pressure`: the atmospheric pressure in Pascal.\n* `humidity`: the relative humidity in percent.\n\nIf the parameter result is supplied as an array of the appropriate type, The\nreturn values will in addition be stored in that array, and the array will be\nreturned.\n\n### read_raw_data(result)\nStore the raw sensor data into the array result, which must provide space for three\n32 bit integers, as provided for instance by `array(\"i\", [0, 0, 0])`. This\nmethod is used internally.\n\n### Example\n\nCopy `bme280_float.py` onto the board. Then:\n\n```python\n#\n# this script for the rp2040 port assumes the I2C connections at\n# GPIO8 and 9. At the RPi Pico, these are the board pins 11 and 12\n# Please check that pull-up resistors are in place at sda and scl.\n#\nimport machine\nimport bme280_float as bme280\n\ni2c = machine.I2C(0, sda=machine.Pin(8), scl=machine.Pin(9))\nbme = bme280.BME280(i2c=i2c)\n\nprint(bme.values)\n```\n","funding_links":[],"categories":["Libraries"],"sub_categories":["Sensors"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobert-hh%2FBME280","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobert-hh%2FBME280","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobert-hh%2FBME280/lists"}