Skip to main content

Meadow.Foundation.Sensors.Light.Veml7700

Veml7700
StatusStatus badge: working
Source codeGitHub
Datasheet(s)GitHub
NuGet packageNuGet 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:

Veml7700Meadow Pin
3V33V3
GNDGND
SCKD08
SDAD07

It should look like the following diagram:

API Reference​

Class Veml7700

High Accuracy Ambient Light Sensor

Assembly: Veml7700.dll​
View Source​
Declaration
public class Veml7700 : ByteCommsSensorBase<Illuminance>, IObservable<IChangeResult<Illuminance>>, ILightSensor, ISamplingSensor<Illuminance>, ISensor<Illuminance>, ISensor, ISamplingSensor, II2cPeripheral, IDisposable

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

Implements:
System.IObservable<Meadow.IChangeResult<Meadow.Units.Illuminance>>, Meadow.Peripherals.Sensors.Light.ILightSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Illuminance>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Illuminance>, Meadow.Peripherals.Sensors.ISensor, Meadow.Peripherals.Sensors.ISamplingSensor, Meadow.Hardware.II2cPeripheral, System.IDisposable

Properties​

Illuminance​

Luminosity reading from the Veml7700 sensor

View Source​
Declaration
public Illuminance? Illuminance { get; }

DataSource​

Sensor types Data source

View Source​
Declaration
public Veml7700.SensorTypes DataSource { get; set; }

DefaultI2cAddress​

The default I2C address for the peripheral

View Source​
Declaration
public byte DefaultI2cAddress { get; }

Methods​

ReadSensor()​

Reads data from the sensor

View Source​
Declaration
protected override Task<Illuminance> ReadSensor()
Returns​

System.Threading.Tasks.Task<Meadow.Units.Illuminance>: The latest sensor reading

SetPower(bool)​

Set power mode

View Source​
Declaration
public void SetPower(bool on)
Parameters​
TypeName
System.Booleanon

Events​

RangeExceededHigh​

Raised when the high range is exceeded

View Source​
Declaration
public event EventHandler RangeExceededHigh
Event Type​

System.EventHandler

RangeExceededLow​

Raised when the low range is exceeded

View Source​
Declaration
public event EventHandler RangeExceededLow
Event Type​

System.EventHandler

Implements​

  • System.IObservable<Meadow.IChangeResult<Meadow.Units.Illuminance>>
  • Meadow.Peripherals.Sensors.Light.ILightSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Illuminance>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Illuminance>
  • Meadow.Peripherals.Sensors.ISensor
  • Meadow.Peripherals.Sensors.ISamplingSensor
  • Meadow.Hardware.II2cPeripheral
  • System.IDisposable