# Filtering a PWM signal

Started by April 2, 2012
```I've been watching some of Dave Jones videos (EEVblog).  In #225 he
discusses using a PWM signal to control the voltage of a power supply.
It needs to be DC to do this, so he uses a filter. He uses a first-order
RC filter, with the output going to the "+" input of an op amp.  With a
10% duty cycle on the input he shows the output at 10% of the input
peak, with some ripple.

What I don't get is why the filter capacitor doesn't (eventually) charge
to the input peak voltage.  'Cause the input never goes negative, and
the op amp input impedance is too high to have any affect (or is it?).
Why doesn't it just keep charging?

If it matters, the input is 5v peak, R is 10k, & C is 100nf.

It's embarrassing that I don't understand something as simple as this,
but I was a software engineer, so that might explain it <G>.

Bob

```
```"Bob Engelhardt"
>
> I've been watching some of Dave Jones videos (EEVblog).  In #225 he
> discusses using a PWM signal to control the voltage of a power supply. It
> needs to be DC to do this, so he uses a filter. He uses a first-order RC
> filter, with the output going to the "+" input of an op amp.  With a 10%
> duty cycle on the input he shows the output at 10% of the input peak, with
> some ripple.
>
> What I don't get is why the filter capacitor doesn't (eventually) charge
> to the input peak voltage.  'Cause the input never goes negative, and the
> op amp input impedance is too high to have any affect (or is it?). Why
> doesn't it just keep charging?
>
> If it matters, the input is 5v peak, R is 10k, & C is 100nf.
>

** The cap charges via R during the "on" time and also discharges the same
way during the "off " time.

As the off time is 9 times longer than the on time - the average value is
10% of the peak and this is the voltage seen on the cap.

...  Phil

```
```Phil Allison wrote:

> ** The cap charges via R during the "on" time and also discharges the same
> way during the "off " time.
> ...

Ooooh, of course.  Discharges when input is 0v ... it doesn't have to go
negative!  Oh, damn - I'm going to have to get an alias for posting here
if I want to avoid the shame of such stupid questions.

Sorry for the noise,
Bob
```
```Bob Engelhardt wrote:

> I've been watching some of Dave Jones videos (EEVblog).  In #225 he
> discusses using a PWM signal to control the voltage of a power supply.
> It needs to be DC to do this, so he uses a filter. He uses a first-order
> RC filter, with the output going to the "+" input of an op amp.  With a
> 10% duty cycle on the input he shows the output at 10% of the input
> peak, with some ripple.
>
> What I don't get is why the filter capacitor doesn't (eventually) charge
> to the input peak voltage.  'Cause the input never goes negative, and
> the op amp input impedance is too high to have any affect (or is it?).
> Why doesn't it just keep charging?
>
> If it matters, the input is 5v peak, R is 10k, & C is 100nf.
>
> It's embarrassing that I don't understand something as simple as this,
> but I was a software engineer, so that might explain it <G>.
>
> Bob
>
>
>
I didn't see the blog so I am only picturing here.

But the input does not have to go negative (-), The source of where the
PWM is coming from goes to common, that is shorting the cap..

If you were to put a diode in the path, then yes, it would just charge
it up.

Like I said, I didn't see the blog but, if he was using a function
generator, that generator does pull to common in the off duty cycle
which simple shorts that network to common, back drains the cap. So some
charge is being removed from it in the 90% off cycle and because the
on duty is endless current supply, it's going to dominate, which is why
even at 10%, it will make it there. :)

Jamie

```
```On Apr 2, 11:17=A0pm, Bob Engelhardt <bobengelha...@comcast.net> wrote:
> Phil Allison wrote:
> > ** The cap charges via R during the "on" time and also discharges the s=
ame
> > way during the "off " time.
> > ...
>
> Ooooh, of course. =A0Discharges when input is 0v ... it doesn't have to g=
o
> negative! =A0Oh, damn - I'm going to have to get an alias for posting her=
e
> =A0 if I want to avoid the shame of such stupid questions.
>
> Sorry for the noise,
> Bob

Not to worry Bob, if I was worried about looking stupid, I'd never
post anything!

I still don't really see why you need R5 to be 1 k ohm and not zero
ohms in your previous thread.  (This may be becasue I don't have a
good model for the FET.) I've built some opamp to FET current drivers
with R5 =3D 0... but I do have the gate resistor R4 and the 'roll-off'
cap.

George H.
```