Has anyone used the ADAFRUIT PCA9685?

I’m trying to get an Adafruit PCA9685 working on a Spark Core without much success.

I’ve connected the I2C bus using D0 and D1. I’m including the ADAFRUIT_PCA9685 library but this doesn’t seem to be working. I’ve tried adding 10k pullups to the I2C lines but I’m still seeing the line low for most of the time with the odd high section but not meaningful I2C traffic according to the Saleae analyser I have connected.

I’m using Dallas one wire on D2 and SPI to an OLED display successfully but the I2C access to the PCA chip just doesn’t seem to be working as expected.

Any ideas?

I haven’t but will be giving it a go in a week or so. So very interested in your progress.

I think I need to give another PCA board a try. Maybe a hardware issue, I’m not sure. I’m seeing both SCL and SDA low for most of the time when it should be high :disappointed:

Interestingly just having the Adafruit PCA board connected to my Spark Core made the Sprak unstabble and had several resets during the day. But non at all since removing power from the board.

Have you got another non Particle micro to test and confirm the functionality of your PCA9685?

@PeteStewardson, you may want to try stronger I2C pull-up like 2.2K or 4.7K. If you have the lines pulled up but not connected to the Photon I2C lines AND they are being driven low then the PCA board is flaky IMO. Make sure you pull-up to the same voltage you power the board logic with. How are you powering the board?


OK as an update to this, my Core started to reset constantly so I loaded the example PCA9685 application and even with no PCA board connected this application causes the reset issue. Looks like the PCA9685 library is no good.

Are you using the Adafruit library? Looking for PCA9685 libraries I found another one in Github https://github.com/kasperskaarhoj/PCA9685-Arduino-Library

I’m using the one in the particle build environment list. Will have a look at the linked one as well.

There isn’t much difference in the implementation of the PCA9685-Arduino-Library and the Adafruit PCA9685 library.

That breakout already has 10K pullups, adding more would probably make things worse. Also from what I know of the PCA9685 and I2C, the breakout must be powered with 3.3v. If the breakout is powered with 5v then it will not work with the 3.3v I2C signals from the Photon – a voltage shifter would be needed. This is because the breakout has SCL/SDA pulled up to VDD on the breakout board and the Photon will have problems trying to pull the lines low if they are pulled up to 5v.

I’m trying to get a bare PCA9685 (not the Adafruit breakout) working with a Photon and haven’t quite gotten it. There’s a decent writeup on I2C pullup resistor values at http://dsscircuits.com/articles/effects-of-varying-i2c-pull-up-resistors - keep in mind this is for the Arduino @ 5v and the Photon I2C bus is 3.3v. 10K looks too high. I’m trying values around 1K in my design.

Nope, since I2C is only pulling pins low and not driving high 3.3V & 5V I2C devices can happily coexist.
You are not sinking huge currents via 5V/10k…1k, which will well work on the Photon.

Adding one set of 10k resistors in parallel might actually bring down the total pull-up resistance to 5k which helps the rise time for the signal - but you always need to look at the over all pull-up value too high or too low will not help.

So I had success with cascading 4 of the adafruit boards hooked up to a photon.

However the original post was about using the Adafruit PCA9685 on a Core not a Photon. I didn’t get a chance to try that out.

My CAD file has 4.7K pullups but I have a feeling I ended up using 2.2K after reading the article posted above. In any case it worked and was all good.

Thanks for updating that and thanks for the photos! Sorry, I forgot this posting was originally about the Core. Hopefully it is useful to have information on both here.

Another reliable recommendation said to try 2.2k-3k for 3.3v fast-mode I2C. Let’s look at what I said about voltages again! PCA9685 will work on 3.3v and 5v but if you use 3.3v output on the Photon you can only run 1x PCA, and maybe not even all the pins! PCA9685 is 10mA max. operating current; can output up to 25mA on 16x pins, so 400mA. Max load on the Photon’s 3.3v output is 100mA. Connecting LEDs directly to the PCA output pins would only allow for a few pins this way! FET drivers won’t necessarily pull 25mA (or anything close I think), but the safest bet is to check the FET datasheet.

I still have problems with a bare PCA9685 (part of a FET driver circuit, very much like mrOmatic’s photos). It works with an Arduino. With 2 different Photons I get the same results. The Photon can drive the PCA9685 pins all-on, but any other setting appears as all-off on the attached FET-driven LED-strip. In other words, with the Adafruit library, setPin(0, 4096, false) turns the LED(s) all-on, but PWM values like setPin(0, 4000, false) appear off, for all values 0-4094. I’ve tried double-inverting the API commands and outputs successfully. That is, I’ve sent the PCA_MODE2 command to invert outputs and changed “false” to “true” in setPin commands, to get the exact same results. Other PCA_MODE2 commands seem to work also.

It looks like a logic analyzer is needed.

Hi - I have a PCA9685 library I wrote for Intel Edison.

I also have a PCA9685 connected to a MeArm.

So - if you can be patient, I will see if I can port my library to the Photon - I don’t anticipate too many issues.


So just to comment on power on my working photon and 4 x Adafruit PCA9685.

I have a good AC/DC -> 5V converter/regulator this powers both the photon and the PCA9685 boards. The 3.3 volt I2C is fine talking to the 5 volt powered PCA9685. I’m also driving mosfets. So I’m only using the PWM pins of the Adafruit PCA9685 and ground on my PCB’s. The trick is picking the mosfet correctly you want a fet with a fast rise that will be fully saturated by 2.5 to 3 volts not just switching on at 5 volts. I’m not extensively experienced with fet’s but got lots of advice on this project as I was switching 340 volts DC.

So you want a few watts of separate power supply for this kind of project you not going to be able to power it from the regulator on the photon.

I didn’t want to mince an earlier response, but I may have seen some inconsistent behavior with 5v powered PCA against Photon’s 3.3. I2C signals, so it’s good to know your field results. I don’t think FET selection is an issue in this case for two reasons: 1) the circuit works with an Arduino; 2) with Photon I get the same results whether I power the PCA with 5v or 3.3v. In the case of #2 I’ve modified the I2C pullups to match the PCA voltage, and tried different pullup resistances.

Another thing I need to check is whether OE on the PCA is behaving as expected - I’m not sure it is. If OE isn’t working then I’ll probably try another PCA.

Adafruit PCA library is barely acceptable, so I merged it with the aforementioned alternative. My gripes are that it barely exposes the IC features and its GPLv3 license.


i just got nearly the same issue with my Adafruit PCA9685-Board on a Photon - no I2C Data are sent, but SDA and SCL remain High.

Up to now, i used the same setup with an Arduino (5V), a Adafruit Huzzah (3.3V) and now a Photon; as library i use the work by Thomas Oppenhoff (http://platformio.org/#!/lib/show/117/PCA9685). I drive MOSFETs, so no issue with output current for LED, when i use the 3.3V output from the MCs. Where the arduino and Huzzah worked fine, i don`t get any response with the photon. My Logic analyzer shows High on SDA and SCL.

As i understood ScruffR, high levels are normal and for transmission of data, the lines should be drawn down by the sender. So if this does not happen, it`s no problem of pullup, but of initalizing maybe the i2c-library?

Just to get some more background:

Have you ported the library you linked for Particle devices?
Have you wired the I2C lines of the board to D0/D1 in the Photon?
How does your test-sketch look?

Hi SrcuffR,

thanks for your quick reply.

  • I adopted the library, so it got compiled, but i`ll check, if i made a mistake in the i2c-part. Nevertheless - the call Wire.begin() is rather simple.
  • D0/D1 is connected to SCL and SDA. 3V to Vcc, external 5V from regulator feeds PCA V+ and Photon.
  • My sketch build up on the LifX-Code found elsewhere. First i started with the onboard RBG-LED, which worked fine. Now i added the PCA-Part, without having tested it before.

So, my next step is break down the problem and investigate controlling the PCA9685 in the most simple manor. I´ll keep you updated within the next days.

[quote=“T-I, post:19, topic:15539”]
D0/D1 is connected to SCL and SDA. 3V to Vcc, external 5V from regulator feeds PCA V+ and Photon.
[/quote] Hold it there!!! What do you mean by 3V to Vcc? Can you do a little power wiring diagram or post a picture or two? :smile: