Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: dinesh4761 on Feb 13, 2018, 05:01 am

Title: ESP8266 PWM Signal frequency
Post by: dinesh4761 on Feb 13, 2018, 05:01 am

Hi,

Greetings!

I have just started development on ESP8266 platform using arduino.
I am trying to generate PWM signal (50% duty cycle) in range of 20KHz to 50KHz.

Till now I am able to generate 20KHz only.
Please note that I have tried with analogWrite, ticker and timer1.

Kindly suggest me proper method to generate PWM signal of desired frequency.

Regards,

Dinesh
Title: ESP8266 PWM Signal frequency
Post by: dinesh4761 on Feb 13, 2018, 05:30 am
Hi,

Greetings!

I have just started development on ESP8266 platform using arduino.
I am trying to generate PWM signal (50% duty cycle) in range of 20KHz to 50KHz.

Till now I am able to generate 20KHz only.
Please note that I have tried with analogWrite, ticker and timer1.

Kindly suggest me proper method to generate PWM signal of desired frequency.

Regards,

Dinesh
Title: Re: ESP8266 PWM Signal frequency
Post by: larryd on Feb 13, 2018, 06:19 am
(http://forum.arduino.cc/index.php?action=dlattach;topic=528826.0;attach=245273)
Title: Re: ESP8266 PWM Signal frequency
Post by: larryd on Feb 13, 2018, 06:25 am
Quote
I am trying to generate PWM signal (50% duty cycle) in range of 20KHz to 50KHz.
50%?   Try tone();

Or

Try the Timer1 library.

Example:
https://github.com/PaulStoffregen/TimerOne/blob/master/examples/FanSpeed/FanSpeed.pde (https://github.com/PaulStoffregen/TimerOne/blob/master/examples/FanSpeed/FanSpeed.pde)


Title: Re: ESP8266 PWM Signal frequency
Post by: 6v6gt on Feb 13, 2018, 09:35 am
Exactly. But look at analogWriteFreq() for the ESP8266.
Title: Re: ESP8266 PWM Signal frequency
Post by: Coding Badly on Feb 13, 2018, 10:24 am

@dinesh4761, do not cross-post.  Threads merged.

Title: Re: ESP8266 PWM Signal frequency
Post by: PaulRB on Feb 13, 2018, 04:24 pm
I am trying to generate PWM signal (50% duty cycle)
If the duty cycle is always 50% then it is not a "PWM" signal. PWM is short for "Pulse Width Modulated". If the duty cycle is always 50% then there is no modulation. What you meant to say was "FM", Frequency Modulated.