ModularSensors > Files > sensors / BoschBME280.h

BoschBME280.h file

Contains the BoschBME280 sensor subclass and the variable subclasses BoschBME280_Temp, BoschBME280_Humidity, BoschBME280_Pressure, and BoschBME280_Altitude.

These are used for the Bosch BME280 digital pressure and humidity sensor.

This depends on the Adafruit BME280 library.

Classes

class BoschBME280
The Sensor sub-class for the Bosch BME280.
class BoschBME280_Temp
The Variable sub-class used for the temperature output from a Bosch BME280.
class BoschBME280_Humidity
The Variable sub-class used for the relative humidity output from a Bosch BME280.
class BoschBME280_Pressure
The Variable sub-class used for the atmospheric pressure output from a Bosch BME280.
class BoschBME280_Altitude
The Variable sub-class used for the altitude calculated from the measurements made by a Bosch BME280.

Defines

#define BME280_NUM_VARIABLES = 4
Sensor::_numReturnedValues; the BME280 can report 4 values.
#define SEALEVELPRESSURE_HPA = (1013.25)
The atmospheric pressure at sea level.

Sensor Timing

The sensor timing for a Bosch BME280

#define BME280_WARM_UP_TIME_MS = 100
Sensor::_warmUpTime_ms; BME280 warms up in 100ms.
#define BME280_STABILIZATION_TIME_MS = 4000
Sensor::_stabilizationTime_ms; BME280 is stable after 4000ms.
#define BME280_MEASUREMENT_TIME_MS = 1100
Sensor::_measurementTime_ms; BME280 takes 1100ms to complete a measurement.

Temperature

The temperature variable from a Bosch BME280

  • Range is -40°C to +85°C
  • Accuracy is ±0.5°C

BoschBME280_Temp(BoschBME280* parentSense, const char* uuid = "", const char* varCode = BME280_TEMP_DEFAULT_CODE) explicit

Construct a new BoschBME280_Temp object.

Parameters
parentSense The parent BoschBME280 providing the result values.
uuid A universally unique identifier (UUID or GUID) for the variable; optional with the default value of an empty string.
varCode A short code to help identify the variable in files; optional with a default value of "BoschBME280Temp".

#define BME280_TEMP_RESOLUTION = 2
Decimals places in string representation; temperature should have 2 - resolution is 0.01°C.
#define BME280_TEMP_VAR_NUM = 0
Sensor variable number; temperature is stored in sensorValues[0].
#define BME280_TEMP_VAR_NAME = "temperature"
Variable name in ODM2 controlled vocabulary; "temperature".
#define BME280_TEMP_UNIT_NAME = "degreeCelsius"
Variable unit name in ODM2 controlled vocabulary; "degreeCelsius" (°C)
#define BME280_TEMP_DEFAULT_CODE = "BoschBME280Temp"
Default variable short code; "BoschBME280Temp".

Humidity

The humidity variable from a Bosch BME280

BoschBME280_Humidity(BoschBME280* parentSense, const char* uuid = "", const char* varCode = BME280_HUMIDITY_DEFAULT_CODE) explicit

Construct a new BoschBME280_Humidity object.

Parameters
parentSense The parent BoschBME280 providing the result values.
uuid A universally unique identifier (UUID or GUID) for the variable; optional with the default value of an empty string.
varCode A short code to help identify the variable in files; optional with a default value of "BoschBME280Humidity".

#define BME280_HUMIDITY_RESOLUTION = 3
Decimals places in string representation; humidity should have 3- resolution is 0.008 % RH (16 bit).
#define BME280_HUMIDITY_VAR_NUM = 1
Sensor variable number; humidity is stored in sensorValues[1].
#define BME280_HUMIDITY_VAR_NAME = "relativeHumidity"
Variable name in ODM2 controlled vocabulary; "relativeHumidity".
#define BME280_HUMIDITY_UNIT_NAME = "percent"
Variable unit name in ODM2 controlled vocabulary; "percent" - percent relative humidity (% RH)
#define BME280_HUMIDITY_DEFAULT_CODE = "BoschBME280Humidity"
Default variable short code; "BoschBME280Humidity".

Barometric Pressure

The barometric pressure variable from a Bosch BME280

  • Range is 300 to 1100 hPa
    • Absolute accuracy is ±1 hPa
    • Relative accuracy is ±0.12 hPa

BoschBME280_Pressure(BoschBME280* parentSense, const char* uuid = "", const char* varCode = BME280_PRESSURE_DEFAULT_CODE) explicit

Construct a new BoschBME280_Pressure object.

Parameters
parentSense The parent BoschBME280 providing the result values.
uuid A universally unique identifier (UUID or GUID) for the variable; optional with the default value of an empty string.
varCode A short code to help identify the variable in files; optional with a default value of "BoschBME280Pressure".

#define BME280_PRESSURE_RESOLUTION = 2
Decimals places in string representation; barometric pressure should have 2.
#define BME280_PRESSURE_VAR_NUM = 2
Sensor variable number; pressure is stored in sensorValues[2].
#define BME280_PRESSURE_VAR_NAME = "barometricPressure"
Variable name in ODM2 controlled vocabulary; "barometricPressure".
#define BME280_PRESSURE_UNIT_NAME = "pascal"
Variable unit name in ODM2 controlled vocabulary; "pascal" (Pa)
#define BME280_PRESSURE_DEFAULT_CODE = "BoschBME280Pressure"
Default variable short code; "BoschBME280Pressure".

Altitude

The altitude variable from a Bosch BME280

BoschBME280_Altitude(BoschBME280* parentSense, const char* uuid = "", const char* varCode = BME280_ALTITUDE_DEFAULT_CODE) explicit

Construct a new BoschBME280_Altitude object.

Parameters
parentSense The parent BoschBME280 providing the result values.
uuid A universally unique identifier (UUID or GUID) for the variable; optional with the default value of an empty string.
varCode A short code to help identify the variable in files; optional with a default value of "BoschBME280Altitude".

#define BME280_ALTITUDE_RESOLUTION = 0
Decimals places in string representation; altitude should have 0 - resolution is 1m.
#define BME280_ALTITUDE_VAR_NUM = 3
Sensor variable number; altitude is stored in sensorValues[3].
#define BME280_ALTITUDE_VAR_NAME = "heightAboveSeaFloor"
Variable name in ODM2 controlled vocabulary; "heightAboveSeaFloor".
#define BME280_ALTITUDE_UNIT_NAME = "meter"
Variable unit name in ODM2 controlled vocabulary; "meter".
#define BME280_ALTITUDE_DEFAULT_CODE = "BoschBME280Altitude"
Default variable short code; "BoschBME280Altitude".