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

Servo timing is wrong in example for regular servo's like sg90. #88

Open
jhaand opened this issue Jan 26, 2022 · 0 comments
Open

Servo timing is wrong in example for regular servo's like sg90. #88

jhaand opened this issue Jan 26, 2022 · 0 comments

Comments

@jhaand
Copy link

jhaand commented Jan 26, 2022

Concerns:
The example for the servo sweep in ./examples/servo/servo.ino

Expected:
Either the PWM values match the timing for the usec's below
or that they list the regular values seen with servos with the cycle time of 20 msec.
Which means a sweep between 500 and 2500 usec.

Observed:
This oversteered the maximum voltage for one of my servo's and it went spinning.
Also the maximum lower angle was not met.
The current values match the following timing

#define SERVOMIN  150  // (150 / 4096) * 20e3 = 732 usec
#define SERVOMAX  600  // (600 / 4096) * 20e3 = 2930 usec
#define USMIN  600 // These do not correspond to the calculated values above
#define USMAX  2400 //  These do not correspond to the calculated values above

Proposed:
Make the timing for the example sweep between 500 and 2500 usec.
like for instance:

#define SERVOMIN 102   // ( 500 / 20000 ) * 4096
#define SERVOMID 307   // ( 1500 / 20000 ) * 4096
#define SERVOMAX 491   // ( 2500 / 20000 ) * 4096
#define USMIN  500
#define USMAX 2500

You could change these values to sweep between 600 and 2400 usec like in the original example.
But at least keep it consistent and show how to calculate the values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant