adafruit_bmp3xx
¶
CircuitPython driver from BMP388 Temperature and Barometric Pressure sensor.
- Author(s): Carter Nelson
Implementation Notes¶
Hardware:
- Adafruit BMP388 - Precision Barometric Pressure and Altimeter (Product ID: 3966)
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_bmp3xx.
BMP3XX
¶ Base class for BMP3XX sensor.
-
altitude
¶ The altitude in meters based on the currently set sea level pressure.
-
filter_coefficient
¶ The IIR filter coefficient.
-
pressure
¶ The pressure in hPa.
-
pressure_oversampling
¶ The pressure oversampling setting.
-
reset
()¶ Perform a power on reset. All user configuration settings are overwritten with their default state.
-
temperature
¶ The temperature in degrees Celsius
-
temperature_oversampling
¶ The temperature oversampling setting.
-
-
class
adafruit_bmp3xx.
BMP3XX_I2C
(i2c, address=119)¶ Driver for I2C connected BMP3XX.
Parameters: Quickstart: Importing and using the BMP388
Here is an example of using the
BMP3XX_I2C
class. First you will need to import the libraries to use the sensorimport board import adafruit_bmp3xx
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA bmp = adafruit_bmp3xx.BMP3XX_I2C(i2c)
Now you have access to the
temperature
andpressure
attributestemperature = bmp.temperature pressure = bmp.pressure
-
class
adafruit_bmp3xx.
BMP3XX_SPI
(spi, cs)¶ Driver for SPI connected BMP3XX.
Parameters: - spi (SPI) – SPI device
- cs (DigitalInOut) – Chip Select
Quickstart: Importing and using the BMP388
Here is an example of using the
BMP3XX_SPI
class. First you will need to import the libraries to use the sensorimport board import adafruit_bmp3xx from digitalio import DigitalInOut, Direction
Once this is done you can define your
board.SPI
object and define your sensor objectspi = board.SPI() cs = DigitalInOut(board.D5) bmp = adafruit_bmp3xx.BMP3XX_SPI(spi, cs)
Now you have access to the
temperature
andpressure
attributestemperature = bmp.temperature pressure = bmp.pressure