adafruit_bme680
CircuitPython library for BME680 temperature, pressure and humidity sensor.
Author(s): Limor Fried, William Garber, many others
Implementation Notes
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- class adafruit_bme680.Adafruit_BME680(*, refresh_rate: int = 10)[source]
Driver from BME680 air quality sensor
- Parameters:
refresh_rate (int) – Maximum number of readings per second. Faster property reads will be from the previous reading.
- property altitude: float
The altitude based on current
pressure
vs the sea level pressure (sea_level_pressure
) - which you must enter ahead of time)
- class adafruit_bme680.Adafruit_BME680_I2C(i2c: I2C, address: int = 119, debug: bool = False, *, refresh_rate: int = 10)[source]
Driver for I2C connected BME680.
- Parameters:
Quickstart: Importing and using the BME680
Here is an example of using the
BMP680_I2C
class. First you will need to import the libraries to use the sensorimport board import adafruit_bme680
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA bme680 = adafruit_bme680.Adafruit_BME680_I2C(i2c)
You need to setup the pressure at sea level
bme680.sea_level_pressure = 1013.25
Now you have access to the
temperature
,gas
,relative_humidity
,pressure
andaltitude
attributestemperature = bme680.temperature gas = bme680.gas relative_humidity = bme680.relative_humidity pressure = bme680.pressure altitude = bme680.altitude
- class adafruit_bme680.Adafruit_BME680_SPI(spi: SPI, cs: DigitalInOut, baudrate: int = 100000, debug: bool = False, *, refresh_rate: int = 10)[source]
Driver for SPI connected BME680.
- Parameters:
Quickstart: Importing and using the BME680
Here is an example of using the
BMP680_SPI
class. First you will need to import the libraries to use the sensorimport board from digitalio import DigitalInOut, Direction import adafruit_bme680
Once this is done you can define your
board.SPI
object and define your sensor objectcs = digitalio.DigitalInOut(board.D10) spi = board.SPI() bme680 = adafruit_bme680.Adafruit_BME680_SPI(spi, cs)
You need to setup the pressure at sea level
bme680.sea_level_pressure = 1013.25
Now you have access to the
temperature
,gas
,relative_humidity
,pressure
andaltitude
attributestemperature = bme680.temperature gas = bme680.gas relative_humidity = bme680.relative_humidity pressure = bme680.pressure altitude = bme680.altitude
- adafruit_bme680.bme_set_bits(reg_data, bitname_msk, bitname_pos, data)[source]
Macro to set bits data2 = data << bitname_pos set masked bits from data2 in reg_data