Go Down

### Topic: Quick question about low-pass filter and pwm (Read 8070 times)previous topic - next topic

#### far_1

#15
##### Oct 13, 2014, 01:51 amLast Edit: Oct 13, 2014, 02:04 am by far_1 Reason: 1
@dlloyd

Haha. Nice one.

P.S. Found a really good explanation video

#### far_1

#16
##### Oct 13, 2014, 02:11 am
A few youtube videos later, and I think i'm starting to understand the theoretical operation.

But thanks anyway for the help.

#### cartoonist

#17
##### Oct 13, 2014, 03:11 am
Low pass filters do work a lot like, but not exactly as Grumpy_Mike sayd.

Cuttoff frequency means the amplitude is -3dB
-3dB means half the power (relative power is measured in 10log) but usally we measure voltage and then -3dB means 0.71 of the amplitude (relative amplitude is measured in 20log)
http://en.wikipedia.org/wiki/Low-pass_filter

A single-pole low-pass filter has a rolloff of 6dB/octave which is the same as a rolloff of 20dB/decade.
So 100Hz measured at the output of a simple 10Hz RC lowwpass filter (first order filter) will be 20dB reduced at the output. In voltage -20dB means 1/10th of the amplitude.
For a PWM signal of 100Hz 50-50 duty cycle into a simple 10Hz low-pass filter we will measure a DC output of half the amplitude of the squarewave. On top of this DC there will be 100 Hz and a lot of uneven harmonics like 300Hz, 500Hz, 700Hz and more uneven harmonics at an ever decreasing amplitude.

It is all mathematics. Fourier analyse of a 50-50 square wave of 100 Hz, tells us there will be a 100Hz component of amplitude 4/pi + 300Hz component of 4/(3*pi) amplitude + 500Hz of amplitude 4/(5*pi) etc etc
the 100Hz component will be -20dB so [1/10 of 4/pi] about 0.127 of the amplitude of the square wave
the 300Hz component will be -30dB so [1/30 of 4/(3*pi)] about 0.014 (1.4%) of the square wave amplitude.
the 500Hz component will be -34dB s0 [1/50 of 4/(5*pi)] about 0.005 (0.5%) of the square wave amplitude.

Higher order components are lower because fourier analyse says the amplitude is lower combined with the effect of the higher attenuation in the low-pass filter.
So higher order like 7th and 9th harmonics can sometimes be neglected because there amplitude is less than 0.25% of the original square wave amplitude.

When the PWM input signal has not an exact 50-50 duty cycle or varies in duty-cycle then the mathematics really get complicated.
So a long answer for a quick question. I hope my explanation was clear and sorry for the boring mathematics, but electronics aint easy.
You do not need a new P.C., you need a new O.S.  Linux is free, safe, easy, fast and reliable.

#18

#### Grumpy_Mike

#19
##### Oct 13, 2014, 04:05 am
Quote
You have two frequencies...the higher pitched one will be filtered, and the lower will pass.
But if i have just one (unmodulated) frequency, and i apply a filter...i'm going to get just the attenuation of the signal as you described. Am i understanding this correctly?

Yes. That is it for sin signals.

Now you have got that consider a PWM signal.
The whole point about filtering a PWM signal is to remove as much of the AC component as possible and leave just the DC component. That DC component is set by the duty cycle of the square wave, so you want to turn PWM into the appropriate DC voltage level. So the cut off frequency needs to be a long way from the actual frequency of the PWM modulation so that the modulation frequency gets removed. However if you get the cutoff frequency too low then the DC will not be able to change very quickly.
For example suppose you had a cutoff frequency of 0.1Hz  and the PWM duty cycle changed it would be 10 seconds before the DC voltage got to the correct level for the duty cycle.

I know this link has been posted before but look at the animation of the input duty cycle and the DC level.
http://www.thebox.myzen.co.uk/Tutorial/PWM.html

#### cartoonist

#20
##### Oct 13, 2014, 04:17 am
"I know this link has been posted before but look at the animation of the input duty cycle and the DC level."

that is a very nice and clear page .

You do not need a new P.C., you need a new O.S.  Linux is free, safe, easy, fast and reliable.

#### Grumpy_Mike

#21
##### Oct 13, 2014, 04:18 am

"I know this link has been posted before but look at the animation of the input duty cycle and the DC level."

that is a very nice and clear page .

Thank you.

#### Paul__B

#22
##### Oct 13, 2014, 08:39 am
21 replies.

And that was a quick question.

#### Grumpy_Mike

#23
##### Oct 13, 2014, 10:10 am
The question is indeed quick. Unfortunately the answer is not.

#### far_1

#24
##### Oct 13, 2014, 11:19 am
Indeed, the answer is far from quick.
But i think, slowly i'm getting a hang of it.

Thanks for the insightful explanations and links.

Go Up