Skip to content

viam-modules/ams

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Configure your as5048 encoder

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>
  }
}

Attributes

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:
  • i2c_bus: The index of the I2C bus on the board wired to this encoder.
    Example: "1"
  • i2c_addr: The address of the bus.
    Example: 64

Example configuration

viam:ams:as5048

  {
      "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": []
  }

Next Steps

  • 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.