# HELP! PWM RC Low Pass Filter

Discussion in 'The Projects Forum' started by jameseraymond, Jul 17, 2013.

1. ### jameseraymond Thread Starter New Member

Oct 25, 2012
18
0
I have been given some PWM specs from a customer:
500Hz (+/- 5%)
0-5V
0-100% duty cycle (The duty cycle with change the speed of a pump).

I need to convert the PWM signal to an analog signal for my controller. I have been told to try an RC Filter.

The RC Filter response needs to be < 1 second, as the pump speed will change frequently. I would also like to get the RC Filter output to be as close to 5V as possible at 100% duty cycle. If it matters, the device has an internal resistance of 36k Ohms.

Im assuming this an easy multi-stage RC low pass filter. I do not have the time and/or resources to get this done by myself. Is anyone around that has some filter experience that could give the some tips and/or RC values to try?

Does all this make sense? Any ideas, questions, concerns?

2. ### wayneh Expert

Sep 9, 2010
12,960
3,775
Op-amp integrator?

3. ### Ron H AAC Fanatic!

Apr 14, 2005
7,049
657
The ripple will be highest at 50% duty cycle.
How much ripple can you tolerate?

4. ### crutschow Expert

Mar 14, 2008
14,828
3,816
For a higher degree of filtering you can use an active filter. The free FilterPro program from Texas Instruments makes the design of such filters quite simple. The order of filter required is determined by the amount of ripple you can tolerate at the controller input.

5. ### BobTPH Active Member

Jun 5, 2013
823
130
A simple RC with a cutoff of 5Hz would reduce the ripple by 40db (to 50mV), is that good enough?

Bob

6. ### Ron H AAC Fanatic!

Apr 14, 2005
7,049
657
True for sine waves. For a square wave, the p-p ripple will be about 78mV.
For settling to better than 99% in 500mS, a single pole (single RC) filter with a 100mS time constant (F3dB=1.6Hz) could be used. This has a ripple of 25mV p-p when the duty cycle=50%.

A passive or active 2 pole filter can, obviously, achieve much lower ripple while maintaining the same settling time.

7. ### BobTPH Active Member

Jun 5, 2013
823
130
Ron_H,

Not questioning your result, but how did you calculate that? I was just going by 5V down by 40db, which is the response of the filter for the 500Hz component. Is it that the harmonics add that much?

Bob

8. ### Ron H AAC Fanatic!

Apr 14, 2005
7,049
657
You can attribute it to the harmonics, and to the relative phases of the harmonics, but it's easier to calculate in the time domain.
It is an easily verifiable fact that the ripple will be highest at 50% duty cycle when the DC voltage on the capacitor=2.5V.
If the ripple is low compared to the 5V p-p signal, then it will approximate a triangle wave, i.e., the magnitude of the current through the resistor will be approximately constant, and will change direction on each half cycle. We can calculate the ripple by calculating the change in voltage across the capacitor during a half cycle:

V=2.5v (the 50% voltage)

$\Delta v=\frac{It}{C}$

$I=\frac{V}{R}$

substituting,

$\Delta v=\frac{Vt}{RC}$

but

$RC=\frac{1}{\omega_{3dB}}$

therefore,

$\Delta v=Vt \omega_{3dB}=Vt \times 2 \pi f_{3dB}$

At 50% duty cycle,

$t=\frac{1}{2F}$

where F is the square wave frequency.

Substituting,

$\Delta v=V \times \pi \times \frac{f_{3dB}}{F}$

Now, if V=2.5, F=500Hz, and f3dB=5Hz, then

Δv=2.5*3.14*5/500=78.5mV

It was actually easier than that when I first did it, because I simply calculated R and C from the 5Hz cutoff freq, then calculated the current (2.5/R), then calculated V=It/C.

Jun 5, 2013
823
130
Thanks!

Bob