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