PCA9685 works with leds but not with servos
Moderators: grovkillen, Stuntteam, TD-er
PCA9685 works with leds but not with servos
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
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
- 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
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.
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

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



Re: PCA9685 works with leds but not with servos
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
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
Re: PCA9685 works with leds but not with servos
GPIO on PCA9685?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
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
Shardan
Re: PCA9685 works with leds but not with servos
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
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
Re: PCA9685 works with leds but not with servos
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
Shardan
Re: PCA9685 works with leds but not with servos
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?
Did you check the power supply for the servo?
Do you tried it with a gpio instead of the pca9685?
Re: PCA9685 works with leds but not with servos
Which parameters does that command use?
With Wiki it exists only inside the "Raw List" without any further documentation.
Regards
Shardan
With Wiki it exists only inside the "Raw List" without any further documentation.
Regards
Shardan
Regards
Shardan
Shardan
Re: PCA9685 works with leds but not with servos
the new frequency?Which parameters does that command use?
The plugin was changed recently to have multiple instances, but i cannot see how they are addressed with the cmd command...
Re: PCA9685 works with leds but not with servos
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
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
Re: PCA9685 works with leds but not with servos
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.
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.

Re: PCA9685 works with leds but not with servos
Great to see blog posts describing these issuesFab 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.![]()

Good work!
Re: PCA9685 works with leds but not with servos
ThanksTD-er wrote: ↑04 Dec 2020, 00:57Great to see blog posts describing these issuesFab 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.![]()
Good work!

Re: PCA9685 works with leds but not with servos
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?TD-er wrote: ↑04 Dec 2020, 00:57Great to see blog posts describing these issuesFab 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.![]()
Good work!

https://nerdiy.de/en/category/espeasy/
Re: PCA9685 works with leds but not with servos
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.
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.
Who is online
Users browsing this forum: Majestic-12 [Bot] and 14 guests