Remarks
Ags01Db | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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()
{
Resolver.Log.Info("Initialize ...");
ags10Db = new Ags01Db(Device.CreateI2cBus());
Resolver.Log.Info($"Version: v{ags10Db.GetVersion()}");
var consumer = Ags01Db.CreateObserver(
handler: result =>
{
Resolver.Log.Info($"Concentration New Value {result.New.PartsPerMillion}ppm");
Resolver.Log.Info($"Concentration Old Value {result.Old?.PartsPerMillion}ppm");
},
filter: null
);
ags10Db.Subscribe(consumer);
ags10Db.ConcentrationUpdated += (object sender, IChangeResult<Meadow.Units.Concentration> e) =>
{
Resolver.Log.Info($"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:
Syntax
public class Ags01Db : ByteCommsSensorBase<Concentration>, IObservable<IChangeResult<Concentration>>, ISamplingSensor<Concentration>, ISensor<Concentration>, IDisposable, II2cPeripheral
Constructors
Ags01Db(II2cBus, byte)
Create a new Ags01Db object
Declaration
public Ags01Db(II2cBus i2cBus, byte address = 17)
Parameters
Type | Name | Description |
---|---|---|
II2cBus | i2cBus | The I2C bus |
byte | address | The I2C address |
Remarks
Ags01Db | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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()
{
Resolver.Log.Info("Initialize ...");
ags10Db = new Ags01Db(Device.CreateI2cBus());
Resolver.Log.Info($"Version: v{ags10Db.GetVersion()}");
var consumer = Ags01Db.CreateObserver(
handler: result =>
{
Resolver.Log.Info($"Concentration New Value {result.New.PartsPerMillion}ppm");
Resolver.Log.Info($"Concentration Old Value {result.Old?.PartsPerMillion}ppm");
},
filter: null
);
ags10Db.Subscribe(consumer);
ags10Db.ConcentrationUpdated += (object sender, IChangeResult<Meadow.Units.Concentration> e) =>
{
Resolver.Log.Info($"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:
Properties
Concentration
The current concentration value
Declaration
public Concentration? Concentration { get; }
Property Value
Type | Description |
---|---|
Concentration? |
Remarks
Ags01Db | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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()
{
Resolver.Log.Info("Initialize ...");
ags10Db = new Ags01Db(Device.CreateI2cBus());
Resolver.Log.Info($"Version: v{ags10Db.GetVersion()}");
var consumer = Ags01Db.CreateObserver(
handler: result =>
{
Resolver.Log.Info($"Concentration New Value {result.New.PartsPerMillion}ppm");
Resolver.Log.Info($"Concentration Old Value {result.Old?.PartsPerMillion}ppm");
},
filter: null
);
ags10Db.Subscribe(consumer);
ags10Db.ConcentrationUpdated += (object sender, IChangeResult<Meadow.Units.Concentration> e) =>
{
Resolver.Log.Info($"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:
DefaultI2cAddress
The default I2C address for the peripheral
Declaration
public byte DefaultI2cAddress { get; }
Property Value
Type | Description |
---|---|
byte |
Remarks
Ags01Db | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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()
{
Resolver.Log.Info("Initialize ...");
ags10Db = new Ags01Db(Device.CreateI2cBus());
Resolver.Log.Info($"Version: v{ags10Db.GetVersion()}");
var consumer = Ags01Db.CreateObserver(
handler: result =>
{
Resolver.Log.Info($"Concentration New Value {result.New.PartsPerMillion}ppm");
Resolver.Log.Info($"Concentration Old Value {result.Old?.PartsPerMillion}ppm");
},
filter: null
);
ags10Db.Subscribe(consumer);
ags10Db.ConcentrationUpdated += (object sender, IChangeResult<Meadow.Units.Concentration> e) =>
{
Resolver.Log.Info($"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:
Methods
GetVersion()
Get ASG01DB Version
Declaration
public byte GetVersion()
Returns
Type | Description |
---|---|
byte | Version |
Remarks
Ags01Db | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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()
{
Resolver.Log.Info("Initialize ...");
ags10Db = new Ags01Db(Device.CreateI2cBus());
Resolver.Log.Info($"Version: v{ags10Db.GetVersion()}");
var consumer = Ags01Db.CreateObserver(
handler: result =>
{
Resolver.Log.Info($"Concentration New Value {result.New.PartsPerMillion}ppm");
Resolver.Log.Info($"Concentration Old Value {result.Old?.PartsPerMillion}ppm");
},
filter: null
);
ags10Db.Subscribe(consumer);
ags10Db.ConcentrationUpdated += (object sender, IChangeResult<Meadow.Units.Concentration> e) =>
{
Resolver.Log.Info($"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:
RaiseChangedAndNotify(IChangeResult<Concentration>)
Raise change events for subscribers
Declaration
protected void RaiseChangedAndNotify(IChangeResult<Concentration> changeResult)
Parameters
Type | Name | Description |
---|---|---|
IChangeResult<Concentration> | changeResult | The change result with the current sensor data |
Remarks
Ags01Db | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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()
{
Resolver.Log.Info("Initialize ...");
ags10Db = new Ags01Db(Device.CreateI2cBus());
Resolver.Log.Info($"Version: v{ags10Db.GetVersion()}");
var consumer = Ags01Db.CreateObserver(
handler: result =>
{
Resolver.Log.Info($"Concentration New Value {result.New.PartsPerMillion}ppm");
Resolver.Log.Info($"Concentration Old Value {result.Old?.PartsPerMillion}ppm");
},
filter: null
);
ags10Db.Subscribe(consumer);
ags10Db.ConcentrationUpdated += (object sender, IChangeResult<Meadow.Units.Concentration> e) =>
{
Resolver.Log.Info($"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:
ReadSensor()
Get ASG01DB VOC Gas Concentration and update the Concentration property
Declaration
protected override Task<Concentration> ReadSensor()
Returns
Type | Description |
---|---|
Task<Concentration> |
Overrides
Remarks
Ags01Db | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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()
{
Resolver.Log.Info("Initialize ...");
ags10Db = new Ags01Db(Device.CreateI2cBus());
Resolver.Log.Info($"Version: v{ags10Db.GetVersion()}");
var consumer = Ags01Db.CreateObserver(
handler: result =>
{
Resolver.Log.Info($"Concentration New Value {result.New.PartsPerMillion}ppm");
Resolver.Log.Info($"Concentration Old Value {result.Old?.PartsPerMillion}ppm");
},
filter: null
);
ags10Db.Subscribe(consumer);
ags10Db.ConcentrationUpdated += (object sender, IChangeResult<Meadow.Units.Concentration> e) =>
{
Resolver.Log.Info($"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:
Events
ConcentrationUpdated
Raised when the concentration changes
Declaration
public event EventHandler<IChangeResult<Concentration>> ConcentrationUpdated
Event Type
Type | Description |
---|---|
EventHandler<IChangeResult<Concentration>> |
Remarks
Ags01Db | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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()
{
Resolver.Log.Info("Initialize ...");
ags10Db = new Ags01Db(Device.CreateI2cBus());
Resolver.Log.Info($"Version: v{ags10Db.GetVersion()}");
var consumer = Ags01Db.CreateObserver(
handler: result =>
{
Resolver.Log.Info($"Concentration New Value {result.New.PartsPerMillion}ppm");
Resolver.Log.Info($"Concentration Old Value {result.Old?.PartsPerMillion}ppm");
},
filter: null
);
ags10Db.Subscribe(consumer);
ags10Db.ConcentrationUpdated += (object sender, IChangeResult<Meadow.Units.Concentration> e) =>
{
Resolver.Log.Info($"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: