Table of Contents

Class Mhz19b

Namespace
Iot.Device.Mhz19b
Assembly
Iot.Device.Mhz19b.dll

MH-Z19B CO2 concentration sensor binding

[Interface("MH-Z19B CO2 concentration sensor binding")]
public sealed class Mhz19b
Inheritance
Mhz19b

Constructors

Mhz19b(Stream, bool)

Initializes a new instance of the Mhz19b class using an existing (serial port) stream.

public Mhz19b(Stream stream, bool shouldDispose)

Parameters

stream Stream

Existing stream

shouldDispose bool

If true, the stream gets disposed when disposing the binding

Mhz19b(string)

Initializes a new instance of the Mhz19b class and creates a new serial port stream.

public Mhz19b(string uartDevice)

Parameters

uartDevice string

Path to the UART device / serial port, e.g. /dev/serial0

Exceptions

ArgumentException

uartDevice is null or empty

Methods

Dispose()

Defines a method to release allocated resources.

public void Dispose()

GetCo2Reading()

Gets the current CO2 concentration from the sensor.

[Telemetry("Co2Concentration")]
public VolumeConcentration GetCo2Reading()

Returns

VolumeConcentration

CO2 volume concentration

Exceptions

IOException

Communication with sensor failed

TimeoutException

A timeout occurred while communicating with the sensor

PerformSpanPointCalibration(VolumeConcentration)

Initiate a span point calibration.

[Command]
public void PerformSpanPointCalibration(VolumeConcentration span)

Parameters

span VolumeConcentration

span value, between 1000[ppm] and 5000[ppm]. The typical value is 2000[ppm].

Exceptions

ArgumentException

Thrown when span value is out of range

IOException

Communication with sensor failed

PerformZeroPointCalibration()

Initiates a zero point calibration.

[Command]
public void PerformZeroPointCalibration()

Exceptions

IOException

Communication with sensor failed

SetAutomaticBaselineCorrection(AbmState)

Switches the autmatic baseline correction on and off.

[Command]
public void SetAutomaticBaselineCorrection(AbmState state)

Parameters

state AbmState

State of automatic correction

Exceptions

IOException

Communication with sensor failed

SetSensorDetectionRange(DetectionRange)

Set the sensor detection range.

[Property("DetectionRange")]
public void SetSensorDetectionRange(DetectionRange detectionRange)

Parameters

detectionRange DetectionRange

Detection range of the sensor

Exceptions

IOException

Communication with sensor failed