Class Bme680
Represents a BME680 temperature, pressure, relative humidity and VOC gas sensor.
[Interface("Represents a BME680 temperature, pressure, relative humidity and VOC gas sensor.")]
public class Bme680 : Bmxx80Base
- Inheritance
-
Bme680
- Inherited Members
Constructors
Bme680(I2cDevice)
Initializes a new instance of the Bme680 class.
public Bme680(I2cDevice i2cDevice)
Parameters
Bme680(I2cDevice, Temperature)
Initializes a new instance of the Bme680 class.
public Bme680(I2cDevice i2cDevice, Temperature ambientTemperatureDefault)
Parameters
i2cDevice
I2cDeviceThe I2cDevice to create with.
ambientTemperatureDefault
TemperatureAssumed ambient temperature for startup. Used for initialization of the gas measurement if the temperature cannot be read during a reset.
Fields
DefaultI2cAddress
Default I2C bus address.
public const byte DefaultI2cAddress = 118
Field Value
SecondaryI2cAddress
Secondary I2C bus address.
public const byte SecondaryI2cAddress = 119
Field Value
Properties
FilterMode
Gets or sets the filtering mode to be used for measurements.
[Property]
public Bme680FilteringMode FilterMode { get; set; }
Property Value
Exceptions
- ArgumentOutOfRangeException
Thrown when the Bme680FilteringMode is set to an undefined mode.
GasConversionIsEnabled
Gets or sets a value indicating whether gas conversions are enabled.
[Property]
public bool GasConversionIsEnabled { get; set; }
Property Value
HeaterIsEnabled
Gets or sets a value indicating whether the heater is enabled.
[Property]
public bool HeaterIsEnabled { get; set; }
Property Value
HeaterProfile
Gets or sets the heater profile to be used for measurements. Current heater profile is only set if the chosen profile is configured.
[Property]
public Bme680HeaterProfile HeaterProfile { get; set; }
Property Value
Exceptions
- ArgumentOutOfRangeException
Thrown when the Bme680HeaterProfile is set to an undefined profile.
HumiditySampling
Gets or sets the humidity sampling.
[Property]
public Sampling HumiditySampling { get; set; }
Property Value
Exceptions
- ArgumentOutOfRangeException
Thrown when the Sampling is set to an undefined mode.
TempCalibrationFactor
The temperature calibration factor.
protected override int TempCalibrationFactor { get; }
Property Value
Methods
ConfigureHeatingProfile(Bme680HeaterProfile, Temperature, Duration, Temperature)
Configures a heater profile, making it ready for use.
public void ConfigureHeatingProfile(Bme680HeaterProfile profile, Temperature targetTemperature, Duration duration, Temperature ambientTemperature)
Parameters
profile
Bme680HeaterProfileThe Bme680HeaterProfile to configure.
targetTemperature
TemperatureThe target temperature. Ranging from 0-400.
duration
DurationThe measurement durations. Ranging from 0-4032ms.
ambientTemperature
TemperatureThe ambient temperature.
Exceptions
- ArgumentOutOfRangeException
Thrown when the heating profile does not match a defined profile in Bme680HeaterProfile.
GetMeasurementDuration(Bme680HeaterProfile)
Gets the required time in ms to perform a measurement. The duration of the gas measurement is not considered if GasConversionIsEnabled is set to false or the chosen Bme680HeaterProfile is not configured. The precision of this duration is within 1ms of the actual measurement time.
public Duration GetMeasurementDuration(Bme680HeaterProfile profile)
Parameters
profile
Bme680HeaterProfileThe used Bme680HeaterProfile.
Returns
- Duration
Measurement duration.
Read()
Performs a synchronous reading.
public Bme680ReadResult Read()
Returns
ReadGasMeasurementInProcess()
Reads whether a gas measurement is in process.
public bool ReadGasMeasurementInProcess()
Returns
- bool
True if gas measurment is in process.
ReadHeaterIsStable()
Reads whether the target heater temperature is reached.
public bool ReadHeaterIsStable()
Returns
- bool
True if heater is stable.
ReadMeasurementInProcess()
Reads whether a measurement of any kind is in process.
public bool ReadMeasurementInProcess()
Returns
- bool
True if measurment is in process.
ReadNewDataIsAvailable()
Reads whether new data is available.
public bool ReadNewDataIsAvailable()
Returns
- bool
True if new data is available.
ReadPowerMode()
Read the Bme680PowerMode state.
[Property("PowerMode")]
public Bme680PowerMode ReadPowerMode()
Returns
- Bme680PowerMode
The current Bme680PowerMode.
SetDefaultConfiguration()
Sets the default configuration for the sensor.
protected override void SetDefaultConfiguration()
SetPowerMode(Bme680PowerMode)
Sets the power mode to the given mode.
[Property("PowerMode")]
public void SetPowerMode(Bme680PowerMode powerMode)
Parameters
powerMode
Bme680PowerModeThe Bme680PowerMode to set.
Exceptions
- ArgumentOutOfRangeException
Thrown when the power mode does not match a defined mode in Bme680PowerMode.
TryReadGasResistance(out ElectricResistance)
Reads the gas resistance. A return value indicates whether the reading succeeded.
[Telemetry("GasResistance")]
public bool TryReadGasResistance(out ElectricResistance gasResistance)
Parameters
gasResistance
ElectricResistanceContains the measured gas resistance if the heater module reached the target temperature and the measurement was valid. Undefined otherwise.
Returns
- bool
if measurement was not skipped, otherwisetrue
.false
TryReadHumidity(out RelativeHumidity)
Reads the humidity. A return value indicates whether the reading succeeded.
[Telemetry("Humidity")]
public bool TryReadHumidity(out RelativeHumidity humidity)
Parameters
humidity
RelativeHumidityContains the measured humidity as %rH if the HumiditySampling was not set to Skipped. Contains NaN otherwise.
Returns
- bool
if measurement was not skipped, otherwisetrue
.false
TryReadPressure(out Pressure)
Reads the pressure. A return value indicates whether the reading succeeded.
public override bool TryReadPressure(out Pressure pressure)
Parameters
pressure
PressureContains the measured pressure if the PressureSampling was not set to Skipped. Contains NaN otherwise.
Returns
- bool
if measurement was not skipped, otherwisetrue
.false
TryReadTemperature(out Temperature)
Reads the temperature. A return value indicates whether the reading succeeded.
public override bool TryReadTemperature(out Temperature temperature)
Parameters
temperature
TemperatureContains the measured temperature if the TemperatureSampling was not set to Skipped. Contains NaN otherwise.
Returns
- bool
if measurement was not skipped, otherwisetrue
.false