Skip to main content

Class Ccs811

Provide access to the CCS811 C02 and VOC Air Quality Sensor

Assembly: Ccs811.dll
View Source
Declaration
public class Ccs811 : PollingSensorBase<(Concentration? Co2, Concentration? Voc)>, IObservable<IChangeResult<(Concentration? Co2, Concentration? Voc)>>, ISamplingSensor<(Concentration? Co2, Concentration? Voc)>, ISensor<(Concentration? Co2, Concentration? Voc)>, ICo2Sensor, IVocSensor, ISamplingSensor<Concentration>, ISensor<Concentration>, ISensor, ISamplingSensor, II2cPeripheral

Inheritance: System.Object -> Meadow.Foundation.ObservableBase<UNIT>

Implements:

Expand

System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Concentration>,System.Nullable<Meadow.Units.Concentration>>>>, Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Concentration>,System.Nullable<Meadow.Units.Concentration>>>, Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Concentration>,System.Nullable<Meadow.Units.Concentration>>>, Meadow.Peripherals.Sensors.Atmospheric.ICo2Sensor, Meadow.Peripherals.Sensors.Atmospheric.IVocSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Concentration>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Concentration>, Meadow.Peripherals.Sensors.ISensor, Meadow.Peripherals.Sensors.ISamplingSensor, Meadow.Hardware.II2cPeripheral

Properties

Co2

The measured CO2 concentration

View Source
Declaration
public Concentration? Co2 { get; }

Voc

The measured VOC concentration

View Source
Declaration
public Concentration? Voc { get; }

DefaultI2cAddress

The default I2C address for the peripheral

View Source
Declaration
public byte DefaultI2cAddress { get; }

Methods

Initialize()

Initialize the sensor

View Source
Declaration
protected void Initialize()
Exceptions

System.Exception
Raised if HW_ID register returns an invalid id

GetBaseline()

Get baseline value

View Source
Declaration
public ushort GetBaseline()
Returns

System.UInt16: The baseline value### SetBaseline(ushort) Set the baseline value

View Source
Declaration
public void SetBaseline(ushort value)
Parameters
TypeNameDescription
System.UInt16valueThe new baseline

GetMeasurementMode()

Get the current measurement mode

View Source
Declaration
public Ccs811.MeasurementMode GetMeasurementMode()
Returns

Meadow.Foundation.Sensors.Atmospheric.Ccs811.MeasurementMode: The measurement mode### SetMeasurementMode(MeasurementMode) Set the Measurement mode

View Source
Declaration
public void SetMeasurementMode(Ccs811.MeasurementMode mode)
Parameters
TypeNameDescription
Meadow.Foundation.Sensors.Atmospheric.Ccs811.MeasurementModemodeThe new mode

ReadSensor()

Reads data from the sensor

View Source
Declaration
protected override Task<(Concentration? Co2, Concentration? Voc)> ReadSensor()
Returns

System.Threading.Tasks.Task<System.ValueTuple<System.Nullable<Meadow.Units.Concentration>,System.Nullable<Meadow.Units.Concentration>>>: The latest sensor reading### RaiseEventsAndNotify(IChangeResult<(Concentration? Co2, Concentration? Voc)>) Raise events for subscribers and notify of value changes

View Source
Declaration
protected override void RaiseEventsAndNotify(IChangeResult<(Concentration? Co2, Concentration? Voc)> changeResult)
Parameters
TypeNameDescription
Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Concentration>,System.Nullable<Meadow.Units.Concentration>>>changeResultThe updated sensor data

Events

VocUpdated

Event raised when the VOC concentration value changes

View Source
Declaration
public event EventHandler<ChangeResult<Concentration>> VocUpdated
Event Type

System.EventHandler<Meadow.ChangeResult<Meadow.Units.Concentration>>

Implements

  • System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Concentration>,System.Nullable<Meadow.Units.Concentration>>>>
  • Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Concentration>,System.Nullable<Meadow.Units.Concentration>>>
  • Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Concentration>,System.Nullable<Meadow.Units.Concentration>>>
  • Meadow.Peripherals.Sensors.Atmospheric.ICo2Sensor
  • Meadow.Peripherals.Sensors.Atmospheric.IVocSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Concentration>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Concentration>
  • Meadow.Peripherals.Sensors.ISensor
  • Meadow.Peripherals.Sensors.ISamplingSensor
  • Meadow.Hardware.II2cPeripheral