bme280 package

Submodules

bme280.const module

exception bme280.const.ConstError

Bases: TypeError

bme280.reader module

class bme280.reader.reader(bus, address)

Bases: object

Wraps a I2C SMBus instance to provide methods for reading signed/unsigned bytes and 16-bit words

signed_byte(register)
signed_short(register)
unsigned_byte(register)
unsigned_short(register)

Module contents

Raspberry Pi BME280 Driver.

class bme280.compensated_readings(raw_readings, compensation_params)

Bases: object

Compensation formulas translated from Appendix A (8.1) of BME280 datasheet:

  • Temperature in °C, double precision. Output value of “51.23” equals 51.23 °C

  • Pressure in hPa as double. Output value of “963.862” equals 963.862 hPa

  • Humidity in %rH as as double. Output value of “46.332” represents 46.332 %rH

bme280.load_calibration_params(bus, address=118)

The BME280 output consists of the ADC output values. However, each sensing element behaves differently. Therefore, the actual pressure and temperature must be calculated using a set of calibration parameters.

The calibration parameters are subsequently used to with some compensation formula to perform temperature readout in degC, humidity in % and pressure in hPA.

class bme280.memoize(f)

Bases: object

class bme280.params

Bases: dict

bme280.sample(bus, address=118, compensation_params=None, sampling=1)

Primes the sensor for reading (defaut: x1 oversampling), pauses for a set amount of time so that the reading stabilizes, and then returns a compensated reading object with the following attributes:

  • timestamp (Python’s datetime object) when reading was taken.

  • temperature, in degrees Celcius.

  • humidity, in % relative humidity.

  • pressure, in hPa.

class bme280.uncompensated_readings(block)

Bases: object