Electronic – FIltering a PWM signal

pwm


The first box is my modulating signal and the last box is my demodulated signal (filtered signal)

I used my signal to change the duty Cycle of a PWM modulator (fix PWM frequency and variable Duty cycle ).
MY PWM output frequency is 20KHz.
My input signal it will be from 0 to 100Hz.

My question is what is the best way to filter the signal to obtain the lowest distortion ?

I have two way, the simple one is to use an diode envelop detector:
enter image description here

The second which I just read about is Infinite Impedance Detector
enter image description here

What are your recommendations ?
Is it enough to use an diode envelop detector with third order low pass filer to eliminate the ripples ?

Best Answer

You are thinking of a solution that is inappropriate. Filtering a PWM signal requires only low pass filtering and not envelope detection and certainly not the 2nd circuit you have shown.

For simple filters use a resistor and capacitor in series across the PWM output to ground. The capacitor is grounded and the common R and C node voltage has the filtered output. A more sophisticated filter might be based around an op-amp 2nd order filter and this is akin to replacing the resistor with an inductor.

Higher order filters give improved results i.e. smaller ripple voltages due to the unmodulated PWM frequency.

If your modulation frequency is 100Hz try making an RC lowpass filter with a 3dB cut-off at about 200Hz. There will be some attenuation of 100Hz signals (maybe 1dB) and if this is too much progress to an op-amp (or inductor) 2nd order filter.