Remarks

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

The TEMT6000 is an I2C ambient light sensor.

Code Example

Veml7700 sensor;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    sensor = new Veml7700(Device.CreateI2cBus());
    sensor.DataSource = Veml7700.SensorTypes.Ambient;

    sensor.RangeExceededHigh += (s, a) => Resolver.Log.Info("Too bright to measure");
    sensor.RangeExceededLow += (s, a) => Resolver.Log.Info("Too dim to measure");

    // classical .NET events can also be used:
    sensor.Updated += (sender, result) => Resolver.Log.Info($"Illuminance: {result.New.Lux:n3}Lux");

    return Task.CompletedTask;
}

public override async Task Run()
{
    var conditions = await sensor.Read();

    Resolver.Log.Info("Initial Readings:");
    Resolver.Log.Info($"  Illuminance: {conditions.Lux:n3}Lux");

    sensor.StartUpdating(TimeSpan.FromSeconds(1));
}

Sample project(s) available on GitHub

Wiring Example

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

Veml7700 Meadow Pin
3V3 3V3
GND GND
SCK D08
SDA D07

It should look like the following diagram:

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

Syntax

public class Veml7700 : ByteCommsSensorBase<Illuminance>, ISamplingSensor<Illuminance>, ISamplingSensor<Illuminance>, IDisposable, ILightSensor, IDisposable

Constructors

Veml7700(II2cBus)

Create a new Veml7700 object with the default address

Declaration
public Veml7700(II2cBus i2cBus)

Parameters

Type Name Description
II2cBus i2cBus

The I2C bus

Properties

DataSource

Sensor types Data source

Declaration
public Veml7700.SensorTypes DataSource { get; set; }

Property Value

Type Description
Veml7700.SensorTypes

Illuminance

Luminosity reading from the TSL2561 sensor.

Declaration
public Illuminance? Illuminance { get; protected set; }

Property Value

Type Description
System.Nullable<Illuminance>

Methods

RaiseEventsAndNotify(IChangeResult<Illuminance>)

Raise events for subcribers and notify of value changes

Declaration
protected override void RaiseEventsAndNotify(IChangeResult<Illuminance> changeResult)

Parameters

Type Name Description
IChangeResult<Illuminance> changeResult

The updated sensor data

ReadSensor()

Reads data from the sensor

Declaration
protected override Task<Illuminance> ReadSensor()

Returns

Type Description
Task<Illuminance>

The latest sensor reading

Overrides

Meadow.Foundation.SamplingSensorBase<Illuminance>.ReadSensor()

Events

LuminosityUpdated

Raised when the luminosity value changes

Declaration
public event EventHandler<IChangeResult<Illuminance>> LuminosityUpdated

Event Type

Type Description
EventHandler<IChangeResult<Illuminance>>

RangeExceededHigh

Raised when the high range is exceeded

Declaration
public event EventHandler RangeExceededHigh

Event Type

Type Description
EventHandler

RangeExceededLow

Raised when the low range is exceeded

Declaration
public event EventHandler RangeExceededLow

Event Type

Type Description
EventHandler