Page 1 of 1

PCA9685 connecting problem

Posted: 10 Jan 2019, 11:26
by Maruu23
Hi,

I am currnetly trying to connect an PCA9685 to an NodeMCU (ESP8266) Board. On the ESP is running ESP Easy Mega from December.

So far I've connected GND between the ESP and PCA9685, 3,3V to VCC and also GPIO4 to SDA and GPIO5 to SCL of the PCA9685. I've left the additional Power-Connections at the PCA9685 free. After that, I've done an I2C Scan in ESPEasy and it found at adress 0x40 the PCA9685 (see image attached). Next I've created a device (don't know if this is neccessary) and choose the address 0x40 for that device (see image attached). Now I tried to create a PWM signal at PWM Pin 0 and called the following URL: http://192.168.178.10/control?cmd=pcapwm,0,2000 but unfortunately it doesen't generate a PWM signal at that PIN. Does anybody know what I am doing wrong?

I also tried to generate a PWM Signal with the ESP8266 itself and called the URL: http://192.168.178.10/control?cmd=PWM,13,400 . This works like a charm and I've successfully checked it with my Oscilloscope. But I need in total 10 different PWM signals, so the PCA9685 seems to me the better solution.

Greetings, Hannes

Re: PCA9685 connecting problem

Posted: 13 Jan 2019, 20:38
by Maruu23
Nobody? I've purchased a second PCA9685, but unfortunatley the same problem with the second one too. Maybe someone will find a mistake in the construction of my circuit (see image attached).

Greetings, Hannes

Re: PCA9685 connecting problem

Posted: 13 Jan 2019, 21:22
by grovkillen
I'm not sure what pin numbers that board will listen to. Probably not 0..16

Re: PCA9685 connecting problem

Posted: 13 Jan 2019, 22:12
by Maruu23
Hi, I tried that already, but 0...16 seems to be the correct ones. I also flashed an older EspEasy Mega Version from August 2018 and made a factory reset. Unfortunately still the same, no PWM at the PCA9685 Pins. :(

Re: PCA9685 connecting problem

Posted: 13 Jan 2019, 22:52
by Maruu23
I just flashed the older Version ESP_Easy_mega-20180804_normal_ESP8266_4096.bin on my NodeMCU Lolin V3 Board. After sending the command, I get the HTTP result (see image attached). But also no PWM at the PCA9685 pins.

Re: PCA9685 connecting problem

Posted: 14 Jan 2019, 00:32
by Domosapiens
I2C Scan in ESPEasy and it found at adress 0x40
Although you found an address ...
Did you ...
Connect a pull-up resistor(1.5k to 10k) on SDA line. Connect a pull-up resistor(1.5k to 10k) on SCL line ?
Although it should not be needed (there should be a pull-up on-board):
SCL - I2C clock pin, connect to your microcontrollers I2C clock line. Can use 3V or 5V logic, and has a weak pullup to VCC
SDA - I2C data pin, connect to your microcontrollers I2C data line. Can use 3V or 5V logic, and has a weak pullup to VCC

Secondary:
OE - Output enable. Can be used to quickly disable all outputs. When this pin is low all pins are enabled. When the pin is high the outputs are disabled. Pulled low by default so it's an optional pin!
Although it should not be needed (there should be a pull-down on-board)
Just to make sure, connect OE to ground.

Re: PCA9685 connecting problem

Posted: 14 Jan 2019, 01:04
by moebius
did you try mode 0x14?

Re: PCA9685 connecting problem

Posted: 15 Jan 2019, 09:19
by Maruu23
Testes both, an what should I say, it was the 0x14 mode. The older ESP Mega image doesn't support setting the mode. The newer ones (I tried December 2018) let you specify the mode while creating a device. So first you have to ad the device, specify the address (0x40) and then change the mode to 0x14. Thank you so much for helping me!

Re: PCA9685 connecting problem

Posted: 15 Jan 2019, 16:56
by Domosapiens
For reference on Oct 22, 2018:
https://github.com/letscontrolit/ESPEasy/issues/1940

(that I don't understand)

What is the meaning of mode 0x10 and mode 0x14 ?

Re: PCA9685 connecting problem

Posted: 16 Jan 2019, 08:03
by Maruu23
Good question. Here is the datasheet: https://cdn-shop.adafruit.com/datasheets/PCA9685.pdf
On page 16 you can find the description of the Mode 2 register. The difference between 0x10 (Binary 00010000) and 0x14 (Binary 00010100) seems to be the second bit (starting at bit 0) and this is:

0 The 16 LEDn outputs are configured with an open-drain structure.
1* The 16 LEDn outputs are configured with a totem pole structure

But maybe I'm wrong ;)

Re: PCA9685 connecting problem

Posted: 16 Jan 2019, 11:11
by Domosapiens
But maybe I'm wrong
I think you are right!
The fourth bit seems INVRT/NOT INVRT: 0x10 (Binary 00010000) and 0x00 (Binary 00000000)

That explains 4 of the 32 (!!) options
0x00 : open-drain
0x04 : totem pole
0x10 : Inverted logic / open-drain
0x14 : Inverted logic / totem pole

From that description of the Mode 2 register, I conclude:
Bit 1: not applicable for GUI
Bit 3: not applicable for GUI
Bit 5-7: not applicable for GUI

Are those other 28 options just a source of user mistakes?
ESP-NOT-so-Easy?
@grovkillen:
Hope this helps when you document this module in RTD.

Re: PCA9685 connecting problem

Posted: 16 Jan 2019, 11:47
by Maruu23
I second that! Maybe it would be the best to reduce the ComboBox to the four entries and make 0x14 as default. Also it would help to explain within the drop down or next to it whats the result of each option.

Re: PCA9685 connecting problem

Posted: 16 Jan 2019, 11:48
by grovkillen
Thanks for digging around! :)

Re: PCA9685 connecting problem

Posted: 21 Jan 2021, 23:10
by Rub87
Hello,

I have a wESP32 with the 27122020 release. when I send a comaand to the PCA the outputs seem to work fine, but the 'state' that is returned alway remains 0. I am using the stock 0x40 adress and mode 0xE (14) (non inverted that seems to be the PCA sources for optocouplers)

when I do for example PCAPWM,0,2000 the response is:
{
"log": "0: PWM 0",
"plugin": 22,
"pin": 0,
"mode": "PWM",
"state": 0
}

should I be worried? At the moment there is no other hardware connected to the wESP32 board. 8k2 pull up resistors are present between 3.3v and both I2C lines.