Class Ina219
Represents a INA219 Precision Digital Current and Power Monitor
Assembly: Ina2xx.dll
View Source
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
public override void Configure()
Configure(BusVoltageRange, ADCModes, ShuntVoltageRange, ADCModes, Mode)
Sets Configuration of sensor
View Source
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
Type | Name | Description |
---|---|---|
Meadow.Foundation.Sensors.Power.Ina219.BusVoltageRange to use for Bus Voltage measurement | ||
Meadow.Foundation.Sensors.Power.Ina219.ADCModes | busADCMode | ADC resolution/averaging for Bus Voltage |
Meadow.Foundation.Sensors.Power.Ina219.ShuntVoltageRange to use for Shunt Voltage measurement | ||
Meadow.Foundation.Sensors.Power.Ina219.ADCModes | shuntADCMode | ADC resolution/averaging for Shunt Voltage |
Meadow.Foundation.Sensors.Power.Ina219.Mode | mode | selection 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
public void Configure(Ina219.BusVoltageRange busVoltageRange, Current maxExpectedCurrent, Ina219.ADCModes adcMode = ADCModes.ADCMode_12bit_532us, Ina219.Mode mode = Mode.ContinuousAll)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Foundation.Sensors.Power.Ina219.BusVoltageRange | busVoltageRange | voltage measurement range |
Meadow.Units.Current | maxExpectedCurrent | Maximum expected current for the application. |
Meadow.Foundation.Sensors.Power.Ina219.ADCModes | adcMode | ADC resolution/averaging setting common to both ADCs |
Meadow.Foundation.Sensors.Power.Ina219.Mode | mode | selection of values and trigger mode |
ReadCurrent()
Read the Current measurement from the power monitor IC.
View Source
public override Current ReadCurrent()
Returns
Meadow.Units.Current
ReadBusVoltage()
Read the Voltage measurement from the power monitor IC.
View Source
public override Voltage ReadBusVoltage()
Returns
Meadow.Units.Voltage
ReadShuntVoltage()
Read the Voltage across the Shunt (sense) resistor from the power monitor IC.
View Source
public override Voltage ReadShuntVoltage()
Returns
Meadow.Units.Voltage
ReadPower()
Read the Power measurement from the power monitor IC.
View Source
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