#pca9685 do I need to mark servos depends on?

1 messages · Page 1 of 1 (latest)

carmine oracle
#

Currently trying to follow this instructable https://www.instructables.com/Hack-Skellington-AI-powered-Halloween-Skeleton/ I am using a Rasberry PI 4b instead of of a radxa. I am on Step 3 where I am testing my first servo. At first I was getting errors but added the IC2 bus and they have gone away but when I go to control nothing moves.

I add it using the periph-servo-pca9685 module but when I try to run it nothing happens. even though Viam shows everything working.

I thought maybe I need to set the "depends on" dropwdown to the viam-labs_perifph-servo-pca9685 but that results in errors.

Instructables

Hack Skellington - AI-powered Halloween Skeleton: Tired of halloween skeletons that repeat the same 3 phrases over and over again? Using a few inexpensive hardware components plus modern technology, you can bring your skeleton to life in a truly customizable way. It might be the star of your neighb…

young novaBOT
#

Hi @carmine oracle, I'm an AI assistant for Viam. I'll analyze available sources and get back to you shortly.

#

Answer

You do not need to set the "depends on" field for the periph-servo-pca9685 servo component in Viam. The periph-servo-pca9685 module is a standalone servo model that communicates directly with the PCA9685 over I2C, and it does not require a board component or any other dependency to be specified in the "depends on" dropdown (1) (2) .

Instead, the servo’s configuration should specify the correct I2C bus, channel, and address. Here’s an example configuration for the servo component:

{
  "i2c_bus": "0",
  "i2c_addr": "0x40",
  "channel": 0
}

You only need to adjust the values for your hardware setup (e.g., bus, address, and channel) . The module itself will handle the communication with the PCA9685. No "depends on" value is required or recommended for this module, and setting one can cause errors .

If the servo is not moving but Viam shows everything as working, double-check:

  • Power supply to the PCA9685 and servos.
  • I2C bus and address values (use i2cdetect to verify the address) .
  • That you have specified the correct channel (0–15) .
  • That the frequency, min/max angle, and width values are appropriate for your servo model (1) .

If you continue to have issues, check the logs for errors and verify your wiring and configuration. For more details, see the periph-servo-pca9685 documentation and the Viam registry page for the module (1) (2) .

#

Feel free to tag @young nova with additional questions. I also appreciate feedback, it helps me improve.

carmine oracle
#

ok I added the address but still no control

#

@young nova does the order of the config json matter do I need to have bus at the top of the config values?

young novaBOT
#

Thanks for the follow-up, @carmine oracle. I'll get back to you soon.

#

Answer

No, the order of keys in your JSON configuration does not matter. JSON objects are unordered collections, so as long as all required fields are present and correctly named, Viam will parse the configuration properly regardless of the order in which you list the keys. Just make sure your syntax is correct and all necessary attributes are included for your component.