04-12-2025 08:49 AM
Currently using the NI myRio to hopefully power 16 Servos using the PCA9685 Adafruit 16 Channel Servo Driver. However Im facing difficulties with the construction of the Block Diagram using the I2C blocks - I've scoured rhe internet for resources and have tried taking the Block Diagram, inputting the correct slave address, then sending the bit equivalent of the PWM signal i want to send but it did not work. Not sure if I had done something wrong, any help whatsoever would be much appreciated!
04-12-2025 05:08 PM
I'm not an expert on the PCA9685, but it looks like it uses I²C to allow it to "control" one of up-to-16 servo motors, one at a time (because you need to send separate commands to each motor). It is meant to be used with microprocessors such as an Arduino, and uses libraries for those microprocessors (or so it seemed to me when I tried to look up what that chip did) to handle all the messy details.
Of interest to me was seeing "tutorials" on the Web where they showed motors moving from "0º" to "180º", but the motors certainly didn't rotate half-way around -- I guess they forgot to calibrate the pulse width their Arduino was sending.
Do you have access to the I²C commands this chip expects? Who generates the digital pulses that drive the servo? [Making digital putses of a specified with is quite easy with the myRIO -- maybe you don't need the Adafruit board, but can go directly to the motor, but now I'm really out of my comfort zone ...].
Bob Schor
04-13-2025 08:01 AM - edited 04-13-2025 08:15 AM
Getting the I2C commands is "easy": https://www.nxp.com/docs/en/data-sheet/PCA9685.pdf
Reading and understanding a datasheet like this properly may be an entirely different story, depending on your hardware design experience. And translating it into any software is again another story.
I haven't done I2C on a myRIO, only on a FlexRIO. The principle is the same although I did have to make the I2C protocol too there, as the FlexRIO only had digital IO and not ready made I2C interfaces.
But it in any cases involves using a digital oscilloscope to be able to monitor the I2C lines to see if they do what they should. An oscilloscope with according protocol analyzer would be even nicer, but it's perfectly possible to do with a normal oscilloscope and a bit of manual bit pattern recognition.
And I agree, that using the digital IO on the myRIO directly and writing an according FPGA program to drive them as PWM output would be likely even easier to implement than this. You have only to make sure to actually put properly protected motor drivers on the output, the myRIO digital IO are direct IOs on the integrated FPGA and that chip is not only the heart of the whole device but also quite sensible and unforgiving about any voltage or current surges on its IO.
But that also applies to the PCA9685. This chip only can drive low power LEDs directly (don't try to drive LEDs directly with the RIO pins, they can not sink as much current). For motors you not only need a lot more power but they also produce back EMV which destroys any integrated circuit in a fraction of a second if it is not specifically designed and protected to deal with inductive loads (eg. motors). And the PCA9685 definitely is NOT a motor driver.
04-14-2025 11:42 AM
When reposting questions from reddit, it would only be polite to include a link.