PCA9685 fading

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

PCA9685 fading

#1 Post by Sasch600xt » 29 Mar 2020, 15:43

Hello all,

i want a servo to go from position A to position B with a fading time.

is this possible internal with espeasy ?

i would love to just send a trigger from outside to the esp.
then the esp should move the servo from A to B in lets say 3 seconds.

That would be awesome :)
Same for LED i want to control with the PCA9685

Have a great Sunday all :)
"the flat earth society has members all around the globe"

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

Re: PCA9685 fading

#2 Post by TD-er » 29 Mar 2020, 16:07

There should be a fade option in the PWM output, so this should be possible.
See the pwm command: https://espeasy.readthedocs.io/en/lates ... nds-listed

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: PCA9685 fading

#3 Post by Sasch600xt » 29 Mar 2020, 16:47

yes, i found something there indeed
but it looks like it is only for internal GPIOs ?

on this page it looks like there is no option for the PCA9685
https://www.letscontrolit.com/wiki/index.php/PCA9685

or am i wrong here ?
"the flat earth society has members all around the globe"

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

Re: PCA9685 fading

#4 Post by TD-er » 29 Mar 2020, 17:25

Ah sorry, missed the PCA9685 part of your question...

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: PCA9685 fading

#5 Post by Sasch600xt » 29 Mar 2020, 22:00

it is going more complicated :)

i try now the native GPIOs of the ESP.

with the build in version of (max) 2 servos, there is no "fading" option:

Servo,<servo>,<GPIO>,<position>
GPIO: 0 … 15
Servo: 1/2
Position: -180 … 180



and with the PWM function i can use the fading option but there is no posibility to set the correct servo freq of 50Hz:

PWM,<GPIO>,<duty>
PWM,<GPIO>,<duty>,<duration>
PWM,<GPIO>,<duty>,<duration>,<frequency>
GPIO: 0 … 15
Duty: 0 … 1023
Duration: 100 … 15000 msec (optional)
Frequency: 100 … 40000 Hz (optional)



So ......HELP :)
"the flat earth society has members all around the globe"

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

Re: PCA9685 fading

#6 Post by TD-er » 30 Mar 2020, 16:30

Hmm not sure why it is limited to 100 Hz.
Isn't that a bit too low for most servo's?

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: PCA9685 fading

#7 Post by Sasch600xt » 30 Mar 2020, 16:39

this is what i found about PWM servo speed in wiki.

looks like the famous SG90 servo needs exactley 50Hz.
others are in a range between 40 and 200 Hz.


Here from wiki:

Pulse duration
In modern RC servos the angle of mechanical rotation is determined by the width of an electrical pulse that is applied to the control wire. This is a form of pulse-width modulation. The typical RC servo expects to see a pulse every 20 ms, however this can vary within a wide range that differs from servo to servo. The width of the pulse will determine how far the motor turns. For example, in many RC servos a 1.5 ms pulse will make the motor turn to the 90° position (neutral position). The low time (and the total period) can vary over a wide range, and vary from one pulse to the next, without any effect on the position of the servo motor.

Modern RC servo position is not defined by the PWM duty cycle (i.e., ON vs OFF time) but only by the width of the pulse. (This is different from the PWM used, for example, in some DC motor speed control). Most RC servos move to the same position when they receive a 1.5 ms pulse every 6 ms (a duty cycle of 25%) as when they receive a 1.5 ms pulse every 25 ms (a duty cycle of 6%) – in both cases, they turn to the central position (neutral position). With many RC servos, as long as the refresh rate (how many times per second the pulse is sent, aka the pulse repetition rate) is in a range of 40 Hz to 200 Hz, the exact value of the refresh rate is irrelevant.[1][2][3][4][5][6][7][8][9]

The period of 20 ms (50 Hz) comes from the days where the signal was encoded in PPM (pulse-position modulation) format to be sent over the air.[10] The PPM period was around 22.5 ms, and the conversion to PWM was trivial: the time of the PWM high state was the time position of the PPM pulse for that servo.

Most RC receivers send pulses to the RC servo at some constant frame rate, changing only the high time. However, it is possible to command an RC servo to move over its entire range with a function generator set to a constant 10% duty cycle by changing only the frequency (frame rate).[11]

https://en.wikipedia.org/wiki/Servo_control
"the flat earth society has members all around the globe"

Post Reply

Who is online

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