Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make output frequency of the PWM signal adjustable. #91

Open
NAmmann opened this issue Jan 17, 2022 · 3 comments
Open

Make output frequency of the PWM signal adjustable. #91

NAmmann opened this issue Jan 17, 2022 · 3 comments
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@NAmmann
Copy link

NAmmann commented Jan 17, 2022

It happens, that some servos or other motor controllers require the PWM signal to be outputted at a specific frequency. These frequency my be between 5 and 400 Hz.
It would be awesome to configure that output frequency on initialization of a single servo or on a global scale.

@per1234 per1234 added topic: code Related to content of the project itself type: enhancement Proposed improvement labels Jan 17, 2022
@silvan2468
Copy link

You can do this by change the refresh rate in servo.h.
But it is magic for me, why the possible frequeny decreases as more servo objects are generated. With only on servo, 333 Hz ar possible. With 2 servos 200 Hz and with 4 servos about 150 Hz. Why is this?
I would understand this with 8 bit / 16 MHz prozessors. But why also with the much faster 32 bit processors with frequencies >48 MHz?
Is this library up to date or an old dinosaurus? ;)

@hpssjellis
Copy link

hpssjellis commented Feb 13, 2023

@per1234
Looks similar to

arduino/arduino-examples#62

Can the line below be accessed from the sketch to be changed before the Servo include file is loaded?

Note a refresh interval of 20000 us is 0.02 seconds is 1/0.02 = 50 Hz.
So 333 HZ needs a refresh interval of 3003 us (1/333 = 0.003003 seconds)

#define REFRESH_INTERVAL    20000     // minimum time to refresh servos in microseconds 

@razvanphp

This comment was marked as off-topic.

@arduino-libraries arduino-libraries locked as too heated and limited conversation to collaborators Sep 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

5 participants