Generate digital PWM (Duty Cycle control)

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
janjoh
Posts: 35
Joined: 23 Oct 2016 16:57

Generate digital PWM (Duty Cycle control)

Post by janjoh »

WHat is the best way to generate a digital PWM signal? Purpose is control of PWM controlled fan.

I understand that timers/servo library appears buggy right now?
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: Generate digital PWM (Duty Cycle control)

Post by PoltoS »

You can use GPT and Servo (they are no buggy), but much easier is to use analogWrite to drive one of the four PWM pins
janjoh
Posts: 35
Joined: 23 Oct 2016 16:57

Re: Generate digital PWM (Duty Cycle control)

Post by janjoh »

PoltoS wrote:
23 May 2018 00:07
You can use GPT and Servo (they are no buggy), but much easier is to use analogWrite to drive one of the four PWM pins
Analogwrite does not work for me with these fans. They require a true "return to zero" signal and i have not been able to find a way to decrease the pwm frequency properly to acheive this. AnalogWrite for all intents and purposes generates an analog level, not a discernable duty cycle. IN most applications this is a plus. But in this case, it is a minus :)
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: Generate digital PWM (Duty Cycle control)

Post by PoltoS »

analogWrite generates real return to zero, but at 488 Hz. If the input capacity is to big, your signal will become smoother like real analog.

For your case use FastPins and delays
janjoh
Posts: 35
Joined: 23 Oct 2016 16:57

Re: Generate digital PWM (Duty Cycle control)

Post by janjoh »

Hm, i wonder what would happen with an external pulldown resistor...
Post Reply