TheWaterboy
Lifetime Supporting Member + Moderator
I need to filter values from an analog input. Most of the time all the values are good but occasionally a bubble will go through the system and create a value that is not representative of the fluid being measured.
For the purposes of datalogging the high values of the day I don't really want to average those bogus values into the mix, I would rather ignore them.
As an example the values would be captured every 5 seconds like this
1,1,1,2,1,1,2,1,1,2,3,4,8,24,7,5,4,2,1,1,1,1,2,1,2,1,1,1,1.
Because it is a short duration event I know its bogus and want to ignore the values from 4 through 4. If the lasted longer than 1 minute or so than I would indeed use the high value as the real number. I other words I need to look backwards in time to see if the current value is reasonable.
How would I begin create a sliding filter or sieve like this in realtime?
For the purposes of datalogging the high values of the day I don't really want to average those bogus values into the mix, I would rather ignore them.
As an example the values would be captured every 5 seconds like this
1,1,1,2,1,1,2,1,1,2,3,4,8,24,7,5,4,2,1,1,1,1,2,1,2,1,1,1,1.
Because it is a short duration event I know its bogus and want to ignore the values from 4 through 4. If the lasted longer than 1 minute or so than I would indeed use the high value as the real number. I other words I need to look backwards in time to see if the current value is reasonable.
How would I begin create a sliding filter or sieve like this in realtime?