Author Topic: RC filter question about Average vs RMS  (Read 492 times)

0 Members and 1 Guest are viewing this topic.

Offline Noise0Topic starter

  • Contributor
  • Posts: 20
  • Country: it
RC filter question about Average vs RMS
« on: February 25, 2021, 03:01:00 pm »
Hi

im trying to average a noisy output of a sensor. At first i averaged the reading via software, then I thought to add a simple RC filter in order to decrease the number of samples needed to achieve a stable value on the output.

I noticed that after the RC filter the Average value was sliglty higher (of a very small amount but  noticeable).
So I inspected the signal before and after the RC filter with oscilloscope . check picture.
I always used RC filter with the intent to clear the AC part of a  signal getting the Average, but it seems that not the Average but the RMS value is present on the output.
Is this true? Or it's just an error due to instument tolerance?

Could you clarify me this doubt about Average vs RMS of a DC signal with superimposed random noise? If i succeed to cancel the random noise (AC part) what i get have to be the Average value , right? In my understanding RMS is about equivalent joule effect on a load, so that's not waht im looking for when i sample a sensor, right?

thx
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21698
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: RC filter question about Average vs RMS
« Reply #1 on: February 25, 2021, 03:37:11 pm »
That's well within error bound of the scope.

Errors aside, RMS will always be higher for a raw signal than for filtered.  We can decompose a signal into AC and DC components,
\$v(t) = V + f(t)\$
where in general f(t) varies with time, and has an average value of zero over the period \$\Delta t\$ being considered.  V is a constant.

RMS is defined as,
\$ \sqrt{ \frac{1}{\Delta t} \int_{t_0}^{t + \Delta t} v(t)^2 dt} \$
so,
\$ \sqrt{ \frac{1}{\Delta t} \int_{t_0}^{t + \Delta t} \left( V + f(t) \right)^2 dt} \$
\$ \sqrt{ \frac{1}{\Delta t} \int_{t_0}^{t + \Delta t} \left( V^2 + 2 V f(t) + f(t)^2 \right) dt} \$
\$ \sqrt{ \frac{1}{\Delta t} \left[ \int_{t_0}^{t + \Delta t} V^2 dt + \int_{t_0}^{t + \Delta t} 2 V f(t) dt + \int_{t_0}^{t + \Delta t} f(t)^2 dt \right] } \$
\$ \sqrt{ \frac{1}{\Delta t} \left[ V^2 \int_{t_0}^{t + \Delta t} dt + 2 V \int_{t_0}^{t + \Delta t} f(t) dt + \int_{t_0}^{t + \Delta t} f(t)^2 dt \right] } \$
\$ \sqrt{ \frac{1}{\Delta t} \left[ V^2 (\Delta t) + 2 V (0) + \int_{t_0}^{t + \Delta t} f(t)^2 dt \right] } \$
\$ \sqrt{ \frac{V^2 \Delta t}{\Delta t} + \frac{1}{\Delta t} \int_{t_0}^{t + \Delta t} f(t)^2 dt } \$
\$ \sqrt{ V^2 + {f(t)_\textrm{rms}}^2 } \$

Which is just taking the RMS of two orthogonal components,
\$ V_\textrm{rms} = \sqrt{v_1(t)^2 + v_2(t)^2 } \$
the DC and AC parts are orthogonal for \$\Delta t \rightarrow \infty\$ at the least.

Further, if we decompose f(t) into a sum of sinusoidal waves (Fourier transform), we have Parseval's theorem: simply sum up the squares of the amplitudes of all components, take the average, and square-root.

When orthogonality doesn't hold, we might get a residual.  Besides rounding error, this may be what the scope is reading.  For periodic signals, the orthogonality also holds for any multiple of that period.  For aperiodic signals, it only holds at infinity, or at special cases.  The scope can't buffer to infinity, its window is always finite of course.  Basically, there's likely some residual blip that's unbalanced over that window, and this causes the RMS to measure differently.  (And your signal looks fairly nonperiodic.)

Finally, basic statistics!  You're asking about a very small difference -- the AC peak-to-peak is a small fraction of the DC value, so the DC dominates.  What's the difference in length between the hypotenuse and long side, of, say, a 1° right triangle?  (Recall what else uses a sum-of-squares formula!)  It's fuck all, and if you measured that with anything less than a micrometer, chances are, you're as likely as not to find the hypotenuse shorter instead -- what ought to be a Euclidian contradiction. :)

If you're not familiar with signals and calculus, this probably isn't all that helpful; there are some excellent, simple explanations out there of what integration means, which may prove illuminating.  If nothing else, since the scope is doing it with DSP (digital signal processing), what it really means is, not calculus at all, but the stepwise equivalent (Riemann summation), literally taking the square of individual points in time, and averaging over that. :-+

Tim
« Last Edit: February 25, 2021, 03:42:47 pm by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: Noise0

Offline Noise0Topic starter

  • Contributor
  • Posts: 20
  • Country: it
Re: RC filter question about Average vs RMS
« Reply #2 on: February 25, 2021, 04:35:36 pm »
Thanks for the effort you put into your response, its very usefull to me.
So if i have understood correctly, the short answer would be:
Yes, RC filtering more and more lead to the average of the signal, not the rms.
Is it Correct?
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21698
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: RC filter question about Average vs RMS
« Reply #3 on: February 25, 2021, 04:58:30 pm »
I mean, the average is there, regardless of how you filter it.  What you're doing with it, is what matters.  If your circuit would find the noise a nuisance, yeah, probably better to filter it.  And yeah, RMS is a different process than average, which reads the same when the AC part is very small.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: Noise0

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: RC filter question about Average vs RMS
« Reply #4 on: February 25, 2021, 05:11:36 pm »
RMS is handy when we're looking at power or some other effect where we want to compare to an equivalent DC value.  Power calculations for example.

From a filtering point of view, I would expect that average is the value you want.

Here is a short video on the RMS vs Average values for various waveforms.

https://youtu.be/KygtYb2EsQE
 
The following users thanked this post: Noise0


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf