PCA9685 connecting problem

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Maruu23
New user
Posts: 7
Joined: 09 Jan 2019, 15:42

PCA9685 connecting problem

#1 Post by Maruu23 » 10 Jan 2019, 11:26

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
Attachments
Normal PWM Command.PNG
Normal PWM Command.PNG (6.52 KiB) Viewed 10046 times
I2C Scan.PNG
I2C Scan.PNG (20.68 KiB) Viewed 10046 times
Hardware.PNG
Hardware.PNG (22.57 KiB) Viewed 10046 times
Devices.PNG
Devices.PNG (35.43 KiB) Viewed 10046 times
Device.PNG
Device.PNG (28.53 KiB) Viewed 10046 times
Command.PNG
Command.PNG (6.97 KiB) Viewed 10046 times

Maruu23
New user
Posts: 7
Joined: 09 Jan 2019, 15:42

Re: PCA9685 connecting problem

#2 Post by Maruu23 » 13 Jan 2019, 20:38

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
Attachments
20190113_204034.jpg
20190113_204034.jpg (1.33 MiB) Viewed 10024 times

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: PCA9685 connecting problem

#3 Post by grovkillen » 13 Jan 2019, 21:22

I'm not sure what pin numbers that board will listen to. Probably not 0..16
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Maruu23
New user
Posts: 7
Joined: 09 Jan 2019, 15:42

Re: PCA9685 connecting problem

#4 Post by Maruu23 » 13 Jan 2019, 22:12

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. :(

Maruu23
New user
Posts: 7
Joined: 09 Jan 2019, 15:42

Re: PCA9685 connecting problem

#5 Post by Maruu23 » 13 Jan 2019, 22:52

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.
Attachments
EspEasy.png
EspEasy.png (14.55 KiB) Viewed 10009 times

Domosapiens
Normal user
Posts: 307
Joined: 06 Nov 2016, 13:45

Re: PCA9685 connecting problem

#6 Post by Domosapiens » 14 Jan 2019, 00:32

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.
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.

moebius
Normal user
Posts: 35
Joined: 22 May 2017, 19:36

Re: PCA9685 connecting problem

#7 Post by moebius » 14 Jan 2019, 01:04

did you try mode 0x14?

Maruu23
New user
Posts: 7
Joined: 09 Jan 2019, 15:42

Re: PCA9685 connecting problem

#8 Post by Maruu23 » 15 Jan 2019, 09:19

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!

Domosapiens
Normal user
Posts: 307
Joined: 06 Nov 2016, 13:45

Re: PCA9685 connecting problem

#9 Post by Domosapiens » 15 Jan 2019, 16:56

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 ?
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.

Maruu23
New user
Posts: 7
Joined: 09 Jan 2019, 15:42

Re: PCA9685 connecting problem

#10 Post by Maruu23 » 16 Jan 2019, 08:03

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 ;)

Domosapiens
Normal user
Posts: 307
Joined: 06 Nov 2016, 13:45

Re: PCA9685 connecting problem

#11 Post by Domosapiens » 16 Jan 2019, 11:11

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.
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.

Maruu23
New user
Posts: 7
Joined: 09 Jan 2019, 15:42

Re: PCA9685 connecting problem

#12 Post by Maruu23 » 16 Jan 2019, 11:47

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.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: PCA9685 connecting problem

#13 Post by grovkillen » 16 Jan 2019, 11:48

Thanks for digging around! :)
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Rub87
Normal user
Posts: 28
Joined: 29 Nov 2020, 22:28
Location: Belgium

Re: PCA9685 connecting problem

#14 Post by Rub87 » 21 Jan 2021, 23:10

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.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 29 guests