pyupm_bmp280 module

class pyupm_bmp280.BME280(bus=0, addr=119, cs=-1)[source]

Bases: pyupm_bmp280.BMP280, pyupm_bmp280.IHumiditySensor

API for the BME280 Digital Humidity, Pressure, and Temperature Sensor.

ID: bme280

Name: Digital Humidity, Pressure, and Temperature Sensor

Category: pressure humidity

Manufacturer: bosch adafruit

Connection: i2c spi gpio

Link:https://www.adafruit.com/products/2652 The BME280 is as combined digital humidity, pressure and temperature sensor based on proven sensing principles. The sensor module is housed in an extremely compact metal-lid LGA package with a footprint of only 2.5 * 2.5 mm2 with a height of 0.93 mm. Its small dimensions and its low power consumption allow the implementation in battery driven devices such as handsets, GPS modules or watches. The BME280 is register and performance compatible to the Bosch Sensortec BMP280 digital pressure sensor.

C++ includes: bme280.hpp

getHumidity()[source]

float getHumidity()

Return the current measured relative humidity. update() must have been called prior to calling this method. If the device is a bmp280 rather than a bme280, this method will always return 0.

The relative humidity in percent.

getHumidityRelative()[source]

int getHumidityRelative()

getModuleName()[source]

const char* getModuleName()

Returns name of module. This is the string in library name after libupm_

name of module

setOversampleRateHumidity(rate)[source]

void setOversampleRateHumidity(BME280_OSRS_H_T rate)

Set the humidity sensor oversampling parameter. See the data sheet for details. This value can be automatically set to a suitable value by using one of the predefined modes for setUsageMode().

rate: One of the OSRS_H_T values.

class pyupm_bmp280.BMP280(bus=0, addr=119, cs=-1)[source]

Bases: pyupm_bmp280.ITemperatureSensor, pyupm_bmp280.IPressureSensor

API for the BMP280 Digital Pressure Sensor.

ID: bmp280

Name: Digital Pressure Sensor

Category: pressure

Manufacturer: bosch adafruit

Connection: i2c spi gpio

Link:https://www.adafruit.com/products/2651 The BMP280 is an absolute barometric pressure sensor especially designed for mobile applications. The sensor module is housed in an extremely compact 8-pin metal-lid LGA package with a footprint of only 2.0 * 2.5 mm2 and 0.95 mm package height. Its small dimensions and its low power consumption of 2.7 uA @1Hz allow the implementation in battery driven devices such as mobile phones, GPS modules or watches.

As the successor to the widely adopted BMP180, the BMP280 delivers high performance in all applications that require precise pressure measurement. The BMP280 operates at lower noise, supports new filter modes and an SPI interface within a footprint 63% smaller than the BMP180.

C++ includes: bmp280.hpp

getAltitude()[source]

float getAltitude()

Return the current computed altitude in meters. update() must have been called prior to calling this method.

The computed altitude in meters.

getChipID()[source]

uint8_t getChipID()

Return the chip ID.

The chip ID (BMP280_CHIPID).

getModuleName()[source]

const char* getModuleName()

Returns name of module. This is the string in library name after libupm_

name of module

getPressure()[source]

float getPressure()

Return the current measured pressure in Pascals (Pa). update() must have been called prior to calling this method.

The pressure in Pascals (Pa).

getPressurePa()[source]

int getPressurePa()

getTemperature(fahrenheit=False)[source]

float getTemperature(bool fahrenheit=false)

Return the current measured temperature. Note, this is not ambient temperature - this is the temperature used to fine tune the pressure measurement. update() must have been called prior to calling this method.

fahrenheit: true to return data in Fahrenheit, false for Celicus. Celsius is the default.

The temperature in degrees Celsius or Fahrenheit.

getTemperatureCelsius()[source]

int getTemperatureCelsius()

reset()[source]

void reset()

Reset the sensor, as if by a power-on-reset.

setFilter(filter)[source]

void setFilter(BMP280_FILTER_T filter)

Set the IIR filtering parameter. See the data sheet for details. This value can be automatically set to a suitable value by using one of the predefined modes for setUsageMode().

filter: One of the BMP280_FILTER_T values.

setMeasureMode(mode)[source]

void setMeasureMode(BMP280_MODES_T mode)

Set the default measuring mode. Basic values are forced, sleep, and normal. See the data sheet for details. This value can be automatically set to a suitable value by using one of the predefined modes for setUsageMode().

mode: One of the BMP280_MODES_T values.

setOversampleRatePressure(rate)[source]

void setOversampleRatePressure(BMP280_OSRS_P_T rate)

Set the pressure sensor oversampling parameter. See the data sheet for details. This value can be automatically set to a suitable value by using one of the predefined modes for setUsageMode().

rate: One of the BMP280_OSRS_P_T values.

setOversampleRateTemperature(rate)[source]

void setOversampleRateTemperature(BMP280_OSRS_T_T rate)

Set the temperature sensor oversampling parameter. See the data sheet for details. This value can be automatically set to a suitable value by using one of the predefined modes for setUsageMode().

rate: One of the BMP280_OSRS_T_T values.

setSeaLevelPreassure(seaLevelhPA=1013.25)[source]

void setSeaLevelPreassure(float seaLevelhPA=1013.25)

Set the pressure at sea level in hecto-Pascals (hPA). This value is used to compute the altitude based on the pressure. At driver initialization time, this value is set to 1013.25 hPA.

seaLevelhPA: The pressure at sea level in hectoPascals (hPa). The default is 1013.25 hPA, (101325 Pa).

The computed altitude in meters.

setTimerStandby(tsb)[source]

void setTimerStandby(BMP280_T_SB_T tsb)

Set the timer standby value. When in NORMAL operating mode, this timer governs how long the chip will wait before performing a measurement. See the data sheet for details.

tsb: One of the BMP280_T_SB_T values.

setUsageMode(mode)[source]

void setUsageMode(BMP280_USAGE_MODE_T mode)

Set a general usage mode. This function can be used to configure the filters and oversampling for a particular use case. These setting are documented in the BMP280 datasheet. The default mode set in the constructor is USAGE_MODE_INDOOR_NAV, the highest resolution mode.

mode: One of the BMP280_USAGE_MODE_T values.

update()[source]

void update()

Update the internal stored values from sensor data.

std::runtime_error: on failure.

class pyupm_bmp280.IHumiditySensor(*args, **kwargs)[source]

Bases: pyupm_bmp280.IModuleStatus

Interface for Humidity Sensors.

C++ includes: iHumiditySensor.hpp

getHumidityRelative()[source]

virtual int getHumidityRelative()=0

class pyupm_bmp280.IModuleStatus(*args, **kwargs)[source]

Bases: object

getModuleName()[source]

virtual const char* getModuleName()=0

Returns name of module. This is the string in library name after libupm_

name of module

class pyupm_bmp280.IPressureSensor(*args, **kwargs)[source]

Bases: pyupm_bmp280.IModuleStatus

getPressurePa()[source]

virtual int getPressurePa()=0

class pyupm_bmp280.ITemperatureSensor(*args, **kwargs)[source]

Bases: pyupm_bmp280.IModuleStatus

Interface for Temperature Sensors.

C++ includes: iTemperatureSensor.hpp

getTemperatureCelsius()[source]

virtual int getTemperatureCelsius()=0