New Page on PWM

This one apparently escaped a few weeks ago but now it is complete, a tutorial page on PWM:-

Very, very, very good indeed! Thanks for the effort!

I've a question for you, one that I did not bother to search yet. Can we program arduino PWM outputs to be non-synchronous, ie, not based on same frequency and phase shift (latter is more important) ?

I am to try (all I can do is try) to do a sigma-delta modulated output. It's fairly easy on an FPGA, but not that easy with a micro unless I have a hard-realtime system. For sigma-delta I need quite a lot of "oversampling", and any significant non hard-RT change will be a disaster.

So I once thought: if I could have all those PWM out-of-phase and with different frequencies, maybe I can be able to have, using some CPLD or discrete logic, a nice sigma-delta output, with a combinatorial circuit.

Still, your page is excellent !!! Let me congratulate you again, and in hopes other electronic tutorials will follow.


Wow! Very informative and well written.

You have developed a very nice, graphical explanation of PWM.

The section on filters is not very accurate. There is a good reference on low-pass filters at

Can we program arduino PWM outputs to be non-synchronous

No they are all tied to the processor clock.

Jdoll :- when you say:-

The section on filters is not very accurate.

Do you mean comprehensive or are you saying their are inaccuracies in it. That is there are bits that are wrong?

If so could you be a bit more specific as I would like the opportunity to correct any errors I may have inadvertently made.

As I said, filter design is very complex and deserves at least a book to itself. My main aim was to simplify the concept of a filter so that it didn't get in the way of the main topic of the page which was PWM.

I was involved in the design of active audio filters that went into the U.K.'s nuclear submarines so I do know a bit about the subject. That's not to say my wording might not be right or I made a slip of the calculator.

I am saying there are inaccuracies.

dB is a function of power ratio: 10 * log (P2/P1). Thus when P2 is half of P1, we have 10 * log (0.5) = -3 deciBels. Amplitude normally refers to voltage, whose square is proportional to power. At the 3 dB point in your low pass filter example, amplitude is reduced to 0.707 (square root of 0.5) of its full value.

A first order filter has an asymptotic slope of 6 dB/octave, not 3. The response of the filter is -3dB at the "corner" frequency - the point where the 6 dB/octave asymptote meets the full-amplitude line. Higher order filters have an asymptotic slope of 6n dB/octave, where n is the order of the filter.