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.
To configure the encoder, you must first configure an I2C bus on your board.
Navigate to the Config tab of your robot’s page in the Viam app.
Click on the Components subtab and click Create component.
Select the encoder
type, then select the AMS-AS5048
model.
Enter a 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": {
"board": "<your-board-name>",
"connection_type": "i2c",
"i2c_attributes": {
"i2c_bus": "<your-i2c-bus-name-on-board>",
"i2c_addr": <int>
}
}
}
The following attributes are available for AMS-AS5048
encoders:
Name | Type | Inclusion | Description |
---|---|---|---|
board | string | Required | The name of the board to which your encoder is connected. |
connection_type | string | Required | Use "i2c" . |
i2c_attributes | object | Required | The attributes to configure I2C connection:
|
Test the encoder
Once your encoder is configured and connected, go to the Control tab and click on the encoder’s dropdown panel. 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 Control tab, or if you notice unexpected behavior, check your robot’s Logs tab for errors, and review the configuration.
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!