PCA9685 works with leds but not with servos

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
kenkoknz
Normal user
Posts: 64
Joined: 03 Jul 2018, 23:46
Location: New Zealand

PCA9685 works with leds but not with servos

#1 Post by kenkoknz » 04 Aug 2018, 23:43

Hi, any advice?

on nodemcu with i2c PCA9685 pwm module;
mega 20080801.
device setup:
Extra IO - PCA9685
i2c addr: 0x40

HW setup:
the +v is connected to 5v usb supply, vcc is connected to 3.3v
Hook up led to vcc and pwm at port 15
Servo is pulg in in port 0

with command:
pcapwm,15,1000
I can control the led and response to various values

however with
pcapwm,0,1000
The servo does not response to any values. Tried different ports and values not working with servos, but works with led.

Could it be something to do with frequency of the pwm maybe? can that be set or connections?

Thanks,
Ken

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

Re: PCA9685 works with leds but not with servos

#2 Post by grovkillen » 04 Aug 2018, 23:49

Have you tried the GPIO command set to 0 first? See this issue: https://github.com/letscontrolit/ESPEasy/issues/483

Not that I think this may be the actual problem but easy to test.
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:

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: PCA9685 works with leds but not with servos

#3 Post by TD-er » 05 Aug 2018, 16:32

Not all GPIO pins are equal.
Some are more equal than others ;)

GPIO 0 is one of those special pins and pin 15 (you tested) is also different regarding the internal Pull-up resistors.

Start read here: https://tttapa.github.io/ESP8266/Chap04 ... oller.html

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: PCA9685 works with leds but not with servos

#4 Post by Shardan » 05 Aug 2018, 21:09

TD-er wrote: 05 Aug 2018, 16:32 Not all GPIO pins are equal.
Some are more equal than others ;)

GPIO 0 is one of those special pins and pin 15 (you tested) is also different regarding the internal Pull-up resistors.

Start read here: https://tttapa.github.io/ESP8266/Chap04 ... oller.html
GPIO on PCA9685?

It might be a problem of the frequencies.
The usual digital servos usw a PWM with a pulse every 20 ms (=50Hz) and a pulse width of 1 ms ... 2 ms.
I think the usual frequency of the PCF is somewhat higher, never checked that.

Anyways, a value of 1000 is very high.... maybe try lower values?

Regards
Shardan
Regards
Shardan

kenkoknz
Normal user
Posts: 64
Joined: 03 Jul 2018, 23:46
Location: New Zealand

Re: PCA9685 works with leds but not with servos

#5 Post by kenkoknz » 06 Aug 2018, 00:21

Hi,
Appreciate all for suggestions:
@grovkillen: I tried your suggestion, no difference, good to know to reset the pwm to 0 next time.

@TD-er: I presume I am accessing the i2c gpio 0(pca9685) and 15, not the esp8266 native pins with the pcapwm cmd. Anyway also have tried other pins, the same.

@Shardan: frequency was my initial suspect, however there is no cmd I can find to change the freq, also tried various lowee values. Funny thing is it works with leds, just not servos. Anyone has the pca9685 working with servos?

Cheers,
Ken

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: PCA9685 works with leds but not with servos

#6 Post by Shardan » 06 Aug 2018, 15:26

kenkoknz wrote: 06 Aug 2018, 00:21 @Shardan: frequency was my initial suspect, however there is no cmd I can find to change the freq, also tried various lowee values. Funny thing is it works with leds, just not servos. Anyone has the pca9685 working with servos?
Cheers,
Ken
Servo's need around 50Hz (20 ms pulse-to-pulse), which might cause visible flickering with LED's.
So I think the chip is initialized with a much higher frequency...
Sadly I don't have a sample at hand so I can't measure.

AFAIK it is not settable via GUI. There should be some code to init the PCA within the plugin.
Checking the datasheet and changing the code plus self compiling might help.

Regards
Shardan
Regards
Shardan

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

Re: PCA9685 works with leds but not with servos

#7 Post by moebius » 06 Aug 2018, 15:57

The command to change the frequency is "pcafrq".

Did you check the power supply for the servo?
Do you tried it with a gpio instead of the pca9685?

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: PCA9685 works with leds but not with servos

#8 Post by Shardan » 06 Aug 2018, 18:32

Which parameters does that command use?
With Wiki it exists only inside the "Raw List" without any further documentation.

Regards
Shardan
Regards
Shardan

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

Re: PCA9685 works with leds but not with servos

#9 Post by moebius » 06 Aug 2018, 19:07

Which parameters does that command use?
the new frequency?

The plugin was changed recently to have multiple instances, but i cannot see how they are addressed with the cmd command...

kenkoknz
Normal user
Posts: 64
Joined: 03 Jul 2018, 23:46
Location: New Zealand

Re: PCA9685 works with leds but not with servos

#10 Post by kenkoknz » 09 May 2019, 02:02

Hi,
Still trying to make servo to work on pca9685, pmw with led works fine, it looks some sw timing adjustments, anyone have any ideas?
Thanks,
Ken

Fab
New user
Posts: 6
Joined: 03 Dec 2020, 17:29
Location: Germany
Contact:

Re: PCA9685 works with leds but not with servos

#11 Post by Fab » 03 Dec 2020, 17:32

Hey guys,
I had the same problem and solved it. Just in case you still need this. I described everything needed here on my website: https://nerdiy.de/en/howto-espeasy-eine ... os-nutzen/
Hope this helps someone. :)
🧑‍🔧Me: Full time nerd in a world with too many projects for too little time
🌍Nerdiy.de: Detailed HowTos

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: PCA9685 works with leds but not with servos

#12 Post by TD-er » 04 Dec 2020, 00:57

Fab wrote: 03 Dec 2020, 17:32 Hey guys,
I had the same problem and solved it. Just in case you still need this. I described everything needed here on my website: https://nerdiy.de/en/howto-espeasy-eine ... os-nutzen/
Hope this helps someone. :)
Great to see blog posts describing these issues :)
Good work!

Fab
New user
Posts: 6
Joined: 03 Dec 2020, 17:29
Location: Germany
Contact:

Re: PCA9685 works with leds but not with servos

#13 Post by Fab » 20 Dec 2020, 10:00

TD-er wrote: 04 Dec 2020, 00:57
Fab wrote: 03 Dec 2020, 17:32 Hey guys,
I had the same problem and solved it. Just in case you still need this. I described everything needed here on my website: https://nerdiy.de/en/howto-espeasy-eine ... os-nutzen/
Hope this helps someone. :)
Great to see blog posts describing these issues :)
Good work!
Thanks :)
🧑‍🔧Me: Full time nerd in a world with too many projects for too little time
🌍Nerdiy.de: Detailed HowTos

Fab
New user
Posts: 6
Joined: 03 Dec 2020, 17:29
Location: Germany
Contact:

Re: PCA9685 works with leds but not with servos

#14 Post by Fab » 20 Dec 2020, 10:11

TD-er wrote: 04 Dec 2020, 00:57
Fab wrote: 03 Dec 2020, 17:32 Hey guys,
I had the same problem and solved it. Just in case you still need this. I described everything needed here on my website: https://nerdiy.de/en/howto-espeasy-eine ... os-nutzen/
Hope this helps someone. :)
Great to see blog posts describing these issues :)
Good work!
BTW: I wrote some more stuff about ESPEasy on my blog. Also how it can be integtraed into NodeRed and controlled. Maybe you can/want to link at specific topics to this? :)
https://nerdiy.de/en/category/espeasy/
🧑‍🔧Me: Full time nerd in a world with too many projects for too little time
🌍Nerdiy.de: Detailed HowTos

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: PCA9685 works with leds but not with servos

#15 Post by TD-er » 20 Dec 2020, 11:56

I will read it and think of a way to link to it.
When making a large pool of links, useful information tends to get lost, so it would be better to link to it from relevant topics.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 36 guests