Page 1 of 1

Averaging measurements...

Posted: 14 Feb 2019, 09:51
by grovkillen
A question arise on GitHub in terms of averaging measurements making them less "jumpy". This is how I would do a 10 sample averaging filter:

Code: Select all

On Temp#Value Do
  Let,10,[VAR#9]
  Let,9,[VAR#8]
  Let,8,[VAR#7]
  Let,7,[VAR#6]
  Let,6,[VAR#5]
  Let,5,[VAR#4]
  Let,4,[VAR#3]
  Let,3,[VAR#2]
  Let,2,[VAR#1]
  Let,1,[Temp#Value]
  TaskValueSet,12,1,([VAR#1]+[VAR#2]+[VAR#3]+[VAR#4]+[VAR#5]+[VAR#6]+[VAR#7]+[VAR#8]+[VAR#9]+[VAR#10])/10
EndOn
Read more in the GitHub link: https://github.com/letscontrolit/ESPEasy/issues/2304

Re: Averaging measurements...

Posted: 14 Feb 2019, 22:17
by iron
Also need to filter out off values. e.g ds18b20 often gets either a max (120?) or min (-60?) *C. Might want to filter those out as they will bump your 10 point avrg significantly

-D

Re: Averaging measurements...

Posted: 14 Feb 2019, 22:33
by grovkillen
I'd say that the 10 point average would swallow those pretty good but yes adding some if to that Let,1,[Temp#Value] could be a good thing. Thanks for suggesting that.