Skip to main content

Class Scd4xBase

Base class for SCD4x series of C02 sensors

Assembly: Scd4x.dll
View Source
public abstract class Scd4xBase : ByteCommsSensorBase<(Concentration? Concentration, Temperature? Temperature, RelativeHumidity? Humidity)>, IObservable<IChangeResult<(Concentration? Concentration, Temperature? Temperature, RelativeHumidity? Humidity)>>, ISamplingSensor<(Concentration? Concentration, Temperature? Temperature, RelativeHumidity? Humidity)>, ISensor<(Concentration? Concentration, Temperature? Temperature, RelativeHumidity? Humidity)>, IDisposable, ITemperatureSensor, ISamplingSensor<Temperature>, ISensor<Temperature>, IHumiditySensor, ISamplingSensor<RelativeHumidity>, ISensor<RelativeHumidity>, ICO2ConcentrationSensor, ISamplingSensor<Concentration>, ISensor<Concentration>, ISensor, ISamplingSensor, II2cPeripheral

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

Derived:
Meadow.Foundation.Sensors.Environmental.Scd40, Meadow.Foundation.Sensors.Environmental.Scd41

Implements:

Expand

System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Concentration>,System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.RelativeHumidity>>>>, Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Concentration>,System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.RelativeHumidity>>>, Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Concentration>,System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.RelativeHumidity>>>, System.IDisposable, Meadow.Peripherals.Sensors.ITemperatureSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Temperature>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Temperature>, Meadow.Peripherals.Sensors.Atmospheric.IHumiditySensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.RelativeHumidity>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.RelativeHumidity>, Meadow.Peripherals.Sensors.Environmental.ICO2ConcentrationSensor, 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

CO2Concentration

The current C02 concentration value

View Source
public Concentration? CO2Concentration { get; }

Temperature

The current temperature

View Source
public Temperature? Temperature { get; }

Humidity

The current humidity

View Source
public RelativeHumidity? Humidity { get; }

DefaultI2cAddress

The default I2C address for the peripheral

View Source
public byte DefaultI2cAddress { get; }

Methods

ReInitialize()

Re-initialize the sensor

View Source
public Task ReInitialize()
Returns

System.Threading.Tasks.Task

PerformForcedRecalibration()

Forced recalibration allows recalibration using an external CO2 reference

View Source
public Task PerformForcedRecalibration()
Returns

System.Threading.Tasks.Task

PersistSettings()

Persist settings to EEPROM

View Source
public void PersistSettings()

PerformFactoryReset()

Device factory reset and clear all saved settings

View Source
public void PerformFactoryReset()

GetSerialNumber()

Get Serial Number from the device

View Source
public byte[] GetSerialNumber()
Returns

System.Byte[]: a 48bit (6 byte) serial number as a byte array### IsDataReady() Is there sensor measurement data ready Sensor returns data ~5 seconds in normal operation and ~30 seconds in low power mode

View Source
protected bool IsDataReady()
Returns

System.Boolean: True if ready### StartUpdating(TimeSpan?) Starts updating the sensor on the updateInterval frequency specified The sensor updates every 5 seconds, its recommended to choose an interval of 5s or longer If the update interval is 30 seconds or longer, the sensor will run in low power mode

View Source
public override void StartUpdating(TimeSpan? updateInterval = null)
Parameters
TypeName
System.Nullable<System.TimeSpan>updateInterval

StopUpdating()

Stop updating the sensor The sensor will not respond to commands for 500ms The call will delay the calling thread for 500ms

View Source
public override void StopUpdating()

ReadSensor()

Get Scdx40 C02 Gas Concentration and Update the Concentration property

View Source
protected override Task<(Concentration? Concentration, Temperature? Temperature, RelativeHumidity? Humidity)> ReadSensor()
Returns

System.Threading.Tasks.Task<System.ValueTuple<System.Nullable<Meadow.Units.Concentration>,System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.RelativeHumidity>>>

RaiseChangedAndNotify(IChangeResult<(Concentration? Concentration, Temperature? Temperature, RelativeHumidity? Humidity)>)

Raise change events for subscribers

View Source
protected void RaiseChangedAndNotify(IChangeResult<(Concentration? Concentration, Temperature? Temperature, RelativeHumidity? Humidity)> changeResult)
Parameters
TypeNameDescription
Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Concentration>,System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.RelativeHumidity>>>changeResultThe change result with the current sensor data

Implements

  • System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Concentration>,System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.RelativeHumidity>>>>
  • Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Concentration>,System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.RelativeHumidity>>>
  • Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Concentration>,System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.RelativeHumidity>>>
  • System.IDisposable
  • Meadow.Peripherals.Sensors.ITemperatureSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Temperature>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Temperature>
  • Meadow.Peripherals.Sensors.Atmospheric.IHumiditySensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.RelativeHumidity>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.RelativeHumidity>
  • Meadow.Peripherals.Sensors.Environmental.ICO2ConcentrationSensor
  • 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