CircuitPython driver for the TI INA260 current and power sensor * Author(s): Bryan Siepert Implementation Notes ——————– Hardware: * INA260 Breakout Software and Dependencies: * Adafruit CircuitPython firmware for the supported boards: * https://github.com/adafruit/circuitpython/releases * Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice * Adafruit’s Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
- class adafruit_ina260.AveragingCount¶
Number of measurements to average
- static get_averaging_count(avg_count)¶
Retrieve the number of measurements giving value read from register
- class adafruit_ina260.ConversionTime¶
1.1 ms (Default)
- static get_seconds(time_enum)¶
Retrieve the time in seconds giving value read from register
- class adafruit_ina260.INA260(i2c_bus, address=64)¶
Driver for the INA260 power and current sensor.
i2c_bus (I2C) – The I2C bus the INA260 is connected to.
address – The I2C device address for the sensor. Default is
While only one Alert Function can be monitored at the ALERT pin at time, the Conversion Ready can also be enabled to assert the ALERT pin. Reading the Alert Function Flag following an alert allows the user to determine if the Alert Function was the source of the Alert.
When the Alert Latch Enable bit is set to Latch mode, the Alert Function Flag bit clears only when the Mask/Enable Register is read. When the Alert Latch Enable bit is set to Transparent mode, the Alert Function Flag bit is cleared following the next conversion that does not result in an Alert condition.
Configures the latching feature of the ALERT pin and Alert Flag Bits.
- alert_limit = 16¶
The Alert Limit Register contains the value used to compare to the register selected in the Mask/Enable Register to determine if a limit has been exceeded. The format for this register will match the format of the register that is selected for comparison.
Active-high open collector when True, Active-low open collector when false (default).
- averaging_count = 3¶
The window size of the rolling average used in continuous mode
Setting this bit high configures the ALERT pin to be asserted if the bus voltage measurement following a conversion exceeds the value programmed in the Alert Limit Register.
Setting this bit high configures the ALERT pin to be asserted if the bus voltage measurement following a conversion drops below the value programmed in the Alert Limit Register.
Setting this bit high configures the ALERT pin to be asserted when the Conversion Ready Flag, Bit 3, is asserted indicating that the device is ready for the next conversion.
- property current¶
The current (between V+ and V-) in mA
- current_conversion_time = 3¶
The conversion time taken for the current measurement
- mask_enable = 16¶
The Mask/Enable Register selects the function that is enabled to control the ALERT pin as well as how that pin functions. If multiple functions are enabled, the highest significant bit position Alert Function (D15-D11) takes priority and responds to the Alert Limit Register.
This bit is set to 1 if an arithmetic operation resulted in an overflow error.
- mode = 3¶
The mode that the INA260 is operating in. Must be one of
Setting this bit high configures the ALERT pin to be asserted if the current measurement following a conversion exceeds the value programmed in the Alert Limit Register.
- property power¶
The power being delivered to the load in mW
Setting this bit high configures the ALERT pin to be asserted if the Power calculation made following a bus voltage measurement exceeds the value programmed in the Alert Limit Register.
Setting this bit t 1 generates a system reset. Reset all registers to default values.
- revision_id = 4¶
Device revision identification bits
Setting this bit high configures the ALERT pin to be asserted if the current measurement following a conversion drops below the value programmed in the Alert Limit Register.
- property voltage¶
The bus voltage in V
- voltage_conversion_time = 3¶
The conversion time taken for the bus voltage measurement
- class adafruit_ina260.Mode¶
Modes avaible to be set
Default: The sensor will continuously measure the bus voltage and shunt voltage across the shunt resistor to calculate
The sensor will immediately begin measuring and calculating current, bus voltage, and power. Re-set this mode to initiate another measurement
Shutdown the sensor, reducing the quiescent current and turning off current into the device inputs. Set another mode to re-enable