This texas-instruments module implements a Texas Instruments TDA4VM board using the rdk:component:board
API, and a Texas Instruments INA219 power sensor and a Texas Instruments INA226 power sensor using the rdk:component:power_sensor
API.
See Configure your ti board or Configure your ina power sensor for more information on configuring these components with Viam.
Follow the setup guide to prepare your TDA4VM for running viam-server
before configuring a ti
board.
Note
Before configuring your board, you must create a machine.
Navigate to the CONFIGURE tab of your machine in the Viam app. Add board / texas-instruments:ti to your machine.
The following attributes are available for viam:texas-instruments:ti
boards:
Attribute | Type | Required? | Description |
---|---|---|---|
digital_interrupts |
object | Optional | Any digital interrupts's pin number and name. |
For instructions on implementing digital interrupts, see Digital interrupt configuration.
{
"name": "<your-texas-instruments-ti-board-name>",
"model": "viam:texas-instruments:ti",
"type": "board",
"namespace": "rdk",
"attributes": {
"digital_interrupts": [
{
"name": "your-interrupt-1",
"pin": "15"
},
{
"name": "your-interrupt-2",
"pin": "16"
}
]
},
"depends_on": []
}
- To test your board, expand the TEST section of its configuration pane or go to the CONTROL tab.
- To write code against your board, use one of the available SDKs.
- To view examples using a board component, explore these tutorials.
Interrupts are a method of signaling precise state changes. Configuring digital interrupts to monitor GPIO pins on your board is useful when your application needs to know precisely when there is a change in GPIO value between high and low.
- When an interrupt configured on your board processes a change in the state of the GPIO pin it is configured to monitor, it ticks to record the state change.
You can stream these ticks with the board API's
StreamTicks()
, or get the current value of the digital interrupt withValue()
. - Calling
GetGPIO()
on a GPIO pin, which you can do without configuring interrupts, is useful when you want to know a pin's value at specific points in your program, but is less precise and convenient than using an interrupt.
Integrate digital_interrupts
into your machine in the attributes
of your board by adding the following to your board's attributes
configuration:
{
"digital_interrupts": [
{
"name": "<your-digital-interrupt-name>",
"pin": "<your-digital-interrupt-pin-number>"
}
]
}
The following attributes are available for digital_interrupts
:
Name | Type | Required? | Description |
---|---|---|---|
name |
string | Required | Your name for the digital interrupt. |
pin |
string | Required | The pin number of the board's GPIO pin that you wish to configure the digital interrupt for. |
"digital_interrupts": [
{
"name": "your-interrupt-1",
"pin": "15"
},
{
"name": "your-interrupt-2",
"pin": "16"
}
]
Note
Before configuring your power sensor, you must create a machine.
Navigate to the CONFIGURE tab of your machine in the Viam app. To use the ina219 model, add power_sensor / texas-instruments:ina219 to your machine. To use the ina226 model, add power_sensor / texas-instruments:ina226 to your machine
On the new component panel, copy and paste the following attribute template into your power sensor's attributes field:
{
"i2c_bus": <int>,
"i2c-addr": <int>,
"max_current_amps": <float>,
"shunt_resistance": <float>
}
The following attributes are available for viam:texas-instruments:ina219
and viam:texas-instruments:ina226
power 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 (Ω). |
Refer to your power sensor data sheet for specifics.
For ina219 model, refer to the below example configuration. For ina226 model, you can still refer to the below example configuration, but change the "model"
field to "viam:texas-instruments:ina226"
{
"name": "<your-texas-instruments-ina-power-sensor-name>",
"model": "viam:texas-instruments:ina219",
"type": "power_sensor",
"namespace": "rdk",
"attributes": {
"i2c_bus": 1
}
"depends_on": []
}
- To test your power sensor, expand the TEST section of its configuration pane or go to the CONTROL tab.
- To write code against your power sensor, use one of the available SDKs.
- To view examples using a power sensor component, explore these tutorials.