This module implements the rdk generic API in a coderscafe:generic:ads1115
model.
With this model, you can read the analog values from different channel on the ADS1115 ADC.
Please make sure that I2C communication is enabled on the device to which the ADC is connected.
To use this module, follow these instructions to add a module from the Viam Registry and select the coderscafe:generic:ads1115
module.
Note
Before configuring your generic, you must create a machine.
- Navigate to the Config tab of your robot’s page in the Viam app.
- Click on the Components subtab and click on the
generic
subtab. - Select the
coderscafe:generic:ads1115
model. - Enter a name for your ADC component and click Create.
- On the new component panel, copy and paste the following attribute template into your generic’s Attributes box:
{
"address": "48",
"busnum": 1,
"gain":1
}
- Save and wait for the component to finish setup
Note
For more information, see Configure a Robot.
The following attributes are available for coderscafe:generic:ads1115
component:
Name | Type | Inclusion | Description |
---|---|---|---|
address |
string | Optional | I2C address |
busnum |
integer | Optional | I2C Bus Number |
gain |
float | Optional | Gain Configuration (2/3, 1, 2, 4, 8, 16) |
{
"address": "48",
"busnum": 1,
"gain":1
}
To read the analog values from the 0th channel of the ADC, navigate to the Control tab in Viam and enter the following command in the Do Command tab.
{
"read_channel":
{
"channel":0
}
}