Menu Close

Perl Module to Drive multiple PCA9685 ICs

On CPAN I published a new Perl module called RPi::MultiPCA9685 :

https://metacpan.org/dist/RPi-MultiPCA9685

The purpose is to be able to set serveral PCA9685 chips in one go. For the bechele project, this will enable the bechele software to drive multiple boards or chips, so the number of channels is not limited by the software, but by the hardware or by the timing.

The Moduleis in use with Version 2.0 of the bechele softwarethat is capable of driving a big number of servos in a scalable way.

A prequisition is that the I2C address of the PCA9685 chips are consecutive. In case of the basic Boards in the view above, the first address is 40Hex (all address solder bridges A0 to A5 are open -> 0) the second Board is 41Hex (A0 is set -> 1) the third Board is 42 (A1 is set ->2) …. and so on. The address is defined by a binary number as a solder pattern added to 40H. In the sample image, the last board (right side) has an address of 43 for testing purposes (A0 and A1set ->3)

Having five address bridges results in 2 ^6 = 64 possible addresses = max. 64 Boards = 1024 possible Servos.

The number of recording channels is not limited by software but by chip timing and hardware. The hardware limit is a maximum of 64 PCA9685 boards. Another limit is the chip timing for addressing all servos. Timing is depending on the refresh rate of the movements. With 20Hz refresh rate a maximum of approx. 100 Servos can be addressed. If you need to address more servos you need to change the refresh rate, otherwise there is not enough time to set all servos. One servo needs approximately a programming time of 0.55 ms at 100 KHz I2C Bus frequency. However you run earlier into other limits. For example it is rather difficult, not to exceed the maximum cable lengths for the I2C Bus, when using standard (Adafruit) PCA9685 boards. Also preventing the Back EMF of 400 servos moving at the same time from affecting your I2C bus stability may be challenging.

Leave a Reply

Your email address will not be published. Required fields are marked *