Skip to main content

Class Ccs811

Provide access to the CCS811 C02 and VOC Air Quality Sensor

Assembly: Ccs811.dll
View Source
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> -> Meadow.Foundation.SamplingSensorBase<UNIT> -> Meadow.Foundation.PollingSensorBase<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
public Concentration? Co2 { get; }

Voc

The measured VOC concentration

View Source
public Concentration? Voc { get; }

DefaultI2cAddress

The default I2C address for the peripheral

View Source
public byte DefaultI2cAddress { get; }

Methods

Initialize()

Initialize the sensor

View Source
protected void Initialize()
Exceptions

System.Exception
Raised if HW_ID register returns an invalid id

GetBaseline()

Get baseline value

View Source
public ushort GetBaseline()
Returns

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

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

GetMeasurementMode()

Get the current measurement mode

View Source
public Ccs811.MeasurementMode GetMeasurementMode()
Returns

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

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

ReadSensor()

Reads data from the sensor

View Source
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
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
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