MicroPython BMP581 Library¶
bmp581
¶
MicroPython Driver for the Bosch BMP581 pressure sensor
Author: Jose D. Montoya
-
class micropython_bmp581.bmp581.BMP581(i2c, address: int =
0x47
)[source]¶ Driver for the BMP581 Sensor connected over I2C.
- Parameters:¶
- Raises:¶
RuntimeError – if the sensor is not found
Quickstart: Importing and using the device
Here is an example of using the
BMP581
class. First you will need to import the libraries to use the sensorfrom machine import Pin, I2C from micropython_bmp581 import bmp581
Once this is done you can define your
machine.I2C
object and define your sensor objecti2c = I2C(1, sda=Pin(2), scl=Pin(3)) bmp581 = bmp581.BMP581(i2c)
Now you have access to the attributes
press = bmp.pressure
- property altitude : float¶
With the measured pressure p and the pressure at sea level p0 e.g. 1013.25hPa, the altitude in meters can be calculated with the international barometric formula
- 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
bmp581.STANDBY
0x00
bmp581.NORMAL
0x01
bmp581.FORCED
0x02
bmp581.NON_STOP
0X03
- property pressure_oversample_rate : str¶
Sensor pressure_oversample_rate Oversampling extends the measurement time per measurement by the oversampling factor. Higher oversampling factors offer decreased noise at the cost of higher power consumption.
Mode
Value
bmp581.OSR1
0x00
bmp581.OSR2
0x01
bmp581.OSR4
0x02
bmp581.OSR8
0x03
bmp581.OSR16
0x04
bmp581.OSR32
0x05
bmp581.OSR64
0x06
bmp581.OSR128
0x07