This module implements the Viam servo API in a periph-servo-pca9685 model.
With this model, you can control servos connected to PCA9685 channels using the periph.io library.
Navigate to the CONFIGURE tab of your machine's page.
Click the + button, select Component or service, then select the servo / periph-servo-pca9685 model provided by the module.
Click Add module, enter a name for your servo, and click Create.
On the new component panel, copy and paste the following attribute template into your servo's Attributes box:
{
"i2c_bus": <string>,
"i2c_addr": <string>,
"channel": <int>,
"frequency_hz": <int>,
"min_angle_deg": <int>,
"max_angle_deg": <int>,
"starting_position_deg": <int>,
"min_width_us": <int>,
"max_width_us": <int>
}The following attributes are available for periph-servo-pca9685 servos:
| Name | Type | Inclusion | Description |
|---|---|---|---|
i2c_bus |
string | Optional | The name or number of the I2C bus to which the PCA9685 is connected. Default: "0". |
i2c_addr |
string | Optional | The I2C address of the PCA9685. Can be formatted as hex (0x) or base 10. See this guide for how to detect i2c devices. i2cdetect displays the hex formatted value. Default: "0x40". |
channel |
int | Optional | The channel (0-15) to which the servo is connected. Default: 0. |
frequency_hz |
int | Optional | The frequency in Hz of the servo. See the servo datasheet. Default: 50. |
min_angle_deg |
int | Optional | The minimum angle in degrees to which the servo will be allowed to move. Default: 0. |
max_angle_deg |
int | Optional | The maximum angle in degrees to which the servo will be allowed to move. Default: 180. |
starting_position_deg |
int | Optional | When the servo is initiated, it will move to this position (in degrees). Default: 0. |
min_width_us |
int | Optional | The minimum duty cycle width in microseconds. See the servo datasheet. Default: 500. |
max_width_us |
int | Optional | The maximum duty cycle width in microseconds. See the servo datasheet. Default: 2500. |
{
"i2c_bus": "0",
"channel": 15
}To release a new version of this module, this repo uses the Viam build-action to build the module in Viam's cloud infrastructure and deploy the new version based on a tagged release.
To kick off a deployment:
- Tag the release commit with the new module version and push it to the repo
- Create a release based on that tag
Within a couple of minutes, the new module version will be published to the Viam registry.
If there is an issue with the action and a manual release is required:
-
Authenticate the Viam CLI:
viam auth login -
Start a remote build for the new module version
viam module build start --version <version>