PCA9685 Component for multiple servos or LED only?

Hello!

I rather new to the ESPHome whorld and came across the PCA9685.
I am currently busy with building a tilt / pan head for a webcam. I want to control the servos with the help of a PCA9685 and an ESP8266 via home assistant / ESPHome.

Looking at Google this seems to be a rather odd idea. Somehome it appears to me that the PCA9685 is rather well used with light but not with servos. Anyone out there using the PCA9685 with servos?

As I haven’t got any hardware at hand I cannot test my ideas. :frowning: From the Youtube videos I found (working educational examples) I gathered some information and these are my ideas so far:

  • YAML on pastebin.com
  • min_power and max_power have to be adjusted to the servo I unterstand from the Youtube videos.
  • output.set_level would be used to set the ‘target angle’
  • output.turn_on/output.turn_off would be used to on/off the frequency
1 Like

The manufacturer says

The PCA9685 is an I²C-bus controlled 16-channel LED controller optimized for Red/Green/Blue/Amber (RGBA) color backlighting applications.

@nickrout : Agreed!

But then the people from Adafruit inspire people to highly ‘abuse’ :wink: the module as an interface for servos…

There are plenty of Videos about Arduino / ESP32 and the PCA9685 on Youtube.

A few examples:

Great vids.

Do they work with the standard esphome servo code?

And why not just use the standard esp pins.

@nickrout :
Have you got any idea how many servos can be attached using ESPHome and the servo code while having a proper working WiFi connection?
I fear that this might become a problem and therefore I’d rather delegate the load of creating PWM to the PCA9685 module.
As the module can take an I2C address in an address range several of those those modules can exist in parallel on the I2C bus. Just in case one feels to have 64+ servos connected… :wink:

The author of the videos uses Arduino IDE to program the ESP. A rather simple C program is used to send commands via I2C to the PCA9685 module.

It is really easy to implement the servo control in C / C++ thanks to the library and additional functions. I could of course add a bit of MQTT code to the example program and integrate it via MQTT in HA. But as I rather want to have it totally in ESPHome / HA… :frowning:

Surely just use the esphome servo code.