Table of Contents

Class Sen5xSensor

Namespace
Iot.Device.Sen5x
Assembly
Iot.Device.Sen5x.dll

Documentation for this public class.

public class Sen5xSensor
Inheritance
Sen5xSensor

Constructors

Sen5xSensor(I2cDevice)

Initializes a new instance of the Sen5xSensor class.

public Sen5xSensor(I2cDevice i2cDevice)

Parameters

i2cDevice I2cDevice

The I2cDevice to which this sensor is connected.

Fields

DefaultI2cAddress

The I2C address as specified in the datasheet.

public const byte DefaultI2cAddress = 105

Field Value

byte

DefaultI2cBusSpeed

The I2C bus speed as specified in the datasheet.

public const I2cBusSpeed DefaultI2cBusSpeed = StandardMode

Field Value

I2cBusSpeed

Methods

ClearDeviceStatus()

Clears all flags in device status register.

public void ClearDeviceStatus()

Exceptions

InvalidOperationException

When the I2C operation fails.

DeviceReset()

Device software reset command. After calling this command, the module is in the same state as after a power reset.

public void DeviceReset()

Exceptions

InvalidOperationException

When the I2C operation fails.

ReadAutoCleaningInterval()

Reads the interval [s] of the periodic fan-cleaning.

public AutoCleaningIntervalParameters ReadAutoCleaningInterval()

Returns

AutoCleaningIntervalParameters

The current auto cleaning interval parameters.

Exceptions

InvalidOperationException

When the I2C operation fails.

ReadDataReadyFlag()

This command can be used for polling to find out when new measurements are available.

public bool ReadDataReadyFlag()

Returns

bool

True when data is ready to be read, false otherwise.

Exceptions

InvalidOperationException

When the I2C operation fails.

ReadDeviceStatus()

Use this command to read the Device Status Register.

public DeviceStatus ReadDeviceStatus()

Returns

DeviceStatus

The device status.

Exceptions

InvalidOperationException

When the I2C operation fails.

ReadFirmwareVersion()

Get firmware version. There is no Major/Minor, only a single value.

public byte ReadFirmwareVersion()

Returns

byte

The firmware version.

Exceptions

InvalidOperationException

When the I2C operation fails.

ReadMeasurement()

Reads the measured values from the sensor module and resets the "Data-Ready Flag". If the sensor module is in Measurement-Mode, an updated measurement value is provided every second and the "Data-Ready Flag" is set. If no synchronized readout is desired, the "Data-Ready Flag" can be ignored. The command "Read Measured Values" always returns the latest measured values. In RHT/Gas-Only Measurement Mode, the PM output is 0xFFFF. If any value is unknown, 0xFFFF is returned.

public Measurement ReadMeasurement()

Returns

Measurement

The measured values.

Exceptions

InvalidOperationException

When the I2C operation fails.

ReadNoxAlgorithmTuningParameters()

The NOx algorithm can be customized by tuning 6 different parameters. Note that this command is available only in idle mode. In measure mode, this command has no effect. In addition, it has no effect if at least one parameter is outside the specified range.

public AlgorithmTuningParameters ReadNoxAlgorithmTuningParameters()

Returns

AlgorithmTuningParameters

The algorithm tuning parametes for NOx.

Exceptions

InvalidOperationException

When the I2C operation fails.

ReadProductName()

This command returns the product name SEN5x (SEN50, SEN54 or SEN55).

public string ReadProductName()

Returns

string

The product name SEN5x (SEN50, SEN54 or SEN55).

Exceptions

InvalidOperationException

When the I2C operation fails.

ReadRhtAccelerationMode()

By default, the RH/T acceleration algorithm is optimized for a sensor which is positioned in free air. If the sensor is integrated into another device, the ambient RH/T output values might not be optimal due to different thermal behavior. This parameter can be used to read the RH/T acceleration behavior for the actual use-case, leading in an improvement of the ambient RH/T output accuracy.

public RhtAccelerationModeParameters ReadRhtAccelerationMode()

Returns

RhtAccelerationModeParameters

The parameters for the RH/T acceleration mode.

Exceptions

InvalidOperationException

When the I2C operation fails.

ReadSerialNumber()

This command returns the requested serial number.

public string ReadSerialNumber()

Returns

string

The serial number.

Exceptions

InvalidOperationException

When the I2C operation fails.

ReadTemperatureCompensationParameters()

These commands allow to compensate temperature effects of the design-in at customer side by applying a custom temperature offset to the ambient temperature.

public TemperatureCompensationParameters ReadTemperatureCompensationParameters()

Returns

TemperatureCompensationParameters

The current temperature compensation parameters.

Exceptions

InvalidOperationException

When the I2C operation fails.

ReadVocAlgorithmState()

Allows to backup and restore the VOC algorithm state to resume operation after a short interruption, skipping initial learning phase. By default, the VOC algorithm resets its state to initial values each time a measurement is started, even if the measurement was stopped only for a short time. So, the VOC index output value needs a long time until it is stable again. This can be avoided by restoring the previously memorized algorithm state before starting the measure mode.

public VocAlgorithmState ReadVocAlgorithmState()

Returns

VocAlgorithmState

The current VOC algorithm state.

Exceptions

InvalidOperationException

When the I2C operation fails.

ReadVocAlgorithmTuningParameters()

The VOC algorithm can be customized by tuning 6 different parameters. Note that this command is available only in idle mode. In measure mode, this command has no effect. In addition, it has no effect if at least one parameter is outside the specified range.

public AlgorithmTuningParameters ReadVocAlgorithmTuningParameters()

Returns

AlgorithmTuningParameters

The algorithm tuning parametes for VOC.

Exceptions

InvalidOperationException

When the I2C operation fails.

ReadWarmStartParameter()

The temperature compensation algorithm is optimized for a cold start by default, i.e., it is assumed that the "Start Measurement" commands are called on a device not yet warmed up by previous measurements. If the measurement is started on a device that is already warmed up, this parameter can be used to improve the initial accuracy of the ambient temperature output. This parameter can be gotten and set in any state of the device, but it is applied only the next time starting a measurement, i.e., when sending a "Start Measurement" command.So, the parameter needs to be written before a warm-start measurement is started.

public WarmStartParameters ReadWarmStartParameter()

Returns

WarmStartParameters

The warm start parameter.

Exceptions

InvalidOperationException

When the I2C operation fails.

StartFanCleaning()

Starts the fan-cleaning manually. This command can only be executed in Measurement-Mode.

public void StartFanCleaning()

Exceptions

InvalidOperationException

When the I2C operation fails.

StartMeasurement()

Starts the measurement. After power up, the module is in Idle-Mode. Before any measurement values can be read, the Measurement-Mode needs to be started using this command.

public void StartMeasurement()

Exceptions

InvalidOperationException

When the I2C operation fails.

StartMeasurementWithoutPM()

Starts a continuous measurement without PM. Only humidity, temperature, VOC, and NOx are available in this mode. Laser and fan are switched off to keep power consumption low.

public void StartMeasurementWithoutPM()

Exceptions

InvalidOperationException

When the I2C operation fails.

StopMeasurement()

Stops the measurement. Use this command to return to the initial state (Idle-Mode).

public void StopMeasurement()

Exceptions

InvalidOperationException

When the I2C operation fails.

WriteAutoCleaningInterval(AutoCleaningIntervalParameters)

Writes the interval [s] of the periodic fan-cleaning. Please note that since this configuration is volatile, it will be reverted to the default value after a device reset.

public void WriteAutoCleaningInterval(AutoCleaningIntervalParameters value)

Parameters

value AutoCleaningIntervalParameters

The new auto cleaning interval to be set.

Exceptions

InvalidOperationException

When the I2C operation fails.

WriteNoxAlgorithmTuningParameters(AlgorithmTuningParameters)

The NOx algorithm can be customized by tuning 6 different parameters. Note that this command is available only in idle mode. In measure mode, this command has no effect. In addition, it has no effect if at least one parameter is outside the specified range.

public void WriteNoxAlgorithmTuningParameters(AlgorithmTuningParameters value)

Parameters

value AlgorithmTuningParameters

The new algorithm tuning parameters for NOx.

Exceptions

InvalidOperationException

When the I2C operation fails.

WriteRhtAccelerationMode(RhtAccelerationModeParameters)

By default, the RH/T acceleration algorithm is optimized for a sensor which is positioned in free air. If the sensor is integrated into another device, the ambient RH/T output values might not be optimal due to different thermal behavior. This parameter can be used to adapt the RH/T acceleration behavior for the actual use-case, leading in an improvement of the ambient RH/T output accuracy.

public void WriteRhtAccelerationMode(RhtAccelerationModeParameters value)

Parameters

value RhtAccelerationModeParameters

The new RH/T acceleration mode parameters.

Exceptions

InvalidOperationException

When the I2C operation fails.

WriteTemperatureCompensationParameters(TemperatureCompensationParameters)

These commands allow to compensate temperature effects of the design-in at customer side by applying a custom temperature offset to the ambient temperature.

public void WriteTemperatureCompensationParameters(TemperatureCompensationParameters value)

Parameters

value TemperatureCompensationParameters

The new temperature compensation parameters to be set.

Exceptions

InvalidOperationException

When the I2C operation fails.

WriteVocAlgorithmState(VocAlgorithmState)

Allows to backup and restore the VOC algorithm state to resume operation after a short interruption, skipping initial learning phase. By default, the VOC algorithm resets its state to initial values each time a measurement is started, even if the measurement was stopped only for a short time. So, the VOC index output value needs a long time until it is stable again. This can be avoided by restoring the previously memorized algorithm state before starting the measure mode.

public void WriteVocAlgorithmState(VocAlgorithmState value)

Parameters

value VocAlgorithmState

The new VOC algorithm state to write.

Exceptions

InvalidOperationException

When the I2C operation fails.

WriteVocAlgorithmTuningParameters(AlgorithmTuningParameters)

The VOC algorithm can be customized by tuning 6 different parameters. Note that this command is available only in idle mode. In measure mode, this command has no effect. In addition, it has no effect if at least one parameter is outside the specified range.

public void WriteVocAlgorithmTuningParameters(AlgorithmTuningParameters value)

Parameters

value AlgorithmTuningParameters

The new algorithm tuning parameters for VOC.

Exceptions

InvalidOperationException

When the I2C operation fails.

WriteWarmStartParameter(WarmStartParameters)

The temperature compensation algorithm is optimized for a cold start by default, i.e., it is assumed that the "Start Measurement" commands are called on a device not yet warmed up by previous measurements. If the measurement is started on a device that is already warmed up, this parameter can be used to improve the initial accuracy of the ambient temperature output. This parameter can be gotten and set in any state of the device, but it is applied only the next time starting a measurement, i.e., when sending a "Start Measurement" command.So, the parameter needs to be written before a warm-start measurement is started.

public void WriteWarmStartParameter(WarmStartParameters value)

Parameters

value WarmStartParameters

The new warm start parameter to be set.

Exceptions

InvalidOperationException

When the I2C operation fails.