adafruit_bme280.basic
¶
CircuitPython driver from BME280 Temperature, Humidity and Barometric Pressure sensor
Author(s): ladyada, Jose David M.
Implementation Notes¶
Hardware:
Adafruit BME280 Temperature, Humidity and Barometric Pressure sensor (Product ID: 2652)
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- class adafruit_bme280.basic.Adafruit_BME280(bus_implementation: Union[I2C_Impl, SPI_Impl])[source]¶
Driver from BME280 Temperature, Humidity and Barometric Pressure sensor
Note
The operational range of the BME280 is 300-1100 hPa. Pressure measurements outside this range may not be as accurate.
- class adafruit_bme280.basic.Adafruit_BME280_I2C(i2c: I2C, address: int = 119)[source]¶
Driver for BME280 connected over I2C
- Parameters
Note
The operational range of the BMP280 is 300-1100 hPa. Pressure measurements outside this range may not be as accurate.
Quickstart: Importing and using the BME280
Here is an example of using the
Adafruit_BME280_I2C
. First you will need to import the libraries to use the sensorimport board from adafruit_bme280 import basic as adafruit_bme280
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
You need to setup the pressure at sea level
bme280.sea_level_pressure = 1013.25
Now you have access to the
temperature
,relative_humidity
pressure
andaltitude
attributestemperature = bme280.temperature relative_humidity = bme280.relative_humidity pressure = bme280.pressure altitude = bme280.altitude
- class adafruit_bme280.basic.Adafruit_BME280_SPI(spi: SPI, cs: DigitalInOut, baudrate: int = 100000)[source]¶
Driver for BME280 connected over SPI
- Parameters
spi (SPI) – SPI device
cs (DigitalInOut) – Chip Select
baudrate (int) – Clock rate, default is 100000. Can be changed with
baudrate()
Note
The operational range of the BMP280 is 300-1100 hPa. Pressure measurements outside this range may not be as accurate.
Quickstart: Importing and using the BME280
Here is an example of using the
Adafruit_BME280_SPI
class. First you will need to import the libraries to use the sensorimport board from digitalio import DigitalInOut from adafruit_bme280 import basic as adafruit_bme280
Once this is done you can define your
board.SPI
object and define your sensor objectcs = digitalio.DigitalInOut(board.D10) spi = board.SPI() bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, cs)
You need to setup the pressure at sea level
bme280.sea_level_pressure = 1013.25
Now you have access to the
temperature
,relative_humidity
pressure
andaltitude
attributestemperature = bme280.temperature relative_humidity = bme280.relative_humidity pressure = bme280.pressure altitude = bme280.altitude
- adafruit_bme280.basic.IIR_FILTER_DISABLE = 0¶
standby timeconstant values TC_X[_Y] where X=milliseconds and Y=tenths of a millisecond
- adafruit_bme280.basic.MODE_NORMAL = 3¶
Other Registers
- adafruit_bme280.basic.OVERSCAN_X16 = 5¶
mode values
- adafruit_bme280.basic.STANDBY_TC_125 = 2¶
mode values
adafruit_bme280.advanced
¶
CircuitPython driver from BME280 Temperature, Humidity and Barometric Pressure sensor
Author(s): ladyada, Jose David M.
Implementation Notes¶
Hardware:
Adafruit BME280 Temperature, Humidity and Barometric Pressure sensor (Product ID: 2652)
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- class adafruit_bme280.advanced.Adafruit_BME280_Advanced(proxy: Union[I2C_Impl, SPI_Impl])[source]¶
Driver from BME280 Temperature, Humidity and Barometric Pressure sensor
Note
The operational range of the BMP280 is 300-1100 hPa. Pressure measurements outside this range may not be as accurate.
- property iir_filter: int¶
Controls the time constant of the IIR filter Allowed values are the constants IIR_FILTER_*
- property measurement_time_max: float¶
Maximum time in milliseconds required to complete a measurement in normal mode
- property measurement_time_typical: float¶
Typical time in milliseconds required to complete a measurement in normal mode
- class adafruit_bme280.advanced.Adafruit_BME280_I2C(i2c: I2C, address: int = micropython.const)[source]¶
Driver for BME280 connected over I2C
- Parameters
Note
The operational range of the BMP280 is 300-1100 hPa. Pressure measurements outside this range may not be as accurate.
Quickstart: Importing and using the BME280
Here is an example of using the
Adafruit_BME280_I2C
. First you will need to import the libraries to use the sensorimport board import adafruit_bme280.advanced as adafruit_bme280
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
You need to setup the pressure at sea level
bme280.sea_level_pressure = 1013.25
Now you have access to the
temperature
,relative_humidity
pressure
andaltitude
attributestemperature = bme280.temperature relative_humidity = bme280.relative_humidity pressure = bme280.pressure altitude = bme280.altitude
- class adafruit_bme280.advanced.Adafruit_BME280_SPI(spi: SPI, cs: DigitalInOut, baudrate: int = 100000)[source]¶
Driver for BME280 connected over SPI
- Parameters
spi (SPI) – SPI device
cs (DigitalInOut) – Chip Select
baudrate (int) – Clock rate, default is 100000. Can be changed with
baudrate()
Note
The operational range of the BMP280 is 300-1100 hPa. Pressure measurements outside this range may not be as accurate.
Quickstart: Importing and using the BME280
Here is an example of using the
Adafruit_BME280_SPI
class. First you will need to import the libraries to use the sensorimport board from digitalio import DigitalInOut import adafruit_bme280.advanced as adafruit_bme280
Once this is done you can define your
board.SPI
object and define your sensor objectcs = digitalio.DigitalInOut(board.D10) spi = board.SPI() bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, cs)
You need to setup the pressure at sea level
bme280.sea_level_pressure = 1013.25
Now you have access to the
temperature
,relative_humidity
pressure
andaltitude
attributestemperature = bme280.temperature relative_humidity = bme280.relative_humidity pressure = bme280.pressure altitude = bme280.altitude