BMP280 Temperature/Pressure Sensor

See Application::make_bmp280_sensor().

API Reference

class BMP280Component : public PollingComponent, public I2CDevice

This class implements support for the BMP280 Temperature+Pressure i2c sensor.

Public Functions

BMP280Component(I2CComponent *parent, const std::string &temperature_name, const std::string &pressure_name, uint8_t address = 0x77, uint32_t update_interval = 15000)
void set_temperature_oversampling(BMP280Oversampling temperature_over_sampling)

Set the oversampling value for the temperature sensor. Default is 16x.

void set_pressure_oversampling(BMP280Oversampling pressure_over_sampling)

Set the oversampling value for the pressure sensor. Default is 16x.

void set_iir_filter(BMP280IIRFilter iir_filter)

Set the IIR Filter used to increase accuracy, defaults to no IIR Filter.

BMP280TemperatureSensor *get_temperature_sensor() const
BMP280PressureSensor *get_pressure_sensor() const
void setup()

Where the component’s initialization should happen.

Analogous to Arduino’s setup(). This method is guaranteed to only be called once. Defaults to doing nothing.

void dump_config()
float get_setup_priority() const

priority of setup().

higher -> executed earlier

Defaults to 0.

Return
The setup priority of this component

void update()

Protected Types

enum ErrorCode

Values:

NONE = 0
COMMUNICATION_FAILED
WRONG_CHIP_ID

Protected Functions

float read_temperature_(int32_t *t_fine)

Read the temperature value and store the calculated ambient temperature in t_fine.

float read_pressure_(int32_t t_fine)

Read the pressure value in hPa using the provided t_fine value.

uint8_t read_u8(uint8_t register_)
uint16_t read_u16_le(uint8_t register_)
int16_t read_s16_le(uint8_t register_)

Protected Attributes

BMP280CalibrationData calibration_
BMP280Oversampling temperature_oversampling_ = {BMP280_OVERSAMPLING_16X}
BMP280Oversampling pressure_oversampling_ = {BMP280_OVERSAMPLING_16X}
BMP280IIRFilter iir_filter_ = {BMP280_IIR_FILTER_OFF}
BMP280TemperatureSensor *temperature_sensor_
BMP280PressureSensor *pressure_sensor_
sensor::BMP280Component::ErrorCode NONE
enum sensor::BMP280Oversampling

Enum listing all Oversampling values for the BMP280.

Oversampling basically means measuring a condition multiple times. Higher oversampling values therefore increase the time required to read sensor values but increase accuracy.

Values:

BMP280_OVERSAMPLING_NONE = 0b000
BMP280_OVERSAMPLING_1X = 0b001
BMP280_OVERSAMPLING_2X = 0b010
BMP280_OVERSAMPLING_4X = 0b011
BMP280_OVERSAMPLING_8X = 0b100
BMP280_OVERSAMPLING_16X = 0b101
enum sensor::BMP280IIRFilter

Enum listing all Infinite Impulse Filter values for the BMP280.

Higher values increase accuracy, but decrease response time.

Values:

BMP280_IIR_FILTER_OFF = 0b000
BMP280_IIR_FILTER_2X = 0b001
BMP280_IIR_FILTER_4X = 0b010
BMP280_IIR_FILTER_8X = 0b011
BMP280_IIR_FILTER_16X = 0b100
using sensor::BMP280TemperatureSensor = typedef sensor::EmptyPollingParentSensor<1, ICON_EMPTY, UNIT_C>
using sensor::BMP280PressureSensor = typedef sensor::EmptyPollingParentSensor<1, ICON_GAUGE, UNIT_HPA>
struct BMP280CalibrationData

Internal struct storing the calibration values of an BMP280.

Public Members

uint16_t t1
int16_t t2
int16_t t3
uint16_t p1
int16_t p2
int16_t p3
int16_t p4
int16_t p5
int16_t p6
int16_t p7
int16_t p8
int16_t p9