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

PWM doesn't work with frequencies below 77Hz #5

Closed
deshipu opened this issue Nov 27, 2014 · 3 comments
Closed

PWM doesn't work with frequencies below 77Hz #5

deshipu opened this issue Nov 27, 2014 · 3 comments

Comments

@deshipu
Copy link

deshipu commented Nov 27, 2014

If you try to set the PWM frequency to anything below 77Hz (either with pwm.setup() or pwm.setclock()), then the resulting signal is the same as if the pin was in INPUT mode -- basically high all the time, with some noise.

It is maybe not an issue when you want to use the PWM for driving LEDs or motors, but RC servos usually require 50Hz signal, and you might also want to use that for generating sound using a speaker or buzzer (that's actually what I'm doing).

@deshipu
Copy link
Author

deshipu commented Nov 27, 2014

By the way, for the sake of using RC servos, it would be nice to be able to set the duty period in µs instead of percents. At 50Hz, 1% corresponds to about 7° of servo rotation, which is a pretty large granularity. With µs, we could get as accurate as the servo's dead band.

@nodemcu nodemcu reopened this Nov 28, 2014
@nodemcu
Copy link
Collaborator

nodemcu commented Nov 28, 2014

the resolution of pwm duty is 256-deep because of SDK driver.
currently I modify this to 100(percentage).
maybe per millage?

@deshipu
Copy link
Author

deshipu commented Nov 28, 2014

In that case, I think it makes the most sense to specify it as 0-255, so there is no surprise about the granularity, and you get the best resolution possible in those circumstances.

@nodemcu nodemcu closed this as completed Dec 3, 2014
vowstar added a commit that referenced this issue Mar 4, 2016
Update latest code from orig
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