Remarks

Ags01Db
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Sensors.Environmental.Ags01Db

The AGS01DB is a MEMS VOC gas sensor that commuincates over I2C.

Supply voltage(V) 3.3~5.5 Supply current(mA) <30 Measuring range(ppm) 0~100 Operating range (°C) 0~50 Operating range (% RH) 0~95 Interface I²C Size:LWH (mm) 23.312.55.8

Code Example

Ags01Db ags10Db;

public override Task Initialize()
{
    Console.WriteLine("Initialize ...");
    ags10Db = new Ags01Db(Device.CreateI2cBus());

    Console.WriteLine($"Version: v{ags10Db.GetVersion()}");

    var consumer = Ags01Db.CreateObserver(
        handler: result =>
        {
            Console.WriteLine($"Concentration New Value {result.New.PartsPerMillion}ppm");
            Console.WriteLine($"Concentration Old Value {result.Old?.PartsPerMillion}ppm");
        },
        filter: null
    );
    ags10Db.Subscribe(consumer);

    ags10Db.ConcentrationUpdated += (object sender, IChangeResult<Meadow.Units.Concentration> e) =>
    {
        Console.WriteLine($"Concentration Updated: {e.New.PartsPerMillion:N2}ppm");
    };

    return Task.CompletedTask;
}

public override Task Run()
{
    ags10Db.StartUpdating(TimeSpan.FromSeconds(1));

    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Wiring Example

To wire a Ags01Db to your Meadow board, connect the following:

Ags01Db Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

Characteristic Locus
Inheritance System.Object ObservableBase<Units.Concentration> SensorBase<Units.Concentration> SamplingSensorBase<Units.Concentration> ByteCommsSensorBase<Units.Concentration> > Ags01Db
Implements IDisposable
Inherited Members ByteCommsSensorBase<Units.Concentration>.Peripheral ByteCommsSensorBase<Units.Concentration>.ReadBuffer ByteCommsSensorBase<Units.Concentration>.WriteBuffer ByteCommsSensorBase<Units.Concentration>.Init(Int32, Int32) ByteCommsSensorBase<Units.Concentration>.Dispose(Boolean) ByteCommsSensorBase<Units.Concentration>.Dispose() SamplingSensorBase<Units.Concentration>.StartUpdating(Nullable<TimeSpan>) SamplingSensorBase<Units.Concentration>.StopUpdating() SensorBase<Units.Concentration>.Updated SensorBase<Units.Concentration>.samplingLock SensorBase<Units.Concentration>.SamplingTokenSource SensorBase<Units.Concentration>.Conditions SensorBase<Units.Concentration>.IsSampling SensorBase<Units.Concentration>.UpdateInterval SensorBase<Units.Concentration>.RaiseEventsAndNotify(IChangeResult<>) SensorBase<Units.Concentration>.Read() ObservableBase<Units.Concentration>.observers ObservableBase<Units.Concentration>.NotifyObservers(IChangeResult<>) Meadow.Foundation.ObservableBase<Units.Concentration>.Subscribe(IObserver<>) Meadow.Foundation.ObservableBase<Units.Concentration>.CreateObserver(Action<>, System.Nullable<Predicate<IChangeResult<UNIT>>>)
Namespace Meadow.Foundation.Sensors.Environmental
Assembly Ags01Db.dll

Syntax

public class Ags01Db : ByteCommsSensorBase<Units.Concentration>, IDisposable

Constructors

Ags01Db(II2cBus, Byte)

Declaration
public Ags01Db(II2cBus i2cBus, byte address = null)

Parameters

Type Name Description
II2cBus i2cBus
System.Byte address

Properties

Concentration

Declaration
public Concentration? Concentration { get; }

Property Value

Type Description
System.Nullable<Concentration>

Methods

GetVersion()

Get ASG01DB Version

Declaration
public byte GetVersion()

Returns

Type Description
System.Byte

Version

RaiseChangedAndNotify(IChangeResult<Units.Concentration>)

Declaration
protected void RaiseChangedAndNotify(IChangeResult<Units.Concentration> changeResult)

Parameters

Type Name Description
IChangeResult<Units.Concentration> changeResult

ReadSensor()

Get ASG01DB VOC Gas Concentration and Update the Concentration property.

Declaration
protected override Task<Units.Concentration> ReadSensor()

Returns

Type Description
Task<Units.Concentration>

Overrides

Meadow.Foundation.SensorBase<Units.Concentration>.ReadSensor()

Events

ConcentrationUpdated

Declaration
public event EventHandler<IChangeResult<Units.Concentration>> ConcentrationUpdated

Event Type

Type Description
EventHandler<IChangeResult<Units.Concentration>>