CircuitPython BMP384 Driver

bmp384

CircuitPython Driver for the Bosch BMP384 Pressure and Temperature sensor

  • Author: Jose D. Montoya

class bmp384.BMP384(i2c_bus: busio.I2C, address: int = 0x77)[source]

Driver for the BMP384 Sensor connected over I2C.

Parameters:
i2c_bus : I2C

The I2C bus the BMP384 is connected to.

address : int

The I2C device address. Defaults to 0x77

Raises:

RuntimeError – if the sensor is not found

Quickstart: Importing and using the device

Here is an example of using the BMP384 class. First you will need to import the libraries to use the sensor

import board
import bmp384

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()  # uses board.SCL and board.SDA
bmp = bmp384.BMP384(i2c)

Now you have access to the attributes

press = bmp.pressure
temp = bmp.temperature
property filter_coefficients : str

Sensor filter_coefficients

Mode

Value

bmp384.IIR_FILTER_DISABLE

0x00

bmp384.IIR_FILTER_X2

0x01

bmp384.IIR_FILTER_X4

0x02

bmp384.IIR_FILTER_X8

0x03

bmp384.IIR_FILTER_X16

0x04

bmp384.IIR_FILTER_X32

0x05

bmp384.IIR_FILTER_X64

0x06

bmp384.IIR_FILTER_X128

0x07

property output_data_rate : int

Sensor output_data_rate. for a complete list of values please see the datasheet

property power_mode : str

Sensor power_mode

Mode

Value

bmp384.SLEEP_MODE

0b00

bmp384.FORCED_MODE

0b10

bmp384.NORMAL_MODE

0b11

property pressure : float

The sensor pressure in hPa :return: Pressure in hPa

property pressure_mode : str

Sensor pressure_mode

Mode

Value

bmp384.PRESS_DISABLE

0x00

bmp384.PRESS_ENABLE

0x01

property pressure_oversample : str

Sensor pressure_oversample

Mode

Value

bmp384.OVERSAMPLE_DISABLE

0x00

bmp384.OVERSAMPLE_X2

0x01

bmp384.OVERSAMPLE_X4

0x02

bmp384.OVERSAMPLE_X8

0x03

bmp384.OVERSAMPLE_X16

0x04

bmp384.OVERSAMPLE_X32

0x05

property temperature : float

The temperature sensor in Celsius :return: Temperature

property temperature_mode : str

Sensor temperature_mode

Mode

Value

bmp384.TEMP_DISABLE

0x00

bmp384.TEMP_ENABLE

0x01

property temperature_oversample : str

Sensor temperature_oversample

Mode

Value

bmp384.OVERSAMPLE_DISABLE

0x00

bmp384.OVERSAMPLE_X2

0x01

bmp384.OVERSAMPLE_X4

0x02

bmp384.OVERSAMPLE_X8

0x03

bmp384.OVERSAMPLE_X16

0x04

bmp384.OVERSAMPLE_X32

0x05