The reasoning behind rewriting this library had much to do with just the fact that many of the existing ones were poorly coded and did not handle the entire functionality of the chip.
For example, with the popular Adafruit library (available here), you absolutely must set the PWM frequency in order for the library to even work - if you do not do that then it never sets the auto-increment value correctly for the other functions to work. It also sets the prescaler value incorrectly, and when it sets it it uses extra commands that are unnecessary and makes for a delay of 3ms instead of the 0.5ms clearly stated in the datasheet (for the oscillator to get up and running). Additionally, it does not do load distributing across the entire phase width, thus causing a large sink across all channels at the start of the phase cycle. It also forces you to use Wire1 for the Due/Zero/etc. instead of allowing you to specify which i2c line you wish to use.
Other libraries seem to also have these as well as various other issues, so I took it upon myself to fix things up and make them a lot happier. The library I have adapted from and modified fixes a lot of those issues while exposing the entire functionality that the chip provides, as well as providing additional assistants (such as Servo control) and other goodies.
Additionally, the library supports the SoftwareI2CLibrary interface for processors like the ATtiny85, which don't have standardized i2c ports. So long as the processor can run at a minimum of 4Mhz to run the minimum required 100kHz baud rate of the module (in standard i2c mode), you can set up those boards to talk to this module.
Feedback is of course welcomed, as is requests for additional functionality, etc.
On a side note, I also have replaced the 10v 1000uF capacitor pre-installed on the board with a 10v 3300uF capacitor, which seems to have helped with the larger 2A servos I've been playing around with.
Please could you add the examples inside a directory named "examples" inside the Github?
This could help, and it's more compliant with the Arduino library structure.
I also suggest to activate the Issues on Github. It could help you to track the issues and to receive feedback by others.
If I use the library for LED dimming setting the value to 0 turns the LED to full bright and off with 256.
Is it possible to have the led turn off with a value of 0 and fully bright with 256?
my PCA9685 came without any capacitor provided,
how bad is it to not use one if i plan to control 4 servos TowerPro MG996R ?
can i do without or should i definitely order and solder a capacitor ?
Hi, How are you?, sorry for asking, But i was wondering, do you know if you can control 3 stepper motors (28byj-48) with the pca9685?,
There Is a picture of How i have it Connected
I have connected the 4 pins of the driver uln2003 (in1,in2,in3,in4) to the pca9685 using 4 pwm pins, and the 4 (v+) of those pwm pins to the (+) of the driver, and ti did the same for the gnd, is thAt correct?
Could you please tell me if it is possible?, and if it is possible, could you please help me with the Code?,
Thank you for all your help, i really appreciate it
Please could you add the examples inside a directory named "examples" inside the Github?
This could help, and it's more compliant with the Arduino library structure.
I also suggest to activate the Issues on Github. It could help you to track the issues and to receive feedback by others.
Giorgio
Hey Giorgio,
Thanks for the feedback! I went ahead and added the example code into the examples folder as you described.
emurr:
If I use the library for LED dimming setting the value to 0 turns the LED to full bright and off with 256.
Is it possible to have the led turn off with a value of 0 and fully bright with 256?
Hmm, I'm not quite certain why you're experiencing this... I will have to run some tests to see what the lines are outputting and ensure they're outputting the right signal when set to PWM values of 0 and max.
psypol:
hello
my PCA9685 came without any capacitor provided,
how bad is it to not use one if i plan to control 4 servos TowerPro MG996R ?
can i do without or should i definitely order and solder a capacitor ?
thanks
The capacitor helps to stabilize the output when it sinks. The capacitor mine came with was a 10v 1000uF capacitor - it wouldn't hurt to solder one on just to reduce the noise in the output lines, but try it and see if it works for what you need.
SugarBombs:
Thanks for the library, it writes quicker than the others out there.
I believe there might be a bug in the source.
When I expand the example to cover all 16 channels, channel 15 does not function. Looking into the source I noticed at line 193:
Hey NachtRaveVL - this is awesome; thanks for sharing
I'm running the SoftI2C example you've provided and I can't seem to get it running on an ATTiny85. I was getting a:
exit status 1
'PORTD' was not declared in this scope
It looked like the SoftI2C master lib was being called too late, so I moved it to the top of the file. Now it seems like the issue is around the definition of (SDA_IN) as per
In file included from /var/folders/gl/nzc8b93x3p3b81_269b11kw80000gn/T/arduino_modified_sketch_307330/pwmtest.ino:3:0:
/Users/alexanderturner/Dropbox/Arduino/libraries/SoftI2CMaster/SoftI2CMaster.h:516:46: error: 'SDA_PIN' was not declared in this scope
[SDADDR] "I" (SDA_DDR), [SDAPIN] "I" (SDA_PIN), [SDAIN] "I" (SDA_IN)