BME280 sensor

class bme280.BME280(i2c=None, mode=1, addr=118, **kwargs)[source]

Bases: object

altitude(sea_level_pressure_hpa=1013.25)[source]

Return the approximative altitude in meters.

humidity()[source]

Return the humidity in percent.

pressure()[source]

Return the pressure in hPa.

read_humidity()[source]
read_pressure()[source]

Gets the compensated pressure in Pascals.

read_raw_humidity()[source]

Assumes that the temperature has already been read

read_raw_pressure()[source]

Reads the raw (uncompensated) pressure level from the sensor.

read_raw_temp()[source]

Reads the raw (uncompensated) temperature from the sensor.

read_temperature()[source]

Get the compensated temperature in 0.01 of a degree celsius.

read_values()[source]

Read temperature, humidity, pressure, and altitude from the sensor.

temperature()[source]

Return the temperature in degrees.

class bme280.Device(address, i2c)[source]

Bases: object

Class for communicating with an I2C device.

Allows reading and writing 8-bit, 16-bit, and byte array values to registers on the device.

readRaw8()[source]

Read an 8-bit value on the bus (without register).

readS16(register, little_endian=True)[source]

Read a signed 16-bit value from the specified register, with the specified endianness (default little endian, or least significant byte first).

readS16BE(register)[source]

Read a signed 16-bit value from the specified register, in big endian byte order.

readS16LE(register)[source]

Read a signed 16-bit value from the specified register, in little endian byte order.

readS8(register)[source]

Read a signed byte from the specified register.

readU16(register, little_endian=True)[source]

Read an unsigned 16-bit value from the specified register, with the specified endianness (default little endian, or least significant byte first).

readU16BE(register)[source]

Read an unsigned 16-bit value from the specified register, in big endian byte order.

readU16LE(register)[source]

Read an unsigned 16-bit value from the specified register, in little endian byte order.

readU8(register)[source]

Read an unsigned byte from the specified register.

write16(register, value)[source]

Write a 16-bit value to the specified register.

write8(register, value)[source]

Write an 8-bit value to the specified register.

writeRaw8(value)[source]

Write an 8-bit value on the bus (without register).

bme280.demo()[source]

Demonstrates the usage of the BME280 class by reading temperature, humidity, and pressure.