This ams module implements an ams as5048 encoder, an absolute encoder that uses an I2C or SPI interface to connect, using the rdk:component:encoder
API.
Important
Any motor using the AMS-AS5048
encoder must have its ticks_per_rotation
attribute configured as 1
because this encoder provides angular measurements directly.
Note
Before configuring your encoder, you must create a machine.
Navigate to the CONFIGURE tab of your machine in the Viam app. Add encoder / ams:as5048 to your machine.
On the new component panel, copy and paste the following attribute template into your encoder's attributes field:
{
"connection_type": "i2c",
"i2c_attributes": {
"i2c_bus": "<your-i2c-bus-index-on-board>",
"i2c_addr": <int>
}
}
The following attributes are available for viam:ams:as5048
encoders:
Attribute | Type | Required? | Description |
---|---|---|---|
connection_type |
string | Required | Use "i2c" . |
i2c_attributes |
object | Required | The attributes to configure the I2C connection:
|
{
"name": "<your-ams-as5048-encoder-name>",
"model": "viam:ams:as5048",
"type": "encoder",
"namespace": "rdk",
"attributes": {
"connection_type": "i2c",
"i2c_attributes": {
"i2c_bus": "1",
"i2c_addr": 64
}
},
"depends_on": []
}
- To test your encoder, expand the TEST section of its configuration pane or go to the CONTROL tab.
- To write code against your encoder, use one of the available SDKs.
- To view examples using a encoder component, explore these tutorials.