smoothing max numReadings

Hello,

I need to smooth some analog input, and I am using the example smoothing code.. The problem is that I need a high sample rate, but if i change the sample number ("numReadings") to more than 500, arduino stops working after the code is uploaded... I dont understand why?
Even if i just use the sample code without changing anything but the sample number the same thing happens.. If the entire code is more complex it stops working even at 100 samples...

Thanks for your time!

I dont understand why?

Because you have a limited amount of memory. 500 ints takes 1000 bytes. You only have 2000 bytes, unless you have a Mega.

Thanks.. It makes sense now.. :wink:
Is there any way to do this "big" smoothing? I mean 2000+ samples... Or it has to be done by hardware?

Fixed point rolling average?

Is there any way to do this "big" smoothing? I mean 2000+ samples... Or it has to be done by hardware?

Smooth 50 samples at a time, 40 times...

I solved it!
I can have 2,000,000+ samples... so very very very smooth.... :wink:

How!?! please... do tell.
I'm looking to display temperature among other things analog.
I went through your steps exactly... up until solving it and all.
...I haven't tried it yet but would averaging the averages (an array, resulting into another array) work? It seams like there should be a more elegant way of doing that (high count averaging).

How!?! please... do tell.

10.21 fixed point arithmetic, I'm guessing (log22000000 = 20.931)