jbienzms / iot-devices

Helper library for interfacing with devices in IoT projects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New PCA9685 issue discovered

mjmeans opened this issue · comments

So I've discovered a problem with PCA9685. When the duty cycle is set to 0, both the on registers and off registers are being set to 0 and both the full on and full off bits are also 0. This is not allowed according to the PCA9685 chip reference which says the ON and OFF count registers should never be programmed with the same value. Further, when the duty cycle is set to 100%, the on register will be set to 0 and the off register cannot be set to 4096, so its set to 4095 (the max value). This means that at 100% the PWM actually ticks off 1/4096th of a cycle. I'm working on a fix for this that involves detecting these two conditions and instead of setting the duty cycle, sets the full on or off bits. But of course that is using my version of this which splits Provider and ControllerProvider. When I've tested it, I'll let you know where and you can get it so you can port the changes into your project.

I wanted to follow up on this. Did you ever get a fix on your end? Can you contribute the changes? Thank you for submitting this issue!

Yes, I did develop a solution that I put into my Adafruit library version of PCA9685 driver. Sorry, I forgot that I had said that I would let you know. You can examine what I did there. I think I left enough comments in my code for anyone to understand it.