Skip to main content

Class Ina219

Represents a INA219 Precision Digital Current and Power Monitor

Assembly: Ina2xx.dll
View Source
Declaration
public class Ina219 : Ina2xx, IObservable<IChangeResult<(Current? Current, Voltage? Voltage, Power? Power)>>, ISamplingSensor<(Current? Current, Voltage? Voltage, Power? Power)>, ISensor<(Current? Current, Voltage? Voltage, Power? Power)>, IDisposable, ICurrentSensor, ISamplingSensor<Current>, ISensor<Current>, IVoltageSensor, ISamplingSensor<Voltage>, ISensor<Voltage>, IPowerSensor, ISamplingSensor<Power>, ISensor<Power>, ISensor, ISamplingSensor, II2cPeripheral

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

Implements:

Expand

System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Current>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Power>>>>, Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Current>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Power>>>, Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Current>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Power>>>, System.IDisposable, Meadow.Peripherals.Sensors.ICurrentSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Current>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Current>, Meadow.Peripherals.Sensors.IVoltageSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Voltage>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Voltage>, Meadow.Peripherals.Sensors.IPowerSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Power>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Power>, Meadow.Peripherals.Sensors.ISensor, Meadow.Peripherals.Sensors.ISamplingSensor, Meadow.Hardware.II2cPeripheral

Methods

Configure()

Sets the sensor Configuration to default values. Each implementation should provide overloads for specific available options.

View Source
Declaration
public override void Configure()

Configure(BusVoltageRange, ADCModes, ShuntVoltageRange, ADCModes, Mode)

Sets Configuration of sensor

View Source
Declaration
public void Configure(Ina219.BusVoltageRange busVoltageRange = BusVoltageRange.Range_32V, Ina219.ADCModes busADCMode = ADCModes.ADCMode_12bit_532us, Ina219.ShuntVoltageRange shuntVoltageRange = ShuntVoltageRange.Range_320mV, Ina219.ADCModes shuntADCMode = ADCModes.ADCMode_12bit_532us, Ina219.Mode mode = Mode.ContinuousAll)
Parameters
TypeNameDescription
Meadow.Foundation.Sensors.Power.Ina219.BusVoltageRange to use for Bus Voltage measurement
Meadow.Foundation.Sensors.Power.Ina219.ADCModesbusADCModeADC resolution/averaging for Bus Voltage
Meadow.Foundation.Sensors.Power.Ina219.ShuntVoltageRange to use for Shunt Voltage measurement
Meadow.Foundation.Sensors.Power.Ina219.ADCModesshuntADCModeADC resolution/averaging for Shunt Voltage
Meadow.Foundation.Sensors.Power.Ina219.Modemodeselection of values and trigger mode

Configure(BusVoltageRange, Current, ADCModes, Mode)

Sets Configuration of sensor, using best shunt voltage range possible based on the max expected current.

View Source
Declaration
public void Configure(Ina219.BusVoltageRange busVoltageRange, Current maxExpectedCurrent, Ina219.ADCModes adcMode = ADCModes.ADCMode_12bit_532us, Ina219.Mode mode = Mode.ContinuousAll)
Parameters
TypeNameDescription
Meadow.Foundation.Sensors.Power.Ina219.BusVoltageRangebusVoltageRangevoltage measurement range
Meadow.Units.CurrentmaxExpectedCurrentMaximum expected current for the application.
Meadow.Foundation.Sensors.Power.Ina219.ADCModesadcModeADC resolution/averaging setting common to both ADCs
Meadow.Foundation.Sensors.Power.Ina219.Modemodeselection of values and trigger mode

ReadCurrent()

Read the Current measurement from the power monitor IC.

View Source
Declaration
public override Current ReadCurrent()
Returns

Meadow.Units.Current

ReadBusVoltage()

Read the Voltage measurement from the power monitor IC.

View Source
Declaration
public override Voltage ReadBusVoltage()
Returns

Meadow.Units.Voltage

ReadShuntVoltage()

Read the Voltage across the Shunt (sense) resistor from the power monitor IC.

View Source
Declaration
public override Voltage ReadShuntVoltage()
Returns

Meadow.Units.Voltage

ReadPower()

Read the Power measurement from the power monitor IC.

View Source
Declaration
public override Power ReadPower()
Returns

Meadow.Units.Power

Implements

  • System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Current>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Power>>>>
  • Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Current>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Power>>>
  • Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Current>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Power>>>
  • System.IDisposable
  • Meadow.Peripherals.Sensors.ICurrentSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Current>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Current>
  • Meadow.Peripherals.Sensors.IVoltageSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Voltage>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Voltage>
  • Meadow.Peripherals.Sensors.IPowerSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Power>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Power>
  • Meadow.Peripherals.Sensors.ISensor
  • Meadow.Peripherals.Sensors.ISamplingSensor
  • Meadow.Hardware.II2cPeripheral