Configure an AMS-AS5048 Encoder
The AMS-AS5048
encoder model supports AMS’s AS5048 encoder.
This is an absolute encoder that uses an I2C or SPI interface to connect.
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.
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 encoder
type, then select the AMS-AS5048
model.
Enter a name or use the suggested name for your encoder and click Create.
Edit and fill in the attributes as applicable.
{
"name": "<your-encoder-name>",
"model": "AMS-AS5048",
"type": "encoder",
"namespace": "rdk",
"attributes": {
"connection_type": "i2c",
"i2c_attributes": {
"i2c_bus": "<your-i2c-bus-index-on-board>",
"i2c_addr": <int>
}
}
}
The following attributes are available for AMS-AS5048
encoders:
Name | Type | Required? | Description |
---|---|---|---|
connection_type | string | Required | Use "i2c" . |
i2c_attributes | object | Required | The attributes to configure the I2C connection:
|
Test the encoder
Once your encoder is configured and connected, open the encoders’s TEST panel on the CONFIGURE or CONTROL tabs. The ticks count is displayed. Try moving the encoder (for example, by turning a motor it is attached to) and check whether the count increases as expected.
If the encoder does not appear on the TEST panel, or if you notice unexpected behavior, check your machine’s LOGS tab for errors, and review the configuration.
Next steps
For more 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!