Electronics > Microcontrollers

Signal filtering - Could this work ?

(1/6) > >>

I am creating a product which will be a weighing loadcell for a client.

The client wants a moving average of the digital signal of around 30 seconds. But the twist is that they also want the ADC frequency to be 400Hz.

A stored value beeing 4 bytes that make for a very big buffer !
4 bytes x 400 = 1600 bytes for 1 second. x30 is 48k bytes !
Maybe I could make this work for 1 signal but I have 3/4 for the prototype software !

So the buffer size won't be doable...

So I was thinking of only adding an average of for example 500ms.
That would be 2 times less values in the moving average buffer !

But is that ok from a signal filtering point of view ? Excel datas from the sensor shows it working but is my idea a red flag.

I am wondering if the ADC beeing 100Hz or 400Hz or 25Hz is going to change anything if we are filtering at such high average ??
And just for the record marketing already that "of course it's possible we'll make it work"  |O

Did the client mention "oversampling"?

Say, with 64x oversampling, you can keep the wanted 400 Hz sampling rate, while having 64 times less samples per time unit. And you can sell it to the client as "3 additional bits of resolution".

Here is one of the papers: https://www.ti.com/lit/an/sprad55/sprad55.pdf

Also ...

--- Quote from: matb on April 19, 2024, 12:27:51 pm ---A stored value beeing 4 bytes that make for a very big buffer !

--- End quote ---

Why not 2 bytes?

Moving average is a low-pass filter. The easiest way is to start with the value of the first sample and calculate the filter as  new = (old * (filterfactor -1) + sample) / filterfactor. Filterfactor determines how much each new sample adds to the filter output. Note that due to the division, you'll need to shift the values to the left by the number of bits used for filterfactor. Otherwise you'll get large rounding errors. If filterfactor is a power of two, then the division is a simple right shift operation which is quick to perform.

Do client required 400Hz update rate? If not, you can make sliding window not by sampling rate, but update rate. Just accumulate SamplingRate/UpdateRate samples in one before putting it into buffer.


[0] Message Index

[#] Next page

There was an error while thanking
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod