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
Number of measurements to average
Retrieve the number of measurements giving value read from register
1.1 ms (Default)
Retrieve the time in seconds giving value read from register
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.
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).
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.
The current (between V+ and V-) in mA
The conversion time taken for the current measurement
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.
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.
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.
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.
The bus voltage in V
The conversion time taken for the bus voltage measurement
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