Remarks

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

Code Example

Ina260 ina260;

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

    var bus = Device.CreateI2cBus();
    ina260 = new Ina260(bus);

    Resolver.Log.Info($"-- INA260 Sample App ---");
    Resolver.Log.Info($"Manufacturer: {ina260.ManufacturerID}");
    Resolver.Log.Info($"Die: {ina260.DieID}");
    ina260.Updated += (s, v) =>
    {
        Resolver.Log.Info($"{v.New.Item2}V @ {v.New.Item3}A");
    };

    return Task.CompletedTask;
}

public override Task Run()
{
    ina260.StartUpdating(TimeSpan.FromSeconds(2));
    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Characteristic Locus
Inheritance object ObservableBase<(Power? Power, Voltage? Voltage, Current? Current)> SamplingSensorBase<(Power? Power, Voltage? Voltage, Current? Current)> PollingSensorBase<(Power? Power, Voltage? Voltage, Current? Current)> ByteCommsSensorBase<(Power? Power, Voltage? Voltage, Current? Current)> > Ina260
Implements IObservable<IChangeResult<(Power? Power, Voltage? Voltage, Current? Current)>> ISamplingSensor<(Power? Power, Voltage? Voltage, Current? Current)> ISensor<(Power? Power, Voltage? Voltage, Current? Current)> IDisposable II2cPeripheral
Inherited Members ByteCommsSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.BusComms ByteCommsSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.ReadBuffer ByteCommsSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.WriteBuffer ByteCommsSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.Init(int, int) ByteCommsSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.Dispose(bool) ByteCommsSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.Dispose() PollingSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.StartUpdating(TimeSpan?) PollingSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.StopUpdating() SamplingSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.samplingLock SamplingSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.Updated SamplingSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.SamplingTokenSource SamplingSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.Conditions SamplingSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.IsSampling SamplingSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.UpdateInterval SamplingSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.ReadSensor() SamplingSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.RaiseEventsAndNotify(IChangeResult<(Power? Power, Voltage? Voltage, Current? Current)>) SamplingSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>.Read() ObservableBase<(Power? Power, Voltage? Voltage, Current? Current)>.observers ObservableBase<(Power? Power, Voltage? Voltage, Current? Current)>.NotifyObservers(IChangeResult<(Power? Power, Voltage? Voltage, Current? Current)>) ObservableBase<(Power? Power, Voltage? Voltage, Current? Current)>.Subscribe(IObserver<IChangeResult<(Power? Power, Voltage? Voltage, Current? Current)>>) ObservableBase<(Power? Power, Voltage? Voltage, Current? Current)>.CreateObserver(Action<IChangeResult<(Power? Power, Voltage? Voltage, Current? Current)>>, Predicate<IChangeResult<(Power? Power, Voltage? Voltage, Current? Current)>>) object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString()
Namespace Meadow.Foundation.Sensors.Power
Assembly Ina260.dll

Syntax

public class Ina260 : ByteCommsSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>, IObservable<IChangeResult<(Power? Power, Voltage? Voltage, Current? Current)>>, ISamplingSensor<(Power? Power, Voltage? Voltage, Current? Current)>, ISensor<(Power? Power, Voltage? Voltage, Current? Current)>, IDisposable, II2cPeripheral

Constructors

Ina260(II2cBus, byte)

Create a new INA260 object

Declaration
public Ina260(II2cBus i2cBus, byte address = 64)

Parameters

Type Name Description
II2cBus i2cBus

The I2C bus

byte address

The I2C address

Remarks

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

Code Example

Ina260 ina260;

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

    var bus = Device.CreateI2cBus();
    ina260 = new Ina260(bus);

    Resolver.Log.Info($"-- INA260 Sample App ---");
    Resolver.Log.Info($"Manufacturer: {ina260.ManufacturerID}");
    Resolver.Log.Info($"Die: {ina260.DieID}");
    ina260.Updated += (s, v) =>
    {
        Resolver.Log.Info($"{v.New.Item2}V @ {v.New.Item3}A");
    };

    return Task.CompletedTask;
}

public override Task Run()
{
    ina260.StartUpdating(TimeSpan.FromSeconds(2));
    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Properties

Current

The value of the current (in Amps) flowing through the shunt resistor from the last reading

Declaration
public Current? Current { get; }

Property Value

Type Description
Current?

Remarks

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

Code Example

Ina260 ina260;

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

    var bus = Device.CreateI2cBus();
    ina260 = new Ina260(bus);

    Resolver.Log.Info($"-- INA260 Sample App ---");
    Resolver.Log.Info($"Manufacturer: {ina260.ManufacturerID}");
    Resolver.Log.Info($"Die: {ina260.DieID}");
    ina260.Updated += (s, v) =>
    {
        Resolver.Log.Info($"{v.New.Item2}V @ {v.New.Item3}A");
    };

    return Task.CompletedTask;
}

public override Task Run()
{
    ina260.StartUpdating(TimeSpan.FromSeconds(2));
    return Task.CompletedTask;
}

Sample project(s) available on GitHub

DefaultI2cAddress

The default I2C address for the peripheral

Declaration
public byte DefaultI2cAddress { get; }

Property Value

Type Description
byte

Remarks

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

Code Example

Ina260 ina260;

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

    var bus = Device.CreateI2cBus();
    ina260 = new Ina260(bus);

    Resolver.Log.Info($"-- INA260 Sample App ---");
    Resolver.Log.Info($"Manufacturer: {ina260.ManufacturerID}");
    Resolver.Log.Info($"Die: {ina260.DieID}");
    ina260.Updated += (s, v) =>
    {
        Resolver.Log.Info($"{v.New.Item2}V @ {v.New.Item3}A");
    };

    return Task.CompletedTask;
}

public override Task Run()
{
    ina260.StartUpdating(TimeSpan.FromSeconds(2));
    return Task.CompletedTask;
}

Sample project(s) available on GitHub

DieID

Reads the unique die identification number

Declaration
public int DieID { get; }

Property Value

Type Description
int

Remarks

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

Code Example

Ina260 ina260;

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

    var bus = Device.CreateI2cBus();
    ina260 = new Ina260(bus);

    Resolver.Log.Info($"-- INA260 Sample App ---");
    Resolver.Log.Info($"Manufacturer: {ina260.ManufacturerID}");
    Resolver.Log.Info($"Die: {ina260.DieID}");
    ina260.Updated += (s, v) =>
    {
        Resolver.Log.Info($"{v.New.Item2}V @ {v.New.Item3}A");
    };

    return Task.CompletedTask;
}

public override Task Run()
{
    ina260.StartUpdating(TimeSpan.FromSeconds(2));
    return Task.CompletedTask;
}

Sample project(s) available on GitHub

ManufacturerID

Reads the unique manufacturer identification number

Declaration
public int ManufacturerID { get; }

Property Value

Type Description
int

Remarks

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

Code Example

Ina260 ina260;

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

    var bus = Device.CreateI2cBus();
    ina260 = new Ina260(bus);

    Resolver.Log.Info($"-- INA260 Sample App ---");
    Resolver.Log.Info($"Manufacturer: {ina260.ManufacturerID}");
    Resolver.Log.Info($"Die: {ina260.DieID}");
    ina260.Updated += (s, v) =>
    {
        Resolver.Log.Info($"{v.New.Item2}V @ {v.New.Item3}A");
    };

    return Task.CompletedTask;
}

public override Task Run()
{
    ina260.StartUpdating(TimeSpan.FromSeconds(2));
    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Power

The power from the last reading..

Declaration
public Power? Power { get; }

Property Value

Type Description
Power?

Remarks

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

Code Example

Ina260 ina260;

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

    var bus = Device.CreateI2cBus();
    ina260 = new Ina260(bus);

    Resolver.Log.Info($"-- INA260 Sample App ---");
    Resolver.Log.Info($"Manufacturer: {ina260.ManufacturerID}");
    Resolver.Log.Info($"Die: {ina260.DieID}");
    ina260.Updated += (s, v) =>
    {
        Resolver.Log.Info($"{v.New.Item2}V @ {v.New.Item3}A");
    };

    return Task.CompletedTask;
}

public override Task Run()
{
    ina260.StartUpdating(TimeSpan.FromSeconds(2));
    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Voltage

The voltage from the last reading..

Declaration
public Voltage? Voltage { get; }

Property Value

Type Description
Voltage?

Remarks

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

Code Example

Ina260 ina260;

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

    var bus = Device.CreateI2cBus();
    ina260 = new Ina260(bus);

    Resolver.Log.Info($"-- INA260 Sample App ---");
    Resolver.Log.Info($"Manufacturer: {ina260.ManufacturerID}");
    Resolver.Log.Info($"Die: {ina260.DieID}");
    ina260.Updated += (s, v) =>
    {
        Resolver.Log.Info($"{v.New.Item2}V @ {v.New.Item3}A");
    };

    return Task.CompletedTask;
}

public override Task Run()
{
    ina260.StartUpdating(TimeSpan.FromSeconds(2));
    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Methods

RaiseEventsAndNotify(IChangeResult<(Power? Power, Voltage? Voltage, Current? Current)>)

Raise events for subscribers and notify of value changes

Declaration
protected override void RaiseEventsAndNotify(IChangeResult<(Power? Power, Voltage? Voltage, Current? Current)> changeResult)

Parameters

Type Name Description
IChangeResult<(Power? Power, Voltage? Voltage, Current? Current)> changeResult

The updated sensor data

Overrides

Remarks

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

Code Example

Ina260 ina260;

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

    var bus = Device.CreateI2cBus();
    ina260 = new Ina260(bus);

    Resolver.Log.Info($"-- INA260 Sample App ---");
    Resolver.Log.Info($"Manufacturer: {ina260.ManufacturerID}");
    Resolver.Log.Info($"Die: {ina260.DieID}");
    ina260.Updated += (s, v) =>
    {
        Resolver.Log.Info($"{v.New.Item2}V @ {v.New.Item3}A");
    };

    return Task.CompletedTask;
}

public override Task Run()
{
    ina260.StartUpdating(TimeSpan.FromSeconds(2));
    return Task.CompletedTask;
}

Sample project(s) available on GitHub

ReadSensor()

Reads data from the sensor

Declaration
protected override Task<(Power? Power, Voltage? Voltage, Current? Current)> ReadSensor()

Returns

Type Description
Task<(Power? Power, Voltage? Voltage, Current? Current)>

The latest sensor reading

Overrides

Remarks

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

Code Example

Ina260 ina260;

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

    var bus = Device.CreateI2cBus();
    ina260 = new Ina260(bus);

    Resolver.Log.Info($"-- INA260 Sample App ---");
    Resolver.Log.Info($"Manufacturer: {ina260.ManufacturerID}");
    Resolver.Log.Info($"Die: {ina260.DieID}");
    ina260.Updated += (s, v) =>
    {
        Resolver.Log.Info($"{v.New.Item2}V @ {v.New.Item3}A");
    };

    return Task.CompletedTask;
}

public override Task Run()
{
    ina260.StartUpdating(TimeSpan.FromSeconds(2));
    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Events

CurrentUpdated

Raised when the current value changes

Declaration
public event EventHandler<IChangeResult<Current>> CurrentUpdated

Event Type

Type Description
EventHandler<IChangeResult<Current>>

Remarks

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

Code Example

Ina260 ina260;

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

    var bus = Device.CreateI2cBus();
    ina260 = new Ina260(bus);

    Resolver.Log.Info($"-- INA260 Sample App ---");
    Resolver.Log.Info($"Manufacturer: {ina260.ManufacturerID}");
    Resolver.Log.Info($"Die: {ina260.DieID}");
    ina260.Updated += (s, v) =>
    {
        Resolver.Log.Info($"{v.New.Item2}V @ {v.New.Item3}A");
    };

    return Task.CompletedTask;
}

public override Task Run()
{
    ina260.StartUpdating(TimeSpan.FromSeconds(2));
    return Task.CompletedTask;
}

Sample project(s) available on GitHub

PowerUpdated

Raised when the power value changes

Declaration
public event EventHandler<IChangeResult<Power>> PowerUpdated

Event Type

Type Description
EventHandler<IChangeResult<Power>>

Remarks

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

Code Example

Ina260 ina260;

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

    var bus = Device.CreateI2cBus();
    ina260 = new Ina260(bus);

    Resolver.Log.Info($"-- INA260 Sample App ---");
    Resolver.Log.Info($"Manufacturer: {ina260.ManufacturerID}");
    Resolver.Log.Info($"Die: {ina260.DieID}");
    ina260.Updated += (s, v) =>
    {
        Resolver.Log.Info($"{v.New.Item2}V @ {v.New.Item3}A");
    };

    return Task.CompletedTask;
}

public override Task Run()
{
    ina260.StartUpdating(TimeSpan.FromSeconds(2));
    return Task.CompletedTask;
}

Sample project(s) available on GitHub

VoltageUpdated

Raised when the voltage value changes

Declaration
public event EventHandler<IChangeResult<Voltage>> VoltageUpdated

Event Type

Type Description
EventHandler<IChangeResult<Voltage>>

Remarks

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

Code Example

Ina260 ina260;

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

    var bus = Device.CreateI2cBus();
    ina260 = new Ina260(bus);

    Resolver.Log.Info($"-- INA260 Sample App ---");
    Resolver.Log.Info($"Manufacturer: {ina260.ManufacturerID}");
    Resolver.Log.Info($"Die: {ina260.DieID}");
    ina260.Updated += (s, v) =>
    {
        Resolver.Log.Info($"{v.New.Item2}V @ {v.New.Item3}A");
    };

    return Task.CompletedTask;
}

public override Task Run()
{
    ina260.StartUpdating(TimeSpan.FromSeconds(2));
    return Task.CompletedTask;
}

Sample project(s) available on GitHub