BME280 - Pressure sensor

Funny text about the sensor

class pyserialsensors.devices.bme280.BME280(*args, t_mode: int = 1, p_mode: int = 5, h_mode: int = 1, standby: int = 3, _filter: int = 0, **kwargs)[source]

Reads absolute pressure [Pa], humidity [pct] and temperature [°C]

get_data() dict[source]

Get current measurement values

Returns

Data dictionary

Return type

dict

get_raw_data() bytearray[source]

Read all values from devices needed to calculate humidity, pressure and temperature values

Returns

Raw data array

Return type

bytearray

get_serial_number() str[source]

A serial number is not supported by bme280 hence a pseudo identifier is calculated by adding the individual calibration values together

Returns

Serial number information or None

Return type

str

init() None[source]

Initialize sensor communication * Activate sleep mode * Write filter and standby calibration * Write humidty oversampling rate * Write temperature oversampling rate * Write pressure oversampling rate

load_calibration() bool[source]

Load all calibration data needed for the calculation of Temperature, Humidtiy and absolute pressure.

Returns

True if read has been completed successfully, False otherwise.

Return type

bool

prepare_measurement() bool[source]

Placeholder function to be compatible with other sensor classes

Returns

True if test was successful, otherwise False.

Return type

bool

read_dewpoint(raw_data: bytearray) float[source]

Return calculated dewpoint in °C, only accurate at > 50% RH

read_dewpoint_f(raw_data: bytearray) float[source]

Calculated dewpoint in F, only accurate at > 50% RH

read_humidity(raw_data: bytearray) float[source]

Convert raw rel. humidity to compensated relative humidity in %

Parameters

raw_data (bytearray) – Full raw data array (temperature,pressure and humidity)

Returns

Relative humidity in %

Return type

float

read_pressure(raw_data: bytearray) float[source]

Convert raw pressure to compensated pressure in Pa

Parameters

raw_data (bytearray) – Full raw data array (temperature,pressure and humidity)

Returns

Pressure in Pa

Return type

float

classmethod read_raw_humidity(raw_data: bytearray) int[source]

Calculate raw (uncompensated) humidity value from the sensor.

Parameters

raw_data (bytearray) – Full raw data array (temperature,pressure and humidity)

Returns

Raw adc read

Return type

int

classmethod read_raw_pressure(raw_data: bytearray) int[source]

Calculate raw (uncompensated) pressure level from the sensor.

Returns

Raw adc read

Return type

int

classmethod read_raw_temp(raw_data: bytearray) int[source]

Calculate uncompensated raw temperature from sensor.

Returns

Raw adc read

Return type

int

read_temperature(raw_data: bytearray) float[source]

Convert raw temperature to compensated temperature in °C

Parameters

raw_data (bytearray) – Full raw data array (temperature,pressure and humidity)

Returns

Temperature in °C or None if conversion failed

Return type

float

reset() None[source]

Reset sensor to default.

sensor_exists() bool[source]

Test if sensor is plugged in and works proper

Returns

True if test was successful, otherwise False.

Return type

bool