2

I am interested in using an Arduino Uno to produce an analog signal by running PWM through an RC low-pass filter.

I'll be controlling a highly dynamic object and need a clean voltage signal to avoid instabilities. Per this calculator on RC designs, it's suggested that one strategy to reducing voltage ripple is to increase the PWM frequency.

With PWM configured to a default of 980Hz for pins 5 and 6, and PWM of 490Hz for the remaining pins, I've decided that this will create too much voltage ripple for my filter. I've found resources that describe how to configure the registers to increase the PWM frequency rather drastically.

My question is very simple: Are there any disadvantages to using a higher frequency PWM? Why is the default set to be so slow?

Thank you!

  • Aside from the clock (if using timer0), the only consequence seems to be in how the components you drive with the PWM handle the frequency. Some might heat up a bit more, and/or jitter less. Burning lasers may yield slightly different results.Ignacio makes a good point about servos, too. – kaay May 30 '17 at 13:50
3

A PWM frequency of 490Hz means a period of approximately 2.041ms. This allows a high period of 2ms, which is the maximum pulse length required by a large number of inexpensive servos. Obviously if your design uses no servos then this is not a consideration.

Timer 0 itself is used for the various Arduino timing functions (delay(), millis(), etc.), so if you change the frequency used for timer 0 then those functions will no longer have accurate results.

  • timer 0 is used for pins 5 and 6. So you better go with pins 9 and 10 (timer 1), or 3 and 11 (timer2), as to not break functions like delay, millis etc. – Gerben Jan 21 '15 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.