Configure an INA219 Power Sensor
Configure an INA219
power sensor to integrate a Texas Instruments INA219 into your machine.
Physically connect your power sensor to your machine’s computer and power both on. Then, configure the power sensor:
Navigate to the CONFIGURE tab of your machine’s page in the Viam app.
Click the + icon next to your machine part in the left-hand menu and select Component.
Select the power_sensor
type, then select the ina219
model.
Enter a name or use the suggested name for your sensor and click Create.
Edit 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": "ina1",
"model": "ina19",
"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 ina219
sensors:
Attribute | Type | Required? | Description |
---|---|---|---|
i2c_bus | integer | Required | The index of the I2C bus that the sensor is connected to. |
i2c_addr | integer | Optional | The sensor’s unique I2C address. Default: 0x40 |
max_current_amps | float | Optional | Default: 3.2A. The maximum current that the sensor can measure in amperes (A). |
shunt_resistance | float | Optional | Default: 0.1Ω. The shunt resistance value of the sensor in Ohms (Ω). |
Test the power sensor
After you configure your power sensor, open the power sensor’s TEST panel on the CONFIGURE or CONTROL tabs. The panel contains readings for your voltage, current, and power.
Troubleshooting
If your power sensor is not working as expected, follow these steps:
- Check your machine logs on the LOGS tab to check for errors.
- Review this power sensor model’s documentation to ensure you have configured all required attributes.
- Click on the TEST panel on the CONFIGURE or CONTROL tab and test if you can use the power sensor there.
If none of these steps work, reach out to us on the Community Discord and we will be happy to help.
Next steps
For general configuration and development info, see:
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.
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!