Configure an INA226 Power Sensor

Configure an INA226 power sensor to integrate a Texas Instruments INA226 into your machine:

Navigate to the Config tab of your machine’s page in the Viam app. Click on the Components subtab and click Create component in the lower-left corner. Select the type power_sensor, then select the ina226 model. Name your sensor, and click Create.

ina226 power sensor configuration panel in the Viam app.

Copy and paste the following attribute template into your power sensor’s Attributes box. Then remove and fill in the attributes as applicable to your power sensor, according to the table below.

{
  "i2c_bus": <int>,
  "i2c_addr": <int>,
  "max_current_amps": <float>,
  "shunt_resistance": <float>
}
{
  "i2c_bus": 1
}
{
  "components": [
    {
      "name": "ina2",
      "model": "ina226",
      "type": "power_sensor",
      "namespace": "rdk",
      "attributes": {
        "i2c_bus": <int>,
        "i2c-addr": <int>,
        "max_current_amps": <float>,
        "shunt_resistance": <float>
      },
      "depends_on": []
    }
  ]
}

The following attributes are available for INA226 sensors:

AttributeTypeInclusionDescription
i2c_busintegerRequiredThe index of the I2C bus that the sensor is connected to.
i2c_addrintegerOptionalDefault: 0x40. The sensor’s unique I2C address.
max_current_ampsnumberOptionalDefault: 20A. The maximum current that the sensor can measure in amperes (A).
shunt_resistancenumberOptionalDefault: 0.1Ω. The shunt resistance value of the sensor in Ohms (Ω).

Test the power sensor

After you configure your power sensor, navigate to the Control tab and select the dropdown panel dedicated to your power sensor. The panel contains readings for your voltage, current, and power.

An instance of the power sensor component in the control tab with voltage, current, and power readings



Have questions, or want to meet other people working on robots? Join our Community Discord.

If you notice any issues with the documentation, feel free to file an issue or edit this file.