Go Down

Topic: RE: Low Pass Filter (Read 7330 times) previous topic - next topic

Power_Broker

NOPE.... it is NOT physically comprised of sinusoids. The waveform can mathematically be 'expressed' as a bunch of sinusoidal waveforms. It does NOT mean that the physical waveform itself (in this case, the PWM waveform coming out of an arduino) IS a bunch of physical sinusoidal signals (plus a DC value). The sinusoids you're talking about come from the realms of mathematical modelling.
If you were correct, wouldn't you expect the FFT functions on an oscilliscope to either not work or not be trusted when used on physical signals, assuming the signals couldn't be broken down into a sum of sinusoids? I'm still not sure where the "Fourier Series/Transform is only purely conceptual" rationale is coming from. Do you have any sources to support your claim? I'm truly curious - maybe I'm misunderstanding what you're saying.
"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

Jiggy-Ninja

#16
Jun 15, 2017, 03:27 am Last Edit: Jun 15, 2017, 03:28 am by Jiggy-Ninja
NOPE.... it is NOT physically comprised of sinusoids. The waveform can mathematically be 'expressed' as a bunch of sinusoidal waveforms. It does NOT mean that the physical waveform itself (in this case, the PWM waveform coming out of an arduino) IS a bunch of physical sinusoidal signals (plus a DC value). The sinusoids you're talking about come from the realms of mathematical modelling.
Is there a point to being that anal about it?
Quote
Although, 'hypothetically'...... if we had the time to do it.... you could physically generate a bunch of sinusoids at the suitable frequencies (together with suitable amplitudes) ...... and add them up..... to come up with an "approximation" for the time waveform.

In the lab, you're not going to be able to generate an infinite number of harmonics. It's like e^(-t)..... it never goes to 'zero' until time reaches infinity.....and infinity means you'll never get there....because it keeps going ....forever.
So? Everything in every engineering discipline involves approximate mathematical models. There is nothing special about Fourier in this regard. You will never be able to generate a perfect square or sine wave with any physical circuit. You won't even be able to generate the exact same signal twice with the same circuit. Noise and other imperfections will always distort it.

Fourier works. There's no point to arguing if it's "really real" when it's a distinction without a difference.

avr_fred

Quote
but you can't deny that the physical signal can still be analyzed and broken down into an infinite sum of sinusoids
I agree 100% with Southpark. Making the statement above only confuses people who do not have a full understanding of why harmonics exist. IMO, saying that harmonics have a "physical" property really distorts the issue to the non-EE - as physical things are those things that you can measure like volts, amps and frequency.

It's like saying a certain device "generates harmonics" - rather than saying "the device uses current in a nonlinear fashion and we can describe that current mathematically using a concept called harmonics". Given the first statement and the second, it is easy to see why the first statement is the norm within engineering circles. Unfortunately, it confuses those who don't speak the same shorthand language.

Quote
I'm not saying that the PWM signal is generated from the Arduino is an infinite number of sinusoidal voltage sources in series (quite absurd isn't it lol)
If I understand your argument, you just invalided it, all in the same sentence. Yes, it's absurd but that is how a square wave is described, the only problem is you need infinity in order to get there...

Quote
Fourier works. There's no point to arguing if it's "really real" when it's a distinction without a difference.
Bingo. Winner winner chicken dinner. As Einstein said, "You truly understand something when you can explain it to your Grandmother".

Power_Broker

Fourier works. There's no point to arguing if it's "really real" when it's a distinction without a difference.
Exactly. Spot on.


IMO, saying that harmonics have a "physical" property really distorts the issue to the non-EE
Valid point, it does take a while to get comfortable thinking in the frequency domain vs the time domain.


If I understand your argument, you just invalided it, all in the same sentence.
Maybe you misunderstood me. I was trying to say that any physical signal can be broken into a set of sinusuids no matter where it originated from. It could be an infinite number of sinusuidal voltage sources in series or it could be a flip-flop - both give the same output.
"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

Southpark

#19
Jun 15, 2017, 06:24 am Last Edit: Jun 15, 2017, 11:42 am by Southpark
Valid point, it does take a while to get comfortable thinking in the frequency domain vs the time domain.
However, a PWM waveform is a waveform. And waveform implies time-domain. The voltage waveform at the PWM output pin is the PWM signal. Better not tell anybody that the square/rectangular raw waveform is a bunch of individual sinusoids, all individually summing together (at any particular moment) to produce this square/rectangular waveform.

If I put a hot soldering iron tip on a circuit board, and the temperature on that part of the circuit (where the hot iron tip is touching) abruptly rises from 25 degrees C to some relatively high temperature value. Yep...assuming this is happening in the real world, in the time domain. Better not tell anybody that the temperature rise at that part of the circuit is physically (actually) a bunch of sinusoids all individually ganging together at the same time.

I do have a very big appreciation for frequency domain concepts, frequency domain theory etc. The application of that theory is tremendous.

Also, I agree absolutely about what AVR_fred wrote.

ilovetoflyfpv

Hi Guys

I appreciate the input but bear in mind my math/science is mid high school level (work in progress). I'm having great deal of trouble understanding how a signal that is 490Hz has a DC component and this occurs at 0Hz.

When is the signal 0Hz? Are we simply taking a snapshot of the PWM signal when it is high (5V)? If this is the case then the capacitive reactance will be infinite? I feel I'm missing some key concept.  :(

@septillion

I don't understand what a pure sine wave is?

I don't understand what the pros/cons of adjusting the frequency?

@tinman13kup

I'm wanting to generate an analog voltage for an On Screen Display. I know that an RC circuit is commonly used to do this. I want to understand why.

@Southpark & Power_Broker

Fourier Series Concept? YIKES! There's no need to use that kind of language here. ;D This is way over my head.

Any help would be greatly appreciated.

Cheers

Jase :)

Southpark

#21
Jun 15, 2017, 08:39 am Last Edit: Jun 16, 2017, 04:29 am by Southpark
I appreciate the input but bear in mind my math/science is mid high school level (work in progress). I'm having great deal of trouble understanding how a signal that is 490Hz has a DC component and this occurs at 0Hz.

When is the signal 0Hz? Are we simply taking a snapshot of the PWM signal when it is high (5V)? If this is the case then the capacitive reactance will be infinite? I feel I'm missing some key concept.  :(

@septillion

I don't understand what a pure sine wave is?
I can understand the confusion. At high school, I only knew what a sinewave was. But probably didn't know what frequency was... I think haha.

Anyway..... you know what a sinusoidal signal is, right? In maths....
y(t) = sin(t) defines ONE particular sinusoidal signal from a family of sinusoidal signals. This one happens to be a 'sine' wave. The wavey pattern of y(t) plotted versus time will repeat itself every (2.pi) seconds. This is known, because....in maths.... the sinusoidal expression is generally written with 1 more parameter... ie   y(t) = sin(w.t)    where w = 2.pi.f

'w' is called 'angular frequency', units of radians per second. I can't type greek symbols...but 'w' is actually supposed to be like a running-writing 'w'.

Yep.... pi is 3.14159 etc. And 'f' is the 'cyclic frequency'.

So, for y(t) = sin(t)...which is sin( 1.t ), you can see that the angular frequency 'w' is equal to 1 for this particular case. So w = 1. But, w is defined as 2.pi.f.
So w = 2.pi.f = 1

Rearranging the above gives cyclic frequency, f = 1/(2.pi), in units of Hertz, or 'cycles per second'. It means a cyclic frequency of 1 radian per second corresponds to a cyclic frequency of 1/(2.pi) Hertz. A 'cycle' means one single repetition of a portion of the waveform. If measured in units of 'seconds', 1 cycle will take a certain amount of time. And that certain amount of time (labelled capital "T") is called a 'period', or 'the period'.

The relation between the period T and the cyclic frequency f is simple.....  it is: f = 1/T, or T = 1/f.
So, when angular frequency w (for this particular case) is equal to 1 radian per second, then we can easily figure out that the corresponding cyclic frequency f is equal to 1/(2.pi) Hertz. And the period T is 1/f, which is 2.pi seconds.

So, if you have a 50 Hertz sinusoidal signal that happens to be a 'sine' wave, then you could mathetically write it as y(t) = sin(2.pi.50.t)
And if you want to make this sine wave larger....just put a multiplying factor on the front of it... like...
y(t) = 3sin(2.pi.50.t), or 3sin(100.pi.t) .... or 3sin(314.159t)

One more thing. The 'sine' wave has a value of zero at time t = 0. And, as time increases, the 'sine' wave value gets larger and larger and will eventually reach a value of '1', before dropping back to zero again.... just google 'sine' wave, and you'll see. If you don't want a 'sine' wave, then you can always modify it.... by adding an offset to it.... like

y(t) = sin(w.t - 2.pi.b)    ....'b' is a fractional number....and you could limit 'b' to a value between -1 and +1. For example... if 'b' is one-quarter, ie. b = 0.25, then

y(t) = sin( w.t - pi/2 )


The above is just some starting details for you about sinusoidal signals. Work towards understanding that first.



ilovetoflyfpv

Hi Southpark

I appreciate you getting back to me. At this stage I can manage basic algebra, trig and I'm familiar with what a sine wave looks like. Unfortunately the rest of your response is pitched well and truly above my head possibly even tertiary level.

y(t) = sin(t)

I'm glad the guy in the above video isn't my teacher I'd be worried if I didn't understand what he was saying he'd hit me with that steel bar.

Cheers

Jase  :(

Southpark

#23
Jun 15, 2017, 09:12 am Last Edit: Jun 15, 2017, 10:03 am by Southpark
y(t) = sin(t)
hahaha! Let me check out that video. I'll take a look at that one tonight. Looking forward to seeing it. Thanks Jase.

---
[UPDATE] : Wow! It will be important to pay attention to him in class. Life may depend on it!

septillion

#24
Jun 15, 2017, 10:59 am Last Edit: Jun 15, 2017, 11:00 am by septillion
I don't understand what a pure sine wave is?


I don't understand what the pros/cons of adjusting the frequency?
Simple explanation: higher frequency => need lower RC values (and thus smaller components) to have the same filter effect => faster response on duty cycle change => and/or (if you do take the values higher) better filtering out of the PWM frequency.

And the DC = 0Hz. DC = Direct Current = Not changing = changing with 0Hz :D And the DC part comes from the fact the PWM signal from the Arduino does not cross 0V. It's either 0V or 5V where as each sine crosses the 0V symmetrical. So think of a 50% duty cycle PWM, if you want to make it symmetrical that would be 50% of the time at -2,5V and 50% of the time at 2,5V. This makes it symmetrical and the voltage difference is still 5V. Now shift that whole signal by 2,5V DC up and you get the PWM of an Arduino, 50% of the time at 0V (-2,5V + 2,5V = 0V) and 50% of the time at 5V (2,5V + 2,5V = 5V). So it has a DC component of 2,5V. And that is what you expect because when you filter the PWM of the Arduino you expect a voltage of 2,5V when the duty cycle is 50% ;)

And although it is a big deal of math, it does work in practice although it damn hard to sum an infinite amount of sines :p

I'm wanting to generate an analog voltage for an On Screen Display.
On Screen Display? I can only think of that with my TV or monitor but I can't think of a link with voltage.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Southpark

#25
Jun 15, 2017, 11:48 am Last Edit: Jun 16, 2017, 07:11 am by Southpark
So? Everything in every engineering discipline involves approximate mathematical models.
Your wording.....  'approximate mathematical models'. Maybe you just mean - a system model that models the behaviour of an actual system. Some system models can model a real system perfectly. It just depends on "what" is being modeled.

Also, the approximation (I was referring to) excludes noise, and 'imperfections'. I'm talking about approximating a square-wave by summing together a few sinusoids.

ilovetoflyfpv

Hi Gang

So a pure sine wave is a graphed unit circle?

Increasing frequency has the following benefits. It allows us to decrease the the values of our RC circuit thus reducing size, improved responsiveness and less ripple?

The DC component is the average of the duty cycle? I'm still having trouble understanding why then we set our cut-off frequency to 0Hz? Don't we need the voltage to toggle between 0V and 5V in order to achieve PWM?

On Screen Display (OSD)

I'm beginning to wonder whether the article that I linked to in my first post is not appropriate for my application. It deals primarily with AC signal while what I'm really interested in is a pulsed DC signal? I found the following article...

Arduino's AnalogWrite - Converting PWM to a Voltage

The focus seems to be more RC Time Constant and Cut-off Frequency. There is a link to an online calculator but I'm unsure how to use it?

Really appreciate the help.

Cheers

Jase :)

MarkT

A sine wave is the projection of a regular helix perpendicular to its axis.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

MrMark

It isn't 'physically' a sum of those things. Because.... physically, the physical signal in the time domain is 'The time domain Signal'.... which ...in this case.... is a periodic 2-level waveform (when the input is held at a constant value that is). Not 'physically' a bunch of sinusoids (plus a DC shift, if there is one).
It's not clear why one would make this distinction.  The time and frequency domain representations of a physical signal are mathematically equivalent.  If one is physical the other is by definition.

septillion

So a pure sine wave is a graphed unit circle?
That's how they are related, yeah.

Increasing frequency has the following benefits. It allows us to decrease the the values of our RC circuit thus reducing size, improved responsiveness and less ripple?
Kind of yeah. If we increase the frequency by a factor 10 we can have the same ripple (but that ripple will still have the frequency of the PWM) if we decrease R x C (so multiplication of R and C) with a factor 10 as well. But we can also let RC stay the same and increase the frequency by 10 and have a ripple that's 10 times less. And you can mix and match. Because lower RC is faster response and smaller but higher ripple etc.

The DC component is the average of the duty cycle? I'm still having trouble understanding why then we set our cut-off frequency to 0Hz?
Ideally you would want the cut off to be at 0Hz but because it's given by Fc = 1 / (2*Pi*R*C) that would mean we need R*C to be infinite which does not fit on most PCB's :p So, the amount of ripple you can tolerate defines where to put it. If a ripple of 1% is fine then the cut off freqency needs to be 1% of the PWM frequency. So for 490Hz that would be at 4,9Hz  which gives a RC of 0,032 which is pretty big (100k and 325nF) and 1% ripple is still "a lot".

Say we have a PWM of 62,5Hz and we allow a 1% ripple so cut off at 625Hz. That just gives a RC of 2,55*10-4 or with the same 100k just a 2,55nF capacitor will work. Or you can increase it to 25nF and just have 0,1% ripple ;)

Don't we need the voltage to toggle between 0V and 5V in order to achieve PWM?
We still do, don't we? That's on the input of the filter and you want just plain DC on the output aka NO switching.

On Screen Display (OSD)
Ahhh, Quad copter FPV OSD.

I'm beginning to wonder whether the article that I linked to in my first post is not appropriate for my application. It deals primarily with AC signal while what I'm really interested in is a pulsed DC signal? I found the following article...
Where is the "pulsed" coming from?! You wanted DC didn't you?

Arduino's AnalogWrite - Converting PWM to a Voltage
Same first order low pass RC-filter. Just another way of explaining it.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Go Up