Author Topic: Signal filtering - Could this work ?  (Read 3027 times)

0 Members and 1 Guest are viewing this topic.

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3148
  • Country: ca
Re: Signal filtering - Could this work ?
« Reply #25 on: April 22, 2024, 09:45:23 pm »
The goal of the product is for the loadcell to report how much weight was lost is the field (imagine a fertilizer spreader) to know how much product was spread each seconds.

So, you're going to measure the weight every 2.5 us and then average the differences in weight between consecutive points?

Averaging differences won't help. Imagine, you have starting way S and weight after 30 sec E. Your weight loss per sec is

(S - E)/30

Now imagine you add a mid point M and now you have two weight loss measurements:

(S - M)/15 and (M - E)/15

You average them

A = ((S - M)/15 + (M - E)/15)/2

If you open all parantheses it'll be

S/30 - M/30 + M/30 - E/30 = (S - E)/30

As you can see the introduction of the mid point didn't change the calculation at all. Even if you add millions of points in between, the calculation of the average weight loss will not change.

 

Offline matbTopic starter

  • Regular Contributor
  • *
  • Posts: 66
  • Country: fr
Re: Signal filtering - Could this work ?
« Reply #26 on: April 23, 2024, 09:01:42 am »
The goal of the product is for the loadcell to report how much weight was lost is the field (imagine a fertilizer spreader) to know how much product was spread each seconds.

So, you're going to measure the weight every 2.5 us and then average the differences in weight between consecutive points?

Averaging differences won't help. Imagine, you have starting way S and weight after 30 sec E. Your weight loss per sec is

(S - E)/30

Now imagine you add a mid point M and now you have two weight loss measurements:

(S - M)/15 and (M - E)/15

You average them

A = ((S - M)/15 + (M - E)/15)/2

If you open all parantheses it'll be

S/30 - M/30 + M/30 - E/30 = (S - E)/30

As you can see the introduction of the mid point didn't change the calculation at all. Even if you add millions of points in between, the calculation of the average weight loss will not change.

I agree from a math point of view but I had hopes it would kinda work just averaging.
I guess I might need the CIC decimation filter with a FIR or a IIR anti-aliasing ?

I'm getting confused with all these filters if I do a CIC + aliasing I won't need a Butterworth to filter the result ?
The CIC filter already does the moving average ?
 

Online xvr

  • Regular Contributor
  • *
  • Posts: 174
  • Country: ie
    • LinkedIn
Re: Signal filtering - Could this work ?
« Reply #27 on: April 23, 2024, 09:20:42 am »
> I agree from a math point of view but I had hopes it would kinda work just averaging.

If you hope that introducing a lot of extra math will magically solve your problem I have bad news for you - it will not  :-//

I think that the first that have to do it's take long raw measurement from field and then find out best math (filters/DSP/etc), that will solve your problem (with something like MATCAD). And only after this start to implement algorithms in firmware.
 

Online gf

  • Super Contributor
  • ***
  • Posts: 1206
  • Country: de
Re: Signal filtering - Could this work ?
« Reply #28 on: April 23, 2024, 10:21:18 am »
The CIC filter already does the moving average ?

A CIC filter is just a particular way to implement a 1st order or higher1) order moving average filter. A CIC structure is particularly useful in combination with down- or up-sampling.

I think that the first that have to do it's take long raw measurement from field and then find out best math (filters/DSP/etc), that will solve your problem (with something like MATCAD). And only after this start to implement algorithms in firmware.

 :-+ I wanted to suggest the same. Collect at least a few minutes of data (or better an hour - even that's only 1.44 million samples @400Sa/S), and analyze it first.

And try to specify requirements like
- What is the desired accuracy / uncertainty?
- Do you want real-time display for instantaneous fill level and instantaneous weight loss per second?
- How much settling time / delay are you willing to accept?



1) An N-th order moving average filter is a concatenation of N equal 1st order moving average filters. Just send the output of the 1st stage into the next stage, and so on. It's also called sincN filter, which refers to the shape of the magnitude of the resulting frequency response.
« Last Edit: April 23, 2024, 10:42:20 am by gf »
 

Online gf

  • Super Contributor
  • ***
  • Posts: 1206
  • Country: de
Re: Signal filtering - Could this work ?
« Reply #29 on: April 23, 2024, 04:51:03 pm »
The CIC filter already does the moving average ?

A CIC filter is just a particular way to implement a 1st order or higher1) order moving average filter. A CIC structure is particularly useful in combination with down- or up-sampling.

This would be my approach (untested!!!): https://godbolt.org/z/dWPabE8Ea
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf